babylonjs-materials 8.36.0 → 8.37.0

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.
@@ -1,2 +1,2 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-materials",["babylonjs"],r):"object"==typeof exports?exports["babylonjs-materials"]=r(require("babylonjs")):e.MATERIALS=r(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(e=>(()=>{"use strict";var r={597:r=>{r.exports=e}},i={};function t(e){var o=i[e];if(void 0!==o)return o.exports;var n=i[e]={exports:{}};return r[e](n,n.exports,t),n.exports}t.d=(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};t.d(o,{default:()=>T});var n={};t.r(n),t.d(n,{WaterMaterial:()=>v});var a={};t.r(a),t.d(a,{WaterMaterial:()=>v});var s=function(e,r){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])},s(e,r)};function l(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}s(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}function f(e,r,i,t){var o,n=arguments.length,a=n<3?r:null===t?t=Object.getOwnPropertyDescriptor(r,i):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,r,i,t);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(n<3?o(a):n>3?o(r,i,a):o(r,i))||a);return n>3&&a&&Object.defineProperty(r,i,a),a}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var c=t(597),d="waterPixelShader";c.ShaderStore.ShadersStore[d]||(c.ShaderStore.ShadersStore[d]="#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#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");var u="waterVertexShader";c.ShaderStore.ShadersStore[u]||(c.ShaderStore.ShadersStore[u]="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#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");var p=function(e){function r(){var r=e.call(this)||this;return r.BUMP=!1,r.REFLECTION=!1,r.CLIPPLANE=!1,r.CLIPPLANE2=!1,r.CLIPPLANE3=!1,r.CLIPPLANE4=!1,r.CLIPPLANE5=!1,r.CLIPPLANE6=!1,r.ALPHATEST=!1,r.DEPTHPREPASS=!1,r.POINTSIZE=!1,r.FOG=!1,r.NORMAL=!1,r.UV1=!1,r.UV2=!1,r.VERTEXCOLOR=!1,r.VERTEXALPHA=!1,r.NUM_BONE_INFLUENCERS=0,r.BonesPerMesh=0,r.INSTANCES=!1,r.INSTANCESCOLOR=!1,r.SPECULARTERM=!1,r.LOGARITHMICDEPTH=!1,r.USE_REVERSE_DEPTHBUFFER=!1,r.FRESNELSEPARATE=!1,r.BUMPSUPERIMPOSE=!1,r.BUMPAFFECTSREFLECTION=!1,r.USE_WORLD_COORDINATES=!1,r.IMAGEPROCESSING=!1,r.VIGNETTE=!1,r.VIGNETTEBLENDMODEMULTIPLY=!1,r.VIGNETTEBLENDMODEOPAQUE=!1,r.TONEMAPPING=0,r.CONTRAST=!1,r.EXPOSURE=!1,r.COLORCURVES=!1,r.COLORGRADING=!1,r.COLORGRADING3D=!1,r.SAMPLER3DGREENDEPTH=!1,r.SAMPLER3DBGRMAP=!1,r.DITHER=!1,r.IMAGEPROCESSINGPOSTPROCESS=!1,r.SKIPFINALCOLORCLAMP=!1,r.rebuild(),r}return l(r,e),r}(c.MaterialDefines),v=function(e){function r(r,i,t){void 0===t&&(t=new c.Vector2(512,512));var o=e.call(this,r,i)||this;return o.renderTargetSize=t,o.diffuseColor=new c.Color3(1,1,1),o.specularColor=new c.Color3(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new c.Vector2(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new c.Color3(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new c.Color3(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.waveCount=20,o.disableClipPlane=!1,o._useWorldCoordinatesForWaveDeformation=!1,o._renderTargets=new c.SmartArray(16),o._mesh=null,o._reflectionTransform=c.Matrix.Zero(),o._offsetMirror=c.Matrix.Zero(),o._tempPlane=new c.Plane(0,0,0,0),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(o.getScene(),t),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add((function(){o._markAllSubMeshesAsImageProcessingDirty()}))),o}return l(r,e),Object.defineProperty(r.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),r.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},r.prototype.removeFromRenderList=function(e){var r;this._refractionRTT&&this._refractionRTT.renderList&&-1!==(r=this._refractionRTT.renderList.indexOf(e))&&this._refractionRTT.renderList.splice(r,1),this._reflectionRTT&&this._reflectionRTT.renderList&&-1!==(r=this._reflectionRTT.renderList.indexOf(e))&&this._reflectionRTT.renderList.splice(r,1)},r.prototype.enableRenderTargets=function(e){var r=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=r),this._reflectionRTT&&(this._reflectionRTT.refreshRate=r)},r.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(r.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&0===this._refractionRTT.refreshRate)},enumerable:!1,configurable:!0}),r.prototype.needAlphaBlending=function(){return this.alpha<1},r.prototype.needAlphaTesting=function(){return!1},r.prototype.getAlphaTestTexture=function(){return null},r.prototype.isReadyForSubMesh=function(e,r,i){var t=r._drawWrapper;if(this.isFrozen&&t.effect&&t._wasPreviouslyReady&&t._wasPreviouslyUsingInstances===i)return!0;r.materialDefines||(r.materialDefines=new p);var o=r.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(r))return!0;var a=n.getEngine();if(o._areTexturesDirty&&(o._needUVs=!1,n.texturesEnabled)){if(this.bumpTexture&&c.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture.isReady())return!1;o._needUVs=!0,o.BUMP=!0}c.MaterialFlags.ReflectionTextureEnabled&&(o.REFLECTION=!0)}if((0,c.PrepareDefinesForFrameBoundValues)(n,a,this,o,!!i),(0,c.PrepareDefinesForMisc)(e,n,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),o,void 0,void 0,void 0,this._isVertexOutputInvariant),o._areMiscDirty&&(o.FRESNELSEPARATE=this._fresnelSeparate,o.BUMPSUPERIMPOSE=this._bumpSuperimpose,o.BUMPAFFECTSREFLECTION=this._bumpAffectsReflection,o.USE_WORLD_COORDINATES=this._useWorldCoordinatesForWaveDeformation),o._needNormals=(0,c.PrepareDefinesForLights)(n,e,o,!0,this._maxSimultaneousLights,this._disableLighting),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if((0,c.PrepareDefinesForAttributes)(e,o,!0,!0),this._mesh=e,this._waitingRenderList){for(var s=0;s<this._waitingRenderList.length;s++)this.addToRenderList(n.getNodeById(this._waitingRenderList[s]));this._waitingRenderList=null}if(o.isDirty){o.markAsProcessed(),n.resetCachedMaterial();var l=new c.EffectFallbacks;o.FOG&&l.addFallback(1,"FOG"),o.LOGARITHMICDEPTH&&l.addFallback(0,"LOGARITHMICDEPTH"),(0,c.HandleFallbacksForShadows)(o,l,this.maxSimultaneousLights),o.NUM_BONE_INFLUENCERS>0&&l.addCPUSkinningFallback(0,e);var f=[c.VertexBuffer.PositionKind];o.NORMAL&&f.push(c.VertexBuffer.NormalKind),o.UV1&&f.push(c.VertexBuffer.UVKind),o.UV2&&f.push(c.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&f.push(c.VertexBuffer.ColorKind),(0,c.PrepareAttributesForBones)(f,e,o,l),(0,c.PrepareAttributesForInstances)(f,o);var d=o.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"],v=["normalSampler","refractionSampler","reflectionSampler"],m=[];c.ImageProcessingConfiguration&&(c.ImageProcessingConfiguration.PrepareUniforms(u,o),c.ImageProcessingConfiguration.PrepareSamplers(v,o)),(0,c.AddClipPlaneUniforms)(u),(0,c.PrepareUniformsAndSamplersList)({uniformsNames:u,uniformBuffersNames:m,samplers:v,defines:o,maxSimultaneousLights:this.maxSimultaneousLights}),r.setEffect(n.getEngine().createEffect("water",{attributes:f,uniformsNames:u,uniformBuffersNames:m,samplers:v,defines:d,fallbacks:l,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},a),o,this._materialContext)}return!(!r.effect||!r.effect.isReady()||(o._renderId=n.getRenderId(),t._wasPreviouslyReady=!0,t._wasPreviouslyUsingInstances=!!i,0))},r.prototype.bindForSubMesh=function(e,r,i){var t=this.getScene(),o=i.materialDefines;if(o){var n=i.effect;if(n&&this._mesh){this._activeEffect=n,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",t.getTransformMatrix()),(0,c.BindBonesParameters)(r,this._activeEffect),this._mustRebind(t,n,i)&&(this.bumpTexture&&c.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())),(0,c.BindClipPlane)(n,this,t),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&(0,c.BindLogDepth)(o,n,t),t.bindEyePosition(n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*r.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),t.lightsEnabled&&!this.disableLighting&&(0,c.BindLights)(t,r,this._activeEffect,o,this.maxSimultaneousLights),t.fogEnabled&&r.applyFog&&t.fogMode!==c.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",t.getViewMatrix()),(0,c.BindFogParameters)(t,r,this._activeEffect),(0,c.BindLogDepth)(o,this._activeEffect,t),c.MaterialFlags.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var a=c.TmpVectors.Matrix[3].copyFrom(this._reflectionTransform);if(t.floatingOriginMode){var s=(0,c.OffsetViewToRef)(t.floatingOriginOffset,t.getViewMatrix(),c.TmpVectors.Matrix[1]);(0,c.MultiplyMatricesToRef)(this._offsetMirror,s,a)}a.multiplyToRef(t.getProjectionMatrix(),a);var l=t.getEngine().getDeltaTime();l!==this._lastDeltaTime&&(this._lastDeltaTime=l,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("reflectionViewProjection",a),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(r,this._activeEffect,i)}}},r.prototype._createRenderTargets=function(e,r){var i=this;this._refractionRTT=new c.RenderTargetTexture(name+"_refraction",{width:r.x,height:r.y},e,!1,!0),this._refractionRTT.wrapU=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0;var t,o=!1;this._refractionRTT.onBeforeRenderObservable.add((function(){o=e.getBoundingBoxRenderer().enabled,e.getBoundingBoxRenderer().enabled=!1})),this._refractionRTT.onAfterRenderObservable.add((function(){e.getBoundingBoxRenderer().enabled=o})),this._reflectionRTT=new c.RenderTargetTexture(name+"_reflection",{width:r.x,height:r.y},e,!1,!0),this._reflectionRTT.wrapU=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var n,a=null,s=c.Matrix.Zero();this._refractionRTT.onBeforeRender=function(){if(i._mesh&&(t=i._mesh.isVisible,i._mesh.isVisible=!1),!i.disableClipPlane){a=e.clipPlane;var r=i._mesh?i._mesh.absolutePosition.y:0;e.clipPlane=c.Plane.FromPositionAndNormal(new c.Vector3(0,r+.05,0),new c.Vector3(0,1,0))}},this._refractionRTT.onAfterRender=function(){i._mesh&&(i._mesh.isVisible=t),i.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(i._mesh&&(t=i._mesh.isVisible,i._mesh.isVisible=!1),!i.disableClipPlane){a=e.clipPlane;var r=i._mesh?i._mesh.absolutePosition.y:0;e.clipPlane=c.Plane.FromPositionAndNormal(new c.Vector3(0,r-.05,0),new c.Vector3(0,-1,0)),c.Matrix.ReflectionToRef(e.clipPlane,s),i._offsetMirror.copyFrom(s),e.floatingOriginMode&&((0,c.OffsetClipPlaneToRef)(e.floatingOriginOffset,e.clipPlane,i._tempPlane),c.Matrix.ReflectionToRef(i._tempPlane,i._offsetMirror))}n=e.getViewMatrix(),s.multiplyToRef(n,i._reflectionTransform),e.setTransformMatrix(i._reflectionTransform,e.getProjectionMatrix()),e._mirroredCameraPosition=c.Vector3.TransformCoordinates(e.activeCamera.position,s)},this._reflectionRTT.onAfterRender=function(){i._mesh&&(i._mesh.isVisible=t),e.clipPlane=a,e.setTransformMatrix(n,e.getProjectionMatrix()),e._mirroredCameraPosition=null}},r.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},r.prototype.getActiveTextures=function(){var r=e.prototype.getActiveTextures.call(this);return this._bumpTexture&&r.push(this._bumpTexture),r},r.prototype.hasTexture=function(r){return!!e.prototype.hasTexture.call(this,r)||this._bumpTexture===r},r.prototype.dispose=function(r){this.bumpTexture&&this.bumpTexture.dispose();var i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);-1!=i&&this.getScene().customRenderTargets.splice(i,1),i=-1,-1!=(i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT))&&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),e.prototype.dispose.call(this,r)},r.prototype.clone=function(e){var i=this;return c.SerializationHelper.Clone((function(){return new r(e,i.getScene())}),this)},r.prototype.serialize=function(){var r=e.prototype.serialize.call(this);if(r.customType="BABYLON.WaterMaterial",r.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var i=0;i<this._refractionRTT.renderList.length;i++)r.renderList.push(this._refractionRTT.renderList[i].id);return r},r.prototype.getClassName=function(){return"WaterMaterial"},r.Parse=function(e,i,t){var o=c.SerializationHelper.Parse((function(){return new r(e.name,i)}),e,i,t);return o._waitingRenderList=e.renderList,o},r.CreateDefaultMesh=function(e,r){return(0,c.CreateGround)(e,{width:512,height:512,subdivisions:32,updatable:!1},r)},f([(0,c.serializeAsTexture)("bumpTexture")],r.prototype,"_bumpTexture",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],r.prototype,"bumpTexture",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"diffuseColor",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"specularColor",void 0),f([(0,c.serialize)()],r.prototype,"specularPower",void 0),f([(0,c.serialize)("disableLighting")],r.prototype,"_disableLighting",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsLightsDirty")],r.prototype,"disableLighting",void 0),f([(0,c.serialize)("maxSimultaneousLights")],r.prototype,"_maxSimultaneousLights",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsLightsDirty")],r.prototype,"maxSimultaneousLights",void 0),f([(0,c.serialize)()],r.prototype,"windForce",void 0),f([(0,c.serializeAsVector2)()],r.prototype,"windDirection",void 0),f([(0,c.serialize)()],r.prototype,"waveHeight",void 0),f([(0,c.serialize)()],r.prototype,"bumpHeight",void 0),f([(0,c.serialize)("bumpSuperimpose")],r.prototype,"_bumpSuperimpose",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"bumpSuperimpose",void 0),f([(0,c.serialize)("fresnelSeparate")],r.prototype,"_fresnelSeparate",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"fresnelSeparate",void 0),f([(0,c.serialize)("bumpAffectsReflection")],r.prototype,"_bumpAffectsReflection",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"bumpAffectsReflection",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"waterColor",void 0),f([(0,c.serialize)()],r.prototype,"colorBlendFactor",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"waterColor2",void 0),f([(0,c.serialize)()],r.prototype,"colorBlendFactor2",void 0),f([(0,c.serialize)()],r.prototype,"waveLength",void 0),f([(0,c.serialize)()],r.prototype,"waveSpeed",void 0),f([(0,c.serialize)()],r.prototype,"waveCount",void 0),f([(0,c.serialize)()],r.prototype,"disableClipPlane",void 0),f([(0,c.serialize)("useWorldCoordinatesForWaveDeformation")],r.prototype,"_useWorldCoordinatesForWaveDeformation",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"useWorldCoordinatesForWaveDeformation",void 0),r}(c.PushMaterial);(0,c.RegisterClass)("BABYLON.WaterMaterial",v);var m=void 0!==t.g?t.g:"undefined"!=typeof window?window:void 0;if(void 0!==m)for(var h in n)m.BABYLON[h]=n[h];const T=a;return o.default})()));
1
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-materials",["babylonjs"],r):"object"==typeof exports?exports["babylonjs-materials"]=r(require("babylonjs")):e.MATERIALS=r(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(e=>(()=>{"use strict";var r={597:r=>{r.exports=e}},i={};function t(e){var o=i[e];if(void 0!==o)return o.exports;var n=i[e]={exports:{}};return r[e](n,n.exports,t),n.exports}t.d=(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};t.d(o,{default:()=>T});var n={};t.r(n),t.d(n,{WaterMaterial:()=>v});var a={};t.r(a),t.d(a,{WaterMaterial:()=>v});var s=function(e,r){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])},s(e,r)};function l(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}s(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}function f(e,r,i,t){var o,n=arguments.length,a=n<3?r:null===t?t=Object.getOwnPropertyDescriptor(r,i):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,r,i,t);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(n<3?o(a):n>3?o(r,i,a):o(r,i))||a);return n>3&&a&&Object.defineProperty(r,i,a),a}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var c=t(597),d="waterPixelShader";c.ShaderStore.ShadersStore[d]||(c.ShaderStore.ShadersStore[d]="#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#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");var u="waterVertexShader";c.ShaderStore.ShadersStore[u]||(c.ShaderStore.ShadersStore[u]="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#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");var p=function(e){function r(){var r=e.call(this)||this;return r.BUMP=!1,r.REFLECTION=!1,r.CLIPPLANE=!1,r.CLIPPLANE2=!1,r.CLIPPLANE3=!1,r.CLIPPLANE4=!1,r.CLIPPLANE5=!1,r.CLIPPLANE6=!1,r.ALPHATEST=!1,r.DEPTHPREPASS=!1,r.POINTSIZE=!1,r.FOG=!1,r.NORMAL=!1,r.UV1=!1,r.UV2=!1,r.VERTEXCOLOR=!1,r.VERTEXALPHA=!1,r.NUM_BONE_INFLUENCERS=0,r.BonesPerMesh=0,r.INSTANCES=!1,r.INSTANCESCOLOR=!1,r.SPECULARTERM=!1,r.LOGARITHMICDEPTH=!1,r.USE_REVERSE_DEPTHBUFFER=!1,r.FRESNELSEPARATE=!1,r.BUMPSUPERIMPOSE=!1,r.BUMPAFFECTSREFLECTION=!1,r.USE_WORLD_COORDINATES=!1,r.IMAGEPROCESSING=!1,r.VIGNETTE=!1,r.VIGNETTEBLENDMODEMULTIPLY=!1,r.VIGNETTEBLENDMODEOPAQUE=!1,r.TONEMAPPING=0,r.CONTRAST=!1,r.EXPOSURE=!1,r.COLORCURVES=!1,r.COLORGRADING=!1,r.COLORGRADING3D=!1,r.SAMPLER3DGREENDEPTH=!1,r.SAMPLER3DBGRMAP=!1,r.DITHER=!1,r.IMAGEPROCESSINGPOSTPROCESS=!1,r.SKIPFINALCOLORCLAMP=!1,r.rebuild(),r}return l(r,e),r}(c.MaterialDefines),v=function(e){function r(r,i,t){void 0===t&&(t=new c.Vector2(512,512));var o=e.call(this,r,i)||this;return o.renderTargetSize=t,o.diffuseColor=new c.Color3(1,1,1),o.specularColor=new c.Color3(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new c.Vector2(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new c.Color3(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new c.Color3(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.waveCount=20,o.disableClipPlane=!1,o._useWorldCoordinatesForWaveDeformation=!1,o._renderTargets=new c.SmartArray(16),o._mesh=null,o._reflectionTransform=c.Matrix.Zero(),o._offsetMirror=c.Matrix.Zero(),o._tempPlane=new c.Plane(0,0,0,0),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(o.getScene(),t),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add((function(){o._markAllSubMeshesAsImageProcessingDirty()}))),o}return l(r,e),Object.defineProperty(r.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),r.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},r.prototype.removeFromRenderList=function(e){var r;this._refractionRTT&&this._refractionRTT.renderList&&-1!==(r=this._refractionRTT.renderList.indexOf(e))&&this._refractionRTT.renderList.splice(r,1),this._reflectionRTT&&this._reflectionRTT.renderList&&-1!==(r=this._reflectionRTT.renderList.indexOf(e))&&this._reflectionRTT.renderList.splice(r,1)},r.prototype.enableRenderTargets=function(e){var r=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=r),this._reflectionRTT&&(this._reflectionRTT.refreshRate=r)},r.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(r.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&0===this._refractionRTT.refreshRate)},enumerable:!1,configurable:!0}),r.prototype.needAlphaBlending=function(){return this.alpha<1},r.prototype.needAlphaTesting=function(){return!1},r.prototype.getAlphaTestTexture=function(){return null},r.prototype.isReadyForSubMesh=function(e,r,i){var t=r._drawWrapper;if(this.isFrozen&&t.effect&&t._wasPreviouslyReady&&t._wasPreviouslyUsingInstances===i)return!0;r.materialDefines||(r.materialDefines=new p);var o=r.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(r))return!0;var a=n.getEngine();if(o._areTexturesDirty&&(o._needUVs=!1,n.texturesEnabled)){if(this.bumpTexture&&c.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture.isReady())return!1;o._needUVs=!0,o.BUMP=!0}c.MaterialFlags.ReflectionTextureEnabled&&(o.REFLECTION=!0)}if((0,c.PrepareDefinesForFrameBoundValues)(n,a,this,o,!!i),(0,c.PrepareDefinesForMisc)(e,n,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),o,void 0,void 0,void 0,this._isVertexOutputInvariant),o._areMiscDirty&&(o.FRESNELSEPARATE=this._fresnelSeparate,o.BUMPSUPERIMPOSE=this._bumpSuperimpose,o.BUMPAFFECTSREFLECTION=this._bumpAffectsReflection,o.USE_WORLD_COORDINATES=this._useWorldCoordinatesForWaveDeformation),o._needNormals=(0,c.PrepareDefinesForLights)(n,e,o,!0,this._maxSimultaneousLights,this._disableLighting),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if((0,c.PrepareDefinesForAttributes)(e,o,!0,!0),this._mesh=e,this._waitingRenderList){for(var s=0;s<this._waitingRenderList.length;s++)this.addToRenderList(n.getNodeById(this._waitingRenderList[s]));this._waitingRenderList=null}if(o.isDirty){o.markAsProcessed(),n.resetCachedMaterial();var l=new c.EffectFallbacks;o.FOG&&l.addFallback(1,"FOG"),o.LOGARITHMICDEPTH&&l.addFallback(0,"LOGARITHMICDEPTH"),(0,c.HandleFallbacksForShadows)(o,l,this.maxSimultaneousLights),o.NUM_BONE_INFLUENCERS>0&&l.addCPUSkinningFallback(0,e);var f=[c.VertexBuffer.PositionKind];o.NORMAL&&f.push(c.VertexBuffer.NormalKind),o.UV1&&f.push(c.VertexBuffer.UVKind),o.UV2&&f.push(c.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&f.push(c.VertexBuffer.ColorKind),(0,c.PrepareAttributesForBones)(f,e,o,l),(0,c.PrepareAttributesForInstances)(f,o);var d=o.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"],v=["normalSampler","refractionSampler","reflectionSampler"],m=[];c.ImageProcessingConfiguration&&(c.ImageProcessingConfiguration.PrepareUniforms(u,o),c.ImageProcessingConfiguration.PrepareSamplers(v,o)),(0,c.AddClipPlaneUniforms)(u),(0,c.PrepareUniformsAndSamplersList)({uniformsNames:u,uniformBuffersNames:m,samplers:v,defines:o,maxSimultaneousLights:this.maxSimultaneousLights}),r.setEffect(n.getEngine().createEffect("water",{attributes:f,uniformsNames:u,uniformBuffersNames:m,samplers:v,defines:d,fallbacks:l,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},a),o,this._materialContext)}return!(!r.effect||!r.effect.isReady()||(o._renderId=n.getRenderId(),t._wasPreviouslyReady=!0,t._wasPreviouslyUsingInstances=!!i,0))},r.prototype.bindForSubMesh=function(e,r,i){var t=this.getScene(),o=i.materialDefines;if(o){var n=i.effect;if(n&&this._mesh){this._activeEffect=n,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",t.getTransformMatrix()),(0,c.BindBonesParameters)(r,this._activeEffect),this._mustRebind(t,n,i)&&(this.bumpTexture&&c.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())),(0,c.BindClipPlane)(n,this,t),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&(0,c.BindLogDepth)(o,n,t),t.bindEyePosition(n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*r.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),t.lightsEnabled&&!this.disableLighting&&(0,c.BindLights)(t,r,this._activeEffect,o,this.maxSimultaneousLights),t.fogEnabled&&r.applyFog&&t.fogMode!==c.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",t.getViewMatrix()),(0,c.BindFogParameters)(t,r,this._activeEffect),(0,c.BindLogDepth)(o,this._activeEffect,t),c.MaterialFlags.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var a=c.TmpVectors.Matrix[3].copyFrom(this._reflectionTransform);if(t.floatingOriginMode){var s=(0,c.OffsetViewToRef)(t.floatingOriginOffset,t.getViewMatrix(),c.TmpVectors.Matrix[1]);(0,c.MultiplyMatricesToRef)(this._offsetMirror,s,a)}a.multiplyToRef(t.getProjectionMatrix(),a);var l=t.getEngine().getDeltaTime();l!==this._lastDeltaTime&&(this._lastDeltaTime=l,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("reflectionViewProjection",a),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(r,this._activeEffect,i)}}},r.prototype._createRenderTargets=function(e,r){var i=this;this._refractionRTT=new c.RenderTargetTexture(name+"_refraction",{width:r.x,height:r.y},e,!1,!0),this._refractionRTT.wrapU=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0;var t,o=!1;this._refractionRTT.onBeforeRenderObservable.add((function(){o=e.getBoundingBoxRenderer().enabled,e.getBoundingBoxRenderer().enabled=!1})),this._refractionRTT.onAfterRenderObservable.add((function(){e.getBoundingBoxRenderer().enabled=o})),this._reflectionRTT=new c.RenderTargetTexture(name+"_reflection",{width:r.x,height:r.y},e,!1,!0),this._reflectionRTT.wrapU=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var n,a=null,s=c.Matrix.Zero();this._refractionRTT.onBeforeRender=function(){if(i._mesh&&(t=i._mesh.isVisible,i._mesh.isVisible=!1),!i.disableClipPlane){a=e.clipPlane;var r=i._mesh?i._mesh.absolutePosition.y:0;e.clipPlane=c.Plane.FromPositionAndNormal(new c.Vector3(0,r+.05,0),new c.Vector3(0,1,0))}},this._refractionRTT.onAfterRender=function(){i._mesh&&(i._mesh.isVisible=t),i.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(i._mesh&&(t=i._mesh.isVisible,i._mesh.isVisible=!1),!i.disableClipPlane){a=e.clipPlane;var r=i._mesh?i._mesh.absolutePosition.y:0;e.clipPlane=c.Plane.FromPositionAndNormal(new c.Vector3(0,r-.05,0),new c.Vector3(0,-1,0)),c.Matrix.ReflectionToRef(e.clipPlane,s),i._offsetMirror.copyFrom(s),e.floatingOriginMode&&((0,c.OffsetClipPlaneToRef)(e.floatingOriginOffset,e.clipPlane,i._tempPlane),c.Matrix.ReflectionToRef(i._tempPlane,i._offsetMirror))}n=e.getViewMatrix(),s.multiplyToRef(n,i._reflectionTransform),e.setTransformMatrix(i._reflectionTransform,e.getProjectionMatrix());var o=c.Vector3.TransformCoordinates(e.activeCamera.position,s);e._mirroredCameraPosition=o,e._forcedViewPosition=o},this._reflectionRTT.onAfterRender=function(){i._mesh&&(i._mesh.isVisible=t),e.clipPlane=a,e.setTransformMatrix(n,e.getProjectionMatrix()),e._mirroredCameraPosition=null,e._forcedViewPosition=null}},r.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},r.prototype.getActiveTextures=function(){var r=e.prototype.getActiveTextures.call(this);return this._bumpTexture&&r.push(this._bumpTexture),r},r.prototype.hasTexture=function(r){return!!e.prototype.hasTexture.call(this,r)||this._bumpTexture===r},r.prototype.dispose=function(r){this.bumpTexture&&this.bumpTexture.dispose();var i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);-1!=i&&this.getScene().customRenderTargets.splice(i,1),i=-1,-1!=(i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT))&&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),e.prototype.dispose.call(this,r)},r.prototype.clone=function(e){var i=this;return c.SerializationHelper.Clone((function(){return new r(e,i.getScene())}),this)},r.prototype.serialize=function(){var r=e.prototype.serialize.call(this);if(r.customType="BABYLON.WaterMaterial",r.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var i=0;i<this._refractionRTT.renderList.length;i++)r.renderList.push(this._refractionRTT.renderList[i].id);return r},r.prototype.getClassName=function(){return"WaterMaterial"},r.Parse=function(e,i,t){var o=c.SerializationHelper.Parse((function(){return new r(e.name,i)}),e,i,t);return o._waitingRenderList=e.renderList,o},r.CreateDefaultMesh=function(e,r){return(0,c.CreateGround)(e,{width:512,height:512,subdivisions:32,updatable:!1},r)},f([(0,c.serializeAsTexture)("bumpTexture")],r.prototype,"_bumpTexture",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],r.prototype,"bumpTexture",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"diffuseColor",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"specularColor",void 0),f([(0,c.serialize)()],r.prototype,"specularPower",void 0),f([(0,c.serialize)("disableLighting")],r.prototype,"_disableLighting",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsLightsDirty")],r.prototype,"disableLighting",void 0),f([(0,c.serialize)("maxSimultaneousLights")],r.prototype,"_maxSimultaneousLights",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsLightsDirty")],r.prototype,"maxSimultaneousLights",void 0),f([(0,c.serialize)()],r.prototype,"windForce",void 0),f([(0,c.serializeAsVector2)()],r.prototype,"windDirection",void 0),f([(0,c.serialize)()],r.prototype,"waveHeight",void 0),f([(0,c.serialize)()],r.prototype,"bumpHeight",void 0),f([(0,c.serialize)("bumpSuperimpose")],r.prototype,"_bumpSuperimpose",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"bumpSuperimpose",void 0),f([(0,c.serialize)("fresnelSeparate")],r.prototype,"_fresnelSeparate",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"fresnelSeparate",void 0),f([(0,c.serialize)("bumpAffectsReflection")],r.prototype,"_bumpAffectsReflection",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"bumpAffectsReflection",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"waterColor",void 0),f([(0,c.serialize)()],r.prototype,"colorBlendFactor",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"waterColor2",void 0),f([(0,c.serialize)()],r.prototype,"colorBlendFactor2",void 0),f([(0,c.serialize)()],r.prototype,"waveLength",void 0),f([(0,c.serialize)()],r.prototype,"waveSpeed",void 0),f([(0,c.serialize)()],r.prototype,"waveCount",void 0),f([(0,c.serialize)()],r.prototype,"disableClipPlane",void 0),f([(0,c.serialize)("useWorldCoordinatesForWaveDeformation")],r.prototype,"_useWorldCoordinatesForWaveDeformation",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"useWorldCoordinatesForWaveDeformation",void 0),r}(c.PushMaterial);(0,c.RegisterClass)("BABYLON.WaterMaterial",v);var m=void 0!==t.g?t.g:"undefined"!=typeof window?window:void 0;if(void 0!==m)for(var h in n)m.BABYLON[h]=n[h];const T=a;return o.default})()));
2
2
  //# sourceMappingURL=babylon.waterMaterial.min.js.map
@@ -1,2 +1,2 @@
1
- !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-materials",["babylonjs"],r):"object"==typeof exports?exports["babylonjs-materials"]=r(require("babylonjs")):e.MATERIALS=r(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(e=>(()=>{"use strict";var r={597:r=>{r.exports=e}},i={};function t(e){var o=i[e];if(void 0!==o)return o.exports;var n=i[e]={exports:{}};return r[e](n,n.exports,t),n.exports}t.d=(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};t.d(o,{default:()=>T});var n={};t.r(n),t.d(n,{WaterMaterial:()=>v});var a={};t.r(a),t.d(a,{WaterMaterial:()=>v});var s=function(e,r){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])},s(e,r)};function l(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}s(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}function f(e,r,i,t){var o,n=arguments.length,a=n<3?r:null===t?t=Object.getOwnPropertyDescriptor(r,i):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,r,i,t);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(n<3?o(a):n>3?o(r,i,a):o(r,i))||a);return n>3&&a&&Object.defineProperty(r,i,a),a}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var c=t(597),d="waterPixelShader";c.ShaderStore.ShadersStore[d]||(c.ShaderStore.ShadersStore[d]="#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#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");var u="waterVertexShader";c.ShaderStore.ShadersStore[u]||(c.ShaderStore.ShadersStore[u]="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#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");var p=function(e){function r(){var r=e.call(this)||this;return r.BUMP=!1,r.REFLECTION=!1,r.CLIPPLANE=!1,r.CLIPPLANE2=!1,r.CLIPPLANE3=!1,r.CLIPPLANE4=!1,r.CLIPPLANE5=!1,r.CLIPPLANE6=!1,r.ALPHATEST=!1,r.DEPTHPREPASS=!1,r.POINTSIZE=!1,r.FOG=!1,r.NORMAL=!1,r.UV1=!1,r.UV2=!1,r.VERTEXCOLOR=!1,r.VERTEXALPHA=!1,r.NUM_BONE_INFLUENCERS=0,r.BonesPerMesh=0,r.INSTANCES=!1,r.INSTANCESCOLOR=!1,r.SPECULARTERM=!1,r.LOGARITHMICDEPTH=!1,r.USE_REVERSE_DEPTHBUFFER=!1,r.FRESNELSEPARATE=!1,r.BUMPSUPERIMPOSE=!1,r.BUMPAFFECTSREFLECTION=!1,r.USE_WORLD_COORDINATES=!1,r.IMAGEPROCESSING=!1,r.VIGNETTE=!1,r.VIGNETTEBLENDMODEMULTIPLY=!1,r.VIGNETTEBLENDMODEOPAQUE=!1,r.TONEMAPPING=0,r.CONTRAST=!1,r.EXPOSURE=!1,r.COLORCURVES=!1,r.COLORGRADING=!1,r.COLORGRADING3D=!1,r.SAMPLER3DGREENDEPTH=!1,r.SAMPLER3DBGRMAP=!1,r.DITHER=!1,r.IMAGEPROCESSINGPOSTPROCESS=!1,r.SKIPFINALCOLORCLAMP=!1,r.rebuild(),r}return l(r,e),r}(c.MaterialDefines),v=function(e){function r(r,i,t){void 0===t&&(t=new c.Vector2(512,512));var o=e.call(this,r,i)||this;return o.renderTargetSize=t,o.diffuseColor=new c.Color3(1,1,1),o.specularColor=new c.Color3(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new c.Vector2(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new c.Color3(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new c.Color3(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.waveCount=20,o.disableClipPlane=!1,o._useWorldCoordinatesForWaveDeformation=!1,o._renderTargets=new c.SmartArray(16),o._mesh=null,o._reflectionTransform=c.Matrix.Zero(),o._offsetMirror=c.Matrix.Zero(),o._tempPlane=new c.Plane(0,0,0,0),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(o.getScene(),t),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add((function(){o._markAllSubMeshesAsImageProcessingDirty()}))),o}return l(r,e),Object.defineProperty(r.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),r.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},r.prototype.removeFromRenderList=function(e){var r;this._refractionRTT&&this._refractionRTT.renderList&&-1!==(r=this._refractionRTT.renderList.indexOf(e))&&this._refractionRTT.renderList.splice(r,1),this._reflectionRTT&&this._reflectionRTT.renderList&&-1!==(r=this._reflectionRTT.renderList.indexOf(e))&&this._reflectionRTT.renderList.splice(r,1)},r.prototype.enableRenderTargets=function(e){var r=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=r),this._reflectionRTT&&(this._reflectionRTT.refreshRate=r)},r.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(r.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&0===this._refractionRTT.refreshRate)},enumerable:!1,configurable:!0}),r.prototype.needAlphaBlending=function(){return this.alpha<1},r.prototype.needAlphaTesting=function(){return!1},r.prototype.getAlphaTestTexture=function(){return null},r.prototype.isReadyForSubMesh=function(e,r,i){var t=r._drawWrapper;if(this.isFrozen&&t.effect&&t._wasPreviouslyReady&&t._wasPreviouslyUsingInstances===i)return!0;r.materialDefines||(r.materialDefines=new p);var o=r.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(r))return!0;var a=n.getEngine();if(o._areTexturesDirty&&(o._needUVs=!1,n.texturesEnabled)){if(this.bumpTexture&&c.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture.isReady())return!1;o._needUVs=!0,o.BUMP=!0}c.MaterialFlags.ReflectionTextureEnabled&&(o.REFLECTION=!0)}if((0,c.PrepareDefinesForFrameBoundValues)(n,a,this,o,!!i),(0,c.PrepareDefinesForMisc)(e,n,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),o,void 0,void 0,void 0,this._isVertexOutputInvariant),o._areMiscDirty&&(o.FRESNELSEPARATE=this._fresnelSeparate,o.BUMPSUPERIMPOSE=this._bumpSuperimpose,o.BUMPAFFECTSREFLECTION=this._bumpAffectsReflection,o.USE_WORLD_COORDINATES=this._useWorldCoordinatesForWaveDeformation),o._needNormals=(0,c.PrepareDefinesForLights)(n,e,o,!0,this._maxSimultaneousLights,this._disableLighting),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if((0,c.PrepareDefinesForAttributes)(e,o,!0,!0),this._mesh=e,this._waitingRenderList){for(var s=0;s<this._waitingRenderList.length;s++)this.addToRenderList(n.getNodeById(this._waitingRenderList[s]));this._waitingRenderList=null}if(o.isDirty){o.markAsProcessed(),n.resetCachedMaterial();var l=new c.EffectFallbacks;o.FOG&&l.addFallback(1,"FOG"),o.LOGARITHMICDEPTH&&l.addFallback(0,"LOGARITHMICDEPTH"),(0,c.HandleFallbacksForShadows)(o,l,this.maxSimultaneousLights),o.NUM_BONE_INFLUENCERS>0&&l.addCPUSkinningFallback(0,e);var f=[c.VertexBuffer.PositionKind];o.NORMAL&&f.push(c.VertexBuffer.NormalKind),o.UV1&&f.push(c.VertexBuffer.UVKind),o.UV2&&f.push(c.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&f.push(c.VertexBuffer.ColorKind),(0,c.PrepareAttributesForBones)(f,e,o,l),(0,c.PrepareAttributesForInstances)(f,o);var d=o.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"],v=["normalSampler","refractionSampler","reflectionSampler"],m=[];c.ImageProcessingConfiguration&&(c.ImageProcessingConfiguration.PrepareUniforms(u,o),c.ImageProcessingConfiguration.PrepareSamplers(v,o)),(0,c.AddClipPlaneUniforms)(u),(0,c.PrepareUniformsAndSamplersList)({uniformsNames:u,uniformBuffersNames:m,samplers:v,defines:o,maxSimultaneousLights:this.maxSimultaneousLights}),r.setEffect(n.getEngine().createEffect("water",{attributes:f,uniformsNames:u,uniformBuffersNames:m,samplers:v,defines:d,fallbacks:l,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},a),o,this._materialContext)}return!(!r.effect||!r.effect.isReady()||(o._renderId=n.getRenderId(),t._wasPreviouslyReady=!0,t._wasPreviouslyUsingInstances=!!i,0))},r.prototype.bindForSubMesh=function(e,r,i){var t=this.getScene(),o=i.materialDefines;if(o){var n=i.effect;if(n&&this._mesh){this._activeEffect=n,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",t.getTransformMatrix()),(0,c.BindBonesParameters)(r,this._activeEffect),this._mustRebind(t,n,i)&&(this.bumpTexture&&c.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())),(0,c.BindClipPlane)(n,this,t),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&(0,c.BindLogDepth)(o,n,t),t.bindEyePosition(n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*r.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),t.lightsEnabled&&!this.disableLighting&&(0,c.BindLights)(t,r,this._activeEffect,o,this.maxSimultaneousLights),t.fogEnabled&&r.applyFog&&t.fogMode!==c.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",t.getViewMatrix()),(0,c.BindFogParameters)(t,r,this._activeEffect),(0,c.BindLogDepth)(o,this._activeEffect,t),c.MaterialFlags.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var a=c.TmpVectors.Matrix[3].copyFrom(this._reflectionTransform);if(t.floatingOriginMode){var s=(0,c.OffsetViewToRef)(t.floatingOriginOffset,t.getViewMatrix(),c.TmpVectors.Matrix[1]);(0,c.MultiplyMatricesToRef)(this._offsetMirror,s,a)}a.multiplyToRef(t.getProjectionMatrix(),a);var l=t.getEngine().getDeltaTime();l!==this._lastDeltaTime&&(this._lastDeltaTime=l,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("reflectionViewProjection",a),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(r,this._activeEffect,i)}}},r.prototype._createRenderTargets=function(e,r){var i=this;this._refractionRTT=new c.RenderTargetTexture(name+"_refraction",{width:r.x,height:r.y},e,!1,!0),this._refractionRTT.wrapU=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0;var t,o=!1;this._refractionRTT.onBeforeRenderObservable.add((function(){o=e.getBoundingBoxRenderer().enabled,e.getBoundingBoxRenderer().enabled=!1})),this._refractionRTT.onAfterRenderObservable.add((function(){e.getBoundingBoxRenderer().enabled=o})),this._reflectionRTT=new c.RenderTargetTexture(name+"_reflection",{width:r.x,height:r.y},e,!1,!0),this._reflectionRTT.wrapU=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var n,a=null,s=c.Matrix.Zero();this._refractionRTT.onBeforeRender=function(){if(i._mesh&&(t=i._mesh.isVisible,i._mesh.isVisible=!1),!i.disableClipPlane){a=e.clipPlane;var r=i._mesh?i._mesh.absolutePosition.y:0;e.clipPlane=c.Plane.FromPositionAndNormal(new c.Vector3(0,r+.05,0),new c.Vector3(0,1,0))}},this._refractionRTT.onAfterRender=function(){i._mesh&&(i._mesh.isVisible=t),i.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(i._mesh&&(t=i._mesh.isVisible,i._mesh.isVisible=!1),!i.disableClipPlane){a=e.clipPlane;var r=i._mesh?i._mesh.absolutePosition.y:0;e.clipPlane=c.Plane.FromPositionAndNormal(new c.Vector3(0,r-.05,0),new c.Vector3(0,-1,0)),c.Matrix.ReflectionToRef(e.clipPlane,s),i._offsetMirror.copyFrom(s),e.floatingOriginMode&&((0,c.OffsetClipPlaneToRef)(e.floatingOriginOffset,e.clipPlane,i._tempPlane),c.Matrix.ReflectionToRef(i._tempPlane,i._offsetMirror))}n=e.getViewMatrix(),s.multiplyToRef(n,i._reflectionTransform),e.setTransformMatrix(i._reflectionTransform,e.getProjectionMatrix()),e._mirroredCameraPosition=c.Vector3.TransformCoordinates(e.activeCamera.position,s)},this._reflectionRTT.onAfterRender=function(){i._mesh&&(i._mesh.isVisible=t),e.clipPlane=a,e.setTransformMatrix(n,e.getProjectionMatrix()),e._mirroredCameraPosition=null}},r.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},r.prototype.getActiveTextures=function(){var r=e.prototype.getActiveTextures.call(this);return this._bumpTexture&&r.push(this._bumpTexture),r},r.prototype.hasTexture=function(r){return!!e.prototype.hasTexture.call(this,r)||this._bumpTexture===r},r.prototype.dispose=function(r){this.bumpTexture&&this.bumpTexture.dispose();var i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);-1!=i&&this.getScene().customRenderTargets.splice(i,1),i=-1,-1!=(i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT))&&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),e.prototype.dispose.call(this,r)},r.prototype.clone=function(e){var i=this;return c.SerializationHelper.Clone((function(){return new r(e,i.getScene())}),this)},r.prototype.serialize=function(){var r=e.prototype.serialize.call(this);if(r.customType="BABYLON.WaterMaterial",r.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var i=0;i<this._refractionRTT.renderList.length;i++)r.renderList.push(this._refractionRTT.renderList[i].id);return r},r.prototype.getClassName=function(){return"WaterMaterial"},r.Parse=function(e,i,t){var o=c.SerializationHelper.Parse((function(){return new r(e.name,i)}),e,i,t);return o._waitingRenderList=e.renderList,o},r.CreateDefaultMesh=function(e,r){return(0,c.CreateGround)(e,{width:512,height:512,subdivisions:32,updatable:!1},r)},f([(0,c.serializeAsTexture)("bumpTexture")],r.prototype,"_bumpTexture",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],r.prototype,"bumpTexture",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"diffuseColor",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"specularColor",void 0),f([(0,c.serialize)()],r.prototype,"specularPower",void 0),f([(0,c.serialize)("disableLighting")],r.prototype,"_disableLighting",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsLightsDirty")],r.prototype,"disableLighting",void 0),f([(0,c.serialize)("maxSimultaneousLights")],r.prototype,"_maxSimultaneousLights",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsLightsDirty")],r.prototype,"maxSimultaneousLights",void 0),f([(0,c.serialize)()],r.prototype,"windForce",void 0),f([(0,c.serializeAsVector2)()],r.prototype,"windDirection",void 0),f([(0,c.serialize)()],r.prototype,"waveHeight",void 0),f([(0,c.serialize)()],r.prototype,"bumpHeight",void 0),f([(0,c.serialize)("bumpSuperimpose")],r.prototype,"_bumpSuperimpose",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"bumpSuperimpose",void 0),f([(0,c.serialize)("fresnelSeparate")],r.prototype,"_fresnelSeparate",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"fresnelSeparate",void 0),f([(0,c.serialize)("bumpAffectsReflection")],r.prototype,"_bumpAffectsReflection",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"bumpAffectsReflection",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"waterColor",void 0),f([(0,c.serialize)()],r.prototype,"colorBlendFactor",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"waterColor2",void 0),f([(0,c.serialize)()],r.prototype,"colorBlendFactor2",void 0),f([(0,c.serialize)()],r.prototype,"waveLength",void 0),f([(0,c.serialize)()],r.prototype,"waveSpeed",void 0),f([(0,c.serialize)()],r.prototype,"waveCount",void 0),f([(0,c.serialize)()],r.prototype,"disableClipPlane",void 0),f([(0,c.serialize)("useWorldCoordinatesForWaveDeformation")],r.prototype,"_useWorldCoordinatesForWaveDeformation",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"useWorldCoordinatesForWaveDeformation",void 0),r}(c.PushMaterial);(0,c.RegisterClass)("BABYLON.WaterMaterial",v);var m=void 0!==t.g?t.g:"undefined"!=typeof window?window:void 0;if(void 0!==m)for(var h in n)m.BABYLON[h]=n[h];const T=a;return o.default})()));
1
+ !function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-materials",["babylonjs"],r):"object"==typeof exports?exports["babylonjs-materials"]=r(require("babylonjs")):e.MATERIALS=r(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(e=>(()=>{"use strict";var r={597:r=>{r.exports=e}},i={};function t(e){var o=i[e];if(void 0!==o)return o.exports;var n=i[e]={exports:{}};return r[e](n,n.exports,t),n.exports}t.d=(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};t.d(o,{default:()=>T});var n={};t.r(n),t.d(n,{WaterMaterial:()=>v});var a={};t.r(a),t.d(a,{WaterMaterial:()=>v});var s=function(e,r){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])},s(e,r)};function l(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}s(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}function f(e,r,i,t){var o,n=arguments.length,a=n<3?r:null===t?t=Object.getOwnPropertyDescriptor(r,i):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,r,i,t);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(n<3?o(a):n>3?o(r,i,a):o(r,i))||a);return n>3&&a&&Object.defineProperty(r,i,a),a}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var c=t(597),d="waterPixelShader";c.ShaderStore.ShadersStore[d]||(c.ShaderStore.ShadersStore[d]="#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#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");var u="waterVertexShader";c.ShaderStore.ShadersStore[u]||(c.ShaderStore.ShadersStore[u]="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#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");var p=function(e){function r(){var r=e.call(this)||this;return r.BUMP=!1,r.REFLECTION=!1,r.CLIPPLANE=!1,r.CLIPPLANE2=!1,r.CLIPPLANE3=!1,r.CLIPPLANE4=!1,r.CLIPPLANE5=!1,r.CLIPPLANE6=!1,r.ALPHATEST=!1,r.DEPTHPREPASS=!1,r.POINTSIZE=!1,r.FOG=!1,r.NORMAL=!1,r.UV1=!1,r.UV2=!1,r.VERTEXCOLOR=!1,r.VERTEXALPHA=!1,r.NUM_BONE_INFLUENCERS=0,r.BonesPerMesh=0,r.INSTANCES=!1,r.INSTANCESCOLOR=!1,r.SPECULARTERM=!1,r.LOGARITHMICDEPTH=!1,r.USE_REVERSE_DEPTHBUFFER=!1,r.FRESNELSEPARATE=!1,r.BUMPSUPERIMPOSE=!1,r.BUMPAFFECTSREFLECTION=!1,r.USE_WORLD_COORDINATES=!1,r.IMAGEPROCESSING=!1,r.VIGNETTE=!1,r.VIGNETTEBLENDMODEMULTIPLY=!1,r.VIGNETTEBLENDMODEOPAQUE=!1,r.TONEMAPPING=0,r.CONTRAST=!1,r.EXPOSURE=!1,r.COLORCURVES=!1,r.COLORGRADING=!1,r.COLORGRADING3D=!1,r.SAMPLER3DGREENDEPTH=!1,r.SAMPLER3DBGRMAP=!1,r.DITHER=!1,r.IMAGEPROCESSINGPOSTPROCESS=!1,r.SKIPFINALCOLORCLAMP=!1,r.rebuild(),r}return l(r,e),r}(c.MaterialDefines),v=function(e){function r(r,i,t){void 0===t&&(t=new c.Vector2(512,512));var o=e.call(this,r,i)||this;return o.renderTargetSize=t,o.diffuseColor=new c.Color3(1,1,1),o.specularColor=new c.Color3(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new c.Vector2(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new c.Color3(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new c.Color3(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.waveCount=20,o.disableClipPlane=!1,o._useWorldCoordinatesForWaveDeformation=!1,o._renderTargets=new c.SmartArray(16),o._mesh=null,o._reflectionTransform=c.Matrix.Zero(),o._offsetMirror=c.Matrix.Zero(),o._tempPlane=new c.Plane(0,0,0,0),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(o.getScene(),t),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add((function(){o._markAllSubMeshesAsImageProcessingDirty()}))),o}return l(r,e),Object.defineProperty(r.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),r.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},r.prototype.removeFromRenderList=function(e){var r;this._refractionRTT&&this._refractionRTT.renderList&&-1!==(r=this._refractionRTT.renderList.indexOf(e))&&this._refractionRTT.renderList.splice(r,1),this._reflectionRTT&&this._reflectionRTT.renderList&&-1!==(r=this._reflectionRTT.renderList.indexOf(e))&&this._reflectionRTT.renderList.splice(r,1)},r.prototype.enableRenderTargets=function(e){var r=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=r),this._reflectionRTT&&(this._reflectionRTT.refreshRate=r)},r.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(r.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&0===this._refractionRTT.refreshRate)},enumerable:!1,configurable:!0}),r.prototype.needAlphaBlending=function(){return this.alpha<1},r.prototype.needAlphaTesting=function(){return!1},r.prototype.getAlphaTestTexture=function(){return null},r.prototype.isReadyForSubMesh=function(e,r,i){var t=r._drawWrapper;if(this.isFrozen&&t.effect&&t._wasPreviouslyReady&&t._wasPreviouslyUsingInstances===i)return!0;r.materialDefines||(r.materialDefines=new p);var o=r.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(r))return!0;var a=n.getEngine();if(o._areTexturesDirty&&(o._needUVs=!1,n.texturesEnabled)){if(this.bumpTexture&&c.MaterialFlags.BumpTextureEnabled){if(!this.bumpTexture.isReady())return!1;o._needUVs=!0,o.BUMP=!0}c.MaterialFlags.ReflectionTextureEnabled&&(o.REFLECTION=!0)}if((0,c.PrepareDefinesForFrameBoundValues)(n,a,this,o,!!i),(0,c.PrepareDefinesForMisc)(e,n,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this.needAlphaTestingForMesh(e),o,void 0,void 0,void 0,this._isVertexOutputInvariant),o._areMiscDirty&&(o.FRESNELSEPARATE=this._fresnelSeparate,o.BUMPSUPERIMPOSE=this._bumpSuperimpose,o.BUMPAFFECTSREFLECTION=this._bumpAffectsReflection,o.USE_WORLD_COORDINATES=this._useWorldCoordinatesForWaveDeformation),o._needNormals=(0,c.PrepareDefinesForLights)(n,e,o,!0,this._maxSimultaneousLights,this._disableLighting),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if((0,c.PrepareDefinesForAttributes)(e,o,!0,!0),this._mesh=e,this._waitingRenderList){for(var s=0;s<this._waitingRenderList.length;s++)this.addToRenderList(n.getNodeById(this._waitingRenderList[s]));this._waitingRenderList=null}if(o.isDirty){o.markAsProcessed(),n.resetCachedMaterial();var l=new c.EffectFallbacks;o.FOG&&l.addFallback(1,"FOG"),o.LOGARITHMICDEPTH&&l.addFallback(0,"LOGARITHMICDEPTH"),(0,c.HandleFallbacksForShadows)(o,l,this.maxSimultaneousLights),o.NUM_BONE_INFLUENCERS>0&&l.addCPUSkinningFallback(0,e);var f=[c.VertexBuffer.PositionKind];o.NORMAL&&f.push(c.VertexBuffer.NormalKind),o.UV1&&f.push(c.VertexBuffer.UVKind),o.UV2&&f.push(c.VertexBuffer.UV2Kind),o.VERTEXCOLOR&&f.push(c.VertexBuffer.ColorKind),(0,c.PrepareAttributesForBones)(f,e,o,l),(0,c.PrepareAttributesForInstances)(f,o);var d=o.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"],v=["normalSampler","refractionSampler","reflectionSampler"],m=[];c.ImageProcessingConfiguration&&(c.ImageProcessingConfiguration.PrepareUniforms(u,o),c.ImageProcessingConfiguration.PrepareSamplers(v,o)),(0,c.AddClipPlaneUniforms)(u),(0,c.PrepareUniformsAndSamplersList)({uniformsNames:u,uniformBuffersNames:m,samplers:v,defines:o,maxSimultaneousLights:this.maxSimultaneousLights}),r.setEffect(n.getEngine().createEffect("water",{attributes:f,uniformsNames:u,uniformBuffersNames:m,samplers:v,defines:d,fallbacks:l,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},a),o,this._materialContext)}return!(!r.effect||!r.effect.isReady()||(o._renderId=n.getRenderId(),t._wasPreviouslyReady=!0,t._wasPreviouslyUsingInstances=!!i,0))},r.prototype.bindForSubMesh=function(e,r,i){var t=this.getScene(),o=i.materialDefines;if(o){var n=i.effect;if(n&&this._mesh){this._activeEffect=n,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",t.getTransformMatrix()),(0,c.BindBonesParameters)(r,this._activeEffect),this._mustRebind(t,n,i)&&(this.bumpTexture&&c.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())),(0,c.BindClipPlane)(n,this,t),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),this._useLogarithmicDepth&&(0,c.BindLogDepth)(o,n,t),t.bindEyePosition(n)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*r.visibility),o.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),t.lightsEnabled&&!this.disableLighting&&(0,c.BindLights)(t,r,this._activeEffect,o,this.maxSimultaneousLights),t.fogEnabled&&r.applyFog&&t.fogMode!==c.Scene.FOGMODE_NONE&&this._activeEffect.setMatrix("view",t.getViewMatrix()),(0,c.BindFogParameters)(t,r,this._activeEffect),(0,c.BindLogDepth)(o,this._activeEffect,t),c.MaterialFlags.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var a=c.TmpVectors.Matrix[3].copyFrom(this._reflectionTransform);if(t.floatingOriginMode){var s=(0,c.OffsetViewToRef)(t.floatingOriginOffset,t.getViewMatrix(),c.TmpVectors.Matrix[1]);(0,c.MultiplyMatricesToRef)(this._offsetMirror,s,a)}a.multiplyToRef(t.getProjectionMatrix(),a);var l=t.getEngine().getDeltaTime();l!==this._lastDeltaTime&&(this._lastDeltaTime=l,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("reflectionViewProjection",a),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(r,this._activeEffect,i)}}},r.prototype._createRenderTargets=function(e,r){var i=this;this._refractionRTT=new c.RenderTargetTexture(name+"_refraction",{width:r.x,height:r.y},e,!1,!0),this._refractionRTT.wrapU=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0;var t,o=!1;this._refractionRTT.onBeforeRenderObservable.add((function(){o=e.getBoundingBoxRenderer().enabled,e.getBoundingBoxRenderer().enabled=!1})),this._refractionRTT.onAfterRenderObservable.add((function(){e.getBoundingBoxRenderer().enabled=o})),this._reflectionRTT=new c.RenderTargetTexture(name+"_reflection",{width:r.x,height:r.y},e,!1,!0),this._reflectionRTT.wrapU=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=c.Constants.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var n,a=null,s=c.Matrix.Zero();this._refractionRTT.onBeforeRender=function(){if(i._mesh&&(t=i._mesh.isVisible,i._mesh.isVisible=!1),!i.disableClipPlane){a=e.clipPlane;var r=i._mesh?i._mesh.absolutePosition.y:0;e.clipPlane=c.Plane.FromPositionAndNormal(new c.Vector3(0,r+.05,0),new c.Vector3(0,1,0))}},this._refractionRTT.onAfterRender=function(){i._mesh&&(i._mesh.isVisible=t),i.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(i._mesh&&(t=i._mesh.isVisible,i._mesh.isVisible=!1),!i.disableClipPlane){a=e.clipPlane;var r=i._mesh?i._mesh.absolutePosition.y:0;e.clipPlane=c.Plane.FromPositionAndNormal(new c.Vector3(0,r-.05,0),new c.Vector3(0,-1,0)),c.Matrix.ReflectionToRef(e.clipPlane,s),i._offsetMirror.copyFrom(s),e.floatingOriginMode&&((0,c.OffsetClipPlaneToRef)(e.floatingOriginOffset,e.clipPlane,i._tempPlane),c.Matrix.ReflectionToRef(i._tempPlane,i._offsetMirror))}n=e.getViewMatrix(),s.multiplyToRef(n,i._reflectionTransform),e.setTransformMatrix(i._reflectionTransform,e.getProjectionMatrix());var o=c.Vector3.TransformCoordinates(e.activeCamera.position,s);e._mirroredCameraPosition=o,e._forcedViewPosition=o},this._reflectionRTT.onAfterRender=function(){i._mesh&&(i._mesh.isVisible=t),e.clipPlane=a,e.setTransformMatrix(n,e.getProjectionMatrix()),e._mirroredCameraPosition=null,e._forcedViewPosition=null}},r.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},r.prototype.getActiveTextures=function(){var r=e.prototype.getActiveTextures.call(this);return this._bumpTexture&&r.push(this._bumpTexture),r},r.prototype.hasTexture=function(r){return!!e.prototype.hasTexture.call(this,r)||this._bumpTexture===r},r.prototype.dispose=function(r){this.bumpTexture&&this.bumpTexture.dispose();var i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);-1!=i&&this.getScene().customRenderTargets.splice(i,1),i=-1,-1!=(i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT))&&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),e.prototype.dispose.call(this,r)},r.prototype.clone=function(e){var i=this;return c.SerializationHelper.Clone((function(){return new r(e,i.getScene())}),this)},r.prototype.serialize=function(){var r=e.prototype.serialize.call(this);if(r.customType="BABYLON.WaterMaterial",r.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var i=0;i<this._refractionRTT.renderList.length;i++)r.renderList.push(this._refractionRTT.renderList[i].id);return r},r.prototype.getClassName=function(){return"WaterMaterial"},r.Parse=function(e,i,t){var o=c.SerializationHelper.Parse((function(){return new r(e.name,i)}),e,i,t);return o._waitingRenderList=e.renderList,o},r.CreateDefaultMesh=function(e,r){return(0,c.CreateGround)(e,{width:512,height:512,subdivisions:32,updatable:!1},r)},f([(0,c.serializeAsTexture)("bumpTexture")],r.prototype,"_bumpTexture",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],r.prototype,"bumpTexture",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"diffuseColor",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"specularColor",void 0),f([(0,c.serialize)()],r.prototype,"specularPower",void 0),f([(0,c.serialize)("disableLighting")],r.prototype,"_disableLighting",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsLightsDirty")],r.prototype,"disableLighting",void 0),f([(0,c.serialize)("maxSimultaneousLights")],r.prototype,"_maxSimultaneousLights",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsLightsDirty")],r.prototype,"maxSimultaneousLights",void 0),f([(0,c.serialize)()],r.prototype,"windForce",void 0),f([(0,c.serializeAsVector2)()],r.prototype,"windDirection",void 0),f([(0,c.serialize)()],r.prototype,"waveHeight",void 0),f([(0,c.serialize)()],r.prototype,"bumpHeight",void 0),f([(0,c.serialize)("bumpSuperimpose")],r.prototype,"_bumpSuperimpose",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"bumpSuperimpose",void 0),f([(0,c.serialize)("fresnelSeparate")],r.prototype,"_fresnelSeparate",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"fresnelSeparate",void 0),f([(0,c.serialize)("bumpAffectsReflection")],r.prototype,"_bumpAffectsReflection",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"bumpAffectsReflection",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"waterColor",void 0),f([(0,c.serialize)()],r.prototype,"colorBlendFactor",void 0),f([(0,c.serializeAsColor3)()],r.prototype,"waterColor2",void 0),f([(0,c.serialize)()],r.prototype,"colorBlendFactor2",void 0),f([(0,c.serialize)()],r.prototype,"waveLength",void 0),f([(0,c.serialize)()],r.prototype,"waveSpeed",void 0),f([(0,c.serialize)()],r.prototype,"waveCount",void 0),f([(0,c.serialize)()],r.prototype,"disableClipPlane",void 0),f([(0,c.serialize)("useWorldCoordinatesForWaveDeformation")],r.prototype,"_useWorldCoordinatesForWaveDeformation",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsMiscDirty")],r.prototype,"useWorldCoordinatesForWaveDeformation",void 0),r}(c.PushMaterial);(0,c.RegisterClass)("BABYLON.WaterMaterial",v);var m=void 0!==t.g?t.g:"undefined"!=typeof window?window:void 0;if(void 0!==m)for(var h in n)m.BABYLON[h]=n[h];const T=a;return o.default})()));
2
2
  //# sourceMappingURL=babylon.waterMaterial.min.js.map