babylonjs-materials 9.17.1 → 9.18.1
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.js +1 -1
- package/babylon.cellMaterial.js.map +1 -1
- package/babylon.cellMaterial.min.js +1 -1
- package/babylon.cellMaterial.min.js.map +1 -1
- package/babylon.fireMaterial.js +1 -1
- package/babylon.fireMaterial.js.map +1 -1
- package/babylon.fireMaterial.min.js +1 -1
- package/babylon.fireMaterial.min.js.map +1 -1
- package/babylon.furMaterial.js +1 -1
- package/babylon.furMaterial.js.map +1 -1
- package/babylon.furMaterial.min.js +1 -1
- package/babylon.furMaterial.min.js.map +1 -1
- package/babylon.gradientMaterial.js +1 -1
- package/babylon.gradientMaterial.js.map +1 -1
- package/babylon.gradientMaterial.min.js +1 -1
- package/babylon.gradientMaterial.min.js.map +1 -1
- package/babylon.lavaMaterial.js +1 -1
- package/babylon.lavaMaterial.js.map +1 -1
- package/babylon.lavaMaterial.min.js +1 -1
- package/babylon.lavaMaterial.min.js.map +1 -1
- package/babylon.mixMaterial.js +1 -1
- package/babylon.mixMaterial.js.map +1 -1
- package/babylon.mixMaterial.min.js +1 -1
- package/babylon.mixMaterial.min.js.map +1 -1
- package/babylon.normalMaterial.js +1 -1
- package/babylon.normalMaterial.js.map +1 -1
- package/babylon.normalMaterial.min.js +1 -1
- package/babylon.normalMaterial.min.js.map +1 -1
- package/babylon.simpleMaterial.js +1 -1
- package/babylon.simpleMaterial.js.map +1 -1
- package/babylon.simpleMaterial.min.js +1 -1
- package/babylon.simpleMaterial.min.js.map +1 -1
- package/babylon.terrainMaterial.js +1 -1
- package/babylon.terrainMaterial.js.map +1 -1
- package/babylon.terrainMaterial.min.js +1 -1
- package/babylon.terrainMaterial.min.js.map +1 -1
- package/babylon.triPlanarMaterial.js +1 -1
- package/babylon.triPlanarMaterial.js.map +1 -1
- package/babylon.triPlanarMaterial.min.js +1 -1
- package/babylon.triPlanarMaterial.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 +2 -2
package/babylonjs.materials.js
CHANGED
|
@@ -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";function t(e,i,t,n,r,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,f=n.kind,l="getter"===f?"get":"setter"===f?"set":"value",d=!i&&e?n.static?e:e.prototype:null,u=i||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),c=!1,h=t.length-1;h>=0;h--){var m={};for(var v in n)m[v]="access"===v?{}:n[v];for(var v in n.access)m.access[v]=n.access[v];m.addInitializer=function(e){if(c)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var g=(0,t[h])("accessor"===f?{get:u.get,set:u.set}:u[l],m);if("accessor"===f){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(o=s(g.get))&&(u.get=o),(o=s(g.set))&&(u.set=o),(o=s(g.init))&&r.unshift(o)}else(o=s(g))&&("field"===f?r.unshift(o):u[l]=o)}d&&Object.defineProperty(d,n.name,u),c=!0}function n(e,i,t){for(var n=arguments.length>2,r=0;r<i.length;r++)t=n?i[r].call(e,t):i[r].call(e);return n?t:void 0}function r(e,i,t,n){return new(t||(t=Promise))(function(r,a){function s(e){try{f(n.next(e))}catch(e){a(e)}}function o(e){try{f(n.throw(e))}catch(e){a(e)}}function f(e){var i;e.done?r(e.value):(i=e.value,i instanceof t?i:new t(function(e){e(i)})).then(s,o)}f((n=n.apply(e,i||[])).next())})}function a(e,i,t,n){if("a"===t&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof i?e!==i||!n:!i.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?n:"a"===t?n.call(e):n?n.value:i.get(e)}function s(e,i,t,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof i?e!==i||!r:!i.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,t):r?r.value=t:i.set(e,t),t}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;class o extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.NDOTL=!0,this.CUSTOMUSERLIGHTING=!0,this.CELLBASIC=!0,this.DEPTHPREPASS=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let f=(()=>{var e,f,l,d,u;let c,h,m,v,g,p,S,x,T,_=i.PushMaterial,C=[],L=[],E=[],P=[],I=[],D=[],b=[],A=[],F=[],O=[],M=[],N=[],y=[],R=[],V=[],U=[],w=[],G=[];return e=class extends _{get diffuseTexture(){return a(this,f,"f")}set diffuseTexture(e){s(this,f,e,"f")}get computeHighLevel(){return a(this,l,"f")}set computeHighLevel(e){s(this,l,e,"f")}get disableLighting(){return a(this,d,"f")}set disableLighting(e){s(this,d,e,"f")}get maxSimultaneousLights(){return a(this,u,"f")}set maxSimultaneousLights(e){s(this,u,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._diffuseTexture=n(this,C,void 0),f.set(this,(n(this,L),n(this,E,void 0))),this.diffuseColor=(n(this,P),n(this,I,new i.Color3(1,1,1))),this._computeHighLevel=(n(this,D),n(this,b,!1)),l.set(this,(n(this,A),n(this,F,void 0))),this._disableLighting=(n(this,O),n(this,M,!1)),d.set(this,(n(this,N),n(this,y,void 0))),this._maxSimultaneousLights=(n(this,R),n(this,V,4)),u.set(this,(n(this,U),n(this,w,void 0))),this._shadersLoaded=(n(this,G),!1)}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new o);const s=t.materialDefines,f=this.getScene();if(this._isReadyForSubMesh(t))return!0;const l=f.getEngine();if(s._areTexturesDirty&&(s._needUVs=!1,f.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;s._needUVs=!0,s.DIFFUSE=!0}if(s.CELLBASIC=!this.computeHighLevel,i.PrepareDefinesForMisc(e,f,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=i.PrepareDefinesForLights(f,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(f,l,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),f.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n,this.maxSimultaneousLights),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=f.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const o="cell",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant"],c=["diffuseSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(f.getEngine().createEffect(o,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights-1},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return j}),Promise.resolve().then(function(){return q})]):yield Promise.all([Promise.resolve().then(function(){return ee}),Promise.resolve().then(function(){return re})]),this._shadersLoaded=!0})},l),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=f.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this._maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),this._afterBind(t,this._activeEffect,n))}getAnimatables(){const e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),e}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),e}hasTexture(e){return!!super.hasTexture(e)||this._diffuseTexture===e}dispose(e){this._diffuseTexture&&this._diffuseTexture.dispose(),super.dispose(e)}getClassName(){return"CellMaterial"}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.CellMaterial",e}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},f=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=_[Symbol.metadata])&&void 0!==n?n:null):void 0;c=[i.serializeAsTexture("diffuseTexture")],h=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],m=[i.serializeAsColor3("diffuse")],v=[i.serialize("computeHighLevel")],g=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],p=[i.serialize("disableLighting")],S=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],x=[i.serialize("maxSimultaneousLights")],T=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,h,{kind:"accessor",name:"diffuseTexture",static:!1,private:!1,access:{has:e=>"diffuseTexture"in e,get:e=>e.diffuseTexture,set:(e,i)=>{e.diffuseTexture=i}},metadata:r},E,P),t(e,null,g,{kind:"accessor",name:"computeHighLevel",static:!1,private:!1,access:{has:e=>"computeHighLevel"in e,get:e=>e.computeHighLevel,set:(e,i)=>{e.computeHighLevel=i}},metadata:r},F,O),t(e,null,S,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},y,R),t(e,null,T,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},w,G),t(null,null,c,{kind:"field",name:"_diffuseTexture",static:!1,private:!1,access:{has:e=>"_diffuseTexture"in e,get:e=>e._diffuseTexture,set:(e,i)=>{e._diffuseTexture=i}},metadata:r},C,L),t(null,null,m,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},I,D),t(null,null,v,{kind:"field",name:"_computeHighLevel",static:!1,private:!1,access:{has:e=>"_computeHighLevel"in e,get:e=>e._computeHighLevel,set:(e,i)=>{e._computeHighLevel=i}},metadata:r},b,A),t(null,null,p,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},M,N),t(null,null,x,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},V,U),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.CellMaterial",f);class l{constructor(){}}class d{constructor(){}}class u extends i.StandardMaterial{AttachAfterBind(e,t){if(this._newUniformInstances)for(const e in this._newUniformInstances){const n=e.toString().split("-");"vec2"==n[0]?t.setVector2(n[1],this._newUniformInstances[e]):"vec3"==n[0]?this._newUniformInstances[e]instanceof i.Color3?t.setColor3(n[1],this._newUniformInstances[e]):t.setVector3(n[1],this._newUniformInstances[e]):"vec4"==n[0]?(this._newUniformInstances[e]instanceof i.Color4?t.setDirectColor4(n[1],this._newUniformInstances[e]):t.setVector4(n[1],this._newUniformInstances[e]),t.setVector4(n[1],this._newUniformInstances[e])):"mat4"==n[0]?t.setMatrix(n[1],this._newUniformInstances[e]):"float"==n[0]&&t.setFloat(n[1],this._newUniformInstances[e])}if(this._newSamplerInstances)for(const e in this._newSamplerInstances){const i=e.toString().split("-");"sampler2D"==i[0]&&this._newSamplerInstances[e].isReady&&this._newSamplerInstances[e].isReady()&&t.setTexture(i[1],this._newSamplerInstances[e])}}ReviewUniform(e,i){if("uniform"==e&&this._newUniforms)for(let e=0;e<this._newUniforms.length;e++)-1==this._customUniform[e].indexOf("sampler")&&i.push(this._newUniforms[e].replace(/\[\d*\]/g,""));if("sampler"==e&&this._newUniforms)for(let e=0;e<this._newUniforms.length;e++)-1!=this._customUniform[e].indexOf("sampler")&&i.push(this._newUniforms[e].replace(/\[\d*\]/g,""));return i}Builder(e,t,n,r,a,s){s&&this._customAttributes&&this._customAttributes.length>0&&s.push(...this._customAttributes),this.ReviewUniform("uniform",t),this.ReviewUniform("sampler",r);const o=this._createdShaderName;return i.Effect.ShadersStore[o+"VertexShader"]&&i.Effect.ShadersStore[o+"PixelShader"]||(i.Effect.ShadersStore[o+"VertexShader"]=this._injectCustomCode(this.VertexShader,"vertex"),i.Effect.ShadersStore[o+"PixelShader"]=this._injectCustomCode(this.FragmentShader,"fragment")),o}_injectCustomCode(e,i){const t=this._getCustomCode(i);for(const i in t){const n=t[i];if(n&&n.length>0){const t="#define "+i;e=e.replace(t,"\n"+n+"\n"+t)}}return e}_getCustomCode(e){var i,t;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===(t=this._customUniform)||void 0===t?void 0:t.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}}constructor(e,t){super(e,t,!0),this.CustomParts=new d,this.customShaderNameResolve=this.Builder,this.FragmentShader=i.Effect.ShadersStore.defaultPixelShader,this.VertexShader=i.Effect.ShadersStore.defaultVertexShader,u.ShaderIndexer++,this._createdShaderName="custom_"+u.ShaderIndexer}_afterBind(e,i=null,t){if(i){this.AttachAfterBind(e,i);try{super._afterBind(e,i,t)}catch(e){}}}AddUniform(e,i,t){return this._customUniform||(this._customUniform=[],this._newUniforms=[],this._newSamplerInstances={},this._newUniformInstances={}),t&&(-1!=i.indexOf("sampler")?this._newSamplerInstances[i+"-"+e]=t:this._newUniformInstances[i+"-"+e]=t),this._customUniform.push("uniform "+i+" "+e+";"),this._newUniforms.push(e),this}AddAttribute(e){return this._customAttributes||(this._customAttributes=[]),this._customAttributes.push(e),this}Fragment_Begin(e){return this.CustomParts.Fragment_Begin=e,this}Fragment_Definitions(e){return this.CustomParts.Fragment_Definitions=e,this}Fragment_MainBegin(e){return this.CustomParts.Fragment_MainBegin=e,this}Fragment_MainEnd(e){return this.CustomParts.Fragment_MainEnd=e,this}Fragment_Custom_Diffuse(e){return this.CustomParts.Fragment_Custom_Diffuse=e.replace("result","diffuseColor"),this}Fragment_Custom_Alpha(e){return this.CustomParts.Fragment_Custom_Alpha=e.replace("result","alpha"),this}Fragment_Before_Lights(e){return this.CustomParts.Fragment_Before_Lights=e,this}Fragment_Before_Fog(e){return this.CustomParts.Fragment_Before_Fog=e,this}Fragment_Before_FragColor(e){return this.CustomParts.Fragment_Before_FragColor=e.replace("result","color"),this}Vertex_Begin(e){return this.CustomParts.Vertex_Begin=e,this}Vertex_Definitions(e){return this.CustomParts.Vertex_Definitions=e,this}Vertex_MainBegin(e){return this.CustomParts.Vertex_MainBegin=e,this}Vertex_Before_PositionUpdated(e){return this.CustomParts.Vertex_Before_PositionUpdated=e.replace("result","positionUpdated"),this}Vertex_Before_NormalUpdated(e){return this.CustomParts.Vertex_Before_NormalUpdated=e.replace("result","normalUpdated"),this}Vertex_After_WorldPosComputed(e){return this.CustomParts.Vertex_After_WorldPosComputed=e,this}Vertex_MainEnd(e){return this.CustomParts.Vertex_MainEnd=e,this}}u.ShaderIndexer=1,i.RegisterClass("BABYLON.CustomMaterial",u);class c{constructor(){}}const h=c;class m extends i.PBRMaterial{AttachAfterBind(e,t){if(this._newUniformInstances)for(const e in this._newUniformInstances){const n=e.toString().split("-");"vec2"==n[0]?t.setVector2(n[1],this._newUniformInstances[e]):"vec3"==n[0]?this._newUniformInstances[e]instanceof i.Color3?t.setColor3(n[1],this._newUniformInstances[e]):t.setVector3(n[1],this._newUniformInstances[e]):"vec4"==n[0]?(this._newUniformInstances[e]instanceof i.Color4?t.setDirectColor4(n[1],this._newUniformInstances[e]):t.setVector4(n[1],this._newUniformInstances[e]),t.setVector4(n[1],this._newUniformInstances[e])):"mat4"==n[0]?t.setMatrix(n[1],this._newUniformInstances[e]):"float"==n[0]&&t.setFloat(n[1],this._newUniformInstances[e])}if(this._newSamplerInstances)for(const e in this._newSamplerInstances){const i=e.toString().split("-");"sampler2D"==i[0]&&this._newSamplerInstances[e].isReady&&this._newSamplerInstances[e].isReady()&&t.setTexture(i[1],this._newSamplerInstances[e])}}ReviewUniform(e,i){if("uniform"==e&&this._newUniforms)for(let e=0;e<this._newUniforms.length;e++)-1==this._customUniform[e].indexOf("sampler")&&i.push(this._newUniforms[e].replace(/\[\d*\]/g,""));if("sampler"==e&&this._newUniforms)for(let e=0;e<this._newUniforms.length;e++)-1!=this._customUniform[e].indexOf("sampler")&&i.push(this._newUniforms[e].replace(/\[\d*\]/g,""));return i}Builder(e,t,n,r,a,s,o){if(o){const e=o.processFinalCode;o.processFinalCode=(t,n)=>{if("vertex"===t)return e?e(t,n):n;const r=new i.ShaderCodeInliner(n);return r.inlineToken="#define pbr_inline",r.processCode(),e?e(t,r.code):r.code}}s&&this._customAttributes&&this._customAttributes.length>0&&s.push(...this._customAttributes),this.ReviewUniform("uniform",t),this.ReviewUniform("sampler",r);const f=this._createdShaderName;return i.Effect.ShadersStore[f+"VertexShader"]&&i.Effect.ShadersStore[f+"PixelShader"]||(i.Effect.ShadersStore[f+"VertexShader"]=this._injectCustomCode(this.VertexShader,"vertex"),i.Effect.ShadersStore[f+"PixelShader"]=this._injectCustomCode(this.FragmentShader,"fragment")),f}_injectCustomCode(e,i){const t=this._getCustomCode(i);for(const i in t){const n=t[i];if(n&&n.length>0){const t="#define "+i;e=e.replace(t,"\n"+n+"\n"+t)}}return e}_getCustomCode(e){var i,t;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===(t=this._customUniform)||void 0===t?void 0:t.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}}constructor(e,t){super(e,t,!0),this._customEffects=new Set,this.CustomParts=new c,this.customShaderNameResolve=this.Builder,this.FragmentShader=i.Effect.ShadersStore.pbrPixelShader,this.VertexShader=i.Effect.ShadersStore.pbrVertexShader,this.FragmentShader=this.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g,i.Effect.IncludesShadersStore.pbrBlockAlbedoOpacity),this.FragmentShader=this.FragmentShader.replace(/#include<pbrBlockReflectivity>/g,i.Effect.IncludesShadersStore.pbrBlockReflectivity),this.FragmentShader=this.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g,i.Effect.IncludesShadersStore.pbrBlockFinalColorComposition),m.ShaderIndexer++,this._createdShaderName="custompbr_"+m.ShaderIndexer,this.onEffectCreatedObservable.add(({effect:e,subMesh:i})=>{const t=null==i?void 0:i.effect;this._isCreatedShaderEffect(e)&&this._customEffects.add(e),(!this.allowShaderHotSwapping||e.isReady())&&t&&t!==e&&this._isCreatedShaderEffect(t)&&(t.dispose(),t.isDisposed&&this._customEffects.delete(t))})}_isCreatedShaderEffect(e){return e._key.startsWith(this._createdShaderName+"+")}dispose(e,t){delete i.Effect.ShadersStore[this._createdShaderName+"VertexShader"],delete i.Effect.ShadersStore[this._createdShaderName+"PixelShader"],super.dispose(e,t),this._customEffects.forEach(e=>{e.dispose(!0)}),this._customEffects.clear()}_afterBind(e,i=null,t){if(i){this.AttachAfterBind(e,i);try{super._afterBind(e,i,t)}catch(e){}}}AddUniform(e,i,t){return this._customUniform||(this._customUniform=[],this._newUniforms=[],this._newSamplerInstances={},this._newUniformInstances={}),t&&(-1!=i.indexOf("sampler")?this._newSamplerInstances[i+"-"+e]=t:this._newUniformInstances[i+"-"+e]=t),this._customUniform.push("uniform "+i+" "+e+";"),this._newUniforms.push(e),this}AddAttribute(e){return this._customAttributes||(this._customAttributes=[]),this._customAttributes.push(e),this}Fragment_Begin(e){return this.CustomParts.Fragment_Begin=e,this}Fragment_Definitions(e){return this.CustomParts.Fragment_Definitions=e,this}Fragment_MainBegin(e){return this.CustomParts.Fragment_MainBegin=e,this}Fragment_Custom_Albedo(e){return this.CustomParts.Fragment_Custom_Albedo=e.replace("result","surfaceAlbedo"),this}Fragment_Custom_Alpha(e){return this.CustomParts.Fragment_Custom_Alpha=e.replace("result","alpha"),this}Fragment_Before_Lights(e){return this.CustomParts.Fragment_Before_Lights=e,this}Fragment_Custom_MetallicRoughness(e){return this.CustomParts.Fragment_Custom_MetallicRoughness=e,this}Fragment_Custom_MicroSurface(e){return this.CustomParts.Fragment_Custom_MicroSurface=e,this}Fragment_Before_Fog(e){return this.CustomParts.Fragment_Before_Fog=e,this}Fragment_Before_FinalColorComposition(e){return this.CustomParts.Fragment_Before_FinalColorComposition=e,this}Fragment_Before_FragColor(e){return this.CustomParts.Fragment_Before_FragColor=e.replace("result","color"),this}Fragment_MainEnd(e){return this.CustomParts.Fragment_MainEnd=e,this}Vertex_Begin(e){return this.CustomParts.Vertex_Begin=e,this}Vertex_Definitions(e){return this.CustomParts.Vertex_Definitions=e,this}Vertex_MainBegin(e){return this.CustomParts.Vertex_MainBegin=e,this}Vertex_Before_PositionUpdated(e){return this.CustomParts.Vertex_Before_PositionUpdated=e.replace("result","positionUpdated"),this}Vertex_Before_NormalUpdated(e){return this.CustomParts.Vertex_Before_NormalUpdated=e.replace("result","normalUpdated"),this}Vertex_After_WorldPosComputed(e){return this.CustomParts.Vertex_After_WorldPosComputed=e,this}Vertex_MainEnd(e){return this.CustomParts.Vertex_MainEnd=e,this}}m.ShaderIndexer=1,i.RegisterClass("BABYLON.PBRCustomMaterial",m);class v extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.UV1=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.BonesPerMesh=0,this.NUM_BONE_INFLUENCERS=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.rebuild()}}let g=(()=>{var e,o,f,l;let d,u,c,h,m,g,p,S,x=i.PushMaterial,T=[],_=[],C=[],L=[],E=[],P=[],I=[],D=[],b=[],A=[],F=[],O=[],M=[],N=[],y=[],R=[];return e=class extends x{get diffuseTexture(){return a(this,o,"f")}set diffuseTexture(e){s(this,o,e,"f")}get distortionTexture(){return a(this,f,"f")}set distortionTexture(e){s(this,f,e,"f")}get opacityTexture(){return a(this,l,"f")}set opacityTexture(e){s(this,l,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._diffuseTexture=n(this,T,void 0),o.set(this,(n(this,_),n(this,C,void 0))),this._distortionTexture=(n(this,L),n(this,E,void 0)),f.set(this,(n(this,P),n(this,I,void 0))),this._opacityTexture=(n(this,D),n(this,b,void 0)),l.set(this,(n(this,A),n(this,F,void 0))),this.diffuseColor=(n(this,O),n(this,M,new i.Color3(1,1,1))),this.speed=(n(this,N),n(this,y,1)),this._scaledDiffuse=(n(this,R),new i.Color3),this._lastTime=0,this._shadersLoaded=!1}needAlphaBlending(){return!1}needAlphaTesting(){return!0}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new v);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(s._areTexturesDirty&&(s._needUVs=!1,this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;s._needUVs=!0,s.DIFFUSE=!0}if(s.ALPHATEST=!!this._opacityTexture,s._areMiscDirty&&(s.POINTSIZE=this.pointsCloud||o.forcePointsCloud,s.FOG=o.fogEnabled&&e.applyFog&&o.fogMode!==i.Scene.FOGMODE_NONE&&this.fogEnabled,s.LOGARITHMICDEPTH=this._useLogarithmicDepth),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!1,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.UV1&&a.push(i.VertexBuffer.UVKind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="fire",d=["world","view","viewProjection","vEyePosition","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant","time","speed"];i.AddClipPlaneUniforms(d);const u=s.toString();t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:d,uniformBuffersNames:[],samplers:["diffuseSampler","distortionSampler","opacitySampler"],defines:u,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:null,maxSimultaneousLights:4,transformFeedbackVaryings:null,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return fe}),Promise.resolve().then(function(){return ce})]):yield Promise.all([Promise.resolve().then(function(){return ge}),Promise.resolve().then(function(){return Te})]),this._shadersLoaded=!0})},f),s,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this._scaledDiffuse,this.alpha*t.visibility),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),this._lastTime+=r.getEngine().getDeltaTime(),this._activeEffect.setFloat("time",this._lastTime),this._activeEffect.setFloat("speed",this.speed),this._afterBind(t,this._activeEffect,n))}getAnimatables(){const 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}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),this._distortionTexture&&e.push(this._distortionTexture),this._opacityTexture&&e.push(this._opacityTexture),e}hasTexture(e){return!!super.hasTexture(e)||this._diffuseTexture===e||this._distortionTexture===e||this._opacityTexture===e}getClassName(){return"FireMaterial"}dispose(e){this._diffuseTexture&&this._diffuseTexture.dispose(),this._distortionTexture&&this._distortionTexture.dispose(),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.FireMaterial",e.diffuseColor=this.diffuseColor.asArray(),e.speed=this.speed,this._diffuseTexture&&(e._diffuseTexture=this._diffuseTexture.serialize()),this._distortionTexture&&(e._distortionTexture=this._distortionTexture.serialize()),this._opacityTexture&&(e._opacityTexture=this._opacityTexture.serialize()),e}static Parse(t,n,r){const a=new e(t.name,n);return a.diffuseColor=i.Color3.FromArray(t.diffuseColor),a.speed=t.speed,a.alpha=t.alpha,a.id=t.id,i.Tags.AddTagsTo(a,t.tags),a.backFaceCulling=t.backFaceCulling,a.wireframe=t.wireframe,t._diffuseTexture&&(a._diffuseTexture=i.Texture.Parse(t._diffuseTexture,n,r)),t._distortionTexture&&(a._distortionTexture=i.Texture.Parse(t._distortionTexture,n,r)),t._opacityTexture&&(a._opacityTexture=i.Texture.Parse(t._opacityTexture,n,r)),a}},o=new WeakMap,f=new WeakMap,l=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=x[Symbol.metadata])&&void 0!==n?n:null):void 0;d=[i.serializeAsTexture("diffuseTexture")],u=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],c=[i.serializeAsTexture("distortionTexture")],h=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],m=[i.serializeAsTexture("opacityTexture")],g=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],p=[i.serializeAsColor3("diffuse")],S=[i.serialize()],t(e,null,u,{kind:"accessor",name:"diffuseTexture",static:!1,private:!1,access:{has:e=>"diffuseTexture"in e,get:e=>e.diffuseTexture,set:(e,i)=>{e.diffuseTexture=i}},metadata:r},C,L),t(e,null,h,{kind:"accessor",name:"distortionTexture",static:!1,private:!1,access:{has:e=>"distortionTexture"in e,get:e=>e.distortionTexture,set:(e,i)=>{e.distortionTexture=i}},metadata:r},I,D),t(e,null,g,{kind:"accessor",name:"opacityTexture",static:!1,private:!1,access:{has:e=>"opacityTexture"in e,get:e=>e.opacityTexture,set:(e,i)=>{e.opacityTexture=i}},metadata:r},F,O),t(null,null,d,{kind:"field",name:"_diffuseTexture",static:!1,private:!1,access:{has:e=>"_diffuseTexture"in e,get:e=>e._diffuseTexture,set:(e,i)=>{e._diffuseTexture=i}},metadata:r},T,_),t(null,null,c,{kind:"field",name:"_distortionTexture",static:!1,private:!1,access:{has:e=>"_distortionTexture"in e,get:e=>e._distortionTexture,set:(e,i)=>{e._distortionTexture=i}},metadata:r},E,P),t(null,null,m,{kind:"field",name:"_opacityTexture",static:!1,private:!1,access:{has:e=>"_opacityTexture"in e,get:e=>e._opacityTexture,set:(e,i)=>{e._opacityTexture=i}},metadata:r},b,A),t(null,null,p,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},M,N),t(null,null,S,{kind:"field",name:"speed",static:!1,private:!1,access:{has:e=>"speed"in e,get:e=>e.speed,set:(e,i)=>{e.speed=i}},metadata:r},y,R),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.FireMaterial",g);class p extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.HEIGHTMAP=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.HIGHLEVEL=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let S=(()=>{var e,o,f,l,d;let u,c,h,m,v,g,S,x,T,_,C,L,E,P,I,D,b,A,F,O,M=i.PushMaterial,N=[],y=[],R=[],V=[],U=[],w=[],G=[],W=[],B=[],z=[],H=[],k=[],X=[],j=[],Z=[],Y=[],K=[],q=[],Q=[],J=[],$=[],ee=[],ie=[],te=[],ne=[],re=[],ae=[],se=[],oe=[],fe=[],le=[],de=[],ue=[],ce=[],he=[],me=[],ve=[],ge=[],pe=[];return e=class extends M{get diffuseTexture(){return a(this,o,"f")}set diffuseTexture(e){s(this,o,e,"f")}get heightTexture(){return a(this,f,"f")}set heightTexture(e){s(this,f,e,"f")}get disableLighting(){return a(this,l,"f")}set disableLighting(e){s(this,l,e,"f")}get maxSimultaneousLights(){return a(this,d,"f")}set maxSimultaneousLights(e){s(this,d,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._diffuseTexture=(n(this,N),n(this,y,void 0)),o.set(this,(n(this,R),n(this,V,void 0))),this._heightTexture=(n(this,U),n(this,w,void 0)),f.set(this,(n(this,G),n(this,W,void 0))),this.diffuseColor=(n(this,B),n(this,z,new i.Color3(1,1,1))),this.furLength=(n(this,H),n(this,k,1)),this.furAngle=(n(this,X),n(this,j,0)),this.furColor=(n(this,Z),n(this,Y,new i.Color3(.44,.21,.02))),this.furOffset=(n(this,K),n(this,q,0)),this.furSpacing=(n(this,Q),n(this,J,12)),this.furGravity=(n(this,$),n(this,ee,new i.Vector3(0,0,0))),this.furSpeed=(n(this,ie),n(this,te,100)),this.furDensity=(n(this,ne),n(this,re,20)),this.furOcclusion=(n(this,ae),n(this,se,0)),this.furTexture=n(this,oe),this._disableLighting=n(this,fe,!1),l.set(this,(n(this,le),n(this,de,void 0))),this._maxSimultaneousLights=(n(this,ue),n(this,ce,4)),d.set(this,(n(this,he),n(this,me,void 0))),this.highLevelFur=(n(this,ve),n(this,ge,!0)),this._meshes=n(this,pe),this._furTime=0,this._shadersLoaded=!1}get furTime(){return this._furTime}set furTime(e){this._furTime=e}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}updateFur(){for(let e=1;e<this._meshes.length;e++){const 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}}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new p);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(s._areTexturesDirty&&o.texturesEnabled){if(this.diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled){if(!this.diffuseTexture.isReady())return!1;s._needUVs=!0,s.DIFFUSE=!0}if(this.heightTexture&&f.getCaps().maxVertexTextureImageUnits){if(!this.heightTexture.isReady())return!1;s._needUVs=!0,s.HEIGHTMAP=!0}}if(this.highLevelFur!==s.HIGHLEVEL&&(s.HIGHLEVEL=!0,s.markAsUnprocessed()),i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n,this.maxSimultaneousLights),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="fur",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant","furLength","furAngle","furColor","furOffset","furGravity","furTime","furSpacing","furDensity","furOcclusion"];i.AddClipPlaneUniforms(u);const c=["diffuseSampler","heightTexture","furTexture","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return Ee}),Promise.resolve().then(function(){return be})]):yield Promise.all([Promise.resolve().then(function(){return Me}),Promise.resolve().then(function(){return Ve})]),this._shadersLoaded=!0})},f),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this.maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,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(t,this._activeEffect,n))}getAnimatables(){const 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}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),this._heightTexture&&e.push(this._heightTexture),e}hasTexture(e){return!!super.hasTexture(e)||this.diffuseTexture===e||this._heightTexture===e}dispose(e){if(this.diffuseTexture&&this.diffuseTexture.dispose(),this._meshes)for(let i=1;i<this._meshes.length;i++){const t=this._meshes[i].material;t&&t.dispose(e),this._meshes[i].dispose()}super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.FurMaterial",this._meshes&&(e.sourceMeshName=this._meshes[0].name,e.quality=this._meshes.length),e}getClassName(){return"FurMaterial"}static Parse(t,n,r){const a=i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r);return t.sourceMeshName&&a.highLevelFur&&n.executeWhenReady(()=>{const i=n.getMeshByName(t.sourceMeshName);if(i){const r=e.GenerateTexture("Fur Texture",n);a.furTexture=r,e.FurifyMesh(i,t.quality)}}),a}static GenerateTexture(e,t){const n=new i.DynamicTexture("FurTexture "+e,256,t,!0),r=n.getContext();for(let e=0;e<2e4;++e)r.fillStyle="rgba(255, "+Math.floor(255*Math.random())+", "+Math.floor(255*Math.random())+", 1)",r.fillRect(Math.random()*n.getSize().width,Math.random()*n.getSize().height,2,2);return n.update(!1),n.wrapU=i.Texture.WRAP_ADDRESSMODE,n.wrapV=i.Texture.WRAP_ADDRESSMODE,n}static FurifyMesh(t,n){const r=[t],a=t.material;let s;if(!(a instanceof e))throw"The material of the source mesh must be a Fur Material";for(s=1;s<n;s++){const o=new e(a.name+s,t.getScene());t.getScene().materials.pop(),i.Tags.EnableFor(o),i.Tags.AddTagsTo(o,"furShellMaterial"),o.furLength=a.furLength,o.furAngle=a.furAngle,o.furGravity=a.furGravity,o.furSpacing=a.furSpacing,o.furSpeed=a.furSpeed,o.furColor=a.furColor,o.diffuseTexture=a.diffuseTexture,o.furOffset=s/n,o.furTexture=a.furTexture,o.highLevelFur=a.highLevelFur,o.furTime=a.furTime,o.furDensity=a.furDensity;const f=t.clone(t.name+s);f.material=o,f.skeleton=t.skeleton,f.position=i.Vector3.Zero(),r.push(f)}for(s=1;s<r.length;s++)r[s].parent=t;return t.material._meshes=r,r}},o=new WeakMap,f=new WeakMap,l=new WeakMap,d=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=M[Symbol.metadata])&&void 0!==n?n:null):void 0;u=[i.serializeAsTexture("diffuseTexture")],c=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],h=[i.serializeAsTexture("heightTexture")],m=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],v=[i.serializeAsColor3()],g=[i.serialize()],S=[i.serialize()],x=[i.serializeAsColor3()],T=[i.serialize()],_=[i.serialize()],C=[i.serializeAsVector3()],L=[i.serialize()],E=[i.serialize()],P=[i.serialize()],I=[i.serialize("disableLighting")],D=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],b=[i.serialize("maxSimultaneousLights")],A=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],F=[i.serialize()],O=[i.serialize()],t(e,null,c,{kind:"accessor",name:"diffuseTexture",static:!1,private:!1,access:{has:e=>"diffuseTexture"in e,get:e=>e.diffuseTexture,set:(e,i)=>{e.diffuseTexture=i}},metadata:r},V,U),t(e,null,m,{kind:"accessor",name:"heightTexture",static:!1,private:!1,access:{has:e=>"heightTexture"in e,get:e=>e.heightTexture,set:(e,i)=>{e.heightTexture=i}},metadata:r},W,B),t(e,null,D,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},de,ue),t(e,null,A,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},me,ve),t(e,null,O,{kind:"getter",name:"furTime",static:!1,private:!1,access:{has:e=>"furTime"in e,get:e=>e.furTime},metadata:r},null,N),t(null,null,u,{kind:"field",name:"_diffuseTexture",static:!1,private:!1,access:{has:e=>"_diffuseTexture"in e,get:e=>e._diffuseTexture,set:(e,i)=>{e._diffuseTexture=i}},metadata:r},y,R),t(null,null,h,{kind:"field",name:"_heightTexture",static:!1,private:!1,access:{has:e=>"_heightTexture"in e,get:e=>e._heightTexture,set:(e,i)=>{e._heightTexture=i}},metadata:r},w,G),t(null,null,v,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},z,H),t(null,null,g,{kind:"field",name:"furLength",static:!1,private:!1,access:{has:e=>"furLength"in e,get:e=>e.furLength,set:(e,i)=>{e.furLength=i}},metadata:r},k,X),t(null,null,S,{kind:"field",name:"furAngle",static:!1,private:!1,access:{has:e=>"furAngle"in e,get:e=>e.furAngle,set:(e,i)=>{e.furAngle=i}},metadata:r},j,Z),t(null,null,x,{kind:"field",name:"furColor",static:!1,private:!1,access:{has:e=>"furColor"in e,get:e=>e.furColor,set:(e,i)=>{e.furColor=i}},metadata:r},Y,K),t(null,null,T,{kind:"field",name:"furOffset",static:!1,private:!1,access:{has:e=>"furOffset"in e,get:e=>e.furOffset,set:(e,i)=>{e.furOffset=i}},metadata:r},q,Q),t(null,null,_,{kind:"field",name:"furSpacing",static:!1,private:!1,access:{has:e=>"furSpacing"in e,get:e=>e.furSpacing,set:(e,i)=>{e.furSpacing=i}},metadata:r},J,$),t(null,null,C,{kind:"field",name:"furGravity",static:!1,private:!1,access:{has:e=>"furGravity"in e,get:e=>e.furGravity,set:(e,i)=>{e.furGravity=i}},metadata:r},ee,ie),t(null,null,L,{kind:"field",name:"furSpeed",static:!1,private:!1,access:{has:e=>"furSpeed"in e,get:e=>e.furSpeed,set:(e,i)=>{e.furSpeed=i}},metadata:r},te,ne),t(null,null,E,{kind:"field",name:"furDensity",static:!1,private:!1,access:{has:e=>"furDensity"in e,get:e=>e.furDensity,set:(e,i)=>{e.furDensity=i}},metadata:r},re,ae),t(null,null,P,{kind:"field",name:"furOcclusion",static:!1,private:!1,access:{has:e=>"furOcclusion"in e,get:e=>e.furOcclusion,set:(e,i)=>{e.furOcclusion=i}},metadata:r},se,oe),t(null,null,I,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},fe,le),t(null,null,b,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},ce,he),t(null,null,F,{kind:"field",name:"highLevelFur",static:!1,private:!1,access:{has:e=>"highLevelFur"in e,get:e=>e.highLevelFur,set:(e,i)=>{e.highLevelFur=i}},metadata:r},ge,pe),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.FurMaterial",S);class x extends i.MaterialDefines{constructor(){super(),this.EMISSIVE=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let T=(()=>{var e,o,f;let l,d,u,c,h,m,v,g,p,S,T,_=i.PushMaterial,C=[],L=[],E=[],P=[],I=[],D=[],b=[],A=[],F=[],O=[],M=[],N=[],y=[],R=[],V=[],U=[],w=[],G=[],W=[],B=[],z=[],H=[];return e=class extends _{get maxSimultaneousLights(){return a(this,o,"f")}set maxSimultaneousLights(e){s(this,o,e,"f")}get disableLighting(){return a(this,f,"f")}set disableLighting(e){s(this,f,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._maxSimultaneousLights=n(this,C,4),o.set(this,(n(this,L),n(this,E,void 0))),this.topColor=(n(this,P),n(this,I,new i.Color3(1,0,0))),this.topColorAlpha=(n(this,D),n(this,b,1)),this.bottomColor=(n(this,A),n(this,F,new i.Color3(0,0,1))),this.bottomColorAlpha=(n(this,O),n(this,M,1)),this.offset=(n(this,N),n(this,y,0)),this.scale=(n(this,R),n(this,V,1)),this.smoothness=(n(this,U),n(this,w,1)),this._disableLighting=(n(this,G),n(this,W,!1)),f.set(this,(n(this,B),n(this,z,void 0))),this._shadersLoaded=(n(this,H),!1)}needAlphaBlending(){return this.alpha<1||this.topColorAlpha<1||this.bottomColorAlpha<1}needAlphaTesting(){return!0}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new x);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),s.EMISSIVE=this._disableLighting,i.PrepareDefinesForAttributes(e,s,!1,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="gradient",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","mBones","logarithmicDepthConstant","topColor","bottomColor","offset","smoothness","scale"];i.AddClipPlaneUniforms(u);const c=["areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:4,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return We}),Promise.resolve().then(function(){return ke})]):yield Promise.all([Promise.resolve().then(function(){return Ye}),Promise.resolve().then(function(){return Je})]),this._shadersLoaded=!0})},f),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,s),this._mustRebind(r,s,n)&&(i.BindClipPlane(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this.maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,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(t,this._activeEffect,n))}getAnimatables(){return[]}dispose(e){super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.GradientMaterial",e}getClassName(){return"GradientMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,f=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=_[Symbol.metadata])&&void 0!==n?n:null):void 0;l=[i.serialize("maxSimultaneousLights")],d=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],u=[i.serializeAsColor3()],c=[i.serialize()],h=[i.serializeAsColor3()],m=[i.serialize()],v=[i.serialize()],g=[i.serialize()],p=[i.serialize()],S=[i.serialize("disableLighting")],T=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,d,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},E,P),t(e,null,T,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},z,H),t(null,null,l,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},C,L),t(null,null,u,{kind:"field",name:"topColor",static:!1,private:!1,access:{has:e=>"topColor"in e,get:e=>e.topColor,set:(e,i)=>{e.topColor=i}},metadata:r},I,D),t(null,null,c,{kind:"field",name:"topColorAlpha",static:!1,private:!1,access:{has:e=>"topColorAlpha"in e,get:e=>e.topColorAlpha,set:(e,i)=>{e.topColorAlpha=i}},metadata:r},b,A),t(null,null,h,{kind:"field",name:"bottomColor",static:!1,private:!1,access:{has:e=>"bottomColor"in e,get:e=>e.bottomColor,set:(e,i)=>{e.bottomColor=i}},metadata:r},F,O),t(null,null,m,{kind:"field",name:"bottomColorAlpha",static:!1,private:!1,access:{has:e=>"bottomColorAlpha"in e,get:e=>e.bottomColorAlpha,set:(e,i)=>{e.bottomColorAlpha=i}},metadata:r},M,N),t(null,null,v,{kind:"field",name:"offset",static:!1,private:!1,access:{has:e=>"offset"in e,get:e=>e.offset,set:(e,i)=>{e.offset=i}},metadata:r},y,R),t(null,null,g,{kind:"field",name:"scale",static:!1,private:!1,access:{has:e=>"scale"in e,get:e=>e.scale,set:(e,i)=>{e.scale=i}},metadata:r},V,U),t(null,null,p,{kind:"field",name:"smoothness",static:!1,private:!1,access:{has:e=>"smoothness"in e,get:e=>e.smoothness,set:(e,i)=>{e.smoothness=i}},metadata:r},w,G),t(null,null,S,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},W,B),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.GradientMaterial",T);class _ extends i.MaterialDefines{constructor(){super(),this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.OPACITY=!1,this.ANTIALIAS=!1,this.LINES_ONLY=!1,this.FOG=!1,this.PREMULTIPLYALPHA=!1,this.MAX_LINE=!1,this.UV1=!1,this.UV2=!1,this.INSTANCES=!1,this.THIN_INSTANCES=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.MULTI_SCALE=!1,this.HORIZON_FADE=!1,this.BELOW_LINE_COLOR=!1,this.ORIGIN_MARKER=!1,this.rebuild()}}let C=(()=>{var e,o;let f,l,d,u,c,h,m,v,g,p,S,x,T,C,L,E,P,I,D,b,A=i.PushMaterial,F=[],O=[],M=[],N=[],y=[],R=[],V=[],U=[],w=[],G=[],W=[],B=[],z=[],H=[],k=[],X=[],j=[],Z=[],Y=[],K=[],q=[],Q=[],J=[],$=[],ee=[],ie=[],te=[],ne=[],re=[],ae=[],se=[],oe=[],fe=[],le=[],de=[],ue=[],ce=[];return e=class extends A{get belowLineColor(){return this._belowLineColor}set belowLineColor(e){this._belowLineColor!==e&&(this._belowLineColor=e,this._markAllSubMeshesAsMiscDirty())}get linesOnly(){return this._linesOnly}set linesOnly(e){this._linesOnly!==e&&(this._linesOnly=e,this.needDepthPrePass=e,this._markAllSubMeshesAsMiscDirty())}get opacityTexture(){return a(this,o,"f")}set opacityTexture(e){s(this,o,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this.mainColor=(n(this,F),n(this,O,i.Color3.Black())),this.lineColor=(n(this,M),n(this,N,i.Color3.Teal())),this.gridRatio=(n(this,y),n(this,R,1)),this.gridOffset=(n(this,V),n(this,U,i.Vector3.Zero())),this.majorUnitFrequency=(n(this,w),n(this,G,10)),this.minorUnitVisibility=(n(this,W),n(this,B,.33)),this.opacity=(n(this,z),n(this,H,1)),this.antialias=(n(this,k),n(this,X,!0)),this._belowLineColor=(n(this,j),null),this.useMultiScale=n(this,Z,!1),this.minGridSpacing=(n(this,Y),n(this,K,.001)),this.gridOctaves=(n(this,q),n(this,Q,4)),this.useHorizonFade=(n(this,J),n(this,$,!1)),this.useOriginMarker=(n(this,ee),n(this,ie,!1)),this._linesOnly=(n(this,te),!1),this.gridThicknessModifier=n(this,ne,1),this.preMultiplyAlpha=(n(this,re),n(this,ae,!1)),this.useMaxLine=(n(this,se),n(this,oe,!1)),this._opacityTexture=(n(this,fe),n(this,le,void 0)),o.set(this,(n(this,de),n(this,ue,void 0))),this._gridControl=(n(this,ce),new i.Vector4(this.gridRatio,this.majorUnitFrequency,this.minorUnitVisibility,this.opacity)),this._viewportSize=new i.Vector2,this._shadersLoaded=!1}needAlphaBlending(){return this.linesOnly||this.opacity<1||this._opacityTexture&&this._opacityTexture.isReady()}needAlphaBlendingForMesh(e){return e.visibility<1||this.needAlphaBlending()}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new _);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;s.LINES_ONLY!==this.linesOnly&&(s.LINES_ONLY=this.linesOnly,s.markAsUnprocessed()),s.PREMULTIPLYALPHA!=this.preMultiplyAlpha&&(s.PREMULTIPLYALPHA=!s.PREMULTIPLYALPHA,s.markAsUnprocessed()),s.MAX_LINE!==this.useMaxLine&&(s.MAX_LINE=!s.MAX_LINE,s.markAsUnprocessed()),s.ANTIALIAS!==this.antialias&&(s.ANTIALIAS=this.antialias,s.markAsUnprocessed()),s.MULTI_SCALE!==this.useMultiScale&&(s.MULTI_SCALE=this.useMultiScale,s.markAsUnprocessed()),s.HORIZON_FADE!==this.useHorizonFade&&(s.HORIZON_FADE=this.useHorizonFade,s.markAsUnprocessed());const f=null!==this._belowLineColor;if(s.BELOW_LINE_COLOR!==f&&(s.BELOW_LINE_COLOR=f,s.markAsUnprocessed()),s.ORIGIN_MARKER!==this.useOriginMarker&&(s.ORIGIN_MARKER=this.useOriginMarker,s.markAsUnprocessed()),s._areTexturesDirty&&(s._needUVs=!1,o.texturesEnabled&&this._opacityTexture&&i.MaterialFlags.OpacityTextureEnabled)){if(!this._opacityTexture.isReady())return!1;s._needUVs=!0,s.OPACITY=!0}if(i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,!1,this.fogEnabled,!1,s,void 0,void 0,void 0,this._isVertexOutputInvariant),i.PrepareDefinesForFrameBoundValues(o,o.getEngine(),this,s,!!n),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial(),i.PrepareDefinesForAttributes(e,s,!1,!1);const n=[i.VertexBuffer.PositionKind,i.VertexBuffer.NormalKind];s.UV1&&n.push(i.VertexBuffer.UVKind),s.UV2&&n.push(i.VertexBuffer.UV2Kind),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess,i.PrepareAttributesForInstances(n,s);const a=["projection","mainColor","lineColor","gridControl","gridOffset","vFogInfos","vFogColor","world","view","opacityMatrix","vOpacityInfos","visibility","logarithmicDepthConstant","gridThicknessModifier"];s.MULTI_SCALE&&a.push("minGridSpacing","gridOctaves"),(s.HORIZON_FADE||s.BELOW_LINE_COLOR||s.ORIGIN_MARKER)&&a.push("cameraPosition","viewportSize"),s.BELOW_LINE_COLOR&&a.push("belowLineColor");const f=s.toString();i.AddClipPlaneUniforms(a),t.setEffect(o.getEngine().createEffect("grid",{attributes:n,uniformsNames:a,uniformBuffersNames:["Scene"],samplers:["opacitySampler"],defines:f,fallbacks:null,onCompiled:this.onCompiled,onError:this.onError,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return ti}),Promise.resolve().then(function(){return si})]):yield Promise.all([Promise.resolve().then(function(){return di}),Promise.resolve().then(function(){return mi})]),this._shadersLoaded=!0})},o.getEngine()),s,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;if(s){if(this._activeEffect=s,this._activeEffect.setFloat("visibility",t.visibility),a.INSTANCES&&!a.THIN_INSTANCE||this.bindOnlyWorldMatrix(e),this.bindView(s),this.bindViewProjection(s),this._mustRebind(r,s,n)&&(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._activeEffect.setFloat("gridThicknessModifier",this.gridThicknessModifier),a.BELOW_LINE_COLOR&&this._belowLineColor&&this._activeEffect.setColor3("belowLineColor",this._belowLineColor),a.MULTI_SCALE&&(this._activeEffect.setFloat("minGridSpacing",this.minGridSpacing),this._activeEffect.setFloat("gridOctaves",Math.max(1,Math.min(8,Math.round(this.gridOctaves))))),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(s,this,r),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r)),i.BindFogParameters(r,t,this._activeEffect),a.HORIZON_FADE||a.BELOW_LINE_COLOR||a.ORIGIN_MARKER){const e=r.activeCamera;if(e){this._activeEffect.setVector3("cameraPosition",e.globalPosition);const i=r.getEngine();this._viewportSize.x=i.getRenderWidth(),this._viewportSize.y=i.getRenderHeight(),this._activeEffect.setVector2("viewportSize",this._viewportSize)}}this._afterBind(t,this._activeEffect,n)}}dispose(e){super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.GridMaterial",e}getClassName(){return"GridMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=A[Symbol.metadata])&&void 0!==n?n:null):void 0;f=[i.serializeAsColor3()],l=[i.serializeAsColor3()],d=[i.serialize()],u=[i.serializeAsVector3()],c=[i.serialize()],h=[i.serialize()],m=[i.serialize()],v=[i.serialize()],g=[i.serializeAsColor3()],p=[i.serialize()],S=[i.serialize()],x=[i.serialize()],T=[i.serialize()],C=[i.serialize()],L=[i.serialize()],E=[i.serialize()],P=[i.serialize()],I=[i.serialize()],D=[i.serializeAsTexture("opacityTexture")],b=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],t(e,null,g,{kind:"getter",name:"belowLineColor",static:!1,private:!1,access:{has:e=>"belowLineColor"in e,get:e=>e.belowLineColor},metadata:r},null,F),t(e,null,L,{kind:"getter",name:"linesOnly",static:!1,private:!1,access:{has:e=>"linesOnly"in e,get:e=>e.linesOnly},metadata:r},null,F),t(e,null,b,{kind:"accessor",name:"opacityTexture",static:!1,private:!1,access:{has:e=>"opacityTexture"in e,get:e=>e.opacityTexture,set:(e,i)=>{e.opacityTexture=i}},metadata:r},ue,ce),t(null,null,f,{kind:"field",name:"mainColor",static:!1,private:!1,access:{has:e=>"mainColor"in e,get:e=>e.mainColor,set:(e,i)=>{e.mainColor=i}},metadata:r},O,M),t(null,null,l,{kind:"field",name:"lineColor",static:!1,private:!1,access:{has:e=>"lineColor"in e,get:e=>e.lineColor,set:(e,i)=>{e.lineColor=i}},metadata:r},N,y),t(null,null,d,{kind:"field",name:"gridRatio",static:!1,private:!1,access:{has:e=>"gridRatio"in e,get:e=>e.gridRatio,set:(e,i)=>{e.gridRatio=i}},metadata:r},R,V),t(null,null,u,{kind:"field",name:"gridOffset",static:!1,private:!1,access:{has:e=>"gridOffset"in e,get:e=>e.gridOffset,set:(e,i)=>{e.gridOffset=i}},metadata:r},U,w),t(null,null,c,{kind:"field",name:"majorUnitFrequency",static:!1,private:!1,access:{has:e=>"majorUnitFrequency"in e,get:e=>e.majorUnitFrequency,set:(e,i)=>{e.majorUnitFrequency=i}},metadata:r},G,W),t(null,null,h,{kind:"field",name:"minorUnitVisibility",static:!1,private:!1,access:{has:e=>"minorUnitVisibility"in e,get:e=>e.minorUnitVisibility,set:(e,i)=>{e.minorUnitVisibility=i}},metadata:r},B,z),t(null,null,m,{kind:"field",name:"opacity",static:!1,private:!1,access:{has:e=>"opacity"in e,get:e=>e.opacity,set:(e,i)=>{e.opacity=i}},metadata:r},H,k),t(null,null,v,{kind:"field",name:"antialias",static:!1,private:!1,access:{has:e=>"antialias"in e,get:e=>e.antialias,set:(e,i)=>{e.antialias=i}},metadata:r},X,j),t(null,null,p,{kind:"field",name:"useMultiScale",static:!1,private:!1,access:{has:e=>"useMultiScale"in e,get:e=>e.useMultiScale,set:(e,i)=>{e.useMultiScale=i}},metadata:r},Z,Y),t(null,null,S,{kind:"field",name:"minGridSpacing",static:!1,private:!1,access:{has:e=>"minGridSpacing"in e,get:e=>e.minGridSpacing,set:(e,i)=>{e.minGridSpacing=i}},metadata:r},K,q),t(null,null,x,{kind:"field",name:"gridOctaves",static:!1,private:!1,access:{has:e=>"gridOctaves"in e,get:e=>e.gridOctaves,set:(e,i)=>{e.gridOctaves=i}},metadata:r},Q,J),t(null,null,T,{kind:"field",name:"useHorizonFade",static:!1,private:!1,access:{has:e=>"useHorizonFade"in e,get:e=>e.useHorizonFade,set:(e,i)=>{e.useHorizonFade=i}},metadata:r},$,ee),t(null,null,C,{kind:"field",name:"useOriginMarker",static:!1,private:!1,access:{has:e=>"useOriginMarker"in e,get:e=>e.useOriginMarker,set:(e,i)=>{e.useOriginMarker=i}},metadata:r},ie,te),t(null,null,E,{kind:"field",name:"gridThicknessModifier",static:!1,private:!1,access:{has:e=>"gridThicknessModifier"in e,get:e=>e.gridThicknessModifier,set:(e,i)=>{e.gridThicknessModifier=i}},metadata:r},ne,re),t(null,null,P,{kind:"field",name:"preMultiplyAlpha",static:!1,private:!1,access:{has:e=>"preMultiplyAlpha"in e,get:e=>e.preMultiplyAlpha,set:(e,i)=>{e.preMultiplyAlpha=i}},metadata:r},ae,se),t(null,null,I,{kind:"field",name:"useMaxLine",static:!1,private:!1,access:{has:e=>"useMaxLine"in e,get:e=>e.useMaxLine,set:(e,i)=>{e.useMaxLine=i}},metadata:r},oe,fe),t(null,null,D,{kind:"field",name:"_opacityTexture",static:!1,private:!1,access:{has:e=>"_opacityTexture"in e,get:e=>e._opacityTexture,set:(e,i)=>{e._opacityTexture=i}},metadata:r},le,de),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.GridMaterial",C);class L extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.LIGHT0=!1,this.LIGHT1=!1,this.LIGHT2=!1,this.LIGHT3=!1,this.SPOTLIGHT0=!1,this.SPOTLIGHT1=!1,this.SPOTLIGHT2=!1,this.SPOTLIGHT3=!1,this.HEMILIGHT0=!1,this.HEMILIGHT1=!1,this.HEMILIGHT2=!1,this.HEMILIGHT3=!1,this.DIRLIGHT0=!1,this.DIRLIGHT1=!1,this.DIRLIGHT2=!1,this.DIRLIGHT3=!1,this.POINTLIGHT0=!1,this.POINTLIGHT1=!1,this.POINTLIGHT2=!1,this.POINTLIGHT3=!1,this.SHADOW0=!1,this.SHADOW1=!1,this.SHADOW2=!1,this.SHADOW3=!1,this.SHADOWS=!1,this.SHADOWESM0=!1,this.SHADOWESM1=!1,this.SHADOWESM2=!1,this.SHADOWESM3=!1,this.SHADOWPOISSON0=!1,this.SHADOWPOISSON1=!1,this.SHADOWPOISSON2=!1,this.SHADOWPOISSON3=!1,this.SHADOWPCF0=!1,this.SHADOWPCF1=!1,this.SHADOWPCF2=!1,this.SHADOWPCF3=!1,this.SHADOWPCSS0=!1,this.SHADOWPCSS1=!1,this.SHADOWPCSS2=!1,this.SHADOWPCSS3=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.UNLIT=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let E=(()=>{var e,o,f,l,d;let u,c,h,m,v,g,p,S,x,T,_,C,E,P,I,D=i.PushMaterial,b=[],A=[],F=[],O=[],M=[],N=[],y=[],R=[],V=[],U=[],w=[],G=[],W=[],B=[],z=[],H=[],k=[],X=[],j=[],Z=[],Y=[],K=[],q=[],Q=[],J=[],$=[],ee=[],ie=[],te=[],ne=[];return e=class extends D{get diffuseTexture(){return a(this,o,"f")}set diffuseTexture(e){s(this,o,e,"f")}get disableLighting(){return a(this,f,"f")}set disableLighting(e){s(this,f,e,"f")}get unlit(){return a(this,l,"f")}set unlit(e){s(this,l,e,"f")}get maxSimultaneousLights(){return a(this,d,"f")}set maxSimultaneousLights(e){s(this,d,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._diffuseTexture=n(this,b,void 0),o.set(this,(n(this,A),n(this,F,void 0))),this.noiseTexture=(n(this,O),n(this,M,void 0)),this.fogColor=(n(this,N),n(this,y,void 0)),this.speed=(n(this,R),n(this,V,1)),this.movingSpeed=(n(this,U),n(this,w,1)),this.lowFrequencySpeed=(n(this,G),n(this,W,1)),this.fogDensity=(n(this,B),n(this,z,.15)),this._lastTime=(n(this,H),0),this.diffuseColor=n(this,k,new i.Color3(1,1,1)),this._disableLighting=(n(this,X),n(this,j,!1)),f.set(this,(n(this,Z),n(this,Y,void 0))),this._unlit=(n(this,K),n(this,q,!1)),l.set(this,(n(this,Q),n(this,J,void 0))),this._maxSimultaneousLights=(n(this,$),n(this,ee,4)),d.set(this,(n(this,ie),n(this,te,void 0))),this._scaledDiffuse=(n(this,ne),new i.Color3),this._shadersLoaded=!1}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new L);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(s._areTexturesDirty&&(s._needUVs=!1,o.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;s._needUVs=!0,s.DIFFUSE=!0}if(i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=!0,i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="lava",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant","time","speed","movingSpeed","fogColor","fogDensity","lowFrequencySpeed"];i.AddClipPlaneUniforms(u);const c=["diffuseSampler","noiseTexture","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return Si}),Promise.resolve().then(function(){return Ci})]):yield Promise.all([Promise.resolve().then(function(){return Ii}),Promise.resolve().then(function(){return Fi})]),this._shadersLoaded=!0})},f),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,a.UNLIT=this._unlit,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this._scaledDiffuse,this.alpha*t.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,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(t,this._activeEffect,n))}getAnimatables(){const 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}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),e}hasTexture(e){return!!super.hasTexture(e)||this.diffuseTexture===e}dispose(e){this.diffuseTexture&&this.diffuseTexture.dispose(),this.noiseTexture&&this.noiseTexture.dispose(),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.LavaMaterial",e}getClassName(){return"LavaMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,f=new WeakMap,l=new WeakMap,d=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=D[Symbol.metadata])&&void 0!==n?n:null):void 0;u=[i.serializeAsTexture("diffuseTexture")],c=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],h=[i.serializeAsTexture()],m=[i.serializeAsColor3()],v=[i.serialize()],g=[i.serialize()],p=[i.serialize()],S=[i.serialize()],x=[i.serializeAsColor3()],T=[i.serialize("disableLighting")],_=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],C=[i.serialize("unlit")],E=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],P=[i.serialize("maxSimultaneousLights")],I=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,c,{kind:"accessor",name:"diffuseTexture",static:!1,private:!1,access:{has:e=>"diffuseTexture"in e,get:e=>e.diffuseTexture,set:(e,i)=>{e.diffuseTexture=i}},metadata:r},F,O),t(e,null,_,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},Y,K),t(e,null,E,{kind:"accessor",name:"unlit",static:!1,private:!1,access:{has:e=>"unlit"in e,get:e=>e.unlit,set:(e,i)=>{e.unlit=i}},metadata:r},J,$),t(e,null,I,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},te,ne),t(null,null,u,{kind:"field",name:"_diffuseTexture",static:!1,private:!1,access:{has:e=>"_diffuseTexture"in e,get:e=>e._diffuseTexture,set:(e,i)=>{e._diffuseTexture=i}},metadata:r},b,A),t(null,null,h,{kind:"field",name:"noiseTexture",static:!1,private:!1,access:{has:e=>"noiseTexture"in e,get:e=>e.noiseTexture,set:(e,i)=>{e.noiseTexture=i}},metadata:r},M,N),t(null,null,m,{kind:"field",name:"fogColor",static:!1,private:!1,access:{has:e=>"fogColor"in e,get:e=>e.fogColor,set:(e,i)=>{e.fogColor=i}},metadata:r},y,R),t(null,null,v,{kind:"field",name:"speed",static:!1,private:!1,access:{has:e=>"speed"in e,get:e=>e.speed,set:(e,i)=>{e.speed=i}},metadata:r},V,U),t(null,null,g,{kind:"field",name:"movingSpeed",static:!1,private:!1,access:{has:e=>"movingSpeed"in e,get:e=>e.movingSpeed,set:(e,i)=>{e.movingSpeed=i}},metadata:r},w,G),t(null,null,p,{kind:"field",name:"lowFrequencySpeed",static:!1,private:!1,access:{has:e=>"lowFrequencySpeed"in e,get:e=>e.lowFrequencySpeed,set:(e,i)=>{e.lowFrequencySpeed=i}},metadata:r},W,B),t(null,null,S,{kind:"field",name:"fogDensity",static:!1,private:!1,access:{has:e=>"fogDensity"in e,get:e=>e.fogDensity,set:(e,i)=>{e.fogDensity=i}},metadata:r},z,H),t(null,null,x,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},k,X),t(null,null,T,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},j,Z),t(null,null,C,{kind:"field",name:"_unlit",static:!1,private:!1,access:{has:e=>"_unlit"in e,get:e=>e._unlit,set:(e,i)=>{e._unlit=i}},metadata:r},q,Q),t(null,null,P,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},ee,ie),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.LavaMaterial",E);class P extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.SPECULARTERM=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.MIXMAP2=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.rebuild()}}let I=(()=>{var e,o,f,l,d,u,c,h,m,v,g,p,S;let x,T,_,C,L,E,I,D,b,A,F,O,M,N,y,R,V,U,w,G,W,B,z,H,k,X,j,Z=i.PushMaterial,Y=[],K=[],q=[],Q=[],J=[],$=[],ee=[],ie=[],te=[],ne=[],re=[],ae=[],se=[],oe=[],fe=[],le=[],de=[],ue=[],ce=[],he=[],me=[],ve=[],ge=[],pe=[],Se=[],xe=[],Te=[],_e=[],Ce=[],Le=[],Ee=[],Pe=[],Ie=[],De=[],be=[],Ae=[],Fe=[],Oe=[],Me=[],Ne=[],ye=[],Re=[],Ve=[],Ue=[],we=[],Ge=[],We=[],Be=[],ze=[],He=[],ke=[],Xe=[],je=[],Ze=[];return e=class extends Z{get mixTexture1(){return a(this,o,"f")}set mixTexture1(e){s(this,o,e,"f")}get mixTexture2(){return a(this,f,"f")}set mixTexture2(e){s(this,f,e,"f")}get diffuseTexture1(){return a(this,l,"f")}set diffuseTexture1(e){s(this,l,e,"f")}get diffuseTexture2(){return a(this,d,"f")}set diffuseTexture2(e){s(this,d,e,"f")}get diffuseTexture3(){return a(this,u,"f")}set diffuseTexture3(e){s(this,u,e,"f")}get diffuseTexture4(){return a(this,c,"f")}set diffuseTexture4(e){s(this,c,e,"f")}get diffuseTexture5(){return a(this,h,"f")}set diffuseTexture5(e){s(this,h,e,"f")}get diffuseTexture6(){return a(this,m,"f")}set diffuseTexture6(e){s(this,m,e,"f")}get diffuseTexture7(){return a(this,v,"f")}set diffuseTexture7(e){s(this,v,e,"f")}get diffuseTexture8(){return a(this,g,"f")}set diffuseTexture8(e){s(this,g,e,"f")}get disableLighting(){return a(this,p,"f")}set disableLighting(e){s(this,p,e,"f")}get maxSimultaneousLights(){return a(this,S,"f")}set maxSimultaneousLights(e){s(this,S,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._mixTexture1=n(this,Y,void 0),o.set(this,(n(this,K),n(this,q,void 0))),this._mixTexture2=(n(this,Q),n(this,J,void 0)),f.set(this,(n(this,$),n(this,ee,void 0))),this._diffuseTexture1=(n(this,ie),n(this,te,void 0)),l.set(this,(n(this,ne),n(this,re,void 0))),this._diffuseTexture2=(n(this,ae),n(this,se,void 0)),d.set(this,(n(this,oe),n(this,fe,void 0))),this._diffuseTexture3=(n(this,le),n(this,de,void 0)),u.set(this,(n(this,ue),n(this,ce,void 0))),this._diffuseTexture4=(n(this,he),n(this,me,void 0)),c.set(this,(n(this,ve),n(this,ge,void 0))),this._diffuseTexture5=(n(this,pe),n(this,Se,void 0)),h.set(this,(n(this,xe),n(this,Te,void 0))),this._diffuseTexture6=(n(this,_e),n(this,Ce,void 0)),m.set(this,(n(this,Le),n(this,Ee,void 0))),this._diffuseTexture7=(n(this,Pe),n(this,Ie,void 0)),v.set(this,(n(this,De),n(this,be,void 0))),this._diffuseTexture8=(n(this,Ae),n(this,Fe,void 0)),g.set(this,(n(this,Oe),n(this,Me,void 0))),this.diffuseColor=(n(this,Ne),n(this,ye,new i.Color3(1,1,1))),this.specularColor=(n(this,Re),n(this,Ve,new i.Color3(0,0,0))),this.specularPower=(n(this,Ue),n(this,we,64)),this._disableLighting=(n(this,Ge),n(this,We,!1)),p.set(this,(n(this,Be),n(this,ze,void 0))),this._maxSimultaneousLights=(n(this,He),n(this,ke,4)),S.set(this,(n(this,Xe),n(this,je,void 0))),this._shadersLoaded=(n(this,Ze),!1)}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new P);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(o.texturesEnabled){if(!this._mixTexture1||!this._mixTexture1.isReady())return!1;if(s._needUVs=!0,i.MaterialFlags.DiffuseTextureEnabled){if(!this._diffuseTexture1||!this._diffuseTexture1.isReady())return!1;if(s.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(s.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,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n,this.maxSimultaneousLights),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="mix",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","textureMatrix","logarithmicDepthConstant","diffuse1Infos","diffuse2Infos","diffuse3Infos","diffuse4Infos","diffuse5Infos","diffuse6Infos","diffuse7Infos","diffuse8Infos"],c=["mixMap1Sampler","mixMap2Sampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","diffuse4Sampler","diffuse5Sampler","diffuse6Sampler","diffuse7Sampler","diffuse8Sampler"],h=[];i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return yi}),Promise.resolve().then(function(){return wi})]):yield Promise.all([Promise.resolve().then(function(){return zi}),Promise.resolve().then(function(){return ji})]),this._shadersLoaded=!0})},f),s,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this.maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),this._afterBind(t,this._activeEffect,n))}getAnimatables(){const 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}getActiveTextures(){const e=super.getActiveTextures();return this._mixTexture1&&e.push(this._mixTexture1),this._diffuseTexture1&&e.push(this._diffuseTexture1),this._diffuseTexture2&&e.push(this._diffuseTexture2),this._diffuseTexture3&&e.push(this._diffuseTexture3),this._diffuseTexture4&&e.push(this._diffuseTexture4),this._mixTexture2&&e.push(this._mixTexture2),this._diffuseTexture5&&e.push(this._diffuseTexture5),this._diffuseTexture6&&e.push(this._diffuseTexture6),this._diffuseTexture7&&e.push(this._diffuseTexture7),this._diffuseTexture8&&e.push(this._diffuseTexture8),e}hasTexture(e){return!!super.hasTexture(e)||this._mixTexture1===e||this._diffuseTexture1===e||this._diffuseTexture2===e||this._diffuseTexture3===e||this._diffuseTexture4===e||this._mixTexture2===e||this._diffuseTexture5===e||this._diffuseTexture6===e||this._diffuseTexture7===e||this._diffuseTexture8===e}dispose(e){this._mixTexture1&&this._mixTexture1.dispose(),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.MixMaterial",e}getClassName(){return"MixMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,f=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,c=new WeakMap,h=new WeakMap,m=new WeakMap,v=new WeakMap,g=new WeakMap,p=new WeakMap,S=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=Z[Symbol.metadata])&&void 0!==n?n:null):void 0;x=[i.serializeAsTexture("mixTexture1")],T=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],_=[i.serializeAsTexture("mixTexture2")],C=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],L=[i.serializeAsTexture("diffuseTexture1")],E=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],I=[i.serializeAsTexture("diffuseTexture2")],D=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],b=[i.serializeAsTexture("diffuseTexture3")],A=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],F=[i.serializeAsTexture("diffuseTexture4")],O=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],M=[i.serializeAsTexture("diffuseTexture1")],N=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],y=[i.serializeAsTexture("diffuseTexture2")],R=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],V=[i.serializeAsTexture("diffuseTexture3")],U=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],w=[i.serializeAsTexture("diffuseTexture4")],G=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],W=[i.serializeAsColor3()],B=[i.serializeAsColor3()],z=[i.serialize()],H=[i.serialize("disableLighting")],k=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],X=[i.serialize("maxSimultaneousLights")],j=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,T,{kind:"accessor",name:"mixTexture1",static:!1,private:!1,access:{has:e=>"mixTexture1"in e,get:e=>e.mixTexture1,set:(e,i)=>{e.mixTexture1=i}},metadata:r},q,Q),t(e,null,C,{kind:"accessor",name:"mixTexture2",static:!1,private:!1,access:{has:e=>"mixTexture2"in e,get:e=>e.mixTexture2,set:(e,i)=>{e.mixTexture2=i}},metadata:r},ee,ie),t(e,null,E,{kind:"accessor",name:"diffuseTexture1",static:!1,private:!1,access:{has:e=>"diffuseTexture1"in e,get:e=>e.diffuseTexture1,set:(e,i)=>{e.diffuseTexture1=i}},metadata:r},re,ae),t(e,null,D,{kind:"accessor",name:"diffuseTexture2",static:!1,private:!1,access:{has:e=>"diffuseTexture2"in e,get:e=>e.diffuseTexture2,set:(e,i)=>{e.diffuseTexture2=i}},metadata:r},fe,le),t(e,null,A,{kind:"accessor",name:"diffuseTexture3",static:!1,private:!1,access:{has:e=>"diffuseTexture3"in e,get:e=>e.diffuseTexture3,set:(e,i)=>{e.diffuseTexture3=i}},metadata:r},ce,he),t(e,null,O,{kind:"accessor",name:"diffuseTexture4",static:!1,private:!1,access:{has:e=>"diffuseTexture4"in e,get:e=>e.diffuseTexture4,set:(e,i)=>{e.diffuseTexture4=i}},metadata:r},ge,pe),t(e,null,N,{kind:"accessor",name:"diffuseTexture5",static:!1,private:!1,access:{has:e=>"diffuseTexture5"in e,get:e=>e.diffuseTexture5,set:(e,i)=>{e.diffuseTexture5=i}},metadata:r},Te,_e),t(e,null,R,{kind:"accessor",name:"diffuseTexture6",static:!1,private:!1,access:{has:e=>"diffuseTexture6"in e,get:e=>e.diffuseTexture6,set:(e,i)=>{e.diffuseTexture6=i}},metadata:r},Ee,Pe),t(e,null,U,{kind:"accessor",name:"diffuseTexture7",static:!1,private:!1,access:{has:e=>"diffuseTexture7"in e,get:e=>e.diffuseTexture7,set:(e,i)=>{e.diffuseTexture7=i}},metadata:r},be,Ae),t(e,null,G,{kind:"accessor",name:"diffuseTexture8",static:!1,private:!1,access:{has:e=>"diffuseTexture8"in e,get:e=>e.diffuseTexture8,set:(e,i)=>{e.diffuseTexture8=i}},metadata:r},Me,Ne),t(e,null,k,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},ze,He),t(e,null,j,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},je,Ze),t(null,null,x,{kind:"field",name:"_mixTexture1",static:!1,private:!1,access:{has:e=>"_mixTexture1"in e,get:e=>e._mixTexture1,set:(e,i)=>{e._mixTexture1=i}},metadata:r},Y,K),t(null,null,_,{kind:"field",name:"_mixTexture2",static:!1,private:!1,access:{has:e=>"_mixTexture2"in e,get:e=>e._mixTexture2,set:(e,i)=>{e._mixTexture2=i}},metadata:r},J,$),t(null,null,L,{kind:"field",name:"_diffuseTexture1",static:!1,private:!1,access:{has:e=>"_diffuseTexture1"in e,get:e=>e._diffuseTexture1,set:(e,i)=>{e._diffuseTexture1=i}},metadata:r},te,ne),t(null,null,I,{kind:"field",name:"_diffuseTexture2",static:!1,private:!1,access:{has:e=>"_diffuseTexture2"in e,get:e=>e._diffuseTexture2,set:(e,i)=>{e._diffuseTexture2=i}},metadata:r},se,oe),t(null,null,b,{kind:"field",name:"_diffuseTexture3",static:!1,private:!1,access:{has:e=>"_diffuseTexture3"in e,get:e=>e._diffuseTexture3,set:(e,i)=>{e._diffuseTexture3=i}},metadata:r},de,ue),t(null,null,F,{kind:"field",name:"_diffuseTexture4",static:!1,private:!1,access:{has:e=>"_diffuseTexture4"in e,get:e=>e._diffuseTexture4,set:(e,i)=>{e._diffuseTexture4=i}},metadata:r},me,ve),t(null,null,M,{kind:"field",name:"_diffuseTexture5",static:!1,private:!1,access:{has:e=>"_diffuseTexture5"in e,get:e=>e._diffuseTexture5,set:(e,i)=>{e._diffuseTexture5=i}},metadata:r},Se,xe),t(null,null,y,{kind:"field",name:"_diffuseTexture6",static:!1,private:!1,access:{has:e=>"_diffuseTexture6"in e,get:e=>e._diffuseTexture6,set:(e,i)=>{e._diffuseTexture6=i}},metadata:r},Ce,Le),t(null,null,V,{kind:"field",name:"_diffuseTexture7",static:!1,private:!1,access:{has:e=>"_diffuseTexture7"in e,get:e=>e._diffuseTexture7,set:(e,i)=>{e._diffuseTexture7=i}},metadata:r},Ie,De),t(null,null,w,{kind:"field",name:"_diffuseTexture8",static:!1,private:!1,access:{has:e=>"_diffuseTexture8"in e,get:e=>e._diffuseTexture8,set:(e,i)=>{e._diffuseTexture8=i}},metadata:r},Fe,Oe),t(null,null,W,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},ye,Re),t(null,null,B,{kind:"field",name:"specularColor",static:!1,private:!1,access:{has:e=>"specularColor"in e,get:e=>e.specularColor,set:(e,i)=>{e.specularColor=i}},metadata:r},Ve,Ue),t(null,null,z,{kind:"field",name:"specularPower",static:!1,private:!1,access:{has:e=>"specularPower"in e,get:e=>e.specularPower,set:(e,i)=>{e.specularPower=i}},metadata:r},we,Ge),t(null,null,H,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},We,Be),t(null,null,X,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},ke,Xe),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.MixMaterial",I);class D extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.LIGHT0=!1,this.LIGHT1=!1,this.LIGHT2=!1,this.LIGHT3=!1,this.SPOTLIGHT0=!1,this.SPOTLIGHT1=!1,this.SPOTLIGHT2=!1,this.SPOTLIGHT3=!1,this.HEMILIGHT0=!1,this.HEMILIGHT1=!1,this.HEMILIGHT2=!1,this.HEMILIGHT3=!1,this.DIRLIGHT0=!1,this.DIRLIGHT1=!1,this.DIRLIGHT2=!1,this.DIRLIGHT3=!1,this.POINTLIGHT0=!1,this.POINTLIGHT1=!1,this.POINTLIGHT2=!1,this.POINTLIGHT3=!1,this.SHADOW0=!1,this.SHADOW1=!1,this.SHADOW2=!1,this.SHADOW3=!1,this.SHADOWS=!1,this.SHADOWESM0=!1,this.SHADOWESM1=!1,this.SHADOWESM2=!1,this.SHADOWESM3=!1,this.SHADOWPOISSON0=!1,this.SHADOWPOISSON1=!1,this.SHADOWPOISSON2=!1,this.SHADOWPOISSON3=!1,this.SHADOWPCF0=!1,this.SHADOWPCF1=!1,this.SHADOWPCF2=!1,this.SHADOWPCF3=!1,this.SHADOWPCSS0=!1,this.SHADOWPCSS1=!1,this.SHADOWPCSS2=!1,this.SHADOWPCSS3=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.THIN_INSTANCES=!1,this.LIGHTING=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let b=(()=>{var e,o,f,l;let d,u,c,h,m,v,g,p=i.PushMaterial,S=[],x=[],T=[],_=[],C=[],L=[],E=[],P=[],I=[],b=[],A=[],F=[],O=[],M=[];return e=class extends p{get diffuseTexture(){return a(this,o,"f")}set diffuseTexture(e){s(this,o,e,"f")}get disableLighting(){return a(this,f,"f")}set disableLighting(e){s(this,f,e,"f")}get maxSimultaneousLights(){return a(this,l,"f")}set maxSimultaneousLights(e){s(this,l,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._diffuseTexture=n(this,S,void 0),o.set(this,(n(this,x),n(this,T,void 0))),this.diffuseColor=(n(this,_),n(this,C,new i.Color3(1,1,1))),this._disableLighting=(n(this,L),n(this,E,!1)),f.set(this,(n(this,P),n(this,I,void 0))),this._maxSimultaneousLights=(n(this,b),n(this,A,4)),l.set(this,(n(this,F),n(this,O,void 0))),this._shadersLoaded=(n(this,M),!1)}needAlphaBlending(){return this.alpha<1}needAlphaBlendingForMesh(e){return this.needAlphaBlending()||e.visibility<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new D);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(s._areTexturesDirty&&(s._needUVs=!1,o.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;s._needUVs=!0,s.DIFFUSE=!0}if(i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=!0,i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n,null,t.getRenderingMesh().hasThinInstances),s.LIGHTING=!this._disableLighting,i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="normal",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant"],c=["diffuseSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:4,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return qi}),Promise.resolve().then(function(){return et})]):yield Promise.all([Promise.resolve().then(function(){return rt}),Promise.resolve().then(function(){return ft})]),this._shadersLoaded=!0})},f),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),this._afterBind(t,this._activeEffect,n))}getAnimatables(){const e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&this.diffuseTexture.animations.length>0&&e.push(this.diffuseTexture),e}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),e}hasTexture(e){return!!super.hasTexture(e)||this.diffuseTexture===e}dispose(e){this.diffuseTexture&&this.diffuseTexture.dispose(),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.NormalMaterial",e}getClassName(){return"NormalMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,f=new WeakMap,l=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=p[Symbol.metadata])&&void 0!==n?n:null):void 0;d=[i.serializeAsTexture("diffuseTexture")],u=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],c=[i.serializeAsColor3()],h=[i.serialize("disableLighting")],m=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],v=[i.serialize("maxSimultaneousLights")],g=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,u,{kind:"accessor",name:"diffuseTexture",static:!1,private:!1,access:{has:e=>"diffuseTexture"in e,get:e=>e.diffuseTexture,set:(e,i)=>{e.diffuseTexture=i}},metadata:r},T,_),t(e,null,m,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},I,b),t(e,null,g,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},O,M),t(null,null,d,{kind:"field",name:"_diffuseTexture",static:!1,private:!1,access:{has:e=>"_diffuseTexture"in e,get:e=>e._diffuseTexture,set:(e,i)=>{e._diffuseTexture=i}},metadata:r},S,x),t(null,null,c,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},C,L),t(null,null,h,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},E,P),t(null,null,v,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},A,F),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.NormalMaterial",b);class A extends i.MaterialDefines{constructor(){super(),this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.rebuild()}}class F extends i.PushMaterial{constructor(e,t,n=!1){super(e,t,void 0,n),this._needAlphaBlending=!0,this._shadersLoaded=!1,this.shadowColor=i.Color3.Black()}needAlphaBlending(){return this._needAlphaBlending}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}get activeLight(){return this._activeLight}set activeLight(e){this._activeLight=e}_getFirstShadowLightForMesh(e){for(const i of e.lightSources)if(i.shadowEnabled)return i;return null}isReadyForSubMesh(e,t,n){var a;const s=t._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new A);const o=t.materialDefines,f=this.getScene();if(this._isReadyForSubMesh(t))return!0;const l=f.getEngine();if(this._activeLight)for(const i of e.lightSources)if(i.shadowEnabled){if(this._activeLight===i)break;const t=e.lightSources.indexOf(this._activeLight);-1!==t&&(e.lightSources.splice(t,1),e.lightSources.splice(0,0,this._activeLight));break}i.PrepareDefinesForFrameBoundValues(f,l,this,o,!!n),i.PrepareDefinesForMisc(e,f,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),o,void 0,void 0,void 0,this._isVertexOutputInvariant),o._needNormals=i.PrepareDefinesForLights(f,e,o,!1,1);const d=null===(a=this._getFirstShadowLightForMesh(e))||void 0===a?void 0:a.getShadowGenerator();if(this._needAlphaBlending=!0,d&&d.getClassName&&"CascadedShadowGenerator"===d.getClassName()){const e=d;this._needAlphaBlending=!e.autoCalcDepthBounds}if(i.PrepareDefinesForAttributes(e,o,!1,!0),o.isDirty){o.markAsProcessed(),f.resetCachedMaterial();const n=new i.EffectFallbacks;o.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(o,n,1),o.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),o.IMAGEPROCESSINGPOSTPROCESS=f.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];o.NORMAL&&a.push(i.VertexBuffer.NormalKind),i.PrepareAttributesForBones(a,e,o,n),i.PrepareAttributesForInstances(a,o);const s="shadowOnly",d=o.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","alpha","shadowColor","mBones","logarithmicDepthConstant"],c=[],h=["Scene"];i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:o,maxSimultaneousLights:1,shaderLanguage:this._shaderLanguage}),t.setEffect(f.getEngine().createEffect(s,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:1},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return ct}),Promise.resolve().then(function(){return gt})]):yield Promise.all([Promise.resolve().then(function(){return Tt}),Promise.resolve().then(function(){return Et})]),this._shadersLoaded=!0})},l),o,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(o._renderId=f.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;if(s){if(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this.bindViewProjection(s),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(i.BindClipPlane(s,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(a,s,r),r.bindEyePosition(s)),r.lightsEnabled){i.BindLights(r,t,this._activeEffect,a,1);const e=this._getFirstShadowLightForMesh(t);e&&(e._renderId=-1)}(r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE||a.SHADOWCSM0)&&this.bindView(s),i.BindFogParameters(r,t,this._activeEffect),this._afterBind(t,this._activeEffect,n)}}clone(e){return i.SerializationHelper.Clone(()=>new F(e,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.ShadowOnlyMaterial",e}getClassName(){return"ShadowOnlyMaterial"}static Parse(e,t,n){return i.SerializationHelper.Parse(()=>new F(e.name,t),e,t,n)}}i.RegisterClass("BABYLON.ShadowOnlyMaterial",F);class O extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let M=(()=>{var e,o,f,l;let d,u,c,h,m,v,g,p=i.PushMaterial,S=[],x=[],T=[],_=[],C=[],L=[],E=[],P=[],I=[],D=[],b=[],A=[],F=[],M=[];return e=class extends p{get diffuseTexture(){return a(this,o,"f")}set diffuseTexture(e){s(this,o,e,"f")}get disableLighting(){return a(this,f,"f")}set disableLighting(e){s(this,f,e,"f")}get maxSimultaneousLights(){return a(this,l,"f")}set maxSimultaneousLights(e){s(this,l,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._diffuseTexture=n(this,S,void 0),o.set(this,(n(this,x),n(this,T,void 0))),this.diffuseColor=(n(this,_),n(this,C,new i.Color3(1,1,1))),this._disableLighting=(n(this,L),n(this,E,!1)),f.set(this,(n(this,P),n(this,I,void 0))),this._maxSimultaneousLights=(n(this,D),n(this,b,4)),l.set(this,(n(this,A),n(this,F,void 0))),this._shadersLoaded=(n(this,M),!1)}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new O);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(s._areTexturesDirty&&(s._needUVs=!1,o.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;s._needUVs=!0,s.DIFFUSE=!0}if(i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n,this.maxSimultaneousLights),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="simple",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant"],c=["diffuseSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights-1},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return bt}),Promise.resolve().then(function(){return Mt})]):yield Promise.all([Promise.resolve().then(function(){return Vt}),Promise.resolve().then(function(){return Wt})]),this._shadersLoaded=!0})},f),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this.maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),this._afterBind(t,this._activeEffect,n))}getAnimatables(){const e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),e}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),e}hasTexture(e){return!!super.hasTexture(e)||this.diffuseTexture===e}dispose(e){this._diffuseTexture&&this._diffuseTexture.dispose(),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.SimpleMaterial",e}getClassName(){return"SimpleMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,f=new WeakMap,l=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=p[Symbol.metadata])&&void 0!==n?n:null):void 0;d=[i.serializeAsTexture("diffuseTexture")],u=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],c=[i.serializeAsColor3("diffuse")],h=[i.serialize("disableLighting")],m=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],v=[i.serialize("maxSimultaneousLights")],g=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,u,{kind:"accessor",name:"diffuseTexture",static:!1,private:!1,access:{has:e=>"diffuseTexture"in e,get:e=>e.diffuseTexture,set:(e,i)=>{e.diffuseTexture=i}},metadata:r},T,_),t(e,null,m,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},I,D),t(e,null,g,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},F,M),t(null,null,d,{kind:"field",name:"_diffuseTexture",static:!1,private:!1,access:{has:e=>"_diffuseTexture"in e,get:e=>e._diffuseTexture,set:(e,i)=>{e._diffuseTexture=i}},metadata:r},S,x),t(null,null,c,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},C,L),t(null,null,h,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},E,P),t(null,null,v,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},b,A),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.SimpleMaterial",M);class N extends i.MaterialDefines{constructor(){super(),this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.POINTSIZE=!1,this.FOG=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.DITHER=!1,this.LOGARITHMICDEPTH=!1,this.rebuild()}}let y=(()=>{var e;let a,s,o,f,l,d,u,c,h,m,v,g,p,S=i.PushMaterial,x=[],T=[],_=[],C=[],L=[],E=[],P=[],I=[],D=[],b=[],A=[],F=[],O=[],M=[],y=[],R=[],V=[],U=[],w=[],G=[],W=[],B=[],z=[],H=[],k=[],X=[];return e=class extends S{constructor(e,t,r=!1){super(e,t,void 0,r),this.luminance=n(this,x,1),this.turbidity=(n(this,T),n(this,_,10)),this.rayleigh=(n(this,C),n(this,L,2)),this.mieCoefficient=(n(this,E),n(this,P,.005)),this.mieDirectionalG=(n(this,I),n(this,D,.8)),this.distance=(n(this,b),n(this,A,500)),this.inclination=(n(this,F),n(this,O,.49)),this.azimuth=(n(this,M),n(this,y,.25)),this.sunPosition=(n(this,R),n(this,V,new i.Vector3(0,100,0))),this.useSunPosition=(n(this,U),n(this,w,!1)),this.cameraOffset=(n(this,G),n(this,W,i.Vector3.Zero())),this.up=(n(this,B),n(this,z,i.Vector3.Up())),this.dithering=(n(this,H),n(this,k,!1)),this._cameraPosition=(n(this,X),i.Vector3.Zero()),this._skyOrientation=new i.Quaternion,this._shadersLoaded=!1}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t){const n=t._drawWrapper;if(this.isFrozen&&n.effect&&n._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new N);const a=t.materialDefines,s=this.getScene();if(this._isReadyForSubMesh(t))return!0;if(i.PrepareDefinesForMisc(e,s,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,!1,a,void 0,void 0,void 0,this._isVertexOutputInvariant),i.PrepareDefinesForAttributes(e,a,!0,!1),a.IMAGEPROCESSINGPOSTPROCESS!==s.imageProcessingConfiguration.applyByPostProcess&&a.markAsMiscDirty(),a.DITHER!==this.dithering&&a.markAsMiscDirty(),a.isDirty){a.markAsProcessed(),s.resetCachedMaterial();const e=new i.EffectFallbacks;a.FOG&&e.addFallback(1,"FOG"),a.IMAGEPROCESSINGPOSTPROCESS=s.imageProcessingConfiguration.applyByPostProcess,a.DITHER=this.dithering;const n=[i.VertexBuffer.PositionKind];a.VERTEXCOLOR&&n.push(i.VertexBuffer.ColorKind);const o="sky",f=["world","viewProjection","view","vFogInfos","vFogColor","logarithmicDepthConstant","pointSize","luminance","turbidity","rayleigh","mieCoefficient","mieDirectionalG","sunPosition","cameraPosition","cameraOffset","up"];i.AddClipPlaneUniforms(f);const l=a.toString();t.setEffect(s.getEngine().createEffect(o,{attributes:n,uniformsNames:f,uniformBuffersNames:[],samplers:[],defines:l,fallbacks:e,onCompiled:this.onCompiled,onError:this.onError,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return kt}),Promise.resolve().then(function(){return Yt})]):yield Promise.all([Promise.resolve().then(function(){return Jt}),Promise.resolve().then(function(){return nn})]),this._shadersLoaded=!0})},s.getEngine()),a,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(a._renderId=s.getRenderId(),n._wasPreviouslyReady=!0,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;if(!s)return;this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),this._mustRebind(r,s,n)&&(i.BindClipPlane(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r)),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect);const o=r.activeCamera;if(o){const e=o.getWorldMatrix();this._cameraPosition.x=e.m[12],this._cameraPosition.y=e.m[13],this._cameraPosition.z=e.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){const e=Math.PI*(this.inclination-.5),t=2*Math.PI*(this.azimuth-.5);this.sunPosition.x=this.distance*Math.cos(t)*Math.cos(e),this.sunPosition.y=this.distance*Math.sin(-e),this.sunPosition.z=this.distance*Math.sin(t)*Math.cos(e),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(t,this._activeEffect,n)}getAnimatables(){return[]}dispose(e){super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.SkyMaterial",e}getClassName(){return"SkyMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=S[Symbol.metadata])&&void 0!==n?n:null):void 0;a=[i.serialize()],s=[i.serialize()],o=[i.serialize()],f=[i.serialize()],l=[i.serialize()],d=[i.serialize()],u=[i.serialize()],c=[i.serialize()],h=[i.serializeAsVector3()],m=[i.serialize()],v=[i.serializeAsVector3()],g=[i.serializeAsVector3()],p=[i.serialize()],t(null,null,a,{kind:"field",name:"luminance",static:!1,private:!1,access:{has:e=>"luminance"in e,get:e=>e.luminance,set:(e,i)=>{e.luminance=i}},metadata:r},x,T),t(null,null,s,{kind:"field",name:"turbidity",static:!1,private:!1,access:{has:e=>"turbidity"in e,get:e=>e.turbidity,set:(e,i)=>{e.turbidity=i}},metadata:r},_,C),t(null,null,o,{kind:"field",name:"rayleigh",static:!1,private:!1,access:{has:e=>"rayleigh"in e,get:e=>e.rayleigh,set:(e,i)=>{e.rayleigh=i}},metadata:r},L,E),t(null,null,f,{kind:"field",name:"mieCoefficient",static:!1,private:!1,access:{has:e=>"mieCoefficient"in e,get:e=>e.mieCoefficient,set:(e,i)=>{e.mieCoefficient=i}},metadata:r},P,I),t(null,null,l,{kind:"field",name:"mieDirectionalG",static:!1,private:!1,access:{has:e=>"mieDirectionalG"in e,get:e=>e.mieDirectionalG,set:(e,i)=>{e.mieDirectionalG=i}},metadata:r},D,b),t(null,null,d,{kind:"field",name:"distance",static:!1,private:!1,access:{has:e=>"distance"in e,get:e=>e.distance,set:(e,i)=>{e.distance=i}},metadata:r},A,F),t(null,null,u,{kind:"field",name:"inclination",static:!1,private:!1,access:{has:e=>"inclination"in e,get:e=>e.inclination,set:(e,i)=>{e.inclination=i}},metadata:r},O,M),t(null,null,c,{kind:"field",name:"azimuth",static:!1,private:!1,access:{has:e=>"azimuth"in e,get:e=>e.azimuth,set:(e,i)=>{e.azimuth=i}},metadata:r},y,R),t(null,null,h,{kind:"field",name:"sunPosition",static:!1,private:!1,access:{has:e=>"sunPosition"in e,get:e=>e.sunPosition,set:(e,i)=>{e.sunPosition=i}},metadata:r},V,U),t(null,null,m,{kind:"field",name:"useSunPosition",static:!1,private:!1,access:{has:e=>"useSunPosition"in e,get:e=>e.useSunPosition,set:(e,i)=>{e.useSunPosition=i}},metadata:r},w,G),t(null,null,v,{kind:"field",name:"cameraOffset",static:!1,private:!1,access:{has:e=>"cameraOffset"in e,get:e=>e.cameraOffset,set:(e,i)=>{e.cameraOffset=i}},metadata:r},W,B),t(null,null,g,{kind:"field",name:"up",static:!1,private:!1,access:{has:e=>"up"in e,get:e=>e.up,set:(e,i)=>{e.up=i}},metadata:r},z,H),t(null,null,p,{kind:"field",name:"dithering",static:!1,private:!1,access:{has:e=>"dithering"in e,get:e=>e.dithering,set:(e,i)=>{e.dithering=i}},metadata:r},k,X),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.SkyMaterial",y);class R extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.BUMP=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.SPECULARTERM=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let V=(()=>{var e,o,f,l,d,u,c,h,m,v;let g,p,S,x,T,_,C,L,E,P,I,D,b,A,F,O,M,N,y,V,U,w=i.PushMaterial,G=[],W=[],B=[],z=[],H=[],k=[],X=[],j=[],Z=[],Y=[],K=[],q=[],Q=[],J=[],$=[],ee=[],ie=[],te=[],ne=[],re=[],ae=[],se=[],oe=[],fe=[],le=[],de=[],ue=[],ce=[],he=[],me=[],ve=[],ge=[],pe=[],Se=[],xe=[],Te=[],_e=[],Ce=[],Le=[],Ee=[],Pe=[],Ie=[];return e=class extends w{get mixTexture(){return a(this,o,"f")}set mixTexture(e){s(this,o,e,"f")}get diffuseTexture1(){return a(this,f,"f")}set diffuseTexture1(e){s(this,f,e,"f")}get diffuseTexture2(){return a(this,l,"f")}set diffuseTexture2(e){s(this,l,e,"f")}get diffuseTexture3(){return a(this,d,"f")}set diffuseTexture3(e){s(this,d,e,"f")}get bumpTexture1(){return a(this,u,"f")}set bumpTexture1(e){s(this,u,e,"f")}get bumpTexture2(){return a(this,c,"f")}set bumpTexture2(e){s(this,c,e,"f")}get bumpTexture3(){return a(this,h,"f")}set bumpTexture3(e){s(this,h,e,"f")}get disableLighting(){return a(this,m,"f")}set disableLighting(e){s(this,m,e,"f")}get maxSimultaneousLights(){return a(this,v,"f")}set maxSimultaneousLights(e){s(this,v,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._mixTexture=n(this,G,void 0),o.set(this,(n(this,W),n(this,B,void 0))),this._diffuseTexture1=(n(this,z),n(this,H,void 0)),f.set(this,(n(this,k),n(this,X,void 0))),this._diffuseTexture2=(n(this,j),n(this,Z,void 0)),l.set(this,(n(this,Y),n(this,K,void 0))),this._diffuseTexture3=(n(this,q),n(this,Q,void 0)),d.set(this,(n(this,J),n(this,$,void 0))),this._bumpTexture1=(n(this,ee),n(this,ie,void 0)),u.set(this,(n(this,te),n(this,ne,void 0))),this._bumpTexture2=(n(this,re),n(this,ae,void 0)),c.set(this,(n(this,se),n(this,oe,void 0))),this._bumpTexture3=(n(this,fe),n(this,le,void 0)),h.set(this,(n(this,de),n(this,ue,void 0))),this.diffuseColor=(n(this,ce),n(this,he,new i.Color3(1,1,1))),this.specularColor=(n(this,me),n(this,ve,new i.Color3(0,0,0))),this.specularPower=(n(this,ge),n(this,pe,64)),this._disableLighting=(n(this,Se),n(this,xe,!1)),m.set(this,(n(this,Te),n(this,_e,void 0))),this._maxSimultaneousLights=(n(this,Ce),n(this,Le,4)),v.set(this,(n(this,Ee),n(this,Pe,void 0))),this._shadersLoaded=(n(this,Ie),!1)}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new R);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(o.texturesEnabled){if(!this.mixTexture||!this.mixTexture.isReady())return!1;if(s._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;s.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;s._needNormals=!0,s.BUMP=!0}}if(i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n,this.maxSimultaneousLights),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="terrain",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","textureMatrix","diffuse1Infos","diffuse2Infos","diffuse3Infos"],c=["textureSampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","bump1Sampler","bump2Sampler","bump3Sampler","logarithmicDepthConstant","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return on}),Promise.resolve().then(function(){return un})]):yield Promise.all([Promise.resolve().then(function(){return vn}),Promise.resolve().then(function(){return xn})]),this._shadersLoaded=!0})},f),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("view",r.getViewMatrix()),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this.maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),this._afterBind(t,this._activeEffect,n))}getAnimatables(){const e=[];return this.mixTexture&&this.mixTexture.animations&&this.mixTexture.animations.length>0&&e.push(this.mixTexture),e}getActiveTextures(){const e=super.getActiveTextures();return this._mixTexture&&e.push(this._mixTexture),this._diffuseTexture1&&e.push(this._diffuseTexture1),this._diffuseTexture2&&e.push(this._diffuseTexture2),this._diffuseTexture3&&e.push(this._diffuseTexture3),this._bumpTexture1&&e.push(this._bumpTexture1),this._bumpTexture2&&e.push(this._bumpTexture2),this._bumpTexture3&&e.push(this._bumpTexture3),e}hasTexture(e){return!!super.hasTexture(e)||this._mixTexture===e||this._diffuseTexture1===e||this._diffuseTexture2===e||this._diffuseTexture3===e||this._bumpTexture1===e||this._bumpTexture2===e||this._bumpTexture3===e}dispose(e){this.mixTexture&&this.mixTexture.dispose(),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.TerrainMaterial",e}getClassName(){return"TerrainMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,f=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,c=new WeakMap,h=new WeakMap,m=new WeakMap,v=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=w[Symbol.metadata])&&void 0!==n?n:null):void 0;g=[i.serializeAsTexture("mixTexture")],p=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],S=[i.serializeAsTexture("diffuseTexture1")],x=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],T=[i.serializeAsTexture("diffuseTexture2")],_=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],C=[i.serializeAsTexture("diffuseTexture3")],L=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],E=[i.serializeAsTexture("bumpTexture1")],P=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],I=[i.serializeAsTexture("bumpTexture2")],D=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],b=[i.serializeAsTexture("bumpTexture3")],A=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],F=[i.serializeAsColor3()],O=[i.serializeAsColor3()],M=[i.serialize()],N=[i.serialize("disableLighting")],y=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],V=[i.serialize("maxSimultaneousLights")],U=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,p,{kind:"accessor",name:"mixTexture",static:!1,private:!1,access:{has:e=>"mixTexture"in e,get:e=>e.mixTexture,set:(e,i)=>{e.mixTexture=i}},metadata:r},B,z),t(e,null,x,{kind:"accessor",name:"diffuseTexture1",static:!1,private:!1,access:{has:e=>"diffuseTexture1"in e,get:e=>e.diffuseTexture1,set:(e,i)=>{e.diffuseTexture1=i}},metadata:r},X,j),t(e,null,_,{kind:"accessor",name:"diffuseTexture2",static:!1,private:!1,access:{has:e=>"diffuseTexture2"in e,get:e=>e.diffuseTexture2,set:(e,i)=>{e.diffuseTexture2=i}},metadata:r},K,q),t(e,null,L,{kind:"accessor",name:"diffuseTexture3",static:!1,private:!1,access:{has:e=>"diffuseTexture3"in e,get:e=>e.diffuseTexture3,set:(e,i)=>{e.diffuseTexture3=i}},metadata:r},$,ee),t(e,null,P,{kind:"accessor",name:"bumpTexture1",static:!1,private:!1,access:{has:e=>"bumpTexture1"in e,get:e=>e.bumpTexture1,set:(e,i)=>{e.bumpTexture1=i}},metadata:r},ne,re),t(e,null,D,{kind:"accessor",name:"bumpTexture2",static:!1,private:!1,access:{has:e=>"bumpTexture2"in e,get:e=>e.bumpTexture2,set:(e,i)=>{e.bumpTexture2=i}},metadata:r},oe,fe),t(e,null,A,{kind:"accessor",name:"bumpTexture3",static:!1,private:!1,access:{has:e=>"bumpTexture3"in e,get:e=>e.bumpTexture3,set:(e,i)=>{e.bumpTexture3=i}},metadata:r},ue,ce),t(e,null,y,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},_e,Ce),t(e,null,U,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},Pe,Ie),t(null,null,g,{kind:"field",name:"_mixTexture",static:!1,private:!1,access:{has:e=>"_mixTexture"in e,get:e=>e._mixTexture,set:(e,i)=>{e._mixTexture=i}},metadata:r},G,W),t(null,null,S,{kind:"field",name:"_diffuseTexture1",static:!1,private:!1,access:{has:e=>"_diffuseTexture1"in e,get:e=>e._diffuseTexture1,set:(e,i)=>{e._diffuseTexture1=i}},metadata:r},H,k),t(null,null,T,{kind:"field",name:"_diffuseTexture2",static:!1,private:!1,access:{has:e=>"_diffuseTexture2"in e,get:e=>e._diffuseTexture2,set:(e,i)=>{e._diffuseTexture2=i}},metadata:r},Z,Y),t(null,null,C,{kind:"field",name:"_diffuseTexture3",static:!1,private:!1,access:{has:e=>"_diffuseTexture3"in e,get:e=>e._diffuseTexture3,set:(e,i)=>{e._diffuseTexture3=i}},metadata:r},Q,J),t(null,null,E,{kind:"field",name:"_bumpTexture1",static:!1,private:!1,access:{has:e=>"_bumpTexture1"in e,get:e=>e._bumpTexture1,set:(e,i)=>{e._bumpTexture1=i}},metadata:r},ie,te),t(null,null,I,{kind:"field",name:"_bumpTexture2",static:!1,private:!1,access:{has:e=>"_bumpTexture2"in e,get:e=>e._bumpTexture2,set:(e,i)=>{e._bumpTexture2=i}},metadata:r},ae,se),t(null,null,b,{kind:"field",name:"_bumpTexture3",static:!1,private:!1,access:{has:e=>"_bumpTexture3"in e,get:e=>e._bumpTexture3,set:(e,i)=>{e._bumpTexture3=i}},metadata:r},le,de),t(null,null,F,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},he,me),t(null,null,O,{kind:"field",name:"specularColor",static:!1,private:!1,access:{has:e=>"specularColor"in e,get:e=>e.specularColor,set:(e,i)=>{e.specularColor=i}},metadata:r},ve,ge),t(null,null,M,{kind:"field",name:"specularPower",static:!1,private:!1,access:{has:e=>"specularPower"in e,get:e=>e.specularPower,set:(e,i)=>{e.specularPower=i}},metadata:r},pe,Se),t(null,null,N,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},xe,Te),t(null,null,V,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},Le,Ee),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.TerrainMaterial",V);class U extends i.MaterialDefines{constructor(){super(),this.DIFFUSEX=!1,this.DIFFUSEY=!1,this.DIFFUSEZ=!1,this.BUMPX=!1,this.BUMPY=!1,this.BUMPZ=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.SPECULARTERM=!1,this.NORMAL=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.NONUNIFORMSCALING=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let w=(()=>{var e,o,f,l,d,u,c,h,m;let v,g,p,S,x,T,_,C,L,E,P,I,D,b,A,F,O,M,N,y,R,V=i.PushMaterial,w=[],G=[],W=[],B=[],z=[],H=[],k=[],X=[],j=[],Z=[],Y=[],K=[],q=[],Q=[],J=[],$=[],ee=[],ie=[],te=[],ne=[],re=[],ae=[],se=[],oe=[],fe=[],le=[],de=[],ue=[],ce=[],he=[],me=[],ve=[],ge=[],pe=[],Se=[],xe=[],Te=[],_e=[],Ce=[],Le=[],Ee=[],Pe=[];return e=class extends V{get diffuseTextureX(){return a(this,o,"f")}set diffuseTextureX(e){s(this,o,e,"f")}get diffuseTextureY(){return a(this,f,"f")}set diffuseTextureY(e){s(this,f,e,"f")}get diffuseTextureZ(){return a(this,l,"f")}set diffuseTextureZ(e){s(this,l,e,"f")}get normalTextureX(){return a(this,d,"f")}set normalTextureX(e){s(this,d,e,"f")}get normalTextureY(){return a(this,u,"f")}set normalTextureY(e){s(this,u,e,"f")}get normalTextureZ(){return a(this,c,"f")}set normalTextureZ(e){s(this,c,e,"f")}get disableLighting(){return a(this,h,"f")}set disableLighting(e){s(this,h,e,"f")}get maxSimultaneousLights(){return a(this,m,"f")}set maxSimultaneousLights(e){s(this,m,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this.mixTexture=n(this,w,void 0),this._diffuseTextureX=(n(this,G),n(this,W,void 0)),o.set(this,(n(this,B),n(this,z,void 0))),this._diffuseTextureY=(n(this,H),n(this,k,void 0)),f.set(this,(n(this,X),n(this,j,void 0))),this._diffuseTextureZ=(n(this,Z),n(this,Y,void 0)),l.set(this,(n(this,K),n(this,q,void 0))),this._normalTextureX=(n(this,Q),n(this,J,void 0)),d.set(this,(n(this,$),n(this,ee,void 0))),this._normalTextureY=(n(this,ie),n(this,te,void 0)),u.set(this,(n(this,ne),n(this,re,void 0))),this._normalTextureZ=(n(this,ae),n(this,se,void 0)),c.set(this,(n(this,oe),n(this,fe,void 0))),this.tileSize=(n(this,le),n(this,de,1)),this.diffuseColor=(n(this,ue),n(this,ce,new i.Color3(1,1,1))),this.specularColor=(n(this,he),n(this,me,new i.Color3(.2,.2,.2))),this.specularPower=(n(this,ve),n(this,ge,64)),this._disableLighting=(n(this,pe),n(this,Se,!1)),h.set(this,(n(this,xe),n(this,Te,void 0))),this._maxSimultaneousLights=(n(this,_e),n(this,Ce,4)),m.set(this,(n(this,Le),n(this,Ee,void 0))),this._shadersLoaded=(n(this,Pe),!1)}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new U);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(s._areTexturesDirty&&o.texturesEnabled){if(i.MaterialFlags.DiffuseTextureEnabled){const e=[this.diffuseTextureX,this.diffuseTextureY,this.diffuseTextureZ],i=["DIFFUSEX","DIFFUSEY","DIFFUSEZ"];for(let t=0;t<e.length;t++)if(e[t]){if(!e[t].isReady())return!1;s[i[t]]=!0}}if(i.MaterialFlags.BumpTextureEnabled){const e=[this.normalTextureX,this.normalTextureY,this.normalTextureZ],i=["BUMPX","BUMPY","BUMPZ"];for(let t=0;t<e.length;t++)if(e[t]){if(!e[t].isReady())return!1;s[i[t]]=!0}}}if(i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n,this.maxSimultaneousLights),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="triplanar",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","mBones","tileSize"],c=["diffuseSamplerX","diffuseSamplerY","diffuseSamplerZ","normalSamplerX","normalSamplerY","normalSamplerZ","logarithmicDepthConstant","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return Ln}),Promise.resolve().then(function(){return Dn})]):yield Promise.all([Promise.resolve().then(function(){return On}),Promise.resolve().then(function(){return Rn})]),this._shadersLoaded=!0})},f),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._activeEffect.setFloat("tileSize",this.tileSize),this._mustRebind(r,s,n)&&(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(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this.maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),this._afterBind(t,this._activeEffect,n))}getAnimatables(){const e=[];return this.mixTexture&&this.mixTexture.animations&&this.mixTexture.animations.length>0&&e.push(this.mixTexture),e}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTextureX&&e.push(this._diffuseTextureX),this._diffuseTextureY&&e.push(this._diffuseTextureY),this._diffuseTextureZ&&e.push(this._diffuseTextureZ),this._normalTextureX&&e.push(this._normalTextureX),this._normalTextureY&&e.push(this._normalTextureY),this._normalTextureZ&&e.push(this._normalTextureZ),e}hasTexture(e){return!!super.hasTexture(e)||this._diffuseTextureX===e||this._diffuseTextureY===e||this._diffuseTextureZ===e||this._normalTextureX===e||this._normalTextureY===e||this._normalTextureZ===e}dispose(e){this.mixTexture&&this.mixTexture.dispose(),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.TriPlanarMaterial",e}getClassName(){return"TriPlanarMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,f=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,c=new WeakMap,h=new WeakMap,m=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=V[Symbol.metadata])&&void 0!==n?n:null):void 0;v=[i.serializeAsTexture()],g=[i.serializeAsTexture("diffuseTextureX")],p=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],S=[i.serializeAsTexture("diffuseTexturY")],x=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],T=[i.serializeAsTexture("diffuseTextureZ")],_=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],C=[i.serializeAsTexture("normalTextureX")],L=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],E=[i.serializeAsTexture("normalTextureY")],P=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],I=[i.serializeAsTexture("normalTextureZ")],D=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],b=[i.serialize()],A=[i.serializeAsColor3()],F=[i.serializeAsColor3()],O=[i.serialize()],M=[i.serialize("disableLighting")],N=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],y=[i.serialize("maxSimultaneousLights")],R=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,p,{kind:"accessor",name:"diffuseTextureX",static:!1,private:!1,access:{has:e=>"diffuseTextureX"in e,get:e=>e.diffuseTextureX,set:(e,i)=>{e.diffuseTextureX=i}},metadata:r},z,H),t(e,null,x,{kind:"accessor",name:"diffuseTextureY",static:!1,private:!1,access:{has:e=>"diffuseTextureY"in e,get:e=>e.diffuseTextureY,set:(e,i)=>{e.diffuseTextureY=i}},metadata:r},j,Z),t(e,null,_,{kind:"accessor",name:"diffuseTextureZ",static:!1,private:!1,access:{has:e=>"diffuseTextureZ"in e,get:e=>e.diffuseTextureZ,set:(e,i)=>{e.diffuseTextureZ=i}},metadata:r},q,Q),t(e,null,L,{kind:"accessor",name:"normalTextureX",static:!1,private:!1,access:{has:e=>"normalTextureX"in e,get:e=>e.normalTextureX,set:(e,i)=>{e.normalTextureX=i}},metadata:r},ee,ie),t(e,null,P,{kind:"accessor",name:"normalTextureY",static:!1,private:!1,access:{has:e=>"normalTextureY"in e,get:e=>e.normalTextureY,set:(e,i)=>{e.normalTextureY=i}},metadata:r},re,ae),t(e,null,D,{kind:"accessor",name:"normalTextureZ",static:!1,private:!1,access:{has:e=>"normalTextureZ"in e,get:e=>e.normalTextureZ,set:(e,i)=>{e.normalTextureZ=i}},metadata:r},fe,le),t(e,null,N,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},Te,_e),t(e,null,R,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},Ee,Pe),t(null,null,v,{kind:"field",name:"mixTexture",static:!1,private:!1,access:{has:e=>"mixTexture"in e,get:e=>e.mixTexture,set:(e,i)=>{e.mixTexture=i}},metadata:r},w,G),t(null,null,g,{kind:"field",name:"_diffuseTextureX",static:!1,private:!1,access:{has:e=>"_diffuseTextureX"in e,get:e=>e._diffuseTextureX,set:(e,i)=>{e._diffuseTextureX=i}},metadata:r},W,B),t(null,null,S,{kind:"field",name:"_diffuseTextureY",static:!1,private:!1,access:{has:e=>"_diffuseTextureY"in e,get:e=>e._diffuseTextureY,set:(e,i)=>{e._diffuseTextureY=i}},metadata:r},k,X),t(null,null,T,{kind:"field",name:"_diffuseTextureZ",static:!1,private:!1,access:{has:e=>"_diffuseTextureZ"in e,get:e=>e._diffuseTextureZ,set:(e,i)=>{e._diffuseTextureZ=i}},metadata:r},Y,K),t(null,null,C,{kind:"field",name:"_normalTextureX",static:!1,private:!1,access:{has:e=>"_normalTextureX"in e,get:e=>e._normalTextureX,set:(e,i)=>{e._normalTextureX=i}},metadata:r},J,$),t(null,null,E,{kind:"field",name:"_normalTextureY",static:!1,private:!1,access:{has:e=>"_normalTextureY"in e,get:e=>e._normalTextureY,set:(e,i)=>{e._normalTextureY=i}},metadata:r},te,ne),t(null,null,I,{kind:"field",name:"_normalTextureZ",static:!1,private:!1,access:{has:e=>"_normalTextureZ"in e,get:e=>e._normalTextureZ,set:(e,i)=>{e._normalTextureZ=i}},metadata:r},se,oe),t(null,null,b,{kind:"field",name:"tileSize",static:!1,private:!1,access:{has:e=>"tileSize"in e,get:e=>e.tileSize,set:(e,i)=>{e.tileSize=i}},metadata:r},de,ue),t(null,null,A,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},ce,he),t(null,null,F,{kind:"field",name:"specularColor",static:!1,private:!1,access:{has:e=>"specularColor"in e,get:e=>e.specularColor,set:(e,i)=>{e.specularColor=i}},metadata:r},me,ve),t(null,null,O,{kind:"field",name:"specularPower",static:!1,private:!1,access:{has:e=>"specularPower"in e,get:e=>e.specularPower,set:(e,i)=>{e.specularPower=i}},metadata:r},ge,pe),t(null,null,M,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},Se,xe),t(null,null,y,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},Ce,Le),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.TriPlanarMaterial",w);class G extends i.MaterialDefines{constructor(){super(),this.BUMP=!1,this.REFLECTION=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.SPECULARTERM=!1,this.LOGARITHMICDEPTH=!1,this.USE_REVERSE_DEPTHBUFFER=!1,this.FRESNELSEPARATE=!1,this.BUMPSUPERIMPOSE=!1,this.BUMPAFFECTSREFLECTION=!1,this.USE_WORLD_COORDINATES=!1,this.IMAGEPROCESSING=!1,this.VIGNETTE=!1,this.VIGNETTEBLENDMODEMULTIPLY=!1,this.VIGNETTEBLENDMODEOPAQUE=!1,this.TONEMAPPING=0,this.CONTRAST=!1,this.EXPOSURE=!1,this.COLORCURVES=!1,this.COLORGRADING=!1,this.COLORGRADING3D=!1,this.SAMPLER3DGREENDEPTH=!1,this.SAMPLER3DBGRMAP=!1,this.DITHER=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.rebuild()}}let W=(()=>{var e,o,f,l,d,u,c,h;let m,v,g,p,S,x,T,_,C,L,E,P,I,D,b,A,F,O,M,N,y,R,V,U,w,W,B,z,H,k=i.PushMaterial,X=[],j=[],Z=[],Y=[],K=[],q=[],Q=[],J=[],$=[],ee=[],ie=[],te=[],ne=[],re=[],ae=[],se=[],oe=[],fe=[],le=[],de=[],ue=[],ce=[],he=[],me=[],ve=[],ge=[],pe=[],Se=[],xe=[],Te=[],_e=[],Ce=[],Le=[],Ee=[],Pe=[],Ie=[],De=[],be=[],Ae=[],Fe=[],Oe=[],Me=[],Ne=[],ye=[],Re=[],Ve=[],Ue=[],we=[],Ge=[],We=[],Be=[],ze=[],He=[],ke=[],Xe=[],je=[],Ze=[],Ye=[];return e=class extends k{get bumpTexture(){return a(this,o,"f")}set bumpTexture(e){s(this,o,e,"f")}get disableLighting(){return a(this,f,"f")}set disableLighting(e){s(this,f,e,"f")}get maxSimultaneousLights(){return a(this,l,"f")}set maxSimultaneousLights(e){s(this,l,e,"f")}get bumpSuperimpose(){return a(this,d,"f")}set bumpSuperimpose(e){s(this,d,e,"f")}get fresnelSeparate(){return a(this,u,"f")}set fresnelSeparate(e){s(this,u,e,"f")}get bumpAffectsReflection(){return a(this,c,"f")}set bumpAffectsReflection(e){s(this,c,e,"f")}get useWorldCoordinatesForWaveDeformation(){return a(this,h,"f")}set useWorldCoordinatesForWaveDeformation(e){s(this,h,e,"f")}get hasRenderTargetTextures(){return!0}constructor(e,t,r=new i.Vector2(512,512),a=!1){super(e,t,void 0,a),this.renderTargetSize=r,this._bumpTexture=n(this,X,void 0),o.set(this,(n(this,j),n(this,Z,void 0))),this.diffuseColor=(n(this,Y),n(this,K,new i.Color3(1,1,1))),this.specularColor=(n(this,q),n(this,Q,new i.Color3(0,0,0))),this.specularPower=(n(this,J),n(this,$,64)),this._disableLighting=(n(this,ee),n(this,ie,!1)),f.set(this,(n(this,te),n(this,ne,void 0))),this._maxSimultaneousLights=(n(this,re),n(this,ae,4)),l.set(this,(n(this,se),n(this,oe,void 0))),this.windForce=(n(this,fe),n(this,le,6)),this.windDirection=(n(this,de),n(this,ue,new i.Vector2(0,1))),this.waveHeight=(n(this,ce),n(this,he,.4)),this.bumpHeight=(n(this,me),n(this,ve,.4)),this._bumpSuperimpose=(n(this,ge),n(this,pe,!1)),d.set(this,(n(this,Se),n(this,xe,void 0))),this._fresnelSeparate=(n(this,Te),n(this,_e,!1)),u.set(this,(n(this,Ce),n(this,Le,void 0))),this._bumpAffectsReflection=(n(this,Ee),n(this,Pe,!1)),c.set(this,(n(this,Ie),n(this,De,void 0))),this.waterColor=(n(this,be),n(this,Ae,new i.Color3(.1,.1,.6))),this.colorBlendFactor=(n(this,Fe),n(this,Oe,.2)),this.waterColor2=(n(this,Me),n(this,Ne,new i.Color3(.1,.1,.6))),this.colorBlendFactor2=(n(this,ye),n(this,Re,.2)),this.waveLength=(n(this,Ve),n(this,Ue,.1)),this.waveSpeed=(n(this,we),n(this,Ge,1)),this.waveCount=(n(this,We),n(this,Be,20)),this.disableClipPlane=(n(this,ze),n(this,He,!1)),this._useWorldCoordinatesForWaveDeformation=(n(this,ke),n(this,Xe,!1)),h.set(this,(n(this,je),n(this,Ze,void 0))),this._renderTargets=(n(this,Ye),new i.SmartArray(16)),this._mesh=null,this._reflectionTransform=i.Matrix.Zero(),this._offsetMirror=i.Matrix.Zero(),this._tempPlane=new i.Plane(0,0,0,0),this._lastTime=0,this._shadersLoaded=!1,this._lastDeltaTime=0,this._createRenderTargets(this.getScene(),r),this.getRenderTargetTextures=()=>(this._renderTargets.reset(),this._renderTargets.push(this._reflectionRTT),this._renderTargets.push(this._refractionRTT),this._renderTargets),this._imageProcessingConfiguration=this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add(()=>{this._markAllSubMeshesAsImageProcessingDirty()}))}get refractionTexture(){return this._refractionRTT}get reflectionTexture(){return this._reflectionRTT}addToRenderList(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)}removeFromRenderList(e){if(this._refractionRTT&&this._refractionRTT.renderList){const i=this._refractionRTT.renderList.indexOf(e);-1!==i&&this._refractionRTT.renderList.splice(i,1)}if(this._reflectionRTT&&this._reflectionRTT.renderList){const i=this._reflectionRTT.renderList.indexOf(e);-1!==i&&this._reflectionRTT.renderList.splice(i,1)}}enableRenderTargets(e){const i=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=i),this._reflectionRTT&&(this._reflectionRTT.refreshRate=i)}getRenderList(){return this._refractionRTT?this._refractionRTT.renderList:[]}get renderTargetsEnabled(){return!(this._refractionRTT&&0===this._refractionRTT.refreshRate)}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new G);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(s._areTexturesDirty&&(s._needUVs=!1,o.texturesEnabled)){if(this.bumpTexture&&i.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture.isReady())return!1;s._needUVs=!0,s.BUMP=!0}i.MaterialFlags.ReflectionTextureEnabled&&(s.REFLECTION=!0)}if(i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._areMiscDirty&&(s.FRESNELSEPARATE=this._fresnelSeparate,s.BUMPSUPERIMPOSE=this._bumpSuperimpose,s.BUMPAFFECTSREFLECTION=this._bumpAffectsReflection,s.USE_WORLD_COORDINATES=this._useWorldCoordinatesForWaveDeformation),s._needNormals=i.PrepareDefinesForLights(o,e,s,!0,this._maxSimultaneousLights,this._disableLighting),s._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(s),s.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,s.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(i.PrepareDefinesForAttributes(e,s,!0,!0),this._mesh=e,this._waitingRenderList){for(let e=0;e<this._waitingRenderList.length;e++)this.addToRenderList(o.getNodeById(this._waitingRenderList[e]));this._waitingRenderList=null}if(s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),s.LOGARITHMICDEPTH&&n.addFallback(0,"LOGARITHMICDEPTH"),i.HandleFallbacksForShadows(s,n,this.maxSimultaneousLights),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e);const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="water",d=s.toString(),u=["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"],c=["normalSampler","refractionSampler","reflectionSampler"],h=[];i.ImageProcessingConfiguration&&(i.ImageProcessingConfiguration.PrepareUniforms(u,s),i.ImageProcessingConfiguration.PrepareSamplers(c,s)),i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return Gn}),Promise.resolve().then(function(){return Hn})]):yield Promise.all([Promise.resolve().then(function(){return Zn}),Promise.resolve().then(function(){return Qn})]),this._shadersLoaded=!0})},f),s,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;if(!s||!this._mesh)return;this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this.maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),i.BindLogDepth(a,this._activeEffect,r),i.MaterialFlags.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));const o=i.TmpVectors.Matrix[3].copyFrom(this._reflectionTransform);if(r.floatingOriginMode){const e=i.OffsetViewToRef(r.floatingOriginOffset,r.getViewMatrix(),i.TmpVectors.Matrix[1]);i.MultiplyMatricesToRef(this._offsetMirror,e,o)}o.multiplyToRef(r.getProjectionMatrix(),o);const f=r.getEngine().getDeltaTime();f!==this._lastDeltaTime&&(this._lastDeltaTime=f,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("reflectionViewProjection",o),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(t,this._activeEffect,n)}_createRenderTargets(e,t){this._refractionRTT=new i.RenderTargetTexture(name+"_refraction",{width:t.x,height:t.y},e,!1,!0),this._refractionRTT.wrapU=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0;let n,r=!1;this._refractionRTT.onBeforeRenderObservable.add(()=>{r=e.getBoundingBoxRenderer().enabled,e.getBoundingBoxRenderer().enabled=!1}),this._refractionRTT.onAfterRenderObservable.add(()=>{e.getBoundingBoxRenderer().enabled=r}),this._reflectionRTT=new i.RenderTargetTexture(name+"_reflection",{width:t.x,height:t.y},e,!1,!0),this._reflectionRTT.wrapU=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;let a,s=null;const o=i.Matrix.Zero();this._refractionRTT.onBeforeRender=()=>{if(this._mesh&&(n=this._mesh.isVisible,this._mesh.isVisible=!1),!this.disableClipPlane){s=e.clipPlane;const t=this._mesh?this._mesh.absolutePosition.y:0;e.clipPlane=i.Plane.FromPositionAndNormal(new i.Vector3(0,t+.05,0),new i.Vector3(0,1,0))}},this._refractionRTT.onAfterRender=()=>{this._mesh&&(this._mesh.isVisible=n),this.disableClipPlane||(e.clipPlane=s)},this._reflectionRTT.onBeforeRender=()=>{if(this._mesh&&(n=this._mesh.isVisible,this._mesh.isVisible=!1),!this.disableClipPlane){s=e.clipPlane;const t=this._mesh?this._mesh.absolutePosition.y:0;e.clipPlane=i.Plane.FromPositionAndNormal(new i.Vector3(0,t-.05,0),new i.Vector3(0,-1,0)),i.Matrix.ReflectionToRef(e.clipPlane,o),this._offsetMirror.copyFrom(o),e.floatingOriginMode&&(i.OffsetClipPlaneToRef(e.floatingOriginOffset,e.clipPlane,this._tempPlane),i.Matrix.ReflectionToRef(this._tempPlane,this._offsetMirror))}a=e.getViewMatrix(),o.multiplyToRef(a,this._reflectionTransform),e.setTransformMatrix(this._reflectionTransform,e.getProjectionMatrix());const t=i.Vector3.TransformCoordinates(e.activeCamera.position,o);e._mirroredCameraPosition=t,e._forcedViewPosition=t},this._reflectionRTT.onAfterRender=()=>{this._mesh&&(this._mesh.isVisible=n),e.clipPlane=s,e.setTransformMatrix(a,e.getProjectionMatrix()),e._mirroredCameraPosition=null,e._forcedViewPosition=null}}getAnimatables(){const 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}getActiveTextures(){const e=super.getActiveTextures();return this._bumpTexture&&e.push(this._bumpTexture),e}hasTexture(e){return!!super.hasTexture(e)||this._bumpTexture===e}dispose(e){this.bumpTexture&&this.bumpTexture.dispose();let i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);-1!=i&&this.getScene().customRenderTargets.splice(i,1),i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT),-1!=i&&this.getScene().customRenderTargets.splice(i,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(let i=0;i<this._refractionRTT.renderList.length;i++)e.renderList.push(this._refractionRTT.renderList[i].id);return e}getClassName(){return"WaterMaterial"}static Parse(t,n,r){const a=i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r);return a._waitingRenderList=t.renderList,a}static CreateDefaultMesh(e,t){return i.CreateGround(e,{width:512,height:512,subdivisions:32,updatable:!1},t)}},o=new WeakMap,f=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,c=new WeakMap,h=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=k[Symbol.metadata])&&void 0!==n?n:null):void 0;m=[i.serializeAsTexture("bumpTexture")],v=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],g=[i.serializeAsColor3()],p=[i.serializeAsColor3()],S=[i.serialize()],x=[i.serialize("disableLighting")],T=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],_=[i.serialize("maxSimultaneousLights")],C=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],L=[i.serialize()],E=[i.serializeAsVector2()],P=[i.serialize()],I=[i.serialize()],D=[i.serialize("bumpSuperimpose")],b=[i.expandToProperty("_markAllSubMeshesAsMiscDirty")],A=[i.serialize("fresnelSeparate")],F=[i.expandToProperty("_markAllSubMeshesAsMiscDirty")],O=[i.serialize("bumpAffectsReflection")],M=[i.expandToProperty("_markAllSubMeshesAsMiscDirty")],N=[i.serializeAsColor3()],y=[i.serialize()],R=[i.serializeAsColor3()],V=[i.serialize()],U=[i.serialize()],w=[i.serialize()],W=[i.serialize()],B=[i.serialize()],z=[i.serialize("useWorldCoordinatesForWaveDeformation")],H=[i.expandToProperty("_markAllSubMeshesAsMiscDirty")],t(e,null,v,{kind:"accessor",name:"bumpTexture",static:!1,private:!1,access:{has:e=>"bumpTexture"in e,get:e=>e.bumpTexture,set:(e,i)=>{e.bumpTexture=i}},metadata:r},Z,Y),t(e,null,T,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},ne,re),t(e,null,C,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},oe,fe),t(e,null,b,{kind:"accessor",name:"bumpSuperimpose",static:!1,private:!1,access:{has:e=>"bumpSuperimpose"in e,get:e=>e.bumpSuperimpose,set:(e,i)=>{e.bumpSuperimpose=i}},metadata:r},xe,Te),t(e,null,F,{kind:"accessor",name:"fresnelSeparate",static:!1,private:!1,access:{has:e=>"fresnelSeparate"in e,get:e=>e.fresnelSeparate,set:(e,i)=>{e.fresnelSeparate=i}},metadata:r},Le,Ee),t(e,null,M,{kind:"accessor",name:"bumpAffectsReflection",static:!1,private:!1,access:{has:e=>"bumpAffectsReflection"in e,get:e=>e.bumpAffectsReflection,set:(e,i)=>{e.bumpAffectsReflection=i}},metadata:r},De,be),t(e,null,H,{kind:"accessor",name:"useWorldCoordinatesForWaveDeformation",static:!1,private:!1,access:{has:e=>"useWorldCoordinatesForWaveDeformation"in e,get:e=>e.useWorldCoordinatesForWaveDeformation,set:(e,i)=>{e.useWorldCoordinatesForWaveDeformation=i}},metadata:r},Ze,Ye),t(null,null,m,{kind:"field",name:"_bumpTexture",static:!1,private:!1,access:{has:e=>"_bumpTexture"in e,get:e=>e._bumpTexture,set:(e,i)=>{e._bumpTexture=i}},metadata:r},X,j),t(null,null,g,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},K,q),t(null,null,p,{kind:"field",name:"specularColor",static:!1,private:!1,access:{has:e=>"specularColor"in e,get:e=>e.specularColor,set:(e,i)=>{e.specularColor=i}},metadata:r},Q,J),t(null,null,S,{kind:"field",name:"specularPower",static:!1,private:!1,access:{has:e=>"specularPower"in e,get:e=>e.specularPower,set:(e,i)=>{e.specularPower=i}},metadata:r},$,ee),t(null,null,x,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},ie,te),t(null,null,_,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},ae,se),t(null,null,L,{kind:"field",name:"windForce",static:!1,private:!1,access:{has:e=>"windForce"in e,get:e=>e.windForce,set:(e,i)=>{e.windForce=i}},metadata:r},le,de),t(null,null,E,{kind:"field",name:"windDirection",static:!1,private:!1,access:{has:e=>"windDirection"in e,get:e=>e.windDirection,set:(e,i)=>{e.windDirection=i}},metadata:r},ue,ce),t(null,null,P,{kind:"field",name:"waveHeight",static:!1,private:!1,access:{has:e=>"waveHeight"in e,get:e=>e.waveHeight,set:(e,i)=>{e.waveHeight=i}},metadata:r},he,me),t(null,null,I,{kind:"field",name:"bumpHeight",static:!1,private:!1,access:{has:e=>"bumpHeight"in e,get:e=>e.bumpHeight,set:(e,i)=>{e.bumpHeight=i}},metadata:r},ve,ge),t(null,null,D,{kind:"field",name:"_bumpSuperimpose",static:!1,private:!1,access:{has:e=>"_bumpSuperimpose"in e,get:e=>e._bumpSuperimpose,set:(e,i)=>{e._bumpSuperimpose=i}},metadata:r},pe,Se),t(null,null,A,{kind:"field",name:"_fresnelSeparate",static:!1,private:!1,access:{has:e=>"_fresnelSeparate"in e,get:e=>e._fresnelSeparate,set:(e,i)=>{e._fresnelSeparate=i}},metadata:r},_e,Ce),t(null,null,O,{kind:"field",name:"_bumpAffectsReflection",static:!1,private:!1,access:{has:e=>"_bumpAffectsReflection"in e,get:e=>e._bumpAffectsReflection,set:(e,i)=>{e._bumpAffectsReflection=i}},metadata:r},Pe,Ie),t(null,null,N,{kind:"field",name:"waterColor",static:!1,private:!1,access:{has:e=>"waterColor"in e,get:e=>e.waterColor,set:(e,i)=>{e.waterColor=i}},metadata:r},Ae,Fe),t(null,null,y,{kind:"field",name:"colorBlendFactor",static:!1,private:!1,access:{has:e=>"colorBlendFactor"in e,get:e=>e.colorBlendFactor,set:(e,i)=>{e.colorBlendFactor=i}},metadata:r},Oe,Me),t(null,null,R,{kind:"field",name:"waterColor2",static:!1,private:!1,access:{has:e=>"waterColor2"in e,get:e=>e.waterColor2,set:(e,i)=>{e.waterColor2=i}},metadata:r},Ne,ye),t(null,null,V,{kind:"field",name:"colorBlendFactor2",static:!1,private:!1,access:{has:e=>"colorBlendFactor2"in e,get:e=>e.colorBlendFactor2,set:(e,i)=>{e.colorBlendFactor2=i}},metadata:r},Re,Ve),t(null,null,U,{kind:"field",name:"waveLength",static:!1,private:!1,access:{has:e=>"waveLength"in e,get:e=>e.waveLength,set:(e,i)=>{e.waveLength=i}},metadata:r},Ue,we),t(null,null,w,{kind:"field",name:"waveSpeed",static:!1,private:!1,access:{has:e=>"waveSpeed"in e,get:e=>e.waveSpeed,set:(e,i)=>{e.waveSpeed=i}},metadata:r},Ge,We),t(null,null,W,{kind:"field",name:"waveCount",static:!1,private:!1,access:{has:e=>"waveCount"in e,get:e=>e.waveCount,set:(e,i)=>{e.waveCount=i}},metadata:r},Be,ze),t(null,null,B,{kind:"field",name:"disableClipPlane",static:!1,private:!1,access:{has:e=>"disableClipPlane"in e,get:e=>e.disableClipPlane,set:(e,i)=>{e.disableClipPlane=i}},metadata:r},He,ke),t(null,null,z,{kind:"field",name:"_useWorldCoordinatesForWaveDeformation",static:!1,private:!1,access:{has:e=>"_useWorldCoordinatesForWaveDeformation"in e,get:e=>e._useWorldCoordinatesForWaveDeformation,set:(e,i)=>{e._useWorldCoordinatesForWaveDeformation=i}},metadata:r},Xe,je),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.WaterMaterial",W);var B={__proto__:null,CellMaterial:f,CustomMaterial:u,CustomShaderStructure:l,FireMaterial:g,FurMaterial:S,GradientMaterial:T,GridMaterial:C,LavaMaterial:E,MixMaterial:I,NormalMaterial:b,PBRCustomMaterial:m,ShaderAlbedoParts:c,ShaderAlebdoParts:h,ShaderSpecialParts:d,ShadowOnlyMaterial:F,SimpleMaterial:M,SkyMaterial:y,TerrainMaterial:V,TriPlanarMaterial:w,WaterMaterial:W};const z="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==z){z.BABYLON=z.BABYLON||{};for(const e in B)z.BABYLON[e]=B[e];z.MATERIALS=B}const H="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[H]||(i.ShaderStore.ShadersStoreWGSL[H]=k);const X=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL,i.logDepthVertexWGSL];for(const e of X)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var j={__proto__:null,cellVertexShaderWGSL:{name:H,shader:k}};const 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);const K=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of K)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var q={__proto__:null,cellPixelShaderWGSL:{name:Z,shader:Y}};const 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);const $=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing,i.logDepthVertex];for(const e of $)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var ee={__proto__:null,cellVertexShader:{name:Q,shader:J}};const ie="cellPixelShader",te="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[ie]||(i.ShaderStore.ShadersStore[ie]=te);const ne=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of ne)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var re={__proto__:null,cellPixelShader:{name:ie,shader:te}};const ae="fireVertexShader",se="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[ae]||(i.ShaderStore.ShadersStoreWGSL[ae]=se);const oe=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.vertexColorMixingWGSL];for(const e of oe)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var fe={__proto__:null,fireVertexShaderWGSL:{name:ae,shader:se}};const le="firePixelShader",de="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[le]||(i.ShaderStore.ShadersStoreWGSL[le]=de);const ue=[i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of ue)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var ce={__proto__:null,firePixelShaderWGSL:{name:le,shader:de}};const he="fireVertexShader",me="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[he]||(i.ShaderStore.ShadersStore[he]=me);const ve=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.vertexColorMixing];for(const e of ve)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var ge={__proto__:null,fireVertexShader:{name:he,shader:me}};const pe="firePixelShader",Se="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[pe]||(i.ShaderStore.ShadersStore[pe]=Se);const xe=[i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of xe)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Te={__proto__:null,firePixelShader:{name:pe,shader:Se}};const _e="furVertexShader",Ce="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[_e]||(i.ShaderStore.ShadersStoreWGSL[_e]=Ce);const Le=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL];for(const e of Le)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Ee={__proto__:null,furVertexShaderWGSL:{name:_e,shader:Ce}};const Pe="furPixelShader",Ie="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[Pe]||(i.ShaderStore.ShadersStoreWGSL[Pe]=Ie);const De=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.logDepthDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of De)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var be={__proto__:null,furPixelShaderWGSL:{name:Pe,shader:Ie}};const Ae="furVertexShader",Fe="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[Ae]||(i.ShaderStore.ShadersStore[Ae]=Fe);const Oe=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing];for(const e of Oe)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Me={__proto__:null,furVertexShader:{name:Ae,shader:Fe}};const Ne="furPixelShader",ye="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[Ne]||(i.ShaderStore.ShadersStore[Ne]=ye);const Re=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.logDepthDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.fogFragmentDeclaration,i.clipPlaneFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of Re)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Ve={__proto__:null,furPixelShader:{name:Ne,shader:ye}};const Ue="gradientVertexShader",we="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[Ue]||(i.ShaderStore.ShadersStoreWGSL[Ue]=we);const Ge=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL];for(const e of Ge)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var We={__proto__:null,gradientVertexShaderWGSL:{name:Ue,shader:we}};const Be="gradientPixelShader",ze="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[Be]||(i.ShaderStore.ShadersStoreWGSL[Be]=ze);const He=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of He)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var ke={__proto__:null,gradientPixelShaderWGSL:{name:Be,shader:ze}};const Xe="gradientVertexShader",je="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[Xe]||(i.ShaderStore.ShadersStore[Xe]=je);const Ze=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing];for(const e of Ze)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Ye={__proto__:null,gradientVertexShader:{name:Xe,shader:je}};const Ke="gradientPixelShader",qe="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[Ke]||(i.ShaderStore.ShadersStore[Ke]=qe);const Qe=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of Qe)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Je={__proto__:null,gradientPixelShader:{name:Ke,shader:qe}};const $e="gridVertexShader",ei="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#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nvarying vWorldPos: vec3f;\n#endif\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#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nvertexOutputs.vWorldPos=worldPos.xyz;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[$e]||(i.ShaderStore.ShadersStoreWGSL[$e]=ei);const ii=[i.instancesDeclarationWGSL,i.sceneUboDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.instancesVertexWGSL,i.fogVertexWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL];for(const e of ii)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var ti={__proto__:null,gridVertexShaderWGSL:{name:$e,shader:ei}};const ni="gridPixelShader",ri="#define SQRT2 1.41421356\n#define PI 3.14159\n#define MAX_OCTAVES 8\n#define LINE_WIDTH_SCREEN_FRACTION 0.004\n#define HORIZON_FADE_EXPONENT 400.0\n#define ORIGIN_MARKER_SPAN 10000000.0\n#define ORIGIN_MARKER_WIDTH_SCALE 0.00000015\n#define ORIGIN_MARKER_THRESHOLD 0.0001\n#define TRANSPARENT_MIN_OPACITY 0.08\nuniform visibility: f32;uniform mainColor: vec3f;uniform lineColor: vec3f;uniform gridControl: vec4f;uniform gridOffset: vec3f;uniform gridThicknessModifier: f32;\n#ifdef MULTI_SCALE\nuniform minGridSpacing: f32;uniform gridOctaves: f32;\n#endif\n#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nuniform cameraPosition: vec3f;uniform viewportSize: vec2f;\n#endif\n#ifdef BELOW_LINE_COLOR\nuniform belowLineColor: vec3f;\n#endif\nvarying vPosition: vec3f;varying vNormal: vec3f;\n#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nvarying vWorldPos: vec3f;\n#endif\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,tcLineWidthCap: f32,thicknessModifier: f32)->f32 {let dPosDx: f32=dpdx(position);let dPosDy: f32=dpdy(position);var differentialLength: f32=length(vec2f(dPosDx,dPosDy))*SQRT2;if (tcLineWidthCap>0.0) {differentialLength=max(differentialLength,tcLineWidthCap);}\nlet lineWidth: f32=differentialLength*thicknessModifier;var result: f32=isPointOnLine(position,lineWidth);result=result*getDynamicVisibility(position);result=result*getAnisotropicAttenuation(differentialLength);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 normal: vec3f=normalize(fragmentInputs.vNormal);var horizonFade: f32=1.0;var tcLineWidthCap: f32=0.0;\n#if defined(HORIZON_FADE) || defined(ORIGIN_MARKER)\nvar tc: f32=length(fragmentInputs.vWorldPos-uniforms.cameraPosition);\n#ifdef HORIZON_FADE\ntcLineWidthCap=LINE_WIDTH_SCREEN_FRACTION*tc/uniforms.viewportSize.y;let rd: vec3f=normalize(fragmentInputs.vWorldPos-uniforms.cameraPosition);if (abs(rd.y)>0.99) {horizonFade=1.0;} else {let flatRayDir: vec3f=normalize(vec3f(rd.x,0.0,rd.z));horizonFade=-pow(abs(dot(rd,flatRayDir)),HORIZON_FADE_EXPONENT)+1.0;}\n#endif\n#endif\nvar grid: f32=0.0;\n#ifdef MULTI_SCALE\nfor (var i: i32=0; i<MAX_OCTAVES; i++) {if (i>=i32(uniforms.gridOctaves)) { break; }\nlet scale: f32=uniforms.minGridSpacing*pow(10.0,f32(i));let gridPos: vec3f=(fragmentInputs.vPosition+uniforms.gridOffset.xyz)/scale;let gx: f32=contributionOnAxis(gridPos.x,tcLineWidthCap,uniforms.gridThicknessModifier)*normalImpactOnAxis(normal.x);let gy: f32=contributionOnAxis(gridPos.y,tcLineWidthCap,uniforms.gridThicknessModifier)*normalImpactOnAxis(normal.y);let gz: f32=contributionOnAxis(gridPos.z,tcLineWidthCap,uniforms.gridThicknessModifier)*normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\ngrid=max(grid,clamp(max(max(gx,gy),gz),0.,1.));\n#else\ngrid=max(grid,clamp(gx+gy+gz,0.,1.));\n#endif\n}\n#else\nlet gridRatio: f32=uniforms.gridControl.x;let gridPos: vec3f=(fragmentInputs.vPosition+uniforms.gridOffset.xyz)/gridRatio;let x: f32=contributionOnAxis(gridPos.x,tcLineWidthCap,uniforms.gridThicknessModifier)*normalImpactOnAxis(normal.x);let y: f32=contributionOnAxis(gridPos.y,tcLineWidthCap,uniforms.gridThicknessModifier)*normalImpactOnAxis(normal.y);let z: f32=contributionOnAxis(gridPos.z,tcLineWidthCap,uniforms.gridThicknessModifier)*normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\ngrid=clamp(max(max(x,y),z),0.,1.);\n#else\ngrid=clamp(x+y+z,0.,1.);\n#endif\n#endif\ngrid=grid*horizonFade;\n#ifdef ORIGIN_MARKER\nlet tcOrigin: f32=ORIGIN_MARKER_WIDTH_SCALE*tc/uniforms.viewportSize.y;let ox: f32=contributionOnAxis(fragmentInputs.vWorldPos.x/ORIGIN_MARKER_SPAN,tcOrigin,uniforms.gridThicknessModifier);let oz: f32=contributionOnAxis(fragmentInputs.vWorldPos.z/ORIGIN_MARKER_SPAN,tcOrigin,uniforms.gridThicknessModifier);let originMask: f32=clamp(ox+oz,0.0,1.0)*horizonFade;if (originMask>ORIGIN_MARKER_THRESHOLD) { grid=originMask; }\n#endif\n#ifdef BELOW_LINE_COLOR\nlet belowSurface: bool=uniforms.cameraPosition.y<fragmentInputs.vWorldPos.y;let effectiveLineColor: vec3f=select(uniforms.lineColor,uniforms.belowLineColor,belowSurface);\n#else\nlet effectiveLineColor: vec3f=uniforms.lineColor;\n#endif\nvar color: vec4f=vec4f(mix(uniforms.mainColor,effectiveLineColor,vec3f(grid)),1.0);\n#ifdef FOG\n#include<fogFragment>\n#endif\nvar opacity: f32=uniforms.gridControl.w;\n#ifdef LINES_ONLY\nif (grid<0.01) { discard; }\nopacity=clamp(grid,TRANSPARENT_MIN_OPACITY,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 PREMULTIPLYALPHA\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb*opacity,fragmentOutputs.color.a);\n#endif\n#include<logDepthFragment>\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[ni]||(i.ShaderStore.ShadersStoreWGSL[ni]=ri);const ai=[i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.fogFragmentWGSL,i.logDepthFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of ai)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var si={__proto__:null,gridPixelShaderWGSL:{name:ni,shader:ri}};const oi="gridVertexShader",fi="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#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nvarying vec3 vWorldPos;\n#endif\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#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nvWorldPos=worldPos.xyz;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}";i.ShaderStore.ShadersStore[oi]||(i.ShaderStore.ShadersStore[oi]=fi);const li=[i.instancesDeclaration,i.sceneVertexDeclaration,i.sceneUboDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.clipPlaneVertexDeclaration,i.instancesVertex,i.fogVertex,i.clipPlaneVertex,i.logDepthVertex];for(const e of li)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var di={__proto__:null,gridVertexShader:{name:oi,shader:fi}};const ui="gridPixelShader",ci="#extension GL_OES_standard_derivatives : enable\n#define SQRT2 1.41421356\n#define PI 3.14159\n#define MAX_OCTAVES 8\n#define LINE_WIDTH_SCREEN_FRACTION 0.004\n#define HORIZON_FADE_EXPONENT 400.0\n#define ORIGIN_MARKER_SPAN 10000000.0\n#define ORIGIN_MARKER_WIDTH_SCALE 0.00000015\n#define ORIGIN_MARKER_THRESHOLD 0.0001\n#define TRANSPARENT_MIN_OPACITY 0.08\nprecision highp float;uniform float visibility;uniform vec3 mainColor;uniform vec3 lineColor;uniform vec4 gridControl;uniform vec3 gridOffset;uniform float gridThicknessModifier;\n#ifdef MULTI_SCALE\nuniform float minGridSpacing;uniform float gridOctaves;\n#endif\n#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nuniform vec3 cameraPosition;uniform vec2 viewportSize;\n#endif\n#ifdef BELOW_LINE_COLOR\nuniform vec3 belowLineColor;\n#endif\nvarying vec3 vPosition;varying vec3 vNormal;\n#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nvarying vec3 vWorldPos;\n#endif\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 tcLineWidthCap,float thicknessModifier) {float dPosDx=dFdx(position);float dPosDy=dFdy(position);float differentialLength=length(vec2(dPosDx,dPosDy))*SQRT2;if (tcLineWidthCap>0.0) {differentialLength=max(differentialLength,tcLineWidthCap);}\nfloat lineWidth=differentialLength*thicknessModifier;float result=isPointOnLine(position,lineWidth);result*=getDynamicVisibility(position);result*=getAnisotropicAttenuation(differentialLength);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>\nvec3 normal=normalize(vNormal);float horizonFade=1.0;float tcLineWidthCap=0.0;\n#if defined(HORIZON_FADE) || defined(ORIGIN_MARKER)\nfloat tc=length(vWorldPos-cameraPosition);\n#endif\n#ifdef HORIZON_FADE\ntcLineWidthCap=LINE_WIDTH_SCREEN_FRACTION*tc/viewportSize.y;vec3 rd=normalize(vWorldPos-cameraPosition);if (abs(rd.y)>0.99) {horizonFade=1.0;} else {vec3 flatRayDir=normalize(vec3(rd.x,0.0,rd.z));horizonFade=-pow(abs(dot(rd,flatRayDir)),HORIZON_FADE_EXPONENT)+1.0;}\n#endif\nfloat grid=0.0;\n#ifdef MULTI_SCALE\nfor (int i=0; i<MAX_OCTAVES; i++) {if (i>=int(gridOctaves)) break;float scale=minGridSpacing*pow(10.0,float(i));vec3 gridPos=(vPosition+gridOffset.xyz)/scale;float gx=contributionOnAxis(gridPos.x,tcLineWidthCap,gridThicknessModifier)*normalImpactOnAxis(normal.x);float gy=contributionOnAxis(gridPos.y,tcLineWidthCap,gridThicknessModifier)*normalImpactOnAxis(normal.y);float gz=contributionOnAxis(gridPos.z,tcLineWidthCap,gridThicknessModifier)*normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\ngrid=max(grid,clamp(max(max(gx,gy),gz),0.,1.));\n#else\ngrid=max(grid,clamp(gx+gy+gz,0.,1.));\n#endif\n}\n#else\nfloat gridRatio=gridControl.x;vec3 gridPos=(vPosition+gridOffset.xyz)/gridRatio;float x=contributionOnAxis(gridPos.x,tcLineWidthCap,gridThicknessModifier)*normalImpactOnAxis(normal.x);float y=contributionOnAxis(gridPos.y,tcLineWidthCap,gridThicknessModifier)*normalImpactOnAxis(normal.y);float z=contributionOnAxis(gridPos.z,tcLineWidthCap,gridThicknessModifier)*normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\ngrid=clamp(max(max(x,y),z),0.,1.);\n#else\ngrid=clamp(x+y+z,0.,1.);\n#endif\n#endif\ngrid*=horizonFade;\n#ifdef ORIGIN_MARKER\nfloat tcOrigin=ORIGIN_MARKER_WIDTH_SCALE*tc/viewportSize.y;float ox=contributionOnAxis(vWorldPos.x/ORIGIN_MARKER_SPAN,tcOrigin,gridThicknessModifier);float oz=contributionOnAxis(vWorldPos.z/ORIGIN_MARKER_SPAN,tcOrigin,gridThicknessModifier);float originMask=clamp(ox+oz,0.0,1.0)*horizonFade;if (originMask>ORIGIN_MARKER_THRESHOLD) grid=originMask;\n#endif\n#ifdef BELOW_LINE_COLOR\nbool belowSurface=cameraPosition.y<vWorldPos.y;vec3 effectiveLineColor=belowSurface ? belowLineColor : lineColor;\n#else\nvec3 effectiveLineColor=lineColor;\n#endif\nvec3 color=mix(mainColor,effectiveLineColor,grid);\n#ifdef FOG\n#include<fogFragment>\n#endif\nfloat opacity=gridControl.w;\n#ifdef LINES_ONLY\nif (grid<0.01) discard;opacity=clamp(grid,TRANSPARENT_MIN_OPACITY,gridControl.w*grid);\n#endif\n#ifdef OPACITY\nopacity*=texture2D(opacitySampler,vOpacityUV).a;\n#endif\ngl_FragColor=vec4(color.rgb,opacity*visibility);\n#ifdef PREMULTIPLYALPHA\ngl_FragColor.rgb*=opacity;\n#endif\n#include<logDepthFragment>\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[ui]||(i.ShaderStore.ShadersStore[ui]=ci);const hi=[i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.fogFragment,i.logDepthFragment,i.imageProcessingCompatibility];for(const e of hi)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var mi={__proto__:null,gridPixelShader:{name:ui,shader:ci}};const vi="lavaVertexShader",gi="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[vi]||(i.ShaderStore.ShadersStoreWGSL[vi]=gi);const pi=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL,i.logDepthVertexWGSL];for(const e of pi)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Si={__proto__:null,lavaVertexShaderWGSL:{name:vi,shader:gi}};const xi="lavaPixelShader",Ti="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[xi]||(i.ShaderStore.ShadersStoreWGSL[xi]=Ti);const _i=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of _i)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Ci={__proto__:null,lavaPixelShaderWGSL:{name:xi,shader:Ti}};const Li="lavaVertexShader",Ei="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[Li]||(i.ShaderStore.ShadersStore[Li]=Ei);const Pi=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing,i.logDepthVertex];for(const e of Pi)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Ii={__proto__:null,lavaVertexShader:{name:Li,shader:Ei}};const Di="lavaPixelShader",bi="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[Di]||(i.ShaderStore.ShadersStore[Di]=bi);const Ai=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of Ai)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Fi={__proto__:null,lavaPixelShader:{name:Di,shader:bi}};const Oi="mixVertexShader",Mi="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[Oi]||(i.ShaderStore.ShadersStoreWGSL[Oi]=Mi);const Ni=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL,i.logDepthVertexWGSL];for(const e of Ni)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var yi={__proto__:null,mixVertexShaderWGSL:{name:Oi,shader:Mi}};const Ri="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[Ri]||(i.ShaderStore.ShadersStoreWGSL[Ri]=Vi);const Ui=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of Ui)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var wi={__proto__:null,mixPixelShaderWGSL:{name:Ri,shader:Vi}};const Gi="mixVertexShader",Wi="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[Gi]||(i.ShaderStore.ShadersStore[Gi]=Wi);const Bi=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing,i.logDepthVertex];for(const e of Bi)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var zi={__proto__:null,mixVertexShader:{name:Gi,shader:Wi}};const Hi="mixPixelShader",ki="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[Hi]||(i.ShaderStore.ShadersStore[Hi]=ki);const Xi=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of Xi)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var ji={__proto__:null,mixPixelShader:{name:Hi,shader:ki}};const Zi="normalVertexShader",Yi="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[Zi]||(i.ShaderStore.ShadersStoreWGSL[Zi]=Yi);const Ki=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL];for(const e of Ki)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var qi={__proto__:null,normalVertexShaderWGSL:{name:Zi,shader:Yi}};const Qi="normalPixelShader",Ji="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[Qi]||(i.ShaderStore.ShadersStoreWGSL[Qi]=Ji);const $i=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of $i)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var et={__proto__:null,normalPixelShaderWGSL:{name:Qi,shader:Ji}};const it="normalVertexShader",tt="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[it]||(i.ShaderStore.ShadersStore[it]=tt);const nt=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.shadowsVertex];for(const e of nt)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var rt={__proto__:null,normalVertexShader:{name:it,shader:tt}};const at="normalPixelShader",st="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[at]||(i.ShaderStore.ShadersStore[at]=st);const ot=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of ot)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var ft={__proto__:null,normalPixelShader:{name:at,shader:st}};const lt="shadowOnlyVertexShader",dt="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[lt]||(i.ShaderStore.ShadersStoreWGSL[lt]=dt);const ut=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.sceneUboDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL];for(const e of ut)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var ct={__proto__:null,shadowOnlyVertexShaderWGSL:{name:lt,shader:dt}};const ht="shadowOnlyPixelShader",mt="#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[ht]||(i.ShaderStore.ShadersStoreWGSL[ht]=mt);const vt=[i.sceneUboDeclarationWGSL,i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL];for(const e of vt)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var gt={__proto__:null,shadowOnlyPixelShaderWGSL:{name:ht,shader:mt}};const pt="shadowOnlyVertexShader",St="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[pt]||(i.ShaderStore.ShadersStore[pt]=St);const xt=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.sceneVertexDeclaration,i.sceneUboDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.shadowsVertex];for(const e of xt)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Tt={__proto__:null,shadowOnlyVertexShader:{name:pt,shader:St}};const _t="shadowOnlyPixelShader",Ct="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[_t]||(i.ShaderStore.ShadersStore[_t]=Ct);const Lt=[i.sceneFragmentDeclaration,i.sceneUboDeclaration,i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of Lt)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Et={__proto__:null,shadowOnlyPixelShader:{name:_t,shader:Ct}};const Pt="simpleVertexShader",It="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[Pt]||(i.ShaderStore.ShadersStoreWGSL[Pt]=It);const Dt=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL];for(const e of Dt)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var bt={__proto__:null,simpleVertexShaderWGSL:{name:Pt,shader:It}};const At="simplePixelShader",Ft="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[At]||(i.ShaderStore.ShadersStoreWGSL[At]=Ft);const Ot=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of Ot)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Mt={__proto__:null,simplePixelShaderWGSL:{name:At,shader:Ft}};const Nt="simpleVertexShader",yt="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[Nt]||(i.ShaderStore.ShadersStore[Nt]=yt);const Rt=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing];for(const e of Rt)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Vt={__proto__:null,simpleVertexShader:{name:Nt,shader:yt}};const Ut="simplePixelShader",wt="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[Ut]||(i.ShaderStore.ShadersStore[Ut]=wt);const Gt=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of Gt)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Wt={__proto__:null,simplePixelShader:{name:Ut,shader:wt}};const Bt="skyVertexShader",zt="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[Bt]||(i.ShaderStore.ShadersStoreWGSL[Bt]=zt);const Ht=[i.logDepthDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.fogVertexDeclarationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL];for(const e of Ht)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var kt={__proto__:null,skyVertexShaderWGSL:{name:Bt,shader:zt}};const Xt="skyPixelShader",jt="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[Xt]||(i.ShaderStore.ShadersStoreWGSL[Xt]=jt);const Zt=[i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.helperFunctionsWGSL,i.clipPlaneFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of Zt)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Yt={__proto__:null,skyPixelShaderWGSL:{name:Xt,shader:jt}};const Kt="skyVertexShader",qt="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[Kt]||(i.ShaderStore.ShadersStore[Kt]=qt);const Qt=[i.logDepthDeclaration,i.clipPlaneVertexDeclaration,i.fogVertexDeclaration,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex];for(const e of Qt)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Jt={__proto__:null,skyVertexShader:{name:Kt,shader:qt}};const $t="skyPixelShader",en="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[$t]||(i.ShaderStore.ShadersStore[$t]=en);const tn=[i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.helperFunctions,i.clipPlaneFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of tn)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var nn={__proto__:null,skyPixelShader:{name:$t,shader:en}};const rn="terrainVertexShader",an="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[rn]||(i.ShaderStore.ShadersStoreWGSL[rn]=an);const sn=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.logDepthDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL];for(const e of sn)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var on={__proto__:null,terrainVertexShaderWGSL:{name:rn,shader:an}};const fn="terrainPixelShader",ln="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[fn]||(i.ShaderStore.ShadersStoreWGSL[fn]=ln);const dn=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of dn)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var un={__proto__:null,terrainPixelShaderWGSL:{name:fn,shader:ln}};const cn="terrainVertexShader",hn="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]=hn);const mn=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.logDepthDeclaration,i.clipPlaneVertexDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing];for(const e of mn)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var vn={__proto__:null,terrainVertexShader:{name:cn,shader:hn}};const gn="terrainPixelShader",pn="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[gn]||(i.ShaderStore.ShadersStore[gn]=pn);const Sn=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of Sn)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var xn={__proto__:null,terrainPixelShader:{name:gn,shader:pn}};const Tn="triplanarVertexShader",_n="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[Tn]||(i.ShaderStore.ShadersStoreWGSL[Tn]=_n);const Cn=[i.helperFunctionsWGSL,i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL];for(const e of Cn)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Ln={__proto__:null,triplanarVertexShaderWGSL:{name:Tn,shader:_n}};const En="triplanarPixelShader",Pn="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[En]||(i.ShaderStore.ShadersStoreWGSL[En]=Pn);const In=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.logDepthDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of In)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Dn={__proto__:null,triplanarPixelShaderWGSL:{name:En,shader:Pn}};const bn="triplanarVertexShader",An="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[bn]||(i.ShaderStore.ShadersStore[bn]=An);const Fn=[i.helperFunctions,i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing];for(const e of Fn)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var On={__proto__:null,triplanarVertexShader:{name:bn,shader:An}};const Mn="triplanarPixelShader",Nn="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[Mn]||(i.ShaderStore.ShadersStore[Mn]=Nn);const yn=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.logDepthDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of yn)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Rn={__proto__:null,triplanarPixelShader:{name:Mn,shader:Nn}};const Vn="waterVertexShader",Un="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[Vn]||(i.ShaderStore.ShadersStoreWGSL[Vn]=Un);const wn=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.logDepthDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL,i.logDepthVertexWGSL];for(const e of wn)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Gn={__proto__:null,waterVertexShaderWGSL:{name:Vn,shader:Un}};const Wn="waterPixelShader",Bn="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(toLinearSpaceVec3(color.rgb),color.a);\n#elif defined(IMAGEPROCESSING)\ncolor=vec4f(toLinearSpaceVec3(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]=Bn);const zn=[i.helperFunctionsWGSL,i.imageProcessingDeclarationWGSL,i.imageProcessingFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL];for(const e of zn)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Hn={__proto__:null,waterPixelShaderWGSL:{name:Wn,shader:Bn}};const kn="waterVertexShader",Xn="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]=Xn);const jn=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.logDepthDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing,i.logDepthVertex];for(const e of jn)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Zn={__proto__:null,waterVertexShader:{name:kn,shader:Xn}};const 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);const qn=[i.helperFunctions,i.imageProcessingDeclaration,i.imageProcessingFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.lightFragment,i.logDepthFragment,i.fogFragment];for(const e of qn)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Qn={__proto__:null,waterPixelShader:{name:Yn,shader:Kn}};e.CellMaterial=f,e.CustomMaterial=u,e.CustomShaderStructure=l,e.FireMaterial=g,e.FurMaterial=S,e.GradientMaterial=T,e.GridMaterial=C,e.LavaMaterial=E,e.MixMaterial=I,e.NormalMaterial=b,e.PBRCustomMaterial=m,e.ShaderAlbedoParts=c,e.ShaderAlebdoParts=h,e.ShaderSpecialParts=d,e.ShadowOnlyMaterial=F,e.SimpleMaterial=M,e.SkyMaterial=y,e.TerrainMaterial=V,e.TriPlanarMaterial=w,e.WaterMaterial=W});
|
|
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";function t(e,i,t,n,r,a){function s(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,f=n.kind,l="getter"===f?"get":"setter"===f?"set":"value",d=!i&&e?n.static?e:e.prototype:null,u=i||(d?Object.getOwnPropertyDescriptor(d,n.name):{}),c=!1,h=t.length-1;h>=0;h--){var m={};for(var v in n)m[v]="access"===v?{}:n[v];for(var v in n.access)m.access[v]=n.access[v];m.addInitializer=function(e){if(c)throw new TypeError("Cannot add initializers after decoration has completed");a.push(s(e||null))};var g=(0,t[h])("accessor"===f?{get:u.get,set:u.set}:u[l],m);if("accessor"===f){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(o=s(g.get))&&(u.get=o),(o=s(g.set))&&(u.set=o),(o=s(g.init))&&r.unshift(o)}else(o=s(g))&&("field"===f?r.unshift(o):u[l]=o)}d&&Object.defineProperty(d,n.name,u),c=!0}function n(e,i,t){for(var n=arguments.length>2,r=0;r<i.length;r++)t=n?i[r].call(e,t):i[r].call(e);return n?t:void 0}function r(e,i,t,n){return new(t||(t=Promise))(function(r,a){function s(e){try{f(n.next(e))}catch(e){a(e)}}function o(e){try{f(n.throw(e))}catch(e){a(e)}}function f(e){var i;e.done?r(e.value):(i=e.value,i instanceof t?i:new t(function(e){e(i)})).then(s,o)}f((n=n.apply(e,i||[])).next())})}function a(e,i,t,n){if("a"===t&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof i?e!==i||!n:!i.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===t?n:"a"===t?n.call(e):n?n.value:i.get(e)}function s(e,i,t,n,r){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof i?e!==i||!r:!i.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?r.call(e,t):r?r.value=t:i.set(e,t),t}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;class o extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.NDOTL=!0,this.CUSTOMUSERLIGHTING=!0,this.CELLBASIC=!0,this.DEPTHPREPASS=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let f=(()=>{var e,f,l,d,u;let c,h,m,v,g,p,S,x,T,_=i.PushMaterial,C=[],E=[],L=[],P=[],I=[],D=[],b=[],A=[],F=[],O=[],N=[],M=[],R=[],y=[],V=[],U=[],w=[],G=[];return e=class extends _{get diffuseTexture(){return a(this,f,"f")}set diffuseTexture(e){s(this,f,e,"f")}get computeHighLevel(){return a(this,l,"f")}set computeHighLevel(e){s(this,l,e,"f")}get disableLighting(){return a(this,d,"f")}set disableLighting(e){s(this,d,e,"f")}get maxSimultaneousLights(){return a(this,u,"f")}set maxSimultaneousLights(e){s(this,u,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._diffuseTexture=n(this,C,void 0),f.set(this,(n(this,E),n(this,L,void 0))),this.diffuseColor=(n(this,P),n(this,I,new i.Color3(1,1,1))),this._computeHighLevel=(n(this,D),n(this,b,!1)),l.set(this,(n(this,A),n(this,F,void 0))),this._disableLighting=(n(this,O),n(this,N,!1)),d.set(this,(n(this,M),n(this,R,void 0))),this._maxSimultaneousLights=(n(this,y),n(this,V,4)),u.set(this,(n(this,U),n(this,w,void 0))),this._shadersLoaded=(n(this,G),!1)}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new o);const s=t.materialDefines,f=this.getScene();if(this._isReadyForSubMesh(t))return!0;const l=f.getEngine();if(s._areTexturesDirty&&(s._needUVs=!1,f.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;s._needUVs=!0,s.DIFFUSE=!0}if(s.CELLBASIC=!this.computeHighLevel,i.PrepareDefinesForMisc(e,f,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=i.PrepareDefinesForLights(f,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(f,l,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),f.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n,this.maxSimultaneousLights),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=f.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const o="cell",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant"],c=["diffuseSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(f.getEngine().createEffect(o,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights-1},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return j}),Promise.resolve().then(function(){return q})]):yield Promise.all([Promise.resolve().then(function(){return ee}),Promise.resolve().then(function(){return re})]),this._shadersLoaded=!0})},l),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=f.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this._maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),this._afterBind(t,this._activeEffect,n))}getAnimatables(){const e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),e}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),e}hasTexture(e){return!!super.hasTexture(e)||this._diffuseTexture===e}dispose(e){this._diffuseTexture&&this._diffuseTexture.dispose(),super.dispose(e)}getClassName(){return"CellMaterial"}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.CellMaterial",e}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},f=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=_[Symbol.metadata])&&void 0!==n?n:null):void 0;c=[i.serializeAsTexture("diffuseTexture")],h=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],m=[i.serializeAsColor3("diffuse")],v=[i.serialize("computeHighLevel")],g=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],p=[i.serialize("disableLighting")],S=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],x=[i.serialize("maxSimultaneousLights")],T=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,h,{kind:"accessor",name:"diffuseTexture",static:!1,private:!1,access:{has:e=>"diffuseTexture"in e,get:e=>e.diffuseTexture,set:(e,i)=>{e.diffuseTexture=i}},metadata:r},L,P),t(e,null,g,{kind:"accessor",name:"computeHighLevel",static:!1,private:!1,access:{has:e=>"computeHighLevel"in e,get:e=>e.computeHighLevel,set:(e,i)=>{e.computeHighLevel=i}},metadata:r},F,O),t(e,null,S,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},R,y),t(e,null,T,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},w,G),t(null,null,c,{kind:"field",name:"_diffuseTexture",static:!1,private:!1,access:{has:e=>"_diffuseTexture"in e,get:e=>e._diffuseTexture,set:(e,i)=>{e._diffuseTexture=i}},metadata:r},C,E),t(null,null,m,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},I,D),t(null,null,v,{kind:"field",name:"_computeHighLevel",static:!1,private:!1,access:{has:e=>"_computeHighLevel"in e,get:e=>e._computeHighLevel,set:(e,i)=>{e._computeHighLevel=i}},metadata:r},b,A),t(null,null,p,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},N,M),t(null,null,x,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},V,U),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.CellMaterial",f);class l{constructor(){}}class d{constructor(){}}class u extends i.StandardMaterial{AttachAfterBind(e,t){if(this._newUniformInstances)for(const e in this._newUniformInstances){const n=e.toString().split("-");"vec2"==n[0]?t.setVector2(n[1],this._newUniformInstances[e]):"vec3"==n[0]?this._newUniformInstances[e]instanceof i.Color3?t.setColor3(n[1],this._newUniformInstances[e]):t.setVector3(n[1],this._newUniformInstances[e]):"vec4"==n[0]?(this._newUniformInstances[e]instanceof i.Color4?t.setDirectColor4(n[1],this._newUniformInstances[e]):t.setVector4(n[1],this._newUniformInstances[e]),t.setVector4(n[1],this._newUniformInstances[e])):"mat4"==n[0]?t.setMatrix(n[1],this._newUniformInstances[e]):"float"==n[0]&&t.setFloat(n[1],this._newUniformInstances[e])}if(this._newSamplerInstances)for(const e in this._newSamplerInstances){const i=e.toString().split("-");"sampler2D"==i[0]&&this._newSamplerInstances[e].isReady&&this._newSamplerInstances[e].isReady()&&t.setTexture(i[1],this._newSamplerInstances[e])}}ReviewUniform(e,i){if("uniform"==e&&this._newUniforms)for(let e=0;e<this._newUniforms.length;e++)-1==this._customUniform[e].indexOf("sampler")&&i.push(this._newUniforms[e].replace(/\[\d*\]/g,""));if("sampler"==e&&this._newUniforms)for(let e=0;e<this._newUniforms.length;e++)-1!=this._customUniform[e].indexOf("sampler")&&i.push(this._newUniforms[e].replace(/\[\d*\]/g,""));return i}Builder(e,t,n,r,a,s){s&&this._customAttributes&&this._customAttributes.length>0&&s.push(...this._customAttributes),this.ReviewUniform("uniform",t),this.ReviewUniform("sampler",r);const o=this._createdShaderName;return i.Effect.ShadersStore[o+"VertexShader"]&&i.Effect.ShadersStore[o+"PixelShader"]||(i.Effect.ShadersStore[o+"VertexShader"]=this._injectCustomCode(this.VertexShader,"vertex"),i.Effect.ShadersStore[o+"PixelShader"]=this._injectCustomCode(this.FragmentShader,"fragment")),o}_injectCustomCode(e,i){const t=this._getCustomCode(i);for(const i in t){const n=t[i];if(n&&n.length>0){const t="#define "+i;e=e.replace(t,"\n"+n+"\n"+t)}}return e}_getCustomCode(e){var i,t;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===(t=this._customUniform)||void 0===t?void 0:t.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}}constructor(e,t){super(e,t,!0),this.CustomParts=new d,this.customShaderNameResolve=this.Builder,this.FragmentShader=i.Effect.ShadersStore.defaultPixelShader,this.VertexShader=i.Effect.ShadersStore.defaultVertexShader,u.ShaderIndexer++,this._createdShaderName="custom_"+u.ShaderIndexer}_afterBind(e,i=null,t){if(i){this.AttachAfterBind(e,i);try{super._afterBind(e,i,t)}catch(e){}}}AddUniform(e,i,t){return this._customUniform||(this._customUniform=[],this._newUniforms=[],this._newSamplerInstances={},this._newUniformInstances={}),t&&(-1!=i.indexOf("sampler")?this._newSamplerInstances[i+"-"+e]=t:this._newUniformInstances[i+"-"+e]=t),this._customUniform.push("uniform "+i+" "+e+";"),this._newUniforms.push(e),this}AddAttribute(e){return this._customAttributes||(this._customAttributes=[]),this._customAttributes.push(e),this}Fragment_Begin(e){return this.CustomParts.Fragment_Begin=e,this}Fragment_Definitions(e){return this.CustomParts.Fragment_Definitions=e,this}Fragment_MainBegin(e){return this.CustomParts.Fragment_MainBegin=e,this}Fragment_MainEnd(e){return this.CustomParts.Fragment_MainEnd=e,this}Fragment_Custom_Diffuse(e){return this.CustomParts.Fragment_Custom_Diffuse=e.replace("result","diffuseColor"),this}Fragment_Custom_Alpha(e){return this.CustomParts.Fragment_Custom_Alpha=e.replace("result","alpha"),this}Fragment_Before_Lights(e){return this.CustomParts.Fragment_Before_Lights=e,this}Fragment_Before_Fog(e){return this.CustomParts.Fragment_Before_Fog=e,this}Fragment_Before_FragColor(e){return this.CustomParts.Fragment_Before_FragColor=e.replace("result","color"),this}Vertex_Begin(e){return this.CustomParts.Vertex_Begin=e,this}Vertex_Definitions(e){return this.CustomParts.Vertex_Definitions=e,this}Vertex_MainBegin(e){return this.CustomParts.Vertex_MainBegin=e,this}Vertex_Before_PositionUpdated(e){return this.CustomParts.Vertex_Before_PositionUpdated=e.replace("result","positionUpdated"),this}Vertex_Before_NormalUpdated(e){return this.CustomParts.Vertex_Before_NormalUpdated=e.replace("result","normalUpdated"),this}Vertex_After_WorldPosComputed(e){return this.CustomParts.Vertex_After_WorldPosComputed=e,this}Vertex_MainEnd(e){return this.CustomParts.Vertex_MainEnd=e,this}}u.ShaderIndexer=1,i.RegisterClass("BABYLON.CustomMaterial",u);class c{constructor(){}}const h=c;class m extends i.PBRMaterial{AttachAfterBind(e,t){if(this._newUniformInstances)for(const e in this._newUniformInstances){const n=e.toString().split("-");"vec2"==n[0]?t.setVector2(n[1],this._newUniformInstances[e]):"vec3"==n[0]?this._newUniformInstances[e]instanceof i.Color3?t.setColor3(n[1],this._newUniformInstances[e]):t.setVector3(n[1],this._newUniformInstances[e]):"vec4"==n[0]?(this._newUniformInstances[e]instanceof i.Color4?t.setDirectColor4(n[1],this._newUniformInstances[e]):t.setVector4(n[1],this._newUniformInstances[e]),t.setVector4(n[1],this._newUniformInstances[e])):"mat4"==n[0]?t.setMatrix(n[1],this._newUniformInstances[e]):"float"==n[0]&&t.setFloat(n[1],this._newUniformInstances[e])}if(this._newSamplerInstances)for(const e in this._newSamplerInstances){const i=e.toString().split("-");"sampler2D"==i[0]&&this._newSamplerInstances[e].isReady&&this._newSamplerInstances[e].isReady()&&t.setTexture(i[1],this._newSamplerInstances[e])}}ReviewUniform(e,i){if("uniform"==e&&this._newUniforms)for(let e=0;e<this._newUniforms.length;e++)-1==this._customUniform[e].indexOf("sampler")&&i.push(this._newUniforms[e].replace(/\[\d*\]/g,""));if("sampler"==e&&this._newUniforms)for(let e=0;e<this._newUniforms.length;e++)-1!=this._customUniform[e].indexOf("sampler")&&i.push(this._newUniforms[e].replace(/\[\d*\]/g,""));return i}Builder(e,t,n,r,a,s,o){if(o){const e=o.processFinalCode;o.processFinalCode=(t,n)=>{if("vertex"===t)return e?e(t,n):n;const r=new i.ShaderCodeInliner(n);return r.inlineToken="#define pbr_inline",r.processCode(),e?e(t,r.code):r.code}}s&&this._customAttributes&&this._customAttributes.length>0&&s.push(...this._customAttributes),this.ReviewUniform("uniform",t),this.ReviewUniform("sampler",r);const f=this._createdShaderName;return i.Effect.ShadersStore[f+"VertexShader"]&&i.Effect.ShadersStore[f+"PixelShader"]||(i.Effect.ShadersStore[f+"VertexShader"]=this._injectCustomCode(this.VertexShader,"vertex"),i.Effect.ShadersStore[f+"PixelShader"]=this._injectCustomCode(this.FragmentShader,"fragment")),f}_injectCustomCode(e,i){const t=this._getCustomCode(i);for(const i in t){const n=t[i];if(n&&n.length>0){const t="#define "+i;e=e.replace(t,"\n"+n+"\n"+t)}}return e}_getCustomCode(e){var i,t;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===(t=this._customUniform)||void 0===t?void 0:t.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}}constructor(e,t){super(e,t,!0),this._customEffects=new Set,this.CustomParts=new c,this.customShaderNameResolve=this.Builder,this.FragmentShader=i.Effect.ShadersStore.pbrPixelShader,this.VertexShader=i.Effect.ShadersStore.pbrVertexShader,this.FragmentShader=this.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g,i.Effect.IncludesShadersStore.pbrBlockAlbedoOpacity),this.FragmentShader=this.FragmentShader.replace(/#include<pbrBlockReflectivity>/g,i.Effect.IncludesShadersStore.pbrBlockReflectivity),this.FragmentShader=this.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g,i.Effect.IncludesShadersStore.pbrBlockFinalColorComposition),m.ShaderIndexer++,this._createdShaderName="custompbr_"+m.ShaderIndexer,this.onEffectCreatedObservable.add(({effect:e,subMesh:i})=>{const t=null==i?void 0:i.effect;this._isCreatedShaderEffect(e)&&this._customEffects.add(e),(!this.allowShaderHotSwapping||e.isReady())&&t&&t!==e&&this._isCreatedShaderEffect(t)&&(t.dispose(),t.isDisposed&&this._customEffects.delete(t))})}_isCreatedShaderEffect(e){return e._key.startsWith(this._createdShaderName+"+")}dispose(e,t){delete i.Effect.ShadersStore[this._createdShaderName+"VertexShader"],delete i.Effect.ShadersStore[this._createdShaderName+"PixelShader"],super.dispose(e,t),this._customEffects.forEach(e=>{e.dispose(!0)}),this._customEffects.clear()}_afterBind(e,i=null,t){if(i){this.AttachAfterBind(e,i);try{super._afterBind(e,i,t)}catch(e){}}}AddUniform(e,i,t){return this._customUniform||(this._customUniform=[],this._newUniforms=[],this._newSamplerInstances={},this._newUniformInstances={}),t&&(-1!=i.indexOf("sampler")?this._newSamplerInstances[i+"-"+e]=t:this._newUniformInstances[i+"-"+e]=t),this._customUniform.push("uniform "+i+" "+e+";"),this._newUniforms.push(e),this}AddAttribute(e){return this._customAttributes||(this._customAttributes=[]),this._customAttributes.push(e),this}Fragment_Begin(e){return this.CustomParts.Fragment_Begin=e,this}Fragment_Definitions(e){return this.CustomParts.Fragment_Definitions=e,this}Fragment_MainBegin(e){return this.CustomParts.Fragment_MainBegin=e,this}Fragment_Custom_Albedo(e){return this.CustomParts.Fragment_Custom_Albedo=e.replace("result","surfaceAlbedo"),this}Fragment_Custom_Alpha(e){return this.CustomParts.Fragment_Custom_Alpha=e.replace("result","alpha"),this}Fragment_Before_Lights(e){return this.CustomParts.Fragment_Before_Lights=e,this}Fragment_Custom_MetallicRoughness(e){return this.CustomParts.Fragment_Custom_MetallicRoughness=e,this}Fragment_Custom_MicroSurface(e){return this.CustomParts.Fragment_Custom_MicroSurface=e,this}Fragment_Before_Fog(e){return this.CustomParts.Fragment_Before_Fog=e,this}Fragment_Before_FinalColorComposition(e){return this.CustomParts.Fragment_Before_FinalColorComposition=e,this}Fragment_Before_FragColor(e){return this.CustomParts.Fragment_Before_FragColor=e.replace("result","color"),this}Fragment_MainEnd(e){return this.CustomParts.Fragment_MainEnd=e,this}Vertex_Begin(e){return this.CustomParts.Vertex_Begin=e,this}Vertex_Definitions(e){return this.CustomParts.Vertex_Definitions=e,this}Vertex_MainBegin(e){return this.CustomParts.Vertex_MainBegin=e,this}Vertex_Before_PositionUpdated(e){return this.CustomParts.Vertex_Before_PositionUpdated=e.replace("result","positionUpdated"),this}Vertex_Before_NormalUpdated(e){return this.CustomParts.Vertex_Before_NormalUpdated=e.replace("result","normalUpdated"),this}Vertex_After_WorldPosComputed(e){return this.CustomParts.Vertex_After_WorldPosComputed=e,this}Vertex_MainEnd(e){return this.CustomParts.Vertex_MainEnd=e,this}}m.ShaderIndexer=1,i.RegisterClass("BABYLON.PBRCustomMaterial",m);class v extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.UV1=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.BonesPerMesh=0,this.NUM_BONE_INFLUENCERS=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.rebuild()}}let g=(()=>{var e,o,f,l;let d,u,c,h,m,g,p,S,x=i.PushMaterial,T=[],_=[],C=[],E=[],L=[],P=[],I=[],D=[],b=[],A=[],F=[],O=[],N=[],M=[],R=[],y=[];return e=class extends x{get diffuseTexture(){return a(this,o,"f")}set diffuseTexture(e){s(this,o,e,"f")}get distortionTexture(){return a(this,f,"f")}set distortionTexture(e){s(this,f,e,"f")}get opacityTexture(){return a(this,l,"f")}set opacityTexture(e){s(this,l,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._diffuseTexture=n(this,T,void 0),o.set(this,(n(this,_),n(this,C,void 0))),this._distortionTexture=(n(this,E),n(this,L,void 0)),f.set(this,(n(this,P),n(this,I,void 0))),this._opacityTexture=(n(this,D),n(this,b,void 0)),l.set(this,(n(this,A),n(this,F,void 0))),this.diffuseColor=(n(this,O),n(this,N,new i.Color3(1,1,1))),this.speed=(n(this,M),n(this,R,1)),this._scaledDiffuse=(n(this,y),new i.Color3),this._lastTime=0,this._shadersLoaded=!1}needAlphaBlending(){return!1}needAlphaTesting(){return!0}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new v);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(s._areTexturesDirty&&(s._needUVs=!1,this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;s._needUVs=!0,s.DIFFUSE=!0}if(s.ALPHATEST=!!this._opacityTexture,s._areMiscDirty&&(s.POINTSIZE=this.pointsCloud||o.forcePointsCloud,s.FOG=o.fogEnabled&&e.applyFog&&o.fogMode!==i.Scene.FOGMODE_NONE&&this.fogEnabled,s.LOGARITHMICDEPTH=this._useLogarithmicDepth),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!1,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.UV1&&a.push(i.VertexBuffer.UVKind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="fire",d=["world","view","viewProjection","vEyePosition","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant","time","speed"];i.AddClipPlaneUniforms(d);const u=s.toString();t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:d,uniformBuffersNames:[],samplers:["diffuseSampler","distortionSampler","opacitySampler"],defines:u,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:null,maxSimultaneousLights:4,transformFeedbackVaryings:null,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return fe}),Promise.resolve().then(function(){return ce})]):yield Promise.all([Promise.resolve().then(function(){return ge}),Promise.resolve().then(function(){return Te})]),this._shadersLoaded=!0})},f),s,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this._scaledDiffuse,this.alpha*t.visibility),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),this._lastTime+=r.getEngine().getDeltaTime(),this._activeEffect.setFloat("time",this._lastTime),this._activeEffect.setFloat("speed",this.speed),this._afterBind(t,this._activeEffect,n))}getAnimatables(){const 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}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),this._distortionTexture&&e.push(this._distortionTexture),this._opacityTexture&&e.push(this._opacityTexture),e}hasTexture(e){return!!super.hasTexture(e)||this._diffuseTexture===e||this._distortionTexture===e||this._opacityTexture===e}getClassName(){return"FireMaterial"}dispose(e){this._diffuseTexture&&this._diffuseTexture.dispose(),this._distortionTexture&&this._distortionTexture.dispose(),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.FireMaterial",e.diffuseColor=this.diffuseColor.asArray(),e.speed=this.speed,this._diffuseTexture&&(e._diffuseTexture=this._diffuseTexture.serialize()),this._distortionTexture&&(e._distortionTexture=this._distortionTexture.serialize()),this._opacityTexture&&(e._opacityTexture=this._opacityTexture.serialize()),e}static Parse(t,n,r){const a=new e(t.name,n);return a.diffuseColor=i.Color3.FromArray(t.diffuseColor),a.speed=t.speed,a.alpha=t.alpha,a.id=t.id,i.Tags.AddTagsTo(a,t.tags),a.backFaceCulling=t.backFaceCulling,a.wireframe=t.wireframe,t._diffuseTexture&&(a._diffuseTexture=i.Texture.Parse(t._diffuseTexture,n,r)),t._distortionTexture&&(a._distortionTexture=i.Texture.Parse(t._distortionTexture,n,r)),t._opacityTexture&&(a._opacityTexture=i.Texture.Parse(t._opacityTexture,n,r)),a}},o=new WeakMap,f=new WeakMap,l=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=x[Symbol.metadata])&&void 0!==n?n:null):void 0;d=[i.serializeAsTexture("diffuseTexture")],u=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],c=[i.serializeAsTexture("distortionTexture")],h=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],m=[i.serializeAsTexture("opacityTexture")],g=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],p=[i.serializeAsColor3("diffuse")],S=[i.serialize()],t(e,null,u,{kind:"accessor",name:"diffuseTexture",static:!1,private:!1,access:{has:e=>"diffuseTexture"in e,get:e=>e.diffuseTexture,set:(e,i)=>{e.diffuseTexture=i}},metadata:r},C,E),t(e,null,h,{kind:"accessor",name:"distortionTexture",static:!1,private:!1,access:{has:e=>"distortionTexture"in e,get:e=>e.distortionTexture,set:(e,i)=>{e.distortionTexture=i}},metadata:r},I,D),t(e,null,g,{kind:"accessor",name:"opacityTexture",static:!1,private:!1,access:{has:e=>"opacityTexture"in e,get:e=>e.opacityTexture,set:(e,i)=>{e.opacityTexture=i}},metadata:r},F,O),t(null,null,d,{kind:"field",name:"_diffuseTexture",static:!1,private:!1,access:{has:e=>"_diffuseTexture"in e,get:e=>e._diffuseTexture,set:(e,i)=>{e._diffuseTexture=i}},metadata:r},T,_),t(null,null,c,{kind:"field",name:"_distortionTexture",static:!1,private:!1,access:{has:e=>"_distortionTexture"in e,get:e=>e._distortionTexture,set:(e,i)=>{e._distortionTexture=i}},metadata:r},L,P),t(null,null,m,{kind:"field",name:"_opacityTexture",static:!1,private:!1,access:{has:e=>"_opacityTexture"in e,get:e=>e._opacityTexture,set:(e,i)=>{e._opacityTexture=i}},metadata:r},b,A),t(null,null,p,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},N,M),t(null,null,S,{kind:"field",name:"speed",static:!1,private:!1,access:{has:e=>"speed"in e,get:e=>e.speed,set:(e,i)=>{e.speed=i}},metadata:r},R,y),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.FireMaterial",g);class p extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.HEIGHTMAP=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.HIGHLEVEL=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let S=(()=>{var e,o,f,l,d;let u,c,h,m,v,g,S,x,T,_,C,E,L,P,I,D,b,A,F,O,N=i.PushMaterial,M=[],R=[],y=[],V=[],U=[],w=[],G=[],W=[],B=[],z=[],H=[],k=[],X=[],j=[],Z=[],Y=[],K=[],q=[],Q=[],J=[],$=[],ee=[],ie=[],te=[],ne=[],re=[],ae=[],se=[],oe=[],fe=[],le=[],de=[],ue=[],ce=[],he=[],me=[],ve=[],ge=[],pe=[];return e=class extends N{get diffuseTexture(){return a(this,o,"f")}set diffuseTexture(e){s(this,o,e,"f")}get heightTexture(){return a(this,f,"f")}set heightTexture(e){s(this,f,e,"f")}get disableLighting(){return a(this,l,"f")}set disableLighting(e){s(this,l,e,"f")}get maxSimultaneousLights(){return a(this,d,"f")}set maxSimultaneousLights(e){s(this,d,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._diffuseTexture=(n(this,M),n(this,R,void 0)),o.set(this,(n(this,y),n(this,V,void 0))),this._heightTexture=(n(this,U),n(this,w,void 0)),f.set(this,(n(this,G),n(this,W,void 0))),this.diffuseColor=(n(this,B),n(this,z,new i.Color3(1,1,1))),this.furLength=(n(this,H),n(this,k,1)),this.furAngle=(n(this,X),n(this,j,0)),this.furColor=(n(this,Z),n(this,Y,new i.Color3(.44,.21,.02))),this.furOffset=(n(this,K),n(this,q,0)),this.furSpacing=(n(this,Q),n(this,J,12)),this.furGravity=(n(this,$),n(this,ee,new i.Vector3(0,0,0))),this.furSpeed=(n(this,ie),n(this,te,100)),this.furDensity=(n(this,ne),n(this,re,20)),this.furOcclusion=(n(this,ae),n(this,se,0)),this.furTexture=n(this,oe),this._disableLighting=n(this,fe,!1),l.set(this,(n(this,le),n(this,de,void 0))),this._maxSimultaneousLights=(n(this,ue),n(this,ce,4)),d.set(this,(n(this,he),n(this,me,void 0))),this.highLevelFur=(n(this,ve),n(this,ge,!0)),this._meshes=n(this,pe),this._furTime=0,this._shadersLoaded=!1}get furTime(){return this._furTime}set furTime(e){this._furTime=e}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}updateFur(){for(let e=1;e<this._meshes.length;e++){const 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}}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new p);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(s._areTexturesDirty&&o.texturesEnabled){if(this.diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled){if(!this.diffuseTexture.isReady())return!1;s._needUVs=!0,s.DIFFUSE=!0}if(this.heightTexture&&f.getCaps().maxVertexTextureImageUnits){if(!this.heightTexture.isReady())return!1;s._needUVs=!0,s.HEIGHTMAP=!0}}if(this.highLevelFur!==s.HIGHLEVEL&&(s.HIGHLEVEL=!0,s.markAsUnprocessed()),i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n,this.maxSimultaneousLights),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="fur",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant","furLength","furAngle","furColor","furOffset","furGravity","furTime","furSpacing","furDensity","furOcclusion"];i.AddClipPlaneUniforms(u);const c=["diffuseSampler","heightTexture","furTexture","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return Le}),Promise.resolve().then(function(){return be})]):yield Promise.all([Promise.resolve().then(function(){return Ne}),Promise.resolve().then(function(){return Ve})]),this._shadersLoaded=!0})},f),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this.maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,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(t,this._activeEffect,n))}getAnimatables(){const 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}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),this._heightTexture&&e.push(this._heightTexture),e}hasTexture(e){return!!super.hasTexture(e)||this.diffuseTexture===e||this._heightTexture===e}dispose(e){if(this.diffuseTexture&&this.diffuseTexture.dispose(),this._meshes)for(let i=1;i<this._meshes.length;i++){const t=this._meshes[i].material;t&&t.dispose(e),this._meshes[i].dispose()}super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.FurMaterial",this._meshes&&(e.sourceMeshName=this._meshes[0].name,e.quality=this._meshes.length),e}getClassName(){return"FurMaterial"}static Parse(t,n,r){const a=i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r);return t.sourceMeshName&&a.highLevelFur&&n.executeWhenReady(()=>{const i=n.getMeshByName(t.sourceMeshName);if(i){const r=e.GenerateTexture("Fur Texture",n);a.furTexture=r,e.FurifyMesh(i,t.quality)}}),a}static GenerateTexture(e,t){const n=new i.DynamicTexture("FurTexture "+e,256,t,!0),r=n.getContext();for(let e=0;e<2e4;++e)r.fillStyle="rgba(255, "+Math.floor(255*Math.random())+", "+Math.floor(255*Math.random())+", 1)",r.fillRect(Math.random()*n.getSize().width,Math.random()*n.getSize().height,2,2);return n.update(!1),n.wrapU=i.Texture.WRAP_ADDRESSMODE,n.wrapV=i.Texture.WRAP_ADDRESSMODE,n}static FurifyMesh(t,n){const r=[t],a=t.material;let s;if(!(a instanceof e))throw"The material of the source mesh must be a Fur Material";for(s=1;s<n;s++){const o=new e(a.name+s,t.getScene());t.getScene().materials.pop(),i.Tags.EnableFor(o),i.Tags.AddTagsTo(o,"furShellMaterial"),o.furLength=a.furLength,o.furAngle=a.furAngle,o.furGravity=a.furGravity,o.furSpacing=a.furSpacing,o.furSpeed=a.furSpeed,o.furColor=a.furColor,o.diffuseTexture=a.diffuseTexture,o.furOffset=s/n,o.furTexture=a.furTexture,o.highLevelFur=a.highLevelFur,o.furTime=a.furTime,o.furDensity=a.furDensity;const f=t.clone(t.name+s);f.material=o,f.skeleton=t.skeleton,f.position=i.Vector3.Zero(),r.push(f)}for(s=1;s<r.length;s++)r[s].parent=t;return t.material._meshes=r,r}},o=new WeakMap,f=new WeakMap,l=new WeakMap,d=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=N[Symbol.metadata])&&void 0!==n?n:null):void 0;u=[i.serializeAsTexture("diffuseTexture")],c=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],h=[i.serializeAsTexture("heightTexture")],m=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],v=[i.serializeAsColor3()],g=[i.serialize()],S=[i.serialize()],x=[i.serializeAsColor3()],T=[i.serialize()],_=[i.serialize()],C=[i.serializeAsVector3()],E=[i.serialize()],L=[i.serialize()],P=[i.serialize()],I=[i.serialize("disableLighting")],D=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],b=[i.serialize("maxSimultaneousLights")],A=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],F=[i.serialize()],O=[i.serialize()],t(e,null,c,{kind:"accessor",name:"diffuseTexture",static:!1,private:!1,access:{has:e=>"diffuseTexture"in e,get:e=>e.diffuseTexture,set:(e,i)=>{e.diffuseTexture=i}},metadata:r},V,U),t(e,null,m,{kind:"accessor",name:"heightTexture",static:!1,private:!1,access:{has:e=>"heightTexture"in e,get:e=>e.heightTexture,set:(e,i)=>{e.heightTexture=i}},metadata:r},W,B),t(e,null,D,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},de,ue),t(e,null,A,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},me,ve),t(e,null,O,{kind:"getter",name:"furTime",static:!1,private:!1,access:{has:e=>"furTime"in e,get:e=>e.furTime},metadata:r},null,M),t(null,null,u,{kind:"field",name:"_diffuseTexture",static:!1,private:!1,access:{has:e=>"_diffuseTexture"in e,get:e=>e._diffuseTexture,set:(e,i)=>{e._diffuseTexture=i}},metadata:r},R,y),t(null,null,h,{kind:"field",name:"_heightTexture",static:!1,private:!1,access:{has:e=>"_heightTexture"in e,get:e=>e._heightTexture,set:(e,i)=>{e._heightTexture=i}},metadata:r},w,G),t(null,null,v,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},z,H),t(null,null,g,{kind:"field",name:"furLength",static:!1,private:!1,access:{has:e=>"furLength"in e,get:e=>e.furLength,set:(e,i)=>{e.furLength=i}},metadata:r},k,X),t(null,null,S,{kind:"field",name:"furAngle",static:!1,private:!1,access:{has:e=>"furAngle"in e,get:e=>e.furAngle,set:(e,i)=>{e.furAngle=i}},metadata:r},j,Z),t(null,null,x,{kind:"field",name:"furColor",static:!1,private:!1,access:{has:e=>"furColor"in e,get:e=>e.furColor,set:(e,i)=>{e.furColor=i}},metadata:r},Y,K),t(null,null,T,{kind:"field",name:"furOffset",static:!1,private:!1,access:{has:e=>"furOffset"in e,get:e=>e.furOffset,set:(e,i)=>{e.furOffset=i}},metadata:r},q,Q),t(null,null,_,{kind:"field",name:"furSpacing",static:!1,private:!1,access:{has:e=>"furSpacing"in e,get:e=>e.furSpacing,set:(e,i)=>{e.furSpacing=i}},metadata:r},J,$),t(null,null,C,{kind:"field",name:"furGravity",static:!1,private:!1,access:{has:e=>"furGravity"in e,get:e=>e.furGravity,set:(e,i)=>{e.furGravity=i}},metadata:r},ee,ie),t(null,null,E,{kind:"field",name:"furSpeed",static:!1,private:!1,access:{has:e=>"furSpeed"in e,get:e=>e.furSpeed,set:(e,i)=>{e.furSpeed=i}},metadata:r},te,ne),t(null,null,L,{kind:"field",name:"furDensity",static:!1,private:!1,access:{has:e=>"furDensity"in e,get:e=>e.furDensity,set:(e,i)=>{e.furDensity=i}},metadata:r},re,ae),t(null,null,P,{kind:"field",name:"furOcclusion",static:!1,private:!1,access:{has:e=>"furOcclusion"in e,get:e=>e.furOcclusion,set:(e,i)=>{e.furOcclusion=i}},metadata:r},se,oe),t(null,null,I,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},fe,le),t(null,null,b,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},ce,he),t(null,null,F,{kind:"field",name:"highLevelFur",static:!1,private:!1,access:{has:e=>"highLevelFur"in e,get:e=>e.highLevelFur,set:(e,i)=>{e.highLevelFur=i}},metadata:r},ge,pe),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.FurMaterial",S);class x extends i.MaterialDefines{constructor(){super(),this.EMISSIVE=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let T=(()=>{var e,o,f;let l,d,u,c,h,m,v,g,p,S,T,_=i.PushMaterial,C=[],E=[],L=[],P=[],I=[],D=[],b=[],A=[],F=[],O=[],N=[],M=[],R=[],y=[],V=[],U=[],w=[],G=[],W=[],B=[],z=[],H=[];return e=class extends _{get maxSimultaneousLights(){return a(this,o,"f")}set maxSimultaneousLights(e){s(this,o,e,"f")}get disableLighting(){return a(this,f,"f")}set disableLighting(e){s(this,f,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._maxSimultaneousLights=n(this,C,4),o.set(this,(n(this,E),n(this,L,void 0))),this.topColor=(n(this,P),n(this,I,new i.Color3(1,0,0))),this.topColorAlpha=(n(this,D),n(this,b,1)),this.bottomColor=(n(this,A),n(this,F,new i.Color3(0,0,1))),this.bottomColorAlpha=(n(this,O),n(this,N,1)),this.offset=(n(this,M),n(this,R,0)),this.scale=(n(this,y),n(this,V,1)),this.smoothness=(n(this,U),n(this,w,1)),this._disableLighting=(n(this,G),n(this,W,!1)),f.set(this,(n(this,B),n(this,z,void 0))),this._shadersLoaded=(n(this,H),!1)}needAlphaBlending(){return this.alpha<1||this.topColorAlpha<1||this.bottomColorAlpha<1}needAlphaTesting(){return!0}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new x);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),s.EMISSIVE=this._disableLighting,i.PrepareDefinesForAttributes(e,s,!1,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="gradient",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","mBones","logarithmicDepthConstant","topColor","bottomColor","offset","smoothness","scale"];i.AddClipPlaneUniforms(u);const c=["areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:4,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return We}),Promise.resolve().then(function(){return ke})]):yield Promise.all([Promise.resolve().then(function(){return Ye}),Promise.resolve().then(function(){return Je})]),this._shadersLoaded=!0})},f),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,s),this._mustRebind(r,s,n)&&(i.BindClipPlane(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this.maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,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(t,this._activeEffect,n))}getAnimatables(){return[]}dispose(e){super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.GradientMaterial",e}getClassName(){return"GradientMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,f=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=_[Symbol.metadata])&&void 0!==n?n:null):void 0;l=[i.serialize("maxSimultaneousLights")],d=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],u=[i.serializeAsColor3()],c=[i.serialize()],h=[i.serializeAsColor3()],m=[i.serialize()],v=[i.serialize()],g=[i.serialize()],p=[i.serialize()],S=[i.serialize("disableLighting")],T=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,d,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},L,P),t(e,null,T,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},z,H),t(null,null,l,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},C,E),t(null,null,u,{kind:"field",name:"topColor",static:!1,private:!1,access:{has:e=>"topColor"in e,get:e=>e.topColor,set:(e,i)=>{e.topColor=i}},metadata:r},I,D),t(null,null,c,{kind:"field",name:"topColorAlpha",static:!1,private:!1,access:{has:e=>"topColorAlpha"in e,get:e=>e.topColorAlpha,set:(e,i)=>{e.topColorAlpha=i}},metadata:r},b,A),t(null,null,h,{kind:"field",name:"bottomColor",static:!1,private:!1,access:{has:e=>"bottomColor"in e,get:e=>e.bottomColor,set:(e,i)=>{e.bottomColor=i}},metadata:r},F,O),t(null,null,m,{kind:"field",name:"bottomColorAlpha",static:!1,private:!1,access:{has:e=>"bottomColorAlpha"in e,get:e=>e.bottomColorAlpha,set:(e,i)=>{e.bottomColorAlpha=i}},metadata:r},N,M),t(null,null,v,{kind:"field",name:"offset",static:!1,private:!1,access:{has:e=>"offset"in e,get:e=>e.offset,set:(e,i)=>{e.offset=i}},metadata:r},R,y),t(null,null,g,{kind:"field",name:"scale",static:!1,private:!1,access:{has:e=>"scale"in e,get:e=>e.scale,set:(e,i)=>{e.scale=i}},metadata:r},V,U),t(null,null,p,{kind:"field",name:"smoothness",static:!1,private:!1,access:{has:e=>"smoothness"in e,get:e=>e.smoothness,set:(e,i)=>{e.smoothness=i}},metadata:r},w,G),t(null,null,S,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},W,B),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.GradientMaterial",T);class _ extends i.MaterialDefines{constructor(){super(),this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.OPACITY=!1,this.ANTIALIAS=!1,this.LINES_ONLY=!1,this.FOG=!1,this.PREMULTIPLYALPHA=!1,this.MAX_LINE=!1,this.UV1=!1,this.UV2=!1,this.INSTANCES=!1,this.THIN_INSTANCES=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.MULTI_SCALE=!1,this.HORIZON_FADE=!1,this.BELOW_LINE_COLOR=!1,this.ORIGIN_MARKER=!1,this.rebuild()}}let C=(()=>{var e,o;let f,l,d,u,c,h,m,v,g,p,S,x,T,C,E,L,P,I,D,b,A=i.PushMaterial,F=[],O=[],N=[],M=[],R=[],y=[],V=[],U=[],w=[],G=[],W=[],B=[],z=[],H=[],k=[],X=[],j=[],Z=[],Y=[],K=[],q=[],Q=[],J=[],$=[],ee=[],ie=[],te=[],ne=[],re=[],ae=[],se=[],oe=[],fe=[],le=[],de=[],ue=[],ce=[];return e=class extends A{get belowLineColor(){return this._belowLineColor}set belowLineColor(e){this._belowLineColor!==e&&(this._belowLineColor=e,this._markAllSubMeshesAsMiscDirty())}get linesOnly(){return this._linesOnly}set linesOnly(e){this._linesOnly!==e&&(this._linesOnly=e,this.needDepthPrePass=e,this._markAllSubMeshesAsMiscDirty())}get opacityTexture(){return a(this,o,"f")}set opacityTexture(e){s(this,o,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this.mainColor=(n(this,F),n(this,O,i.Color3.Black())),this.lineColor=(n(this,N),n(this,M,i.Color3.Teal())),this.gridRatio=(n(this,R),n(this,y,1)),this.gridOffset=(n(this,V),n(this,U,i.Vector3.Zero())),this.majorUnitFrequency=(n(this,w),n(this,G,10)),this.minorUnitVisibility=(n(this,W),n(this,B,.33)),this.opacity=(n(this,z),n(this,H,1)),this.antialias=(n(this,k),n(this,X,!0)),this._belowLineColor=(n(this,j),null),this.useMultiScale=n(this,Z,!1),this.minGridSpacing=(n(this,Y),n(this,K,.001)),this.gridOctaves=(n(this,q),n(this,Q,4)),this.useHorizonFade=(n(this,J),n(this,$,!1)),this.useOriginMarker=(n(this,ee),n(this,ie,!1)),this._linesOnly=(n(this,te),!1),this.gridThicknessModifier=n(this,ne,1),this.preMultiplyAlpha=(n(this,re),n(this,ae,!1)),this.useMaxLine=(n(this,se),n(this,oe,!1)),this._opacityTexture=(n(this,fe),n(this,le,void 0)),o.set(this,(n(this,de),n(this,ue,void 0))),this._gridControl=(n(this,ce),new i.Vector4(this.gridRatio,this.majorUnitFrequency,this.minorUnitVisibility,this.opacity)),this._viewportSize=new i.Vector2,this._shadersLoaded=!1}needAlphaBlending(){return this.linesOnly||this.opacity<1||this._opacityTexture&&this._opacityTexture.isReady()}needAlphaBlendingForMesh(e){return e.visibility<1||this.needAlphaBlending()}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new _);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;s.LINES_ONLY!==this.linesOnly&&(s.LINES_ONLY=this.linesOnly,s.markAsUnprocessed()),s.PREMULTIPLYALPHA!=this.preMultiplyAlpha&&(s.PREMULTIPLYALPHA=!s.PREMULTIPLYALPHA,s.markAsUnprocessed()),s.MAX_LINE!==this.useMaxLine&&(s.MAX_LINE=!s.MAX_LINE,s.markAsUnprocessed()),s.ANTIALIAS!==this.antialias&&(s.ANTIALIAS=this.antialias,s.markAsUnprocessed()),s.MULTI_SCALE!==this.useMultiScale&&(s.MULTI_SCALE=this.useMultiScale,s.markAsUnprocessed()),s.HORIZON_FADE!==this.useHorizonFade&&(s.HORIZON_FADE=this.useHorizonFade,s.markAsUnprocessed());const f=null!==this._belowLineColor;if(s.BELOW_LINE_COLOR!==f&&(s.BELOW_LINE_COLOR=f,s.markAsUnprocessed()),s.ORIGIN_MARKER!==this.useOriginMarker&&(s.ORIGIN_MARKER=this.useOriginMarker,s.markAsUnprocessed()),s._areTexturesDirty&&(s._needUVs=!1,o.texturesEnabled&&this._opacityTexture&&i.MaterialFlags.OpacityTextureEnabled)){if(!this._opacityTexture.isReady())return!1;s._needUVs=!0,s.OPACITY=!0}if(i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,!1,this.fogEnabled,!1,s,void 0,void 0,void 0,this._isVertexOutputInvariant),i.PrepareDefinesForFrameBoundValues(o,o.getEngine(),this,s,!!n),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial(),i.PrepareDefinesForAttributes(e,s,!1,!1);const n=[i.VertexBuffer.PositionKind,i.VertexBuffer.NormalKind];s.UV1&&n.push(i.VertexBuffer.UVKind),s.UV2&&n.push(i.VertexBuffer.UV2Kind),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess,i.PrepareAttributesForInstances(n,s);const a=["projection","mainColor","lineColor","gridControl","gridOffset","vFogInfos","vFogColor","world","view","opacityMatrix","vOpacityInfos","visibility","logarithmicDepthConstant","gridThicknessModifier"];s.MULTI_SCALE&&a.push("minGridSpacing","gridOctaves"),(s.HORIZON_FADE||s.BELOW_LINE_COLOR||s.ORIGIN_MARKER)&&a.push("cameraPosition","viewportSize"),s.BELOW_LINE_COLOR&&a.push("belowLineColor");const f=s.toString();i.AddClipPlaneUniforms(a),t.setEffect(o.getEngine().createEffect("grid",{attributes:n,uniformsNames:a,uniformBuffersNames:["Scene"],samplers:["opacitySampler"],defines:f,fallbacks:null,onCompiled:this.onCompiled,onError:this.onError,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return ti}),Promise.resolve().then(function(){return si})]):yield Promise.all([Promise.resolve().then(function(){return di}),Promise.resolve().then(function(){return mi})]),this._shadersLoaded=!0})},o.getEngine()),s,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;if(s){if(this._activeEffect=s,this._activeEffect.setFloat("visibility",t.visibility),a.INSTANCES&&!a.THIN_INSTANCE||this.bindOnlyWorldMatrix(e),this.bindView(s),this.bindViewProjection(s),this._mustRebind(r,s,n)&&(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._activeEffect.setFloat("gridThicknessModifier",this.gridThicknessModifier),a.BELOW_LINE_COLOR&&this._belowLineColor&&this._activeEffect.setColor3("belowLineColor",this._belowLineColor),a.MULTI_SCALE&&(this._activeEffect.setFloat("minGridSpacing",this.minGridSpacing),this._activeEffect.setFloat("gridOctaves",Math.max(1,Math.min(8,Math.round(this.gridOctaves))))),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(s,this,r),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r)),i.BindFogParameters(r,t,this._activeEffect),a.HORIZON_FADE||a.BELOW_LINE_COLOR||a.ORIGIN_MARKER){const e=r.activeCamera;if(e){this._activeEffect.setVector3("cameraPosition",e.globalPosition);const i=r.getEngine();this._viewportSize.x=i.getRenderWidth(),this._viewportSize.y=i.getRenderHeight(),this._activeEffect.setVector2("viewportSize",this._viewportSize)}}this._afterBind(t,this._activeEffect,n)}}dispose(e){super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.GridMaterial",e}getClassName(){return"GridMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=A[Symbol.metadata])&&void 0!==n?n:null):void 0;f=[i.serializeAsColor3()],l=[i.serializeAsColor3()],d=[i.serialize()],u=[i.serializeAsVector3()],c=[i.serialize()],h=[i.serialize()],m=[i.serialize()],v=[i.serialize()],g=[i.serializeAsColor3()],p=[i.serialize()],S=[i.serialize()],x=[i.serialize()],T=[i.serialize()],C=[i.serialize()],E=[i.serialize()],L=[i.serialize()],P=[i.serialize()],I=[i.serialize()],D=[i.serializeAsTexture("opacityTexture")],b=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],t(e,null,g,{kind:"getter",name:"belowLineColor",static:!1,private:!1,access:{has:e=>"belowLineColor"in e,get:e=>e.belowLineColor},metadata:r},null,F),t(e,null,E,{kind:"getter",name:"linesOnly",static:!1,private:!1,access:{has:e=>"linesOnly"in e,get:e=>e.linesOnly},metadata:r},null,F),t(e,null,b,{kind:"accessor",name:"opacityTexture",static:!1,private:!1,access:{has:e=>"opacityTexture"in e,get:e=>e.opacityTexture,set:(e,i)=>{e.opacityTexture=i}},metadata:r},ue,ce),t(null,null,f,{kind:"field",name:"mainColor",static:!1,private:!1,access:{has:e=>"mainColor"in e,get:e=>e.mainColor,set:(e,i)=>{e.mainColor=i}},metadata:r},O,N),t(null,null,l,{kind:"field",name:"lineColor",static:!1,private:!1,access:{has:e=>"lineColor"in e,get:e=>e.lineColor,set:(e,i)=>{e.lineColor=i}},metadata:r},M,R),t(null,null,d,{kind:"field",name:"gridRatio",static:!1,private:!1,access:{has:e=>"gridRatio"in e,get:e=>e.gridRatio,set:(e,i)=>{e.gridRatio=i}},metadata:r},y,V),t(null,null,u,{kind:"field",name:"gridOffset",static:!1,private:!1,access:{has:e=>"gridOffset"in e,get:e=>e.gridOffset,set:(e,i)=>{e.gridOffset=i}},metadata:r},U,w),t(null,null,c,{kind:"field",name:"majorUnitFrequency",static:!1,private:!1,access:{has:e=>"majorUnitFrequency"in e,get:e=>e.majorUnitFrequency,set:(e,i)=>{e.majorUnitFrequency=i}},metadata:r},G,W),t(null,null,h,{kind:"field",name:"minorUnitVisibility",static:!1,private:!1,access:{has:e=>"minorUnitVisibility"in e,get:e=>e.minorUnitVisibility,set:(e,i)=>{e.minorUnitVisibility=i}},metadata:r},B,z),t(null,null,m,{kind:"field",name:"opacity",static:!1,private:!1,access:{has:e=>"opacity"in e,get:e=>e.opacity,set:(e,i)=>{e.opacity=i}},metadata:r},H,k),t(null,null,v,{kind:"field",name:"antialias",static:!1,private:!1,access:{has:e=>"antialias"in e,get:e=>e.antialias,set:(e,i)=>{e.antialias=i}},metadata:r},X,j),t(null,null,p,{kind:"field",name:"useMultiScale",static:!1,private:!1,access:{has:e=>"useMultiScale"in e,get:e=>e.useMultiScale,set:(e,i)=>{e.useMultiScale=i}},metadata:r},Z,Y),t(null,null,S,{kind:"field",name:"minGridSpacing",static:!1,private:!1,access:{has:e=>"minGridSpacing"in e,get:e=>e.minGridSpacing,set:(e,i)=>{e.minGridSpacing=i}},metadata:r},K,q),t(null,null,x,{kind:"field",name:"gridOctaves",static:!1,private:!1,access:{has:e=>"gridOctaves"in e,get:e=>e.gridOctaves,set:(e,i)=>{e.gridOctaves=i}},metadata:r},Q,J),t(null,null,T,{kind:"field",name:"useHorizonFade",static:!1,private:!1,access:{has:e=>"useHorizonFade"in e,get:e=>e.useHorizonFade,set:(e,i)=>{e.useHorizonFade=i}},metadata:r},$,ee),t(null,null,C,{kind:"field",name:"useOriginMarker",static:!1,private:!1,access:{has:e=>"useOriginMarker"in e,get:e=>e.useOriginMarker,set:(e,i)=>{e.useOriginMarker=i}},metadata:r},ie,te),t(null,null,L,{kind:"field",name:"gridThicknessModifier",static:!1,private:!1,access:{has:e=>"gridThicknessModifier"in e,get:e=>e.gridThicknessModifier,set:(e,i)=>{e.gridThicknessModifier=i}},metadata:r},ne,re),t(null,null,P,{kind:"field",name:"preMultiplyAlpha",static:!1,private:!1,access:{has:e=>"preMultiplyAlpha"in e,get:e=>e.preMultiplyAlpha,set:(e,i)=>{e.preMultiplyAlpha=i}},metadata:r},ae,se),t(null,null,I,{kind:"field",name:"useMaxLine",static:!1,private:!1,access:{has:e=>"useMaxLine"in e,get:e=>e.useMaxLine,set:(e,i)=>{e.useMaxLine=i}},metadata:r},oe,fe),t(null,null,D,{kind:"field",name:"_opacityTexture",static:!1,private:!1,access:{has:e=>"_opacityTexture"in e,get:e=>e._opacityTexture,set:(e,i)=>{e._opacityTexture=i}},metadata:r},le,de),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.GridMaterial",C);class E extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.LIGHT0=!1,this.LIGHT1=!1,this.LIGHT2=!1,this.LIGHT3=!1,this.SPOTLIGHT0=!1,this.SPOTLIGHT1=!1,this.SPOTLIGHT2=!1,this.SPOTLIGHT3=!1,this.HEMILIGHT0=!1,this.HEMILIGHT1=!1,this.HEMILIGHT2=!1,this.HEMILIGHT3=!1,this.DIRLIGHT0=!1,this.DIRLIGHT1=!1,this.DIRLIGHT2=!1,this.DIRLIGHT3=!1,this.POINTLIGHT0=!1,this.POINTLIGHT1=!1,this.POINTLIGHT2=!1,this.POINTLIGHT3=!1,this.SHADOW0=!1,this.SHADOW1=!1,this.SHADOW2=!1,this.SHADOW3=!1,this.SHADOWS=!1,this.SHADOWESM0=!1,this.SHADOWESM1=!1,this.SHADOWESM2=!1,this.SHADOWESM3=!1,this.SHADOWPOISSON0=!1,this.SHADOWPOISSON1=!1,this.SHADOWPOISSON2=!1,this.SHADOWPOISSON3=!1,this.SHADOWPCF0=!1,this.SHADOWPCF1=!1,this.SHADOWPCF2=!1,this.SHADOWPCF3=!1,this.SHADOWPCSS0=!1,this.SHADOWPCSS1=!1,this.SHADOWPCSS2=!1,this.SHADOWPCSS3=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.UNLIT=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let L=(()=>{var e,o,f,l,d;let u,c,h,m,v,g,p,S,x,T,_,C,L,P,I,D=i.PushMaterial,b=[],A=[],F=[],O=[],N=[],M=[],R=[],y=[],V=[],U=[],w=[],G=[],W=[],B=[],z=[],H=[],k=[],X=[],j=[],Z=[],Y=[],K=[],q=[],Q=[],J=[],$=[],ee=[],ie=[],te=[],ne=[];return e=class extends D{get diffuseTexture(){return a(this,o,"f")}set diffuseTexture(e){s(this,o,e,"f")}get disableLighting(){return a(this,f,"f")}set disableLighting(e){s(this,f,e,"f")}get unlit(){return a(this,l,"f")}set unlit(e){s(this,l,e,"f")}get maxSimultaneousLights(){return a(this,d,"f")}set maxSimultaneousLights(e){s(this,d,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._diffuseTexture=n(this,b,void 0),o.set(this,(n(this,A),n(this,F,void 0))),this.noiseTexture=(n(this,O),n(this,N,void 0)),this.fogColor=(n(this,M),n(this,R,void 0)),this.speed=(n(this,y),n(this,V,1)),this.movingSpeed=(n(this,U),n(this,w,1)),this.lowFrequencySpeed=(n(this,G),n(this,W,1)),this.fogDensity=(n(this,B),n(this,z,.15)),this._lastTime=(n(this,H),0),this.diffuseColor=n(this,k,new i.Color3(1,1,1)),this._disableLighting=(n(this,X),n(this,j,!1)),f.set(this,(n(this,Z),n(this,Y,void 0))),this._unlit=(n(this,K),n(this,q,!1)),l.set(this,(n(this,Q),n(this,J,void 0))),this._maxSimultaneousLights=(n(this,$),n(this,ee,4)),d.set(this,(n(this,ie),n(this,te,void 0))),this._scaledDiffuse=(n(this,ne),new i.Color3),this._shadersLoaded=!1}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new E);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(s._areTexturesDirty&&(s._needUVs=!1,o.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;s._needUVs=!0,s.DIFFUSE=!0}if(i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=!0,i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="lava",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant","time","speed","movingSpeed","fogColor","fogDensity","lowFrequencySpeed"];i.AddClipPlaneUniforms(u);const c=["diffuseSampler","noiseTexture","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return Si}),Promise.resolve().then(function(){return Ci})]):yield Promise.all([Promise.resolve().then(function(){return Ii}),Promise.resolve().then(function(){return Fi})]),this._shadersLoaded=!0})},f),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,a.UNLIT=this._unlit,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this._scaledDiffuse,this.alpha*t.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,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(t,this._activeEffect,n))}getAnimatables(){const 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}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),e}hasTexture(e){return!!super.hasTexture(e)||this.diffuseTexture===e}dispose(e){this.diffuseTexture&&this.diffuseTexture.dispose(),this.noiseTexture&&this.noiseTexture.dispose(),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.LavaMaterial",e}getClassName(){return"LavaMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,f=new WeakMap,l=new WeakMap,d=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=D[Symbol.metadata])&&void 0!==n?n:null):void 0;u=[i.serializeAsTexture("diffuseTexture")],c=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],h=[i.serializeAsTexture()],m=[i.serializeAsColor3()],v=[i.serialize()],g=[i.serialize()],p=[i.serialize()],S=[i.serialize()],x=[i.serializeAsColor3()],T=[i.serialize("disableLighting")],_=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],C=[i.serialize("unlit")],L=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],P=[i.serialize("maxSimultaneousLights")],I=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,c,{kind:"accessor",name:"diffuseTexture",static:!1,private:!1,access:{has:e=>"diffuseTexture"in e,get:e=>e.diffuseTexture,set:(e,i)=>{e.diffuseTexture=i}},metadata:r},F,O),t(e,null,_,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},Y,K),t(e,null,L,{kind:"accessor",name:"unlit",static:!1,private:!1,access:{has:e=>"unlit"in e,get:e=>e.unlit,set:(e,i)=>{e.unlit=i}},metadata:r},J,$),t(e,null,I,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},te,ne),t(null,null,u,{kind:"field",name:"_diffuseTexture",static:!1,private:!1,access:{has:e=>"_diffuseTexture"in e,get:e=>e._diffuseTexture,set:(e,i)=>{e._diffuseTexture=i}},metadata:r},b,A),t(null,null,h,{kind:"field",name:"noiseTexture",static:!1,private:!1,access:{has:e=>"noiseTexture"in e,get:e=>e.noiseTexture,set:(e,i)=>{e.noiseTexture=i}},metadata:r},N,M),t(null,null,m,{kind:"field",name:"fogColor",static:!1,private:!1,access:{has:e=>"fogColor"in e,get:e=>e.fogColor,set:(e,i)=>{e.fogColor=i}},metadata:r},R,y),t(null,null,v,{kind:"field",name:"speed",static:!1,private:!1,access:{has:e=>"speed"in e,get:e=>e.speed,set:(e,i)=>{e.speed=i}},metadata:r},V,U),t(null,null,g,{kind:"field",name:"movingSpeed",static:!1,private:!1,access:{has:e=>"movingSpeed"in e,get:e=>e.movingSpeed,set:(e,i)=>{e.movingSpeed=i}},metadata:r},w,G),t(null,null,p,{kind:"field",name:"lowFrequencySpeed",static:!1,private:!1,access:{has:e=>"lowFrequencySpeed"in e,get:e=>e.lowFrequencySpeed,set:(e,i)=>{e.lowFrequencySpeed=i}},metadata:r},W,B),t(null,null,S,{kind:"field",name:"fogDensity",static:!1,private:!1,access:{has:e=>"fogDensity"in e,get:e=>e.fogDensity,set:(e,i)=>{e.fogDensity=i}},metadata:r},z,H),t(null,null,x,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},k,X),t(null,null,T,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},j,Z),t(null,null,C,{kind:"field",name:"_unlit",static:!1,private:!1,access:{has:e=>"_unlit"in e,get:e=>e._unlit,set:(e,i)=>{e._unlit=i}},metadata:r},q,Q),t(null,null,P,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},ee,ie),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.LavaMaterial",L);class P extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.SPECULARTERM=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.MIXMAP2=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.rebuild()}}let I=(()=>{var e,o,f,l,d,u,c,h,m,v,g,p,S;let x,T,_,C,E,L,I,D,b,A,F,O,N,M,R,y,V,U,w,G,W,B,z,H,k,X,j,Z=i.PushMaterial,Y=[],K=[],q=[],Q=[],J=[],$=[],ee=[],ie=[],te=[],ne=[],re=[],ae=[],se=[],oe=[],fe=[],le=[],de=[],ue=[],ce=[],he=[],me=[],ve=[],ge=[],pe=[],Se=[],xe=[],Te=[],_e=[],Ce=[],Ee=[],Le=[],Pe=[],Ie=[],De=[],be=[],Ae=[],Fe=[],Oe=[],Ne=[],Me=[],Re=[],ye=[],Ve=[],Ue=[],we=[],Ge=[],We=[],Be=[],ze=[],He=[],ke=[],Xe=[],je=[],Ze=[];return e=class extends Z{get mixTexture1(){return a(this,o,"f")}set mixTexture1(e){s(this,o,e,"f")}get mixTexture2(){return a(this,f,"f")}set mixTexture2(e){s(this,f,e,"f")}get diffuseTexture1(){return a(this,l,"f")}set diffuseTexture1(e){s(this,l,e,"f")}get diffuseTexture2(){return a(this,d,"f")}set diffuseTexture2(e){s(this,d,e,"f")}get diffuseTexture3(){return a(this,u,"f")}set diffuseTexture3(e){s(this,u,e,"f")}get diffuseTexture4(){return a(this,c,"f")}set diffuseTexture4(e){s(this,c,e,"f")}get diffuseTexture5(){return a(this,h,"f")}set diffuseTexture5(e){s(this,h,e,"f")}get diffuseTexture6(){return a(this,m,"f")}set diffuseTexture6(e){s(this,m,e,"f")}get diffuseTexture7(){return a(this,v,"f")}set diffuseTexture7(e){s(this,v,e,"f")}get diffuseTexture8(){return a(this,g,"f")}set diffuseTexture8(e){s(this,g,e,"f")}get disableLighting(){return a(this,p,"f")}set disableLighting(e){s(this,p,e,"f")}get maxSimultaneousLights(){return a(this,S,"f")}set maxSimultaneousLights(e){s(this,S,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._mixTexture1=n(this,Y,void 0),o.set(this,(n(this,K),n(this,q,void 0))),this._mixTexture2=(n(this,Q),n(this,J,void 0)),f.set(this,(n(this,$),n(this,ee,void 0))),this._diffuseTexture1=(n(this,ie),n(this,te,void 0)),l.set(this,(n(this,ne),n(this,re,void 0))),this._diffuseTexture2=(n(this,ae),n(this,se,void 0)),d.set(this,(n(this,oe),n(this,fe,void 0))),this._diffuseTexture3=(n(this,le),n(this,de,void 0)),u.set(this,(n(this,ue),n(this,ce,void 0))),this._diffuseTexture4=(n(this,he),n(this,me,void 0)),c.set(this,(n(this,ve),n(this,ge,void 0))),this._diffuseTexture5=(n(this,pe),n(this,Se,void 0)),h.set(this,(n(this,xe),n(this,Te,void 0))),this._diffuseTexture6=(n(this,_e),n(this,Ce,void 0)),m.set(this,(n(this,Ee),n(this,Le,void 0))),this._diffuseTexture7=(n(this,Pe),n(this,Ie,void 0)),v.set(this,(n(this,De),n(this,be,void 0))),this._diffuseTexture8=(n(this,Ae),n(this,Fe,void 0)),g.set(this,(n(this,Oe),n(this,Ne,void 0))),this.diffuseColor=(n(this,Me),n(this,Re,new i.Color3(1,1,1))),this.specularColor=(n(this,ye),n(this,Ve,new i.Color3(0,0,0))),this.specularPower=(n(this,Ue),n(this,we,64)),this._disableLighting=(n(this,Ge),n(this,We,!1)),p.set(this,(n(this,Be),n(this,ze,void 0))),this._maxSimultaneousLights=(n(this,He),n(this,ke,4)),S.set(this,(n(this,Xe),n(this,je,void 0))),this._shadersLoaded=(n(this,Ze),!1)}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new P);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(o.texturesEnabled){if(!this._mixTexture1||!this._mixTexture1.isReady())return!1;if(s._needUVs=!0,i.MaterialFlags.DiffuseTextureEnabled){if(!this._diffuseTexture1||!this._diffuseTexture1.isReady())return!1;if(s.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(s.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,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n,this.maxSimultaneousLights),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="mix",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","textureMatrix","logarithmicDepthConstant","diffuse1Infos","diffuse2Infos","diffuse3Infos","diffuse4Infos","diffuse5Infos","diffuse6Infos","diffuse7Infos","diffuse8Infos"],c=["mixMap1Sampler","mixMap2Sampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","diffuse4Sampler","diffuse5Sampler","diffuse6Sampler","diffuse7Sampler","diffuse8Sampler"],h=[];i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return Ri}),Promise.resolve().then(function(){return wi})]):yield Promise.all([Promise.resolve().then(function(){return zi}),Promise.resolve().then(function(){return ji})]),this._shadersLoaded=!0})},f),s,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this.maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),this._afterBind(t,this._activeEffect,n))}getAnimatables(){const 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}getActiveTextures(){const e=super.getActiveTextures();return this._mixTexture1&&e.push(this._mixTexture1),this._diffuseTexture1&&e.push(this._diffuseTexture1),this._diffuseTexture2&&e.push(this._diffuseTexture2),this._diffuseTexture3&&e.push(this._diffuseTexture3),this._diffuseTexture4&&e.push(this._diffuseTexture4),this._mixTexture2&&e.push(this._mixTexture2),this._diffuseTexture5&&e.push(this._diffuseTexture5),this._diffuseTexture6&&e.push(this._diffuseTexture6),this._diffuseTexture7&&e.push(this._diffuseTexture7),this._diffuseTexture8&&e.push(this._diffuseTexture8),e}hasTexture(e){return!!super.hasTexture(e)||this._mixTexture1===e||this._diffuseTexture1===e||this._diffuseTexture2===e||this._diffuseTexture3===e||this._diffuseTexture4===e||this._mixTexture2===e||this._diffuseTexture5===e||this._diffuseTexture6===e||this._diffuseTexture7===e||this._diffuseTexture8===e}dispose(e){this._mixTexture1&&this._mixTexture1.dispose(),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.MixMaterial",e}getClassName(){return"MixMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,f=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,c=new WeakMap,h=new WeakMap,m=new WeakMap,v=new WeakMap,g=new WeakMap,p=new WeakMap,S=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=Z[Symbol.metadata])&&void 0!==n?n:null):void 0;x=[i.serializeAsTexture("mixTexture1")],T=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],_=[i.serializeAsTexture("mixTexture2")],C=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],E=[i.serializeAsTexture("diffuseTexture1")],L=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],I=[i.serializeAsTexture("diffuseTexture2")],D=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],b=[i.serializeAsTexture("diffuseTexture3")],A=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],F=[i.serializeAsTexture("diffuseTexture4")],O=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],N=[i.serializeAsTexture("diffuseTexture1")],M=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],R=[i.serializeAsTexture("diffuseTexture2")],y=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],V=[i.serializeAsTexture("diffuseTexture3")],U=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],w=[i.serializeAsTexture("diffuseTexture4")],G=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],W=[i.serializeAsColor3()],B=[i.serializeAsColor3()],z=[i.serialize()],H=[i.serialize("disableLighting")],k=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],X=[i.serialize("maxSimultaneousLights")],j=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,T,{kind:"accessor",name:"mixTexture1",static:!1,private:!1,access:{has:e=>"mixTexture1"in e,get:e=>e.mixTexture1,set:(e,i)=>{e.mixTexture1=i}},metadata:r},q,Q),t(e,null,C,{kind:"accessor",name:"mixTexture2",static:!1,private:!1,access:{has:e=>"mixTexture2"in e,get:e=>e.mixTexture2,set:(e,i)=>{e.mixTexture2=i}},metadata:r},ee,ie),t(e,null,L,{kind:"accessor",name:"diffuseTexture1",static:!1,private:!1,access:{has:e=>"diffuseTexture1"in e,get:e=>e.diffuseTexture1,set:(e,i)=>{e.diffuseTexture1=i}},metadata:r},re,ae),t(e,null,D,{kind:"accessor",name:"diffuseTexture2",static:!1,private:!1,access:{has:e=>"diffuseTexture2"in e,get:e=>e.diffuseTexture2,set:(e,i)=>{e.diffuseTexture2=i}},metadata:r},fe,le),t(e,null,A,{kind:"accessor",name:"diffuseTexture3",static:!1,private:!1,access:{has:e=>"diffuseTexture3"in e,get:e=>e.diffuseTexture3,set:(e,i)=>{e.diffuseTexture3=i}},metadata:r},ce,he),t(e,null,O,{kind:"accessor",name:"diffuseTexture4",static:!1,private:!1,access:{has:e=>"diffuseTexture4"in e,get:e=>e.diffuseTexture4,set:(e,i)=>{e.diffuseTexture4=i}},metadata:r},ge,pe),t(e,null,M,{kind:"accessor",name:"diffuseTexture5",static:!1,private:!1,access:{has:e=>"diffuseTexture5"in e,get:e=>e.diffuseTexture5,set:(e,i)=>{e.diffuseTexture5=i}},metadata:r},Te,_e),t(e,null,y,{kind:"accessor",name:"diffuseTexture6",static:!1,private:!1,access:{has:e=>"diffuseTexture6"in e,get:e=>e.diffuseTexture6,set:(e,i)=>{e.diffuseTexture6=i}},metadata:r},Le,Pe),t(e,null,U,{kind:"accessor",name:"diffuseTexture7",static:!1,private:!1,access:{has:e=>"diffuseTexture7"in e,get:e=>e.diffuseTexture7,set:(e,i)=>{e.diffuseTexture7=i}},metadata:r},be,Ae),t(e,null,G,{kind:"accessor",name:"diffuseTexture8",static:!1,private:!1,access:{has:e=>"diffuseTexture8"in e,get:e=>e.diffuseTexture8,set:(e,i)=>{e.diffuseTexture8=i}},metadata:r},Ne,Me),t(e,null,k,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},ze,He),t(e,null,j,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},je,Ze),t(null,null,x,{kind:"field",name:"_mixTexture1",static:!1,private:!1,access:{has:e=>"_mixTexture1"in e,get:e=>e._mixTexture1,set:(e,i)=>{e._mixTexture1=i}},metadata:r},Y,K),t(null,null,_,{kind:"field",name:"_mixTexture2",static:!1,private:!1,access:{has:e=>"_mixTexture2"in e,get:e=>e._mixTexture2,set:(e,i)=>{e._mixTexture2=i}},metadata:r},J,$),t(null,null,E,{kind:"field",name:"_diffuseTexture1",static:!1,private:!1,access:{has:e=>"_diffuseTexture1"in e,get:e=>e._diffuseTexture1,set:(e,i)=>{e._diffuseTexture1=i}},metadata:r},te,ne),t(null,null,I,{kind:"field",name:"_diffuseTexture2",static:!1,private:!1,access:{has:e=>"_diffuseTexture2"in e,get:e=>e._diffuseTexture2,set:(e,i)=>{e._diffuseTexture2=i}},metadata:r},se,oe),t(null,null,b,{kind:"field",name:"_diffuseTexture3",static:!1,private:!1,access:{has:e=>"_diffuseTexture3"in e,get:e=>e._diffuseTexture3,set:(e,i)=>{e._diffuseTexture3=i}},metadata:r},de,ue),t(null,null,F,{kind:"field",name:"_diffuseTexture4",static:!1,private:!1,access:{has:e=>"_diffuseTexture4"in e,get:e=>e._diffuseTexture4,set:(e,i)=>{e._diffuseTexture4=i}},metadata:r},me,ve),t(null,null,N,{kind:"field",name:"_diffuseTexture5",static:!1,private:!1,access:{has:e=>"_diffuseTexture5"in e,get:e=>e._diffuseTexture5,set:(e,i)=>{e._diffuseTexture5=i}},metadata:r},Se,xe),t(null,null,R,{kind:"field",name:"_diffuseTexture6",static:!1,private:!1,access:{has:e=>"_diffuseTexture6"in e,get:e=>e._diffuseTexture6,set:(e,i)=>{e._diffuseTexture6=i}},metadata:r},Ce,Ee),t(null,null,V,{kind:"field",name:"_diffuseTexture7",static:!1,private:!1,access:{has:e=>"_diffuseTexture7"in e,get:e=>e._diffuseTexture7,set:(e,i)=>{e._diffuseTexture7=i}},metadata:r},Ie,De),t(null,null,w,{kind:"field",name:"_diffuseTexture8",static:!1,private:!1,access:{has:e=>"_diffuseTexture8"in e,get:e=>e._diffuseTexture8,set:(e,i)=>{e._diffuseTexture8=i}},metadata:r},Fe,Oe),t(null,null,W,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},Re,ye),t(null,null,B,{kind:"field",name:"specularColor",static:!1,private:!1,access:{has:e=>"specularColor"in e,get:e=>e.specularColor,set:(e,i)=>{e.specularColor=i}},metadata:r},Ve,Ue),t(null,null,z,{kind:"field",name:"specularPower",static:!1,private:!1,access:{has:e=>"specularPower"in e,get:e=>e.specularPower,set:(e,i)=>{e.specularPower=i}},metadata:r},we,Ge),t(null,null,H,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},We,Be),t(null,null,X,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},ke,Xe),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.MixMaterial",I);class D extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.LIGHT0=!1,this.LIGHT1=!1,this.LIGHT2=!1,this.LIGHT3=!1,this.SPOTLIGHT0=!1,this.SPOTLIGHT1=!1,this.SPOTLIGHT2=!1,this.SPOTLIGHT3=!1,this.HEMILIGHT0=!1,this.HEMILIGHT1=!1,this.HEMILIGHT2=!1,this.HEMILIGHT3=!1,this.DIRLIGHT0=!1,this.DIRLIGHT1=!1,this.DIRLIGHT2=!1,this.DIRLIGHT3=!1,this.POINTLIGHT0=!1,this.POINTLIGHT1=!1,this.POINTLIGHT2=!1,this.POINTLIGHT3=!1,this.SHADOW0=!1,this.SHADOW1=!1,this.SHADOW2=!1,this.SHADOW3=!1,this.SHADOWS=!1,this.SHADOWESM0=!1,this.SHADOWESM1=!1,this.SHADOWESM2=!1,this.SHADOWESM3=!1,this.SHADOWPOISSON0=!1,this.SHADOWPOISSON1=!1,this.SHADOWPOISSON2=!1,this.SHADOWPOISSON3=!1,this.SHADOWPCF0=!1,this.SHADOWPCF1=!1,this.SHADOWPCF2=!1,this.SHADOWPCF3=!1,this.SHADOWPCSS0=!1,this.SHADOWPCSS1=!1,this.SHADOWPCSS2=!1,this.SHADOWPCSS3=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.THIN_INSTANCES=!1,this.LIGHTING=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let b=(()=>{var e,o,f,l;let d,u,c,h,m,v,g,p=i.PushMaterial,S=[],x=[],T=[],_=[],C=[],E=[],L=[],P=[],I=[],b=[],A=[],F=[],O=[],N=[];return e=class extends p{get diffuseTexture(){return a(this,o,"f")}set diffuseTexture(e){s(this,o,e,"f")}get disableLighting(){return a(this,f,"f")}set disableLighting(e){s(this,f,e,"f")}get maxSimultaneousLights(){return a(this,l,"f")}set maxSimultaneousLights(e){s(this,l,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._diffuseTexture=n(this,S,void 0),o.set(this,(n(this,x),n(this,T,void 0))),this.diffuseColor=(n(this,_),n(this,C,new i.Color3(1,1,1))),this._disableLighting=(n(this,E),n(this,L,!1)),f.set(this,(n(this,P),n(this,I,void 0))),this._maxSimultaneousLights=(n(this,b),n(this,A,4)),l.set(this,(n(this,F),n(this,O,void 0))),this._shadersLoaded=(n(this,N),!1)}needAlphaBlending(){return this.alpha<1}needAlphaBlendingForMesh(e){return this.needAlphaBlending()||e.visibility<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new D);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(s._areTexturesDirty&&(s._needUVs=!1,o.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;s._needUVs=!0,s.DIFFUSE=!0}if(i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=!0,i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n,null,t.getRenderingMesh().hasThinInstances),s.LIGHTING=!this._disableLighting,i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="normal",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant"],c=["diffuseSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:4,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return qi}),Promise.resolve().then(function(){return et})]):yield Promise.all([Promise.resolve().then(function(){return rt}),Promise.resolve().then(function(){return ft})]),this._shadersLoaded=!0})},f),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),this._afterBind(t,this._activeEffect,n))}getAnimatables(){const e=[];return this.diffuseTexture&&this.diffuseTexture.animations&&this.diffuseTexture.animations.length>0&&e.push(this.diffuseTexture),e}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),e}hasTexture(e){return!!super.hasTexture(e)||this.diffuseTexture===e}dispose(e){this.diffuseTexture&&this.diffuseTexture.dispose(),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.NormalMaterial",e}getClassName(){return"NormalMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,f=new WeakMap,l=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=p[Symbol.metadata])&&void 0!==n?n:null):void 0;d=[i.serializeAsTexture("diffuseTexture")],u=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],c=[i.serializeAsColor3()],h=[i.serialize("disableLighting")],m=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],v=[i.serialize("maxSimultaneousLights")],g=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,u,{kind:"accessor",name:"diffuseTexture",static:!1,private:!1,access:{has:e=>"diffuseTexture"in e,get:e=>e.diffuseTexture,set:(e,i)=>{e.diffuseTexture=i}},metadata:r},T,_),t(e,null,m,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},I,b),t(e,null,g,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},O,N),t(null,null,d,{kind:"field",name:"_diffuseTexture",static:!1,private:!1,access:{has:e=>"_diffuseTexture"in e,get:e=>e._diffuseTexture,set:(e,i)=>{e._diffuseTexture=i}},metadata:r},S,x),t(null,null,c,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},C,E),t(null,null,h,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},L,P),t(null,null,v,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},A,F),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.NormalMaterial",b);class A extends i.MaterialDefines{constructor(){super(),this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.rebuild()}}class F extends i.PushMaterial{constructor(e,t,n=!1){super(e,t,void 0,n),this._needAlphaBlending=!0,this._shadersLoaded=!1,this.shadowColor=i.Color3.Black()}needAlphaBlending(){return this._needAlphaBlending}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}get activeLight(){return this._activeLight}set activeLight(e){this._activeLight=e}_getFirstShadowLightForMesh(e){for(const i of e.lightSources)if(i.shadowEnabled)return i;return null}isReadyForSubMesh(e,t,n){var a;const s=t._drawWrapper;if(this.isFrozen&&s.effect&&s._wasPreviouslyReady&&s._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new A);const o=t.materialDefines,f=this.getScene();if(this._isReadyForSubMesh(t))return!0;const l=f.getEngine();if(this._activeLight)for(const i of e.lightSources)if(i.shadowEnabled){if(this._activeLight===i)break;const t=e.lightSources.indexOf(this._activeLight);-1!==t&&(e.lightSources.splice(t,1),e.lightSources.splice(0,0,this._activeLight));break}i.PrepareDefinesForFrameBoundValues(f,l,this,o,!!n),i.PrepareDefinesForMisc(e,f,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),o,void 0,void 0,void 0,this._isVertexOutputInvariant),o._needNormals=i.PrepareDefinesForLights(f,e,o,!1,1);const d=null===(a=this._getFirstShadowLightForMesh(e))||void 0===a?void 0:a.getShadowGenerator();if(this._needAlphaBlending=!0,d&&d.getClassName&&"CascadedShadowGenerator"===d.getClassName()){const e=d;this._needAlphaBlending=!e.autoCalcDepthBounds}if(i.PrepareDefinesForAttributes(e,o,!1,!0),o.isDirty){o.markAsProcessed(),f.resetCachedMaterial();const n=new i.EffectFallbacks;o.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(o,n,1),o.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),o.IMAGEPROCESSINGPOSTPROCESS=f.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];o.NORMAL&&a.push(i.VertexBuffer.NormalKind),i.PrepareAttributesForBones(a,e,o,n),i.PrepareAttributesForInstances(a,o);const s="shadowOnly",d=o.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","alpha","shadowColor","mBones","logarithmicDepthConstant"],c=[],h=["Scene"];i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:o,maxSimultaneousLights:1,shaderLanguage:this._shaderLanguage}),t.setEffect(f.getEngine().createEffect(s,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:1},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return ct}),Promise.resolve().then(function(){return gt})]):yield Promise.all([Promise.resolve().then(function(){return Tt}),Promise.resolve().then(function(){return Lt})]),this._shadersLoaded=!0})},l),o,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(o._renderId=f.getRenderId(),s._wasPreviouslyReady=!0,s._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;if(s){if(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this.bindViewProjection(s),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(i.BindClipPlane(s,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(a,s,r),r.bindEyePosition(s)),r.lightsEnabled){i.BindLights(r,t,this._activeEffect,a,1);const e=this._getFirstShadowLightForMesh(t);e&&(e._renderId=-1)}(r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE||a.SHADOWCSM0)&&this.bindView(s),i.BindFogParameters(r,t,this._activeEffect),this._afterBind(t,this._activeEffect,n)}}clone(e){return i.SerializationHelper.Clone(()=>new F(e,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.ShadowOnlyMaterial",e}getClassName(){return"ShadowOnlyMaterial"}static Parse(e,t,n){return i.SerializationHelper.Parse(()=>new F(e.name,t),e,t,n)}}i.RegisterClass("BABYLON.ShadowOnlyMaterial",F);class O extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let N=(()=>{var e,o,f,l;let d,u,c,h,m,v,g,p=i.PushMaterial,S=[],x=[],T=[],_=[],C=[],E=[],L=[],P=[],I=[],D=[],b=[],A=[],F=[],N=[];return e=class extends p{get diffuseTexture(){return a(this,o,"f")}set diffuseTexture(e){s(this,o,e,"f")}get disableLighting(){return a(this,f,"f")}set disableLighting(e){s(this,f,e,"f")}get maxSimultaneousLights(){return a(this,l,"f")}set maxSimultaneousLights(e){s(this,l,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._diffuseTexture=n(this,S,void 0),o.set(this,(n(this,x),n(this,T,void 0))),this.diffuseColor=(n(this,_),n(this,C,new i.Color3(1,1,1))),this._disableLighting=(n(this,E),n(this,L,!1)),f.set(this,(n(this,P),n(this,I,void 0))),this._maxSimultaneousLights=(n(this,D),n(this,b,4)),l.set(this,(n(this,A),n(this,F,void 0))),this._shadersLoaded=(n(this,N),!1)}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new O);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(s._areTexturesDirty&&(s._needUVs=!1,o.texturesEnabled&&this._diffuseTexture&&i.MaterialFlags.DiffuseTextureEnabled)){if(!this._diffuseTexture.isReady())return!1;s._needUVs=!0,s.DIFFUSE=!0}if(i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n,this.maxSimultaneousLights),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="simple",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","mBones","diffuseMatrix","logarithmicDepthConstant"],c=["diffuseSampler","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights-1},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return bt}),Promise.resolve().then(function(){return Nt})]):yield Promise.all([Promise.resolve().then(function(){return Vt}),Promise.resolve().then(function(){return Wt})]),this._shadersLoaded=!0})},f),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this.maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),this._afterBind(t,this._activeEffect,n))}getAnimatables(){const e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&this._diffuseTexture.animations.length>0&&e.push(this._diffuseTexture),e}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTexture&&e.push(this._diffuseTexture),e}hasTexture(e){return!!super.hasTexture(e)||this.diffuseTexture===e}dispose(e){this._diffuseTexture&&this._diffuseTexture.dispose(),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.SimpleMaterial",e}getClassName(){return"SimpleMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,f=new WeakMap,l=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=p[Symbol.metadata])&&void 0!==n?n:null):void 0;d=[i.serializeAsTexture("diffuseTexture")],u=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],c=[i.serializeAsColor3("diffuse")],h=[i.serialize("disableLighting")],m=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],v=[i.serialize("maxSimultaneousLights")],g=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,u,{kind:"accessor",name:"diffuseTexture",static:!1,private:!1,access:{has:e=>"diffuseTexture"in e,get:e=>e.diffuseTexture,set:(e,i)=>{e.diffuseTexture=i}},metadata:r},T,_),t(e,null,m,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},I,D),t(e,null,g,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},F,N),t(null,null,d,{kind:"field",name:"_diffuseTexture",static:!1,private:!1,access:{has:e=>"_diffuseTexture"in e,get:e=>e._diffuseTexture,set:(e,i)=>{e._diffuseTexture=i}},metadata:r},S,x),t(null,null,c,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},C,E),t(null,null,h,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},L,P),t(null,null,v,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},b,A),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.SimpleMaterial",N);class M extends i.MaterialDefines{constructor(){super(),this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.POINTSIZE=!1,this.FOG=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.DITHER=!1,this.LOGARITHMICDEPTH=!1,this.rebuild()}}let R=(()=>{var e;let a,s,o,f,l,d,u,c,h,m,v,g,p,S=i.PushMaterial,x=[],T=[],_=[],C=[],E=[],L=[],P=[],I=[],D=[],b=[],A=[],F=[],O=[],N=[],R=[],y=[],V=[],U=[],w=[],G=[],W=[],B=[],z=[],H=[],k=[],X=[];return e=class extends S{constructor(e,t,r=!1){super(e,t,void 0,r),this.luminance=n(this,x,1),this.turbidity=(n(this,T),n(this,_,10)),this.rayleigh=(n(this,C),n(this,E,2)),this.mieCoefficient=(n(this,L),n(this,P,.005)),this.mieDirectionalG=(n(this,I),n(this,D,.8)),this.distance=(n(this,b),n(this,A,500)),this.inclination=(n(this,F),n(this,O,.49)),this.azimuth=(n(this,N),n(this,R,.25)),this.sunPosition=(n(this,y),n(this,V,new i.Vector3(0,100,0))),this.useSunPosition=(n(this,U),n(this,w,!1)),this.cameraOffset=(n(this,G),n(this,W,i.Vector3.Zero())),this.up=(n(this,B),n(this,z,i.Vector3.Up())),this.dithering=(n(this,H),n(this,k,!1)),this._cameraPosition=(n(this,X),i.Vector3.Zero()),this._skyOrientation=new i.Quaternion,this._shadersLoaded=!1}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t){const n=t._drawWrapper;if(this.isFrozen&&n.effect&&n._wasPreviouslyReady)return!0;t.materialDefines||(t.materialDefines=new M);const a=t.materialDefines,s=this.getScene();if(this._isReadyForSubMesh(t))return!0;if(i.PrepareDefinesForMisc(e,s,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,!1,a,void 0,void 0,void 0,this._isVertexOutputInvariant),i.PrepareDefinesForAttributes(e,a,!0,!1),a.IMAGEPROCESSINGPOSTPROCESS!==s.imageProcessingConfiguration.applyByPostProcess&&a.markAsMiscDirty(),a.DITHER!==this.dithering&&a.markAsMiscDirty(),a.isDirty){a.markAsProcessed(),s.resetCachedMaterial();const e=new i.EffectFallbacks;a.FOG&&e.addFallback(1,"FOG"),a.IMAGEPROCESSINGPOSTPROCESS=s.imageProcessingConfiguration.applyByPostProcess,a.DITHER=this.dithering;const n=[i.VertexBuffer.PositionKind];a.VERTEXCOLOR&&n.push(i.VertexBuffer.ColorKind);const o="sky",f=["world","viewProjection","view","vFogInfos","vFogColor","logarithmicDepthConstant","pointSize","luminance","turbidity","rayleigh","mieCoefficient","mieDirectionalG","sunPosition","cameraPosition","cameraOffset","up"];i.AddClipPlaneUniforms(f);const l=a.toString();t.setEffect(s.getEngine().createEffect(o,{attributes:n,uniformsNames:f,uniformBuffersNames:[],samplers:[],defines:l,fallbacks:e,onCompiled:this.onCompiled,onError:this.onError,shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return kt}),Promise.resolve().then(function(){return Yt})]):yield Promise.all([Promise.resolve().then(function(){return Jt}),Promise.resolve().then(function(){return nn})]),this._shadersLoaded=!0})},s.getEngine()),a,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(a._renderId=s.getRenderId(),n._wasPreviouslyReady=!0,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;if(!s)return;this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),this._mustRebind(r,s,n)&&(i.BindClipPlane(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r)),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect);const o=r.activeCamera;if(o){const e=o.getWorldMatrix();this._cameraPosition.x=e.m[12],this._cameraPosition.y=e.m[13],this._cameraPosition.z=e.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){const e=Math.PI*(this.inclination-.5),t=2*Math.PI*(this.azimuth-.5);this.sunPosition.x=this.distance*Math.cos(t)*Math.cos(e),this.sunPosition.y=this.distance*Math.sin(-e),this.sunPosition.z=this.distance*Math.sin(t)*Math.cos(e),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(t,this._activeEffect,n)}getAnimatables(){return[]}dispose(e){super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.SkyMaterial",e}getClassName(){return"SkyMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=S[Symbol.metadata])&&void 0!==n?n:null):void 0;a=[i.serialize()],s=[i.serialize()],o=[i.serialize()],f=[i.serialize()],l=[i.serialize()],d=[i.serialize()],u=[i.serialize()],c=[i.serialize()],h=[i.serializeAsVector3()],m=[i.serialize()],v=[i.serializeAsVector3()],g=[i.serializeAsVector3()],p=[i.serialize()],t(null,null,a,{kind:"field",name:"luminance",static:!1,private:!1,access:{has:e=>"luminance"in e,get:e=>e.luminance,set:(e,i)=>{e.luminance=i}},metadata:r},x,T),t(null,null,s,{kind:"field",name:"turbidity",static:!1,private:!1,access:{has:e=>"turbidity"in e,get:e=>e.turbidity,set:(e,i)=>{e.turbidity=i}},metadata:r},_,C),t(null,null,o,{kind:"field",name:"rayleigh",static:!1,private:!1,access:{has:e=>"rayleigh"in e,get:e=>e.rayleigh,set:(e,i)=>{e.rayleigh=i}},metadata:r},E,L),t(null,null,f,{kind:"field",name:"mieCoefficient",static:!1,private:!1,access:{has:e=>"mieCoefficient"in e,get:e=>e.mieCoefficient,set:(e,i)=>{e.mieCoefficient=i}},metadata:r},P,I),t(null,null,l,{kind:"field",name:"mieDirectionalG",static:!1,private:!1,access:{has:e=>"mieDirectionalG"in e,get:e=>e.mieDirectionalG,set:(e,i)=>{e.mieDirectionalG=i}},metadata:r},D,b),t(null,null,d,{kind:"field",name:"distance",static:!1,private:!1,access:{has:e=>"distance"in e,get:e=>e.distance,set:(e,i)=>{e.distance=i}},metadata:r},A,F),t(null,null,u,{kind:"field",name:"inclination",static:!1,private:!1,access:{has:e=>"inclination"in e,get:e=>e.inclination,set:(e,i)=>{e.inclination=i}},metadata:r},O,N),t(null,null,c,{kind:"field",name:"azimuth",static:!1,private:!1,access:{has:e=>"azimuth"in e,get:e=>e.azimuth,set:(e,i)=>{e.azimuth=i}},metadata:r},R,y),t(null,null,h,{kind:"field",name:"sunPosition",static:!1,private:!1,access:{has:e=>"sunPosition"in e,get:e=>e.sunPosition,set:(e,i)=>{e.sunPosition=i}},metadata:r},V,U),t(null,null,m,{kind:"field",name:"useSunPosition",static:!1,private:!1,access:{has:e=>"useSunPosition"in e,get:e=>e.useSunPosition,set:(e,i)=>{e.useSunPosition=i}},metadata:r},w,G),t(null,null,v,{kind:"field",name:"cameraOffset",static:!1,private:!1,access:{has:e=>"cameraOffset"in e,get:e=>e.cameraOffset,set:(e,i)=>{e.cameraOffset=i}},metadata:r},W,B),t(null,null,g,{kind:"field",name:"up",static:!1,private:!1,access:{has:e=>"up"in e,get:e=>e.up,set:(e,i)=>{e.up=i}},metadata:r},z,H),t(null,null,p,{kind:"field",name:"dithering",static:!1,private:!1,access:{has:e=>"dithering"in e,get:e=>e.dithering,set:(e,i)=>{e.dithering=i}},metadata:r},k,X),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.SkyMaterial",R);class y extends i.MaterialDefines{constructor(){super(),this.DIFFUSE=!1,this.BUMP=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.SPECULARTERM=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let V=(()=>{var e,o,f,l,d,u,c,h,m,v;let g,p,S,x,T,_,C,E,L,P,I,D,b,A,F,O,N,M,R,V,U,w=i.PushMaterial,G=[],W=[],B=[],z=[],H=[],k=[],X=[],j=[],Z=[],Y=[],K=[],q=[],Q=[],J=[],$=[],ee=[],ie=[],te=[],ne=[],re=[],ae=[],se=[],oe=[],fe=[],le=[],de=[],ue=[],ce=[],he=[],me=[],ve=[],ge=[],pe=[],Se=[],xe=[],Te=[],_e=[],Ce=[],Ee=[],Le=[],Pe=[],Ie=[];return e=class extends w{get mixTexture(){return a(this,o,"f")}set mixTexture(e){s(this,o,e,"f")}get diffuseTexture1(){return a(this,f,"f")}set diffuseTexture1(e){s(this,f,e,"f")}get diffuseTexture2(){return a(this,l,"f")}set diffuseTexture2(e){s(this,l,e,"f")}get diffuseTexture3(){return a(this,d,"f")}set diffuseTexture3(e){s(this,d,e,"f")}get bumpTexture1(){return a(this,u,"f")}set bumpTexture1(e){s(this,u,e,"f")}get bumpTexture2(){return a(this,c,"f")}set bumpTexture2(e){s(this,c,e,"f")}get bumpTexture3(){return a(this,h,"f")}set bumpTexture3(e){s(this,h,e,"f")}get disableLighting(){return a(this,m,"f")}set disableLighting(e){s(this,m,e,"f")}get maxSimultaneousLights(){return a(this,v,"f")}set maxSimultaneousLights(e){s(this,v,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this._mixTexture=n(this,G,void 0),o.set(this,(n(this,W),n(this,B,void 0))),this._diffuseTexture1=(n(this,z),n(this,H,void 0)),f.set(this,(n(this,k),n(this,X,void 0))),this._diffuseTexture2=(n(this,j),n(this,Z,void 0)),l.set(this,(n(this,Y),n(this,K,void 0))),this._diffuseTexture3=(n(this,q),n(this,Q,void 0)),d.set(this,(n(this,J),n(this,$,void 0))),this._bumpTexture1=(n(this,ee),n(this,ie,void 0)),u.set(this,(n(this,te),n(this,ne,void 0))),this._bumpTexture2=(n(this,re),n(this,ae,void 0)),c.set(this,(n(this,se),n(this,oe,void 0))),this._bumpTexture3=(n(this,fe),n(this,le,void 0)),h.set(this,(n(this,de),n(this,ue,void 0))),this.diffuseColor=(n(this,ce),n(this,he,new i.Color3(1,1,1))),this.specularColor=(n(this,me),n(this,ve,new i.Color3(0,0,0))),this.specularPower=(n(this,ge),n(this,pe,64)),this._disableLighting=(n(this,Se),n(this,xe,!1)),m.set(this,(n(this,Te),n(this,_e,void 0))),this._maxSimultaneousLights=(n(this,Ce),n(this,Ee,4)),v.set(this,(n(this,Le),n(this,Pe,void 0))),this._shadersLoaded=(n(this,Ie),!1)}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new y);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(o.texturesEnabled){if(!this.mixTexture||!this.mixTexture.isReady())return!1;if(s._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;s.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;s._needNormals=!0,s.BUMP=!0}}if(i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n,this.maxSimultaneousLights),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="terrain",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vTextureInfos","mBones","textureMatrix","diffuse1Infos","diffuse2Infos","diffuse3Infos"],c=["textureSampler","diffuse1Sampler","diffuse2Sampler","diffuse3Sampler","bump1Sampler","bump2Sampler","bump3Sampler","logarithmicDepthConstant","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return on}),Promise.resolve().then(function(){return un})]):yield Promise.all([Promise.resolve().then(function(){return vn}),Promise.resolve().then(function(){return xn})]),this._shadersLoaded=!0})},f),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("view",r.getViewMatrix()),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this.maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),this._afterBind(t,this._activeEffect,n))}getAnimatables(){const e=[];return this.mixTexture&&this.mixTexture.animations&&this.mixTexture.animations.length>0&&e.push(this.mixTexture),e}getActiveTextures(){const e=super.getActiveTextures();return this._mixTexture&&e.push(this._mixTexture),this._diffuseTexture1&&e.push(this._diffuseTexture1),this._diffuseTexture2&&e.push(this._diffuseTexture2),this._diffuseTexture3&&e.push(this._diffuseTexture3),this._bumpTexture1&&e.push(this._bumpTexture1),this._bumpTexture2&&e.push(this._bumpTexture2),this._bumpTexture3&&e.push(this._bumpTexture3),e}hasTexture(e){return!!super.hasTexture(e)||this._mixTexture===e||this._diffuseTexture1===e||this._diffuseTexture2===e||this._diffuseTexture3===e||this._bumpTexture1===e||this._bumpTexture2===e||this._bumpTexture3===e}dispose(e){this.mixTexture&&this.mixTexture.dispose(),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.TerrainMaterial",e}getClassName(){return"TerrainMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,f=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,c=new WeakMap,h=new WeakMap,m=new WeakMap,v=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=w[Symbol.metadata])&&void 0!==n?n:null):void 0;g=[i.serializeAsTexture("mixTexture")],p=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],S=[i.serializeAsTexture("diffuseTexture1")],x=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],T=[i.serializeAsTexture("diffuseTexture2")],_=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],C=[i.serializeAsTexture("diffuseTexture3")],E=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],L=[i.serializeAsTexture("bumpTexture1")],P=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],I=[i.serializeAsTexture("bumpTexture2")],D=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],b=[i.serializeAsTexture("bumpTexture3")],A=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],F=[i.serializeAsColor3()],O=[i.serializeAsColor3()],N=[i.serialize()],M=[i.serialize("disableLighting")],R=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],V=[i.serialize("maxSimultaneousLights")],U=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,p,{kind:"accessor",name:"mixTexture",static:!1,private:!1,access:{has:e=>"mixTexture"in e,get:e=>e.mixTexture,set:(e,i)=>{e.mixTexture=i}},metadata:r},B,z),t(e,null,x,{kind:"accessor",name:"diffuseTexture1",static:!1,private:!1,access:{has:e=>"diffuseTexture1"in e,get:e=>e.diffuseTexture1,set:(e,i)=>{e.diffuseTexture1=i}},metadata:r},X,j),t(e,null,_,{kind:"accessor",name:"diffuseTexture2",static:!1,private:!1,access:{has:e=>"diffuseTexture2"in e,get:e=>e.diffuseTexture2,set:(e,i)=>{e.diffuseTexture2=i}},metadata:r},K,q),t(e,null,E,{kind:"accessor",name:"diffuseTexture3",static:!1,private:!1,access:{has:e=>"diffuseTexture3"in e,get:e=>e.diffuseTexture3,set:(e,i)=>{e.diffuseTexture3=i}},metadata:r},$,ee),t(e,null,P,{kind:"accessor",name:"bumpTexture1",static:!1,private:!1,access:{has:e=>"bumpTexture1"in e,get:e=>e.bumpTexture1,set:(e,i)=>{e.bumpTexture1=i}},metadata:r},ne,re),t(e,null,D,{kind:"accessor",name:"bumpTexture2",static:!1,private:!1,access:{has:e=>"bumpTexture2"in e,get:e=>e.bumpTexture2,set:(e,i)=>{e.bumpTexture2=i}},metadata:r},oe,fe),t(e,null,A,{kind:"accessor",name:"bumpTexture3",static:!1,private:!1,access:{has:e=>"bumpTexture3"in e,get:e=>e.bumpTexture3,set:(e,i)=>{e.bumpTexture3=i}},metadata:r},ue,ce),t(e,null,R,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},_e,Ce),t(e,null,U,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},Pe,Ie),t(null,null,g,{kind:"field",name:"_mixTexture",static:!1,private:!1,access:{has:e=>"_mixTexture"in e,get:e=>e._mixTexture,set:(e,i)=>{e._mixTexture=i}},metadata:r},G,W),t(null,null,S,{kind:"field",name:"_diffuseTexture1",static:!1,private:!1,access:{has:e=>"_diffuseTexture1"in e,get:e=>e._diffuseTexture1,set:(e,i)=>{e._diffuseTexture1=i}},metadata:r},H,k),t(null,null,T,{kind:"field",name:"_diffuseTexture2",static:!1,private:!1,access:{has:e=>"_diffuseTexture2"in e,get:e=>e._diffuseTexture2,set:(e,i)=>{e._diffuseTexture2=i}},metadata:r},Z,Y),t(null,null,C,{kind:"field",name:"_diffuseTexture3",static:!1,private:!1,access:{has:e=>"_diffuseTexture3"in e,get:e=>e._diffuseTexture3,set:(e,i)=>{e._diffuseTexture3=i}},metadata:r},Q,J),t(null,null,L,{kind:"field",name:"_bumpTexture1",static:!1,private:!1,access:{has:e=>"_bumpTexture1"in e,get:e=>e._bumpTexture1,set:(e,i)=>{e._bumpTexture1=i}},metadata:r},ie,te),t(null,null,I,{kind:"field",name:"_bumpTexture2",static:!1,private:!1,access:{has:e=>"_bumpTexture2"in e,get:e=>e._bumpTexture2,set:(e,i)=>{e._bumpTexture2=i}},metadata:r},ae,se),t(null,null,b,{kind:"field",name:"_bumpTexture3",static:!1,private:!1,access:{has:e=>"_bumpTexture3"in e,get:e=>e._bumpTexture3,set:(e,i)=>{e._bumpTexture3=i}},metadata:r},le,de),t(null,null,F,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},he,me),t(null,null,O,{kind:"field",name:"specularColor",static:!1,private:!1,access:{has:e=>"specularColor"in e,get:e=>e.specularColor,set:(e,i)=>{e.specularColor=i}},metadata:r},ve,ge),t(null,null,N,{kind:"field",name:"specularPower",static:!1,private:!1,access:{has:e=>"specularPower"in e,get:e=>e.specularPower,set:(e,i)=>{e.specularPower=i}},metadata:r},pe,Se),t(null,null,M,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},xe,Te),t(null,null,V,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},Ee,Le),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.TerrainMaterial",V);class U extends i.MaterialDefines{constructor(){super(),this.DIFFUSEX=!1,this.DIFFUSEY=!1,this.DIFFUSEZ=!1,this.BUMPX=!1,this.BUMPY=!1,this.BUMPZ=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.SPECULARTERM=!1,this.NORMAL=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.NONUNIFORMSCALING=!1,this.LOGARITHMICDEPTH=!1,this.AREALIGHTSUPPORTED=!0,this.AREALIGHTNOROUGHTNESS=!0,this.rebuild()}}let w=(()=>{var e,o,f,l,d,u,c,h,m;let v,g,p,S,x,T,_,C,E,L,P,I,D,b,A,F,O,N,M,R,y,V=i.PushMaterial,w=[],G=[],W=[],B=[],z=[],H=[],k=[],X=[],j=[],Z=[],Y=[],K=[],q=[],Q=[],J=[],$=[],ee=[],ie=[],te=[],ne=[],re=[],ae=[],se=[],oe=[],fe=[],le=[],de=[],ue=[],ce=[],he=[],me=[],ve=[],ge=[],pe=[],Se=[],xe=[],Te=[],_e=[],Ce=[],Ee=[],Le=[],Pe=[];return e=class extends V{get diffuseTextureX(){return a(this,o,"f")}set diffuseTextureX(e){s(this,o,e,"f")}get diffuseTextureY(){return a(this,f,"f")}set diffuseTextureY(e){s(this,f,e,"f")}get diffuseTextureZ(){return a(this,l,"f")}set diffuseTextureZ(e){s(this,l,e,"f")}get normalTextureX(){return a(this,d,"f")}set normalTextureX(e){s(this,d,e,"f")}get normalTextureY(){return a(this,u,"f")}set normalTextureY(e){s(this,u,e,"f")}get normalTextureZ(){return a(this,c,"f")}set normalTextureZ(e){s(this,c,e,"f")}get disableLighting(){return a(this,h,"f")}set disableLighting(e){s(this,h,e,"f")}get maxSimultaneousLights(){return a(this,m,"f")}set maxSimultaneousLights(e){s(this,m,e,"f")}constructor(e,t,r=!1){super(e,t,void 0,r),this.mixTexture=n(this,w,void 0),this._diffuseTextureX=(n(this,G),n(this,W,void 0)),o.set(this,(n(this,B),n(this,z,void 0))),this._diffuseTextureY=(n(this,H),n(this,k,void 0)),f.set(this,(n(this,X),n(this,j,void 0))),this._diffuseTextureZ=(n(this,Z),n(this,Y,void 0)),l.set(this,(n(this,K),n(this,q,void 0))),this._normalTextureX=(n(this,Q),n(this,J,void 0)),d.set(this,(n(this,$),n(this,ee,void 0))),this._normalTextureY=(n(this,ie),n(this,te,void 0)),u.set(this,(n(this,ne),n(this,re,void 0))),this._normalTextureZ=(n(this,ae),n(this,se,void 0)),c.set(this,(n(this,oe),n(this,fe,void 0))),this.tileSize=(n(this,le),n(this,de,1)),this.diffuseColor=(n(this,ue),n(this,ce,new i.Color3(1,1,1))),this.specularColor=(n(this,he),n(this,me,new i.Color3(.2,.2,.2))),this.specularPower=(n(this,ve),n(this,ge,64)),this._disableLighting=(n(this,pe),n(this,Se,!1)),h.set(this,(n(this,xe),n(this,Te,void 0))),this._maxSimultaneousLights=(n(this,_e),n(this,Ce,4)),m.set(this,(n(this,Ee),n(this,Le,void 0))),this._shadersLoaded=(n(this,Pe),!1)}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new U);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(s._areTexturesDirty&&o.texturesEnabled){if(i.MaterialFlags.DiffuseTextureEnabled){const e=[this.diffuseTextureX,this.diffuseTextureY,this.diffuseTextureZ],i=["DIFFUSEX","DIFFUSEY","DIFFUSEZ"];for(let t=0;t<e.length;t++)if(e[t]){if(!e[t].isReady())return!1;s[i[t]]=!0}}if(i.MaterialFlags.BumpTextureEnabled){const e=[this.normalTextureX,this.normalTextureY,this.normalTextureZ],i=["BUMPX","BUMPY","BUMPZ"];for(let t=0;t<e.length;t++)if(e[t]){if(!e[t].isReady())return!1;s[i[t]]=!0}}}if(i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._needNormals=i.PrepareDefinesForLights(o,e,s,!1,this._maxSimultaneousLights,this._disableLighting),i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForAttributes(e,s,!0,!0),s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),i.HandleFallbacksForShadows(s,n,this.maxSimultaneousLights),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e),s.IMAGEPROCESSINGPOSTPROCESS=o.imageProcessingConfiguration.applyByPostProcess;const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="triplanar",d=s.toString(),u=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","mBones","tileSize"],c=["diffuseSamplerX","diffuseSamplerY","diffuseSamplerZ","normalSamplerX","normalSamplerY","normalSamplerZ","logarithmicDepthConstant","areaLightsLTC1Sampler","areaLightsLTC2Sampler"],h=[];i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this.maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return En}),Promise.resolve().then(function(){return Dn})]):yield Promise.all([Promise.resolve().then(function(){return On}),Promise.resolve().then(function(){return yn})]),this._shadersLoaded=!0})},f),s,this._materialContext)}if(s.AREALIGHTUSED)for(let i=0;i<e.lightSources.length;i++)if(!e.lightSources[i]._isReady())return!1;return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._activeEffect.setFloat("tileSize",this.tileSize),this._mustRebind(r,s,n)&&(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(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this.maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),this._afterBind(t,this._activeEffect,n))}getAnimatables(){const e=[];return this.mixTexture&&this.mixTexture.animations&&this.mixTexture.animations.length>0&&e.push(this.mixTexture),e}getActiveTextures(){const e=super.getActiveTextures();return this._diffuseTextureX&&e.push(this._diffuseTextureX),this._diffuseTextureY&&e.push(this._diffuseTextureY),this._diffuseTextureZ&&e.push(this._diffuseTextureZ),this._normalTextureX&&e.push(this._normalTextureX),this._normalTextureY&&e.push(this._normalTextureY),this._normalTextureZ&&e.push(this._normalTextureZ),e}hasTexture(e){return!!super.hasTexture(e)||this._diffuseTextureX===e||this._diffuseTextureY===e||this._diffuseTextureZ===e||this._normalTextureX===e||this._normalTextureY===e||this._normalTextureZ===e}dispose(e){this.mixTexture&&this.mixTexture.dispose(),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();return e.customType="BABYLON.TriPlanarMaterial",e}getClassName(){return"TriPlanarMaterial"}static Parse(t,n,r){return i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r)}},o=new WeakMap,f=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,c=new WeakMap,h=new WeakMap,m=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=V[Symbol.metadata])&&void 0!==n?n:null):void 0;v=[i.serializeAsTexture()],g=[i.serializeAsTexture("diffuseTextureX")],p=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],S=[i.serializeAsTexture("diffuseTexturY")],x=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],T=[i.serializeAsTexture("diffuseTextureZ")],_=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],C=[i.serializeAsTexture("normalTextureX")],E=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],L=[i.serializeAsTexture("normalTextureY")],P=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],I=[i.serializeAsTexture("normalTextureZ")],D=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],b=[i.serialize()],A=[i.serializeAsColor3()],F=[i.serializeAsColor3()],O=[i.serialize()],N=[i.serialize("disableLighting")],M=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],R=[i.serialize("maxSimultaneousLights")],y=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],t(e,null,p,{kind:"accessor",name:"diffuseTextureX",static:!1,private:!1,access:{has:e=>"diffuseTextureX"in e,get:e=>e.diffuseTextureX,set:(e,i)=>{e.diffuseTextureX=i}},metadata:r},z,H),t(e,null,x,{kind:"accessor",name:"diffuseTextureY",static:!1,private:!1,access:{has:e=>"diffuseTextureY"in e,get:e=>e.diffuseTextureY,set:(e,i)=>{e.diffuseTextureY=i}},metadata:r},j,Z),t(e,null,_,{kind:"accessor",name:"diffuseTextureZ",static:!1,private:!1,access:{has:e=>"diffuseTextureZ"in e,get:e=>e.diffuseTextureZ,set:(e,i)=>{e.diffuseTextureZ=i}},metadata:r},q,Q),t(e,null,E,{kind:"accessor",name:"normalTextureX",static:!1,private:!1,access:{has:e=>"normalTextureX"in e,get:e=>e.normalTextureX,set:(e,i)=>{e.normalTextureX=i}},metadata:r},ee,ie),t(e,null,P,{kind:"accessor",name:"normalTextureY",static:!1,private:!1,access:{has:e=>"normalTextureY"in e,get:e=>e.normalTextureY,set:(e,i)=>{e.normalTextureY=i}},metadata:r},re,ae),t(e,null,D,{kind:"accessor",name:"normalTextureZ",static:!1,private:!1,access:{has:e=>"normalTextureZ"in e,get:e=>e.normalTextureZ,set:(e,i)=>{e.normalTextureZ=i}},metadata:r},fe,le),t(e,null,M,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},Te,_e),t(e,null,y,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},Le,Pe),t(null,null,v,{kind:"field",name:"mixTexture",static:!1,private:!1,access:{has:e=>"mixTexture"in e,get:e=>e.mixTexture,set:(e,i)=>{e.mixTexture=i}},metadata:r},w,G),t(null,null,g,{kind:"field",name:"_diffuseTextureX",static:!1,private:!1,access:{has:e=>"_diffuseTextureX"in e,get:e=>e._diffuseTextureX,set:(e,i)=>{e._diffuseTextureX=i}},metadata:r},W,B),t(null,null,S,{kind:"field",name:"_diffuseTextureY",static:!1,private:!1,access:{has:e=>"_diffuseTextureY"in e,get:e=>e._diffuseTextureY,set:(e,i)=>{e._diffuseTextureY=i}},metadata:r},k,X),t(null,null,T,{kind:"field",name:"_diffuseTextureZ",static:!1,private:!1,access:{has:e=>"_diffuseTextureZ"in e,get:e=>e._diffuseTextureZ,set:(e,i)=>{e._diffuseTextureZ=i}},metadata:r},Y,K),t(null,null,C,{kind:"field",name:"_normalTextureX",static:!1,private:!1,access:{has:e=>"_normalTextureX"in e,get:e=>e._normalTextureX,set:(e,i)=>{e._normalTextureX=i}},metadata:r},J,$),t(null,null,L,{kind:"field",name:"_normalTextureY",static:!1,private:!1,access:{has:e=>"_normalTextureY"in e,get:e=>e._normalTextureY,set:(e,i)=>{e._normalTextureY=i}},metadata:r},te,ne),t(null,null,I,{kind:"field",name:"_normalTextureZ",static:!1,private:!1,access:{has:e=>"_normalTextureZ"in e,get:e=>e._normalTextureZ,set:(e,i)=>{e._normalTextureZ=i}},metadata:r},se,oe),t(null,null,b,{kind:"field",name:"tileSize",static:!1,private:!1,access:{has:e=>"tileSize"in e,get:e=>e.tileSize,set:(e,i)=>{e.tileSize=i}},metadata:r},de,ue),t(null,null,A,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},ce,he),t(null,null,F,{kind:"field",name:"specularColor",static:!1,private:!1,access:{has:e=>"specularColor"in e,get:e=>e.specularColor,set:(e,i)=>{e.specularColor=i}},metadata:r},me,ve),t(null,null,O,{kind:"field",name:"specularPower",static:!1,private:!1,access:{has:e=>"specularPower"in e,get:e=>e.specularPower,set:(e,i)=>{e.specularPower=i}},metadata:r},ge,pe),t(null,null,N,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},Se,xe),t(null,null,R,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},Ce,Ee),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.TriPlanarMaterial",w);class G extends i.MaterialDefines{constructor(){super(),this.BUMP=!1,this.REFLECTION=!1,this.CLIPPLANE=!1,this.CLIPPLANE2=!1,this.CLIPPLANE3=!1,this.CLIPPLANE4=!1,this.CLIPPLANE5=!1,this.CLIPPLANE6=!1,this.ALPHATEST=!1,this.DEPTHPREPASS=!1,this.POINTSIZE=!1,this.FOG=!1,this.NORMAL=!1,this.UV1=!1,this.UV2=!1,this.VERTEXCOLOR=!1,this.VERTEXALPHA=!1,this.NUM_BONE_INFLUENCERS=0,this.BonesPerMesh=0,this.INSTANCES=!1,this.INSTANCESCOLOR=!1,this.SPECULARTERM=!1,this.LOGARITHMICDEPTH=!1,this.USE_REVERSE_DEPTHBUFFER=!1,this.FRESNELSEPARATE=!1,this.BUMPSUPERIMPOSE=!1,this.BUMPAFFECTSREFLECTION=!1,this.USE_WORLD_COORDINATES=!1,this.IMAGEPROCESSING=!1,this.VIGNETTE=!1,this.VIGNETTEBLENDMODEMULTIPLY=!1,this.VIGNETTEBLENDMODEOPAQUE=!1,this.TONEMAPPING=0,this.CONTRAST=!1,this.EXPOSURE=!1,this.COLORCURVES=!1,this.COLORGRADING=!1,this.COLORGRADING3D=!1,this.SAMPLER3DGREENDEPTH=!1,this.SAMPLER3DBGRMAP=!1,this.DITHER=!1,this.IMAGEPROCESSINGPOSTPROCESS=!1,this.SKIPFINALCOLORCLAMP=!1,this.rebuild()}}let W=(()=>{var e,o,f,l,d,u,c,h;let m,v,g,p,S,x,T,_,C,E,L,P,I,D,b,A,F,O,N,M,R,y,V,U,w,W,B,z,H,k=i.PushMaterial,X=[],j=[],Z=[],Y=[],K=[],q=[],Q=[],J=[],$=[],ee=[],ie=[],te=[],ne=[],re=[],ae=[],se=[],oe=[],fe=[],le=[],de=[],ue=[],ce=[],he=[],me=[],ve=[],ge=[],pe=[],Se=[],xe=[],Te=[],_e=[],Ce=[],Ee=[],Le=[],Pe=[],Ie=[],De=[],be=[],Ae=[],Fe=[],Oe=[],Ne=[],Me=[],Re=[],ye=[],Ve=[],Ue=[],we=[],Ge=[],We=[],Be=[],ze=[],He=[],ke=[],Xe=[],je=[],Ze=[],Ye=[];return e=class extends k{get bumpTexture(){return a(this,o,"f")}set bumpTexture(e){s(this,o,e,"f")}get disableLighting(){return a(this,f,"f")}set disableLighting(e){s(this,f,e,"f")}get maxSimultaneousLights(){return a(this,l,"f")}set maxSimultaneousLights(e){s(this,l,e,"f")}get bumpSuperimpose(){return a(this,d,"f")}set bumpSuperimpose(e){s(this,d,e,"f")}get fresnelSeparate(){return a(this,u,"f")}set fresnelSeparate(e){s(this,u,e,"f")}get bumpAffectsReflection(){return a(this,c,"f")}set bumpAffectsReflection(e){s(this,c,e,"f")}get useWorldCoordinatesForWaveDeformation(){return a(this,h,"f")}set useWorldCoordinatesForWaveDeformation(e){s(this,h,e,"f")}get hasRenderTargetTextures(){return!0}constructor(e,t,r=new i.Vector2(512,512),a=!1){super(e,t,void 0,a),this.renderTargetSize=r,this._bumpTexture=n(this,X,void 0),o.set(this,(n(this,j),n(this,Z,void 0))),this.diffuseColor=(n(this,Y),n(this,K,new i.Color3(1,1,1))),this.specularColor=(n(this,q),n(this,Q,new i.Color3(0,0,0))),this.specularPower=(n(this,J),n(this,$,64)),this._disableLighting=(n(this,ee),n(this,ie,!1)),f.set(this,(n(this,te),n(this,ne,void 0))),this._maxSimultaneousLights=(n(this,re),n(this,ae,4)),l.set(this,(n(this,se),n(this,oe,void 0))),this.windForce=(n(this,fe),n(this,le,6)),this.windDirection=(n(this,de),n(this,ue,new i.Vector2(0,1))),this.waveHeight=(n(this,ce),n(this,he,.4)),this.bumpHeight=(n(this,me),n(this,ve,.4)),this._bumpSuperimpose=(n(this,ge),n(this,pe,!1)),d.set(this,(n(this,Se),n(this,xe,void 0))),this._fresnelSeparate=(n(this,Te),n(this,_e,!1)),u.set(this,(n(this,Ce),n(this,Ee,void 0))),this._bumpAffectsReflection=(n(this,Le),n(this,Pe,!1)),c.set(this,(n(this,Ie),n(this,De,void 0))),this.waterColor=(n(this,be),n(this,Ae,new i.Color3(.1,.1,.6))),this.colorBlendFactor=(n(this,Fe),n(this,Oe,.2)),this.waterColor2=(n(this,Ne),n(this,Me,new i.Color3(.1,.1,.6))),this.colorBlendFactor2=(n(this,Re),n(this,ye,.2)),this.waveLength=(n(this,Ve),n(this,Ue,.1)),this.waveSpeed=(n(this,we),n(this,Ge,1)),this.waveCount=(n(this,We),n(this,Be,20)),this.disableClipPlane=(n(this,ze),n(this,He,!1)),this._useWorldCoordinatesForWaveDeformation=(n(this,ke),n(this,Xe,!1)),h.set(this,(n(this,je),n(this,Ze,void 0))),this._renderTargets=(n(this,Ye),new i.SmartArray(16)),this._mesh=null,this._reflectionTransform=i.Matrix.Zero(),this._offsetMirror=i.Matrix.Zero(),this._tempPlane=new i.Plane(0,0,0,0),this._lastTime=0,this._shadersLoaded=!1,this._lastDeltaTime=0,this._createRenderTargets(this.getScene(),r),this.getRenderTargetTextures=()=>(this._renderTargets.reset(),this._renderTargets.push(this._reflectionRTT),this._renderTargets.push(this._refractionRTT),this._renderTargets),this._imageProcessingConfiguration=this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add(()=>{this._markAllSubMeshesAsImageProcessingDirty()}))}get refractionTexture(){return this._refractionRTT}get reflectionTexture(){return this._reflectionRTT}addToRenderList(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)}removeFromRenderList(e){if(this._refractionRTT&&this._refractionRTT.renderList){const i=this._refractionRTT.renderList.indexOf(e);-1!==i&&this._refractionRTT.renderList.splice(i,1)}if(this._reflectionRTT&&this._reflectionRTT.renderList){const i=this._reflectionRTT.renderList.indexOf(e);-1!==i&&this._reflectionRTT.renderList.splice(i,1)}}enableRenderTargets(e){const i=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=i),this._reflectionRTT&&(this._reflectionRTT.refreshRate=i)}getRenderList(){return this._refractionRTT?this._refractionRTT.renderList:[]}get renderTargetsEnabled(){return!(this._refractionRTT&&0===this._refractionRTT.refreshRate)}needAlphaBlending(){return this.alpha<1}needAlphaTesting(){return!1}getAlphaTestTexture(){return null}isReadyForSubMesh(e,t,n){const a=t._drawWrapper;if(this.isFrozen&&a.effect&&a._wasPreviouslyReady&&a._wasPreviouslyUsingInstances===n)return!0;t.materialDefines||(t.materialDefines=new G);const s=t.materialDefines,o=this.getScene();if(this._isReadyForSubMesh(t))return!0;const f=o.getEngine();if(s._areTexturesDirty&&(s._needUVs=!1,o.texturesEnabled)){if(this.bumpTexture&&i.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture.isReady())return!1;s._needUVs=!0,s.BUMP=!0}i.MaterialFlags.ReflectionTextureEnabled&&(s.REFLECTION=!0)}if(i.PrepareDefinesForFrameBoundValues(o,f,this,s,!!n),i.PrepareDefinesForMisc(e,o,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),s,void 0,void 0,void 0,this._isVertexOutputInvariant),s._areMiscDirty&&(s.FRESNELSEPARATE=this._fresnelSeparate,s.BUMPSUPERIMPOSE=this._bumpSuperimpose,s.BUMPAFFECTSREFLECTION=this._bumpAffectsReflection,s.USE_WORLD_COORDINATES=this._useWorldCoordinatesForWaveDeformation),s._needNormals=i.PrepareDefinesForLights(o,e,s,!0,this._maxSimultaneousLights,this._disableLighting),s._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(s),s.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,s.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(i.PrepareDefinesForAttributes(e,s,!0,!0),this._mesh=e,this._waitingRenderList){for(let e=0;e<this._waitingRenderList.length;e++)this.addToRenderList(o.getNodeById(this._waitingRenderList[e]));this._waitingRenderList=null}if(s.isDirty){s.markAsProcessed(),o.resetCachedMaterial();const n=new i.EffectFallbacks;s.FOG&&n.addFallback(1,"FOG"),s.LOGARITHMICDEPTH&&n.addFallback(0,"LOGARITHMICDEPTH"),i.HandleFallbacksForShadows(s,n,this.maxSimultaneousLights),s.NUM_BONE_INFLUENCERS>0&&n.addCPUSkinningFallback(0,e);const a=[i.VertexBuffer.PositionKind];s.NORMAL&&a.push(i.VertexBuffer.NormalKind),s.UV1&&a.push(i.VertexBuffer.UVKind),s.UV2&&a.push(i.VertexBuffer.UV2Kind),s.VERTEXCOLOR&&a.push(i.VertexBuffer.ColorKind),i.PrepareAttributesForBones(a,e,s,n),i.PrepareAttributesForInstances(a,s);const l="water",d=s.toString(),u=["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"],c=["normalSampler","refractionSampler","reflectionSampler"],h=[];i.ImageProcessingConfiguration&&(i.ImageProcessingConfiguration.PrepareUniforms(u,s),i.ImageProcessingConfiguration.PrepareSamplers(c,s)),i.AddClipPlaneUniforms(u),i.PrepareUniformsAndSamplersList({uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:s,maxSimultaneousLights:this.maxSimultaneousLights,shaderLanguage:this._shaderLanguage}),t.setEffect(o.getEngine().createEffect(l,{attributes:a,uniformsNames:u,uniformBuffersNames:h,samplers:c,defines:d,fallbacks:n,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights},shaderLanguage:this._shaderLanguage,extraInitializationsAsync:this._shadersLoaded?void 0:()=>r(this,void 0,void 0,function*(){1===this.shaderLanguage?yield Promise.all([Promise.resolve().then(function(){return Gn}),Promise.resolve().then(function(){return Hn})]):yield Promise.all([Promise.resolve().then(function(){return Zn}),Promise.resolve().then(function(){return Qn})]),this._shadersLoaded=!0})},f),s,this._materialContext)}return!(!t.effect||!t.effect.isReady()||(s._renderId=o.getRenderId(),a._wasPreviouslyReady=!0,a._wasPreviouslyUsingInstances=!!n,0))}bindForSubMesh(e,t,n){const r=this.getScene(),a=n.materialDefines;if(!a)return;const s=n.effect;if(!s||!this._mesh)return;this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),i.BindBonesParameters(t,this._activeEffect),this._mustRebind(r,s,n)&&(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(s,this,r),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&i.BindLogDepth(a,s,r),r.bindEyePosition(s)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),r.lightsEnabled&&!this.disableLighting&&i.BindLights(r,t,this._activeEffect,a,this.maxSimultaneousLights),r.fogEnabled&&t.applyFog&&r.fogMode!==i.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",r.getViewMatrix()),i.BindFogParameters(r,t,this._activeEffect),i.BindLogDepth(a,this._activeEffect,r),i.MaterialFlags.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));const o=i.TmpVectors.Matrix[3].copyFrom(this._reflectionTransform);if(r.floatingOriginMode){const e=i.OffsetViewToRef(r.floatingOriginOffset,r.getViewMatrix(),i.TmpVectors.Matrix[1]);i.MultiplyMatricesToRef(this._offsetMirror,e,o)}o.multiplyToRef(r.getProjectionMatrix(),o);const f=r.getEngine().getDeltaTime();f!==this._lastDeltaTime&&(this._lastDeltaTime=f,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("reflectionViewProjection",o),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(t,this._activeEffect,n)}_createRenderTargets(e,t){this._refractionRTT=new i.RenderTargetTexture(name+"_refraction",{width:t.x,height:t.y},e,!1,!0),this._refractionRTT.wrapU=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0;let n,r=!1;this._refractionRTT.onBeforeRenderObservable.add(()=>{r=e.getBoundingBoxRenderer().enabled,e.getBoundingBoxRenderer().enabled=!1}),this._refractionRTT.onAfterRenderObservable.add(()=>{e.getBoundingBoxRenderer().enabled=r}),this._reflectionRTT=new i.RenderTargetTexture(name+"_reflection",{width:t.x,height:t.y},e,!1,!0),this._reflectionRTT.wrapU=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=i.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;let a,s=null;const o=i.Matrix.Zero();this._refractionRTT.onBeforeRender=()=>{if(this._mesh&&(n=this._mesh.isVisible,this._mesh.isVisible=!1),!this.disableClipPlane){s=e.clipPlane;const t=this._mesh?this._mesh.absolutePosition.y:0;e.clipPlane=i.Plane.FromPositionAndNormal(new i.Vector3(0,t+.05,0),new i.Vector3(0,1,0))}},this._refractionRTT.onAfterRender=()=>{this._mesh&&(this._mesh.isVisible=n),this.disableClipPlane||(e.clipPlane=s)},this._reflectionRTT.onBeforeRender=()=>{if(this._mesh&&(n=this._mesh.isVisible,this._mesh.isVisible=!1),!this.disableClipPlane){s=e.clipPlane;const t=this._mesh?this._mesh.absolutePosition.y:0;e.clipPlane=i.Plane.FromPositionAndNormal(new i.Vector3(0,t-.05,0),new i.Vector3(0,-1,0)),i.Matrix.ReflectionToRef(e.clipPlane,o),this._offsetMirror.copyFrom(o),e.floatingOriginMode&&(i.OffsetClipPlaneToRef(e.floatingOriginOffset,e.clipPlane,this._tempPlane),i.Matrix.ReflectionToRef(this._tempPlane,this._offsetMirror))}a=e.getViewMatrix(),o.multiplyToRef(a,this._reflectionTransform),e.setTransformMatrix(this._reflectionTransform,e.getProjectionMatrix());const t=i.Vector3.TransformCoordinates(e.activeCamera.position,o);e._mirroredCameraPosition=t,e._forcedViewPosition=t},this._reflectionRTT.onAfterRender=()=>{this._mesh&&(this._mesh.isVisible=n),e.clipPlane=s,e.setTransformMatrix(a,e.getProjectionMatrix()),e._mirroredCameraPosition=null,e._forcedViewPosition=null}}getAnimatables(){const 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}getActiveTextures(){const e=super.getActiveTextures();return this._bumpTexture&&e.push(this._bumpTexture),e}hasTexture(e){return!!super.hasTexture(e)||this._bumpTexture===e}dispose(e){this.bumpTexture&&this.bumpTexture.dispose();let i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);-1!=i&&this.getScene().customRenderTargets.splice(i,1),i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT),-1!=i&&this.getScene().customRenderTargets.splice(i,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),super.dispose(e)}clone(t){return i.SerializationHelper.Clone(()=>new e(t,this.getScene()),this)}serialize(){const e=super.serialize();if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(let i=0;i<this._refractionRTT.renderList.length;i++)e.renderList.push(this._refractionRTT.renderList[i].id);return e}getClassName(){return"WaterMaterial"}static Parse(t,n,r){const a=i.SerializationHelper.Parse(()=>new e(t.name,n),t,n,r);return a._waitingRenderList=t.renderList,a}static CreateDefaultMesh(e,t){return i.CreateGround(e,{width:512,height:512,subdivisions:32,updatable:!1},t)}},o=new WeakMap,f=new WeakMap,l=new WeakMap,d=new WeakMap,u=new WeakMap,c=new WeakMap,h=new WeakMap,(()=>{var n;const r="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(n=k[Symbol.metadata])&&void 0!==n?n:null):void 0;m=[i.serializeAsTexture("bumpTexture")],v=[i.expandToProperty("_markAllSubMeshesAsTexturesDirty")],g=[i.serializeAsColor3()],p=[i.serializeAsColor3()],S=[i.serialize()],x=[i.serialize("disableLighting")],T=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],_=[i.serialize("maxSimultaneousLights")],C=[i.expandToProperty("_markAllSubMeshesAsLightsDirty")],E=[i.serialize()],L=[i.serializeAsVector2()],P=[i.serialize()],I=[i.serialize()],D=[i.serialize("bumpSuperimpose")],b=[i.expandToProperty("_markAllSubMeshesAsMiscDirty")],A=[i.serialize("fresnelSeparate")],F=[i.expandToProperty("_markAllSubMeshesAsMiscDirty")],O=[i.serialize("bumpAffectsReflection")],N=[i.expandToProperty("_markAllSubMeshesAsMiscDirty")],M=[i.serializeAsColor3()],R=[i.serialize()],y=[i.serializeAsColor3()],V=[i.serialize()],U=[i.serialize()],w=[i.serialize()],W=[i.serialize()],B=[i.serialize()],z=[i.serialize("useWorldCoordinatesForWaveDeformation")],H=[i.expandToProperty("_markAllSubMeshesAsMiscDirty")],t(e,null,v,{kind:"accessor",name:"bumpTexture",static:!1,private:!1,access:{has:e=>"bumpTexture"in e,get:e=>e.bumpTexture,set:(e,i)=>{e.bumpTexture=i}},metadata:r},Z,Y),t(e,null,T,{kind:"accessor",name:"disableLighting",static:!1,private:!1,access:{has:e=>"disableLighting"in e,get:e=>e.disableLighting,set:(e,i)=>{e.disableLighting=i}},metadata:r},ne,re),t(e,null,C,{kind:"accessor",name:"maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"maxSimultaneousLights"in e,get:e=>e.maxSimultaneousLights,set:(e,i)=>{e.maxSimultaneousLights=i}},metadata:r},oe,fe),t(e,null,b,{kind:"accessor",name:"bumpSuperimpose",static:!1,private:!1,access:{has:e=>"bumpSuperimpose"in e,get:e=>e.bumpSuperimpose,set:(e,i)=>{e.bumpSuperimpose=i}},metadata:r},xe,Te),t(e,null,F,{kind:"accessor",name:"fresnelSeparate",static:!1,private:!1,access:{has:e=>"fresnelSeparate"in e,get:e=>e.fresnelSeparate,set:(e,i)=>{e.fresnelSeparate=i}},metadata:r},Ee,Le),t(e,null,N,{kind:"accessor",name:"bumpAffectsReflection",static:!1,private:!1,access:{has:e=>"bumpAffectsReflection"in e,get:e=>e.bumpAffectsReflection,set:(e,i)=>{e.bumpAffectsReflection=i}},metadata:r},De,be),t(e,null,H,{kind:"accessor",name:"useWorldCoordinatesForWaveDeformation",static:!1,private:!1,access:{has:e=>"useWorldCoordinatesForWaveDeformation"in e,get:e=>e.useWorldCoordinatesForWaveDeformation,set:(e,i)=>{e.useWorldCoordinatesForWaveDeformation=i}},metadata:r},Ze,Ye),t(null,null,m,{kind:"field",name:"_bumpTexture",static:!1,private:!1,access:{has:e=>"_bumpTexture"in e,get:e=>e._bumpTexture,set:(e,i)=>{e._bumpTexture=i}},metadata:r},X,j),t(null,null,g,{kind:"field",name:"diffuseColor",static:!1,private:!1,access:{has:e=>"diffuseColor"in e,get:e=>e.diffuseColor,set:(e,i)=>{e.diffuseColor=i}},metadata:r},K,q),t(null,null,p,{kind:"field",name:"specularColor",static:!1,private:!1,access:{has:e=>"specularColor"in e,get:e=>e.specularColor,set:(e,i)=>{e.specularColor=i}},metadata:r},Q,J),t(null,null,S,{kind:"field",name:"specularPower",static:!1,private:!1,access:{has:e=>"specularPower"in e,get:e=>e.specularPower,set:(e,i)=>{e.specularPower=i}},metadata:r},$,ee),t(null,null,x,{kind:"field",name:"_disableLighting",static:!1,private:!1,access:{has:e=>"_disableLighting"in e,get:e=>e._disableLighting,set:(e,i)=>{e._disableLighting=i}},metadata:r},ie,te),t(null,null,_,{kind:"field",name:"_maxSimultaneousLights",static:!1,private:!1,access:{has:e=>"_maxSimultaneousLights"in e,get:e=>e._maxSimultaneousLights,set:(e,i)=>{e._maxSimultaneousLights=i}},metadata:r},ae,se),t(null,null,E,{kind:"field",name:"windForce",static:!1,private:!1,access:{has:e=>"windForce"in e,get:e=>e.windForce,set:(e,i)=>{e.windForce=i}},metadata:r},le,de),t(null,null,L,{kind:"field",name:"windDirection",static:!1,private:!1,access:{has:e=>"windDirection"in e,get:e=>e.windDirection,set:(e,i)=>{e.windDirection=i}},metadata:r},ue,ce),t(null,null,P,{kind:"field",name:"waveHeight",static:!1,private:!1,access:{has:e=>"waveHeight"in e,get:e=>e.waveHeight,set:(e,i)=>{e.waveHeight=i}},metadata:r},he,me),t(null,null,I,{kind:"field",name:"bumpHeight",static:!1,private:!1,access:{has:e=>"bumpHeight"in e,get:e=>e.bumpHeight,set:(e,i)=>{e.bumpHeight=i}},metadata:r},ve,ge),t(null,null,D,{kind:"field",name:"_bumpSuperimpose",static:!1,private:!1,access:{has:e=>"_bumpSuperimpose"in e,get:e=>e._bumpSuperimpose,set:(e,i)=>{e._bumpSuperimpose=i}},metadata:r},pe,Se),t(null,null,A,{kind:"field",name:"_fresnelSeparate",static:!1,private:!1,access:{has:e=>"_fresnelSeparate"in e,get:e=>e._fresnelSeparate,set:(e,i)=>{e._fresnelSeparate=i}},metadata:r},_e,Ce),t(null,null,O,{kind:"field",name:"_bumpAffectsReflection",static:!1,private:!1,access:{has:e=>"_bumpAffectsReflection"in e,get:e=>e._bumpAffectsReflection,set:(e,i)=>{e._bumpAffectsReflection=i}},metadata:r},Pe,Ie),t(null,null,M,{kind:"field",name:"waterColor",static:!1,private:!1,access:{has:e=>"waterColor"in e,get:e=>e.waterColor,set:(e,i)=>{e.waterColor=i}},metadata:r},Ae,Fe),t(null,null,R,{kind:"field",name:"colorBlendFactor",static:!1,private:!1,access:{has:e=>"colorBlendFactor"in e,get:e=>e.colorBlendFactor,set:(e,i)=>{e.colorBlendFactor=i}},metadata:r},Oe,Ne),t(null,null,y,{kind:"field",name:"waterColor2",static:!1,private:!1,access:{has:e=>"waterColor2"in e,get:e=>e.waterColor2,set:(e,i)=>{e.waterColor2=i}},metadata:r},Me,Re),t(null,null,V,{kind:"field",name:"colorBlendFactor2",static:!1,private:!1,access:{has:e=>"colorBlendFactor2"in e,get:e=>e.colorBlendFactor2,set:(e,i)=>{e.colorBlendFactor2=i}},metadata:r},ye,Ve),t(null,null,U,{kind:"field",name:"waveLength",static:!1,private:!1,access:{has:e=>"waveLength"in e,get:e=>e.waveLength,set:(e,i)=>{e.waveLength=i}},metadata:r},Ue,we),t(null,null,w,{kind:"field",name:"waveSpeed",static:!1,private:!1,access:{has:e=>"waveSpeed"in e,get:e=>e.waveSpeed,set:(e,i)=>{e.waveSpeed=i}},metadata:r},Ge,We),t(null,null,W,{kind:"field",name:"waveCount",static:!1,private:!1,access:{has:e=>"waveCount"in e,get:e=>e.waveCount,set:(e,i)=>{e.waveCount=i}},metadata:r},Be,ze),t(null,null,B,{kind:"field",name:"disableClipPlane",static:!1,private:!1,access:{has:e=>"disableClipPlane"in e,get:e=>e.disableClipPlane,set:(e,i)=>{e.disableClipPlane=i}},metadata:r},He,ke),t(null,null,z,{kind:"field",name:"_useWorldCoordinatesForWaveDeformation",static:!1,private:!1,access:{has:e=>"_useWorldCoordinatesForWaveDeformation"in e,get:e=>e._useWorldCoordinatesForWaveDeformation,set:(e,i)=>{e._useWorldCoordinatesForWaveDeformation=i}},metadata:r},Xe,je),r&&Object.defineProperty(e,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})})(),e})();i.RegisterClass("BABYLON.WaterMaterial",W);var B={__proto__:null,CellMaterial:f,CustomMaterial:u,CustomShaderStructure:l,FireMaterial:g,FurMaterial:S,GradientMaterial:T,GridMaterial:C,LavaMaterial:L,MixMaterial:I,NormalMaterial:b,PBRCustomMaterial:m,ShaderAlbedoParts:c,ShaderAlebdoParts:h,ShaderSpecialParts:d,ShadowOnlyMaterial:F,SimpleMaterial:N,SkyMaterial:R,TerrainMaterial:V,TriPlanarMaterial:w,WaterMaterial:W};const z="undefined"!=typeof global?global:"undefined"!=typeof window?window:void 0;if(void 0!==z){z.BABYLON=z.BABYLON||{};for(const e in B)z.BABYLON[e]=B[e];z.MATERIALS=B}const H="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[H]||(i.ShaderStore.ShadersStoreWGSL[H]=k);const X=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL,i.logDepthVertexWGSL];for(const e of X)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var j={__proto__:null,cellVertexShaderWGSL:{name:H,shader:k}};const 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#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#endif\n#ifndef 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\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#endif\n}\n";i.ShaderStore.ShadersStoreWGSL[Z]||(i.ShaderStore.ShadersStoreWGSL[Z]=Y);const K=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of K)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var q={__proto__:null,cellPixelShaderWGSL:{name:Z,shader:Y}};const 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);const $=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing,i.logDepthVertex];for(const e of $)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var ee={__proto__:null,cellVertexShader:{name:Q,shader:J}};const ie="cellPixelShader",te="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[ie]||(i.ShaderStore.ShadersStore[ie]=te);const ne=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of ne)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var re={__proto__:null,cellPixelShader:{name:ie,shader:te}};const ae="fireVertexShader",se="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[ae]||(i.ShaderStore.ShadersStoreWGSL[ae]=se);const oe=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.vertexColorMixingWGSL];for(const e of oe)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var fe={__proto__:null,fireVertexShaderWGSL:{name:ae,shader:se}};const le="firePixelShader",de="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#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nbaseColor=textureSample(diffuseSampler,diffuseSamplerSampler,perturbedBaseCoords.xy)*2.0;baseColor=baseColor*opacityColor;baseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#endif\n#ifndef DEPTHPREPASS\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#endif\n}\n";i.ShaderStore.ShadersStoreWGSL[le]||(i.ShaderStore.ShadersStoreWGSL[le]=de);const ue=[i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of ue)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var ce={__proto__:null,firePixelShaderWGSL:{name:le,shader:de}};const he="fireVertexShader",me="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[he]||(i.ShaderStore.ShadersStore[he]=me);const ve=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.vertexColorMixing];for(const e of ve)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var ge={__proto__:null,fireVertexShader:{name:he,shader:me}};const pe="firePixelShader",Se="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[pe]||(i.ShaderStore.ShadersStore[pe]=Se);const xe=[i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of xe)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Te={__proto__:null,firePixelShader:{name:pe,shader:Se}};const _e="furVertexShader",Ce="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[_e]||(i.ShaderStore.ShadersStoreWGSL[_e]=Ce);const Ee=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL];for(const e of Ee)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Le={__proto__:null,furVertexShaderWGSL:{name:_e,shader:Ce}};const Pe="furPixelShader",Ie="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#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#endif\n#ifndef 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 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#endif\n}\n";i.ShaderStore.ShadersStoreWGSL[Pe]||(i.ShaderStore.ShadersStoreWGSL[Pe]=Ie);const De=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.logDepthDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of De)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var be={__proto__:null,furPixelShaderWGSL:{name:Pe,shader:Ie}};const Ae="furVertexShader",Fe="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[Ae]||(i.ShaderStore.ShadersStore[Ae]=Fe);const Oe=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing];for(const e of Oe)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Ne={__proto__:null,furVertexShader:{name:Ae,shader:Fe}};const Me="furPixelShader",Re="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[Me]||(i.ShaderStore.ShadersStore[Me]=Re);const ye=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.logDepthDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.fogFragmentDeclaration,i.clipPlaneFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of ye)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Ve={__proto__:null,furPixelShader:{name:Me,shader:Re}};const Ue="gradientVertexShader",we="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[Ue]||(i.ShaderStore.ShadersStoreWGSL[Ue]=we);const Ge=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL];for(const e of Ge)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var We={__proto__:null,gradientVertexShaderWGSL:{name:Ue,shader:we}};const Be="gradientPixelShader",ze="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#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef 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#endif\n}\n";i.ShaderStore.ShadersStoreWGSL[Be]||(i.ShaderStore.ShadersStoreWGSL[Be]=ze);const He=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of He)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var ke={__proto__:null,gradientPixelShaderWGSL:{name:Be,shader:ze}};const Xe="gradientVertexShader",je="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[Xe]||(i.ShaderStore.ShadersStore[Xe]=je);const Ze=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing];for(const e of Ze)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Ye={__proto__:null,gradientVertexShader:{name:Xe,shader:je}};const Ke="gradientPixelShader",qe="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[Ke]||(i.ShaderStore.ShadersStore[Ke]=qe);const Qe=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of Qe)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Je={__proto__:null,gradientPixelShader:{name:Ke,shader:qe}};const $e="gridVertexShader",ei="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#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nvarying vWorldPos: vec3f;\n#endif\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#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nvertexOutputs.vWorldPos=worldPos.xyz;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[$e]||(i.ShaderStore.ShadersStoreWGSL[$e]=ei);const ii=[i.instancesDeclarationWGSL,i.sceneUboDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.instancesVertexWGSL,i.fogVertexWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL];for(const e of ii)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var ti={__proto__:null,gridVertexShaderWGSL:{name:$e,shader:ei}};const ni="gridPixelShader",ri="#define SQRT2 1.41421356\n#define PI 3.14159\n#define MAX_OCTAVES 8\n#define LINE_WIDTH_SCREEN_FRACTION 0.004\n#define HORIZON_FADE_EXPONENT 400.0\n#define ORIGIN_MARKER_SPAN 10000000.0\n#define ORIGIN_MARKER_WIDTH_SCALE 0.00000015\n#define ORIGIN_MARKER_THRESHOLD 0.0001\n#define TRANSPARENT_MIN_OPACITY 0.08\nuniform visibility: f32;uniform mainColor: vec3f;uniform lineColor: vec3f;uniform gridControl: vec4f;uniform gridOffset: vec3f;uniform gridThicknessModifier: f32;\n#ifdef MULTI_SCALE\nuniform minGridSpacing: f32;uniform gridOctaves: f32;\n#endif\n#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nuniform cameraPosition: vec3f;uniform viewportSize: vec2f;\n#endif\n#ifdef BELOW_LINE_COLOR\nuniform belowLineColor: vec3f;\n#endif\nvarying vPosition: vec3f;varying vNormal: vec3f;\n#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nvarying vWorldPos: vec3f;\n#endif\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,tcLineWidthCap: f32,thicknessModifier: f32)->f32 {let dPosDx: f32=dpdx(position);let dPosDy: f32=dpdy(position);var differentialLength: f32=length(vec2f(dPosDx,dPosDy))*SQRT2;if (tcLineWidthCap>0.0) {differentialLength=max(differentialLength,tcLineWidthCap);}\nlet lineWidth: f32=differentialLength*thicknessModifier;var result: f32=isPointOnLine(position,lineWidth);result=result*getDynamicVisibility(position);result=result*getAnisotropicAttenuation(differentialLength);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 normal: vec3f=normalize(fragmentInputs.vNormal);var horizonFade: f32=1.0;var tcLineWidthCap: f32=0.0;\n#if defined(HORIZON_FADE) || defined(ORIGIN_MARKER)\nvar tc: f32=length(fragmentInputs.vWorldPos-uniforms.cameraPosition);\n#ifdef HORIZON_FADE\ntcLineWidthCap=LINE_WIDTH_SCREEN_FRACTION*tc/uniforms.viewportSize.y;let rd: vec3f=normalize(fragmentInputs.vWorldPos-uniforms.cameraPosition);if (abs(rd.y)>0.99) {horizonFade=1.0;} else {let flatRayDir: vec3f=normalize(vec3f(rd.x,0.0,rd.z));horizonFade=-pow(abs(dot(rd,flatRayDir)),HORIZON_FADE_EXPONENT)+1.0;}\n#endif\n#endif\nvar grid: f32=0.0;\n#ifdef MULTI_SCALE\nfor (var i: i32=0; i<MAX_OCTAVES; i++) {if (i>=i32(uniforms.gridOctaves)) { break; }\nlet scale: f32=uniforms.minGridSpacing*pow(10.0,f32(i));let gridPos: vec3f=(fragmentInputs.vPosition+uniforms.gridOffset.xyz)/scale;let gx: f32=contributionOnAxis(gridPos.x,tcLineWidthCap,uniforms.gridThicknessModifier)*normalImpactOnAxis(normal.x);let gy: f32=contributionOnAxis(gridPos.y,tcLineWidthCap,uniforms.gridThicknessModifier)*normalImpactOnAxis(normal.y);let gz: f32=contributionOnAxis(gridPos.z,tcLineWidthCap,uniforms.gridThicknessModifier)*normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\ngrid=max(grid,clamp(max(max(gx,gy),gz),0.,1.));\n#else\ngrid=max(grid,clamp(gx+gy+gz,0.,1.));\n#endif\n}\n#else\nlet gridRatio: f32=uniforms.gridControl.x;let gridPos: vec3f=(fragmentInputs.vPosition+uniforms.gridOffset.xyz)/gridRatio;let x: f32=contributionOnAxis(gridPos.x,tcLineWidthCap,uniforms.gridThicknessModifier)*normalImpactOnAxis(normal.x);let y: f32=contributionOnAxis(gridPos.y,tcLineWidthCap,uniforms.gridThicknessModifier)*normalImpactOnAxis(normal.y);let z: f32=contributionOnAxis(gridPos.z,tcLineWidthCap,uniforms.gridThicknessModifier)*normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\ngrid=clamp(max(max(x,y),z),0.,1.);\n#else\ngrid=clamp(x+y+z,0.,1.);\n#endif\n#endif\ngrid=grid*horizonFade;\n#ifdef ORIGIN_MARKER\nlet tcOrigin: f32=ORIGIN_MARKER_WIDTH_SCALE*tc/uniforms.viewportSize.y;let ox: f32=contributionOnAxis(fragmentInputs.vWorldPos.x/ORIGIN_MARKER_SPAN,tcOrigin,uniforms.gridThicknessModifier);let oz: f32=contributionOnAxis(fragmentInputs.vWorldPos.z/ORIGIN_MARKER_SPAN,tcOrigin,uniforms.gridThicknessModifier);let originMask: f32=clamp(ox+oz,0.0,1.0)*horizonFade;if (originMask>ORIGIN_MARKER_THRESHOLD) { grid=originMask; }\n#endif\n#ifdef BELOW_LINE_COLOR\nlet belowSurface: bool=uniforms.cameraPosition.y<fragmentInputs.vWorldPos.y;let effectiveLineColor: vec3f=select(uniforms.lineColor,uniforms.belowLineColor,belowSurface);\n#else\nlet effectiveLineColor: vec3f=uniforms.lineColor;\n#endif\nvar color: vec4f=vec4f(mix(uniforms.mainColor,effectiveLineColor,vec3f(grid)),1.0);\n#ifdef FOG\n#include<fogFragment>\n#endif\nvar opacity: f32=uniforms.gridControl.w;\n#ifdef LINES_ONLY\nif (grid<0.01) { discard; }\nopacity=clamp(grid,TRANSPARENT_MIN_OPACITY,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 PREMULTIPLYALPHA\nfragmentOutputs.color=vec4f(fragmentOutputs.color.rgb*opacity,fragmentOutputs.color.a);\n#endif\n#include<logDepthFragment>\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStoreWGSL[ni]||(i.ShaderStore.ShadersStoreWGSL[ni]=ri);const ai=[i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.fogFragmentWGSL,i.logDepthFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of ai)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var si={__proto__:null,gridPixelShaderWGSL:{name:ni,shader:ri}};const oi="gridVertexShader",fi="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#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nvarying vec3 vWorldPos;\n#endif\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#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nvWorldPos=worldPos.xyz;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}";i.ShaderStore.ShadersStore[oi]||(i.ShaderStore.ShadersStore[oi]=fi);const li=[i.instancesDeclaration,i.sceneVertexDeclaration,i.sceneUboDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.clipPlaneVertexDeclaration,i.instancesVertex,i.fogVertex,i.clipPlaneVertex,i.logDepthVertex];for(const e of li)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var di={__proto__:null,gridVertexShader:{name:oi,shader:fi}};const ui="gridPixelShader",ci="#extension GL_OES_standard_derivatives : enable\n#define SQRT2 1.41421356\n#define PI 3.14159\n#define MAX_OCTAVES 8\n#define LINE_WIDTH_SCREEN_FRACTION 0.004\n#define HORIZON_FADE_EXPONENT 400.0\n#define ORIGIN_MARKER_SPAN 10000000.0\n#define ORIGIN_MARKER_WIDTH_SCALE 0.00000015\n#define ORIGIN_MARKER_THRESHOLD 0.0001\n#define TRANSPARENT_MIN_OPACITY 0.08\nprecision highp float;uniform float visibility;uniform vec3 mainColor;uniform vec3 lineColor;uniform vec4 gridControl;uniform vec3 gridOffset;uniform float gridThicknessModifier;\n#ifdef MULTI_SCALE\nuniform float minGridSpacing;uniform float gridOctaves;\n#endif\n#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nuniform vec3 cameraPosition;uniform vec2 viewportSize;\n#endif\n#ifdef BELOW_LINE_COLOR\nuniform vec3 belowLineColor;\n#endif\nvarying vec3 vPosition;varying vec3 vNormal;\n#if defined(HORIZON_FADE) || defined(BELOW_LINE_COLOR) || defined(ORIGIN_MARKER)\nvarying vec3 vWorldPos;\n#endif\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 tcLineWidthCap,float thicknessModifier) {float dPosDx=dFdx(position);float dPosDy=dFdy(position);float differentialLength=length(vec2(dPosDx,dPosDy))*SQRT2;if (tcLineWidthCap>0.0) {differentialLength=max(differentialLength,tcLineWidthCap);}\nfloat lineWidth=differentialLength*thicknessModifier;float result=isPointOnLine(position,lineWidth);result*=getDynamicVisibility(position);result*=getAnisotropicAttenuation(differentialLength);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>\nvec3 normal=normalize(vNormal);float horizonFade=1.0;float tcLineWidthCap=0.0;\n#if defined(HORIZON_FADE) || defined(ORIGIN_MARKER)\nfloat tc=length(vWorldPos-cameraPosition);\n#endif\n#ifdef HORIZON_FADE\ntcLineWidthCap=LINE_WIDTH_SCREEN_FRACTION*tc/viewportSize.y;vec3 rd=normalize(vWorldPos-cameraPosition);if (abs(rd.y)>0.99) {horizonFade=1.0;} else {vec3 flatRayDir=normalize(vec3(rd.x,0.0,rd.z));horizonFade=-pow(abs(dot(rd,flatRayDir)),HORIZON_FADE_EXPONENT)+1.0;}\n#endif\nfloat grid=0.0;\n#ifdef MULTI_SCALE\nfor (int i=0; i<MAX_OCTAVES; i++) {if (i>=int(gridOctaves)) break;float scale=minGridSpacing*pow(10.0,float(i));vec3 gridPos=(vPosition+gridOffset.xyz)/scale;float gx=contributionOnAxis(gridPos.x,tcLineWidthCap,gridThicknessModifier)*normalImpactOnAxis(normal.x);float gy=contributionOnAxis(gridPos.y,tcLineWidthCap,gridThicknessModifier)*normalImpactOnAxis(normal.y);float gz=contributionOnAxis(gridPos.z,tcLineWidthCap,gridThicknessModifier)*normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\ngrid=max(grid,clamp(max(max(gx,gy),gz),0.,1.));\n#else\ngrid=max(grid,clamp(gx+gy+gz,0.,1.));\n#endif\n}\n#else\nfloat gridRatio=gridControl.x;vec3 gridPos=(vPosition+gridOffset.xyz)/gridRatio;float x=contributionOnAxis(gridPos.x,tcLineWidthCap,gridThicknessModifier)*normalImpactOnAxis(normal.x);float y=contributionOnAxis(gridPos.y,tcLineWidthCap,gridThicknessModifier)*normalImpactOnAxis(normal.y);float z=contributionOnAxis(gridPos.z,tcLineWidthCap,gridThicknessModifier)*normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\ngrid=clamp(max(max(x,y),z),0.,1.);\n#else\ngrid=clamp(x+y+z,0.,1.);\n#endif\n#endif\ngrid*=horizonFade;\n#ifdef ORIGIN_MARKER\nfloat tcOrigin=ORIGIN_MARKER_WIDTH_SCALE*tc/viewportSize.y;float ox=contributionOnAxis(vWorldPos.x/ORIGIN_MARKER_SPAN,tcOrigin,gridThicknessModifier);float oz=contributionOnAxis(vWorldPos.z/ORIGIN_MARKER_SPAN,tcOrigin,gridThicknessModifier);float originMask=clamp(ox+oz,0.0,1.0)*horizonFade;if (originMask>ORIGIN_MARKER_THRESHOLD) grid=originMask;\n#endif\n#ifdef BELOW_LINE_COLOR\nbool belowSurface=cameraPosition.y<vWorldPos.y;vec3 effectiveLineColor=belowSurface ? belowLineColor : lineColor;\n#else\nvec3 effectiveLineColor=lineColor;\n#endif\nvec3 color=mix(mainColor,effectiveLineColor,grid);\n#ifdef FOG\n#include<fogFragment>\n#endif\nfloat opacity=gridControl.w;\n#ifdef LINES_ONLY\nif (grid<0.01) discard;opacity=clamp(grid,TRANSPARENT_MIN_OPACITY,gridControl.w*grid);\n#endif\n#ifdef OPACITY\nopacity*=texture2D(opacitySampler,vOpacityUV).a;\n#endif\ngl_FragColor=vec4(color.rgb,opacity*visibility);\n#ifdef PREMULTIPLYALPHA\ngl_FragColor.rgb*=opacity;\n#endif\n#include<logDepthFragment>\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";i.ShaderStore.ShadersStore[ui]||(i.ShaderStore.ShadersStore[ui]=ci);const hi=[i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.fogFragment,i.logDepthFragment,i.imageProcessingCompatibility];for(const e of hi)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var mi={__proto__:null,gridPixelShader:{name:ui,shader:ci}};const vi="lavaVertexShader",gi="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[vi]||(i.ShaderStore.ShadersStoreWGSL[vi]=gi);const pi=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL,i.logDepthVertexWGSL];for(const e of pi)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Si={__proto__:null,lavaVertexShaderWGSL:{name:vi,shader:gi}};const xi="lavaPixelShader",Ti="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#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#endif\n#ifndef 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 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#endif\n}\n";i.ShaderStore.ShadersStoreWGSL[xi]||(i.ShaderStore.ShadersStoreWGSL[xi]=Ti);const _i=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of _i)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Ci={__proto__:null,lavaPixelShaderWGSL:{name:xi,shader:Ti}};const Ei="lavaVertexShader",Li="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[Ei]||(i.ShaderStore.ShadersStore[Ei]=Li);const Pi=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing,i.logDepthVertex];for(const e of Pi)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Ii={__proto__:null,lavaVertexShader:{name:Ei,shader:Li}};const Di="lavaPixelShader",bi="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[Di]||(i.ShaderStore.ShadersStore[Di]=bi);const Ai=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of Ai)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Fi={__proto__:null,lavaPixelShader:{name:Di,shader:bi}};const Oi="mixVertexShader",Ni="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[Oi]||(i.ShaderStore.ShadersStoreWGSL[Oi]=Ni);const Mi=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL,i.logDepthVertexWGSL];for(const e of Mi)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Ri={__proto__:null,mixVertexShaderWGSL:{name:Oi,shader:Ni}};const yi="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#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef 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#endif\n#ifndef DEPTHPREPASS\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#endif\n}\n";i.ShaderStore.ShadersStoreWGSL[yi]||(i.ShaderStore.ShadersStoreWGSL[yi]=Vi);const Ui=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of Ui)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var wi={__proto__:null,mixPixelShaderWGSL:{name:yi,shader:Vi}};const Gi="mixVertexShader",Wi="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[Gi]||(i.ShaderStore.ShadersStore[Gi]=Wi);const Bi=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing,i.logDepthVertex];for(const e of Bi)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var zi={__proto__:null,mixVertexShader:{name:Gi,shader:Wi}};const Hi="mixPixelShader",ki="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[Hi]||(i.ShaderStore.ShadersStore[Hi]=ki);const Xi=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of Xi)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var ji={__proto__:null,mixPixelShader:{name:Hi,shader:ki}};const Zi="normalVertexShader",Yi="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[Zi]||(i.ShaderStore.ShadersStoreWGSL[Zi]=Yi);const Ki=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL];for(const e of Ki)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var qi={__proto__:null,normalVertexShaderWGSL:{name:Zi,shader:Yi}};const Qi="normalPixelShader",Ji="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#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#endif\n#ifndef DEPTHPREPASS\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#endif\n}\n";i.ShaderStore.ShadersStoreWGSL[Qi]||(i.ShaderStore.ShadersStoreWGSL[Qi]=Ji);const $i=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of $i)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var et={__proto__:null,normalPixelShaderWGSL:{name:Qi,shader:Ji}};const it="normalVertexShader",tt="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[it]||(i.ShaderStore.ShadersStore[it]=tt);const nt=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.shadowsVertex];for(const e of nt)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var rt={__proto__:null,normalVertexShader:{name:it,shader:tt}};const at="normalPixelShader",st="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[at]||(i.ShaderStore.ShadersStore[at]=st);const ot=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of ot)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var ft={__proto__:null,normalPixelShader:{name:at,shader:st}};const lt="shadowOnlyVertexShader",dt="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[lt]||(i.ShaderStore.ShadersStoreWGSL[lt]=dt);const ut=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.sceneUboDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL];for(const e of ut)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var ct={__proto__:null,shadowOnlyVertexShaderWGSL:{name:lt,shader:dt}};const ht="shadowOnlyPixelShader",mt="#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[ht]||(i.ShaderStore.ShadersStoreWGSL[ht]=mt);const vt=[i.sceneUboDeclarationWGSL,i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL];for(const e of vt)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var gt={__proto__:null,shadowOnlyPixelShaderWGSL:{name:ht,shader:mt}};const pt="shadowOnlyVertexShader",St="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[pt]||(i.ShaderStore.ShadersStore[pt]=St);const xt=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.sceneVertexDeclaration,i.sceneUboDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.shadowsVertex];for(const e of xt)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Tt={__proto__:null,shadowOnlyVertexShader:{name:pt,shader:St}};const _t="shadowOnlyPixelShader",Ct="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[_t]||(i.ShaderStore.ShadersStore[_t]=Ct);const Et=[i.sceneFragmentDeclaration,i.sceneUboDeclaration,i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of Et)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Lt={__proto__:null,shadowOnlyPixelShader:{name:_t,shader:Ct}};const Pt="simpleVertexShader",It="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[Pt]||(i.ShaderStore.ShadersStoreWGSL[Pt]=It);const Dt=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL];for(const e of Dt)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var bt={__proto__:null,simpleVertexShaderWGSL:{name:Pt,shader:It}};const At="simplePixelShader",Ft="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#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef DEPTHPREPASS\nbaseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);\n#endif\n#endif\n#ifndef DEPTHPREPASS\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#endif\n}\n";i.ShaderStore.ShadersStoreWGSL[At]||(i.ShaderStore.ShadersStoreWGSL[At]=Ft);const Ot=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of Ot)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Nt={__proto__:null,simplePixelShaderWGSL:{name:At,shader:Ft}};const Mt="simpleVertexShader",Rt="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[Mt]||(i.ShaderStore.ShadersStore[Mt]=Rt);const yt=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing];for(const e of yt)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Vt={__proto__:null,simpleVertexShader:{name:Mt,shader:Rt}};const Ut="simplePixelShader",wt="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[Ut]||(i.ShaderStore.ShadersStore[Ut]=wt);const Gt=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of Gt)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Wt={__proto__:null,simplePixelShader:{name:Ut,shader:wt}};const Bt="skyVertexShader",zt="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[Bt]||(i.ShaderStore.ShadersStoreWGSL[Bt]=zt);const Ht=[i.logDepthDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.fogVertexDeclarationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL];for(const e of Ht)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var kt={__proto__:null,skyVertexShaderWGSL:{name:Bt,shader:zt}};const Xt="skyPixelShader",jt="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[Xt]||(i.ShaderStore.ShadersStoreWGSL[Xt]=jt);const Zt=[i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.helperFunctionsWGSL,i.clipPlaneFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of Zt)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Yt={__proto__:null,skyPixelShaderWGSL:{name:Xt,shader:jt}};const Kt="skyVertexShader",qt="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[Kt]||(i.ShaderStore.ShadersStore[Kt]=qt);const Qt=[i.logDepthDeclaration,i.clipPlaneVertexDeclaration,i.fogVertexDeclaration,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex];for(const e of Qt)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Jt={__proto__:null,skyVertexShader:{name:Kt,shader:qt}};const $t="skyPixelShader",en="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[$t]||(i.ShaderStore.ShadersStore[$t]=en);const tn=[i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.helperFunctions,i.clipPlaneFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of tn)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var nn={__proto__:null,skyPixelShader:{name:$t,shader:en}};const rn="terrainVertexShader",an="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[rn]||(i.ShaderStore.ShadersStoreWGSL[rn]=an);const sn=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.logDepthDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL];for(const e of sn)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var on={__proto__:null,terrainVertexShaderWGSL:{name:rn,shader:an}};const fn="terrainPixelShader",ln="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#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef 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#endif\n#ifndef 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 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#endif\n}\n";i.ShaderStore.ShadersStoreWGSL[fn]||(i.ShaderStore.ShadersStoreWGSL[fn]=ln);const dn=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of dn)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var un={__proto__:null,terrainPixelShaderWGSL:{name:fn,shader:ln}};const cn="terrainVertexShader",hn="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]=hn);const mn=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.logDepthDeclaration,i.clipPlaneVertexDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing];for(const e of mn)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var vn={__proto__:null,terrainVertexShader:{name:cn,shader:hn}};const gn="terrainPixelShader",pn="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[gn]||(i.ShaderStore.ShadersStore[gn]=pn);const Sn=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of Sn)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var xn={__proto__:null,terrainPixelShader:{name:gn,shader:pn}};const Tn="triplanarVertexShader",_n="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[Tn]||(i.ShaderStore.ShadersStoreWGSL[Tn]=_n);const Cn=[i.helperFunctionsWGSL,i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.logDepthVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL];for(const e of Cn)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var En={__proto__:null,triplanarVertexShaderWGSL:{name:Tn,shader:_n}};const Ln="triplanarPixelShader",Pn="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#define DEPTHPREPASS_SKIP_EARLY_RETURN\n#include<depthPrePass>\n#ifndef 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#endif\n}\n";i.ShaderStore.ShadersStoreWGSL[Ln]||(i.ShaderStore.ShadersStoreWGSL[Ln]=Pn);const In=[i.helperFunctionsWGSL,i.lightUboDeclarationWGSL,i.logDepthDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.depthPrePassWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL,i.imageProcessingCompatibilityWGSL];for(const e of In)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Dn={__proto__:null,triplanarPixelShaderWGSL:{name:Ln,shader:Pn}};const bn="triplanarVertexShader",An="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[bn]||(i.ShaderStore.ShadersStore[bn]=An);const Fn=[i.helperFunctions,i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.logDepthDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.logDepthVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing];for(const e of Fn)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var On={__proto__:null,triplanarVertexShader:{name:bn,shader:An}};const Nn="triplanarPixelShader",Mn="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[Nn]||(i.ShaderStore.ShadersStore[Nn]=Mn);const Rn=[i.helperFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.logDepthDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.depthPrePass,i.lightFragment,i.logDepthFragment,i.fogFragment,i.imageProcessingCompatibility];for(const e of Rn)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var yn={__proto__:null,triplanarPixelShader:{name:Nn,shader:Mn}};const Vn="waterVertexShader",Un="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[Vn]||(i.ShaderStore.ShadersStoreWGSL[Vn]=Un);const wn=[i.bonesDeclarationWGSL,i.bakedVertexAnimationDeclarationWGSL,i.instancesDeclarationWGSL,i.clipPlaneVertexDeclarationWGSL,i.fogVertexDeclarationWGSL,i.lightVxFragmentDeclarationWGSL,i.lightVxUboDeclarationWGSL,i.logDepthDeclarationWGSL,i.instancesVertexWGSL,i.bonesVertexWGSL,i.bakedVertexAnimationWGSL,i.clipPlaneVertexWGSL,i.fogVertexWGSL,i.shadowsVertexWGSL,i.vertexColorMixingWGSL,i.logDepthVertexWGSL];for(const e of wn)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Gn={__proto__:null,waterVertexShaderWGSL:{name:Vn,shader:Un}};const Wn="waterPixelShader",Bn="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(toLinearSpaceVec3(color.rgb),color.a);\n#elif defined(IMAGEPROCESSING)\ncolor=vec4f(toLinearSpaceVec3(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]=Bn);const zn=[i.helperFunctionsWGSL,i.imageProcessingDeclarationWGSL,i.imageProcessingFunctionsWGSL,i.lightUboDeclarationWGSL,i.lightsFragmentFunctionsWGSL,i.shadowsFragmentFunctionsWGSL,i.clipPlaneFragmentDeclarationWGSL,i.logDepthDeclarationWGSL,i.fogFragmentDeclarationWGSL,i.clipPlaneFragmentWGSL,i.lightFragmentWGSL,i.logDepthFragmentWGSL,i.fogFragmentWGSL];for(const e of zn)i.ShaderStore.IncludesShadersStoreWGSL[e.name]||(i.ShaderStore.IncludesShadersStoreWGSL[e.name]=e.shader);var Hn={__proto__:null,waterPixelShaderWGSL:{name:Wn,shader:Bn}};const kn="waterVertexShader",Xn="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]=Xn);const jn=[i.bonesDeclaration,i.bakedVertexAnimationDeclaration,i.instancesDeclaration,i.clipPlaneVertexDeclaration,i.fogVertexDeclaration,i.lightFragmentDeclaration,i.lightUboDeclaration,i.logDepthDeclaration,i.instancesVertex,i.bonesVertex,i.bakedVertexAnimation,i.clipPlaneVertex,i.fogVertex,i.shadowsVertex,i.vertexColorMixing,i.logDepthVertex];for(const e of jn)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Zn={__proto__:null,waterVertexShader:{name:kn,shader:Xn}};const 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);const qn=[i.helperFunctions,i.imageProcessingDeclaration,i.imageProcessingFunctions,i.lightFragmentDeclaration,i.lightUboDeclaration,i.lightsFragmentFunctions,i.shadowsFragmentFunctions,i.clipPlaneFragmentDeclaration,i.logDepthDeclaration,i.fogFragmentDeclaration,i.clipPlaneFragment,i.lightFragment,i.logDepthFragment,i.fogFragment];for(const e of qn)i.ShaderStore.IncludesShadersStore[e.name]||(i.ShaderStore.IncludesShadersStore[e.name]=e.shader);var Qn={__proto__:null,waterPixelShader:{name:Yn,shader:Kn}};e.CellMaterial=f,e.CustomMaterial=u,e.CustomShaderStructure=l,e.FireMaterial=g,e.FurMaterial=S,e.GradientMaterial=T,e.GridMaterial=C,e.LavaMaterial=L,e.MixMaterial=I,e.NormalMaterial=b,e.PBRCustomMaterial=m,e.ShaderAlbedoParts=c,e.ShaderAlebdoParts=h,e.ShaderSpecialParts=d,e.ShadowOnlyMaterial=F,e.SimpleMaterial=N,e.SkyMaterial=R,e.TerrainMaterial=V,e.TriPlanarMaterial=w,e.WaterMaterial=W});
|
|
2
2
|
//# sourceMappingURL=babylonjs.materials.min.js.map
|