babylonjs-materials
Version:
Babylon.js Materials Library =====================
861 lines (792 loc) • 171 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("babylonjs"));
else if(typeof define === 'function' && define.amd)
define("babylonjs-materials", ["babylonjs"], factory);
else if(typeof exports === 'object')
exports["babylonjs-materials"] = factory(require("babylonjs"));
else
root["MATERIALS"] = factory(root["BABYLON"]);
})((typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this), (__WEBPACK_EXTERNAL_MODULE_babylonjs_Materials_effect__) => {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "../../../dev/materials/src/water/index.ts":
/*!*************************************************!*\
!*** ../../../dev/materials/src/water/index.ts ***!
\*************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ WaterMaterial: () => (/* reexport safe */ _waterMaterial__WEBPACK_IMPORTED_MODULE_0__.WaterMaterial)
/* harmony export */ });
/* harmony import */ var _waterMaterial__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./waterMaterial */ "../../../dev/materials/src/water/waterMaterial.ts");
/***/ }),
/***/ "../../../dev/materials/src/water/water.fragment.ts":
/*!**********************************************************!*\
!*** ../../../dev/materials/src/water/water.fragment.ts ***!
\**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ waterPixelShader: () => (/* binding */ waterPixelShader)
/* harmony export */ });
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Shaders/ShadersInclude/fogFragment */ "babylonjs/Materials/effect");
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
// Do not edit.
var name = "waterPixelShader";
var shader = "#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=clamp(vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n),0.0,1.0);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=clamp(vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation,0.0,1.0);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";
// Sideeffect
babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
/** @internal */
var waterPixelShader = { name: name, shader: shader };
/***/ }),
/***/ "../../../dev/materials/src/water/water.vertex.ts":
/*!********************************************************!*\
!*** ../../../dev/materials/src/water/water.vertex.ts ***!
\********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ waterVertexShader: () => (/* binding */ waterVertexShader)
/* harmony export */ });
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Shaders/ShadersInclude/logDepthVertex */ "babylonjs/Materials/effect");
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
// Do not edit.
var name = "waterVertexShader";
var shader = "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#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";
// Sideeffect
babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
/** @internal */
var waterVertexShader = { name: name, shader: shader };
/***/ }),
/***/ "../../../dev/materials/src/water/waterMaterial.ts":
/*!*********************************************************!*\
!*** ../../../dev/materials/src/water/waterMaterial.ts ***!
\*********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ WaterMaterial: () => (/* binding */ WaterMaterial)
/* harmony export */ });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.mjs");
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/materialHelper.functions */ "babylonjs/Materials/effect");
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _water_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./water.fragment */ "../../../dev/materials/src/water/water.fragment.ts");
/* harmony import */ var _water_vertex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./water.vertex */ "../../../dev/materials/src/water/water.vertex.ts");
var WaterMaterialDefines = /** @class */ (function (_super) {
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__extends)(WaterMaterialDefines, _super);
function WaterMaterialDefines() {
var _this = _super.call(this) || this;
_this.BUMP = false;
_this.REFLECTION = false;
_this.CLIPPLANE = false;
_this.CLIPPLANE2 = false;
_this.CLIPPLANE3 = false;
_this.CLIPPLANE4 = false;
_this.CLIPPLANE5 = false;
_this.CLIPPLANE6 = false;
_this.ALPHATEST = false;
_this.DEPTHPREPASS = false;
_this.POINTSIZE = false;
_this.FOG = false;
_this.NORMAL = false;
_this.UV1 = false;
_this.UV2 = false;
_this.VERTEXCOLOR = false;
_this.VERTEXALPHA = false;
_this.NUM_BONE_INFLUENCERS = 0;
_this.BonesPerMesh = 0;
_this.INSTANCES = false;
_this.INSTANCESCOLOR = false;
_this.SPECULARTERM = false;
_this.LOGARITHMICDEPTH = false;
_this.USE_REVERSE_DEPTHBUFFER = false;
_this.FRESNELSEPARATE = false;
_this.BUMPSUPERIMPOSE = false;
_this.BUMPAFFECTSREFLECTION = false;
_this.USE_WORLD_COORDINATES = false;
_this.IMAGEPROCESSING = false;
_this.VIGNETTE = false;
_this.VIGNETTEBLENDMODEMULTIPLY = false;
_this.VIGNETTEBLENDMODEOPAQUE = false;
_this.TONEMAPPING = false;
_this.TONEMAPPING_ACES = false;
_this.CONTRAST = false;
_this.EXPOSURE = false;
_this.COLORCURVES = false;
_this.COLORGRADING = false;
_this.COLORGRADING3D = false;
_this.SAMPLER3DGREENDEPTH = false;
_this.SAMPLER3DBGRMAP = false;
_this.DITHER = false;
_this.IMAGEPROCESSINGPOSTPROCESS = false;
_this.SKIPFINALCOLORCLAMP = false;
_this.rebuild();
return _this;
}
return WaterMaterialDefines;
}(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.MaterialDefines));
var WaterMaterial = /** @class */ (function (_super) {
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__extends)(WaterMaterial, _super);
/**
* Constructor
* @param name
* @param scene
* @param renderTargetSize
*/
function WaterMaterial(name, scene, renderTargetSize) {
if (renderTargetSize === void 0) { renderTargetSize = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Vector2(512, 512); }
var _this = _super.call(this, name, scene) || this;
_this.renderTargetSize = renderTargetSize;
_this.diffuseColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(1, 1, 1);
_this.specularColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0, 0, 0);
_this.specularPower = 64;
_this._disableLighting = false;
_this._maxSimultaneousLights = 4;
/**
* Defines the wind force.
*/
_this.windForce = 6;
/**
* Defines the direction of the wind in the plane (X, Z).
*/
_this.windDirection = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Vector2(0, 1);
/**
* Defines the height of the waves.
*/
_this.waveHeight = 0.4;
/**
* Defines the bump height related to the bump map.
*/
_this.bumpHeight = 0.4;
/**
* Defines wether or not: to add a smaller moving bump to less steady waves.
*/
_this._bumpSuperimpose = false;
/**
* Defines wether or not color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.
*/
_this._fresnelSeparate = false;
/**
* Defines wether or not bump Wwves modify the reflection.
*/
_this._bumpAffectsReflection = false;
/**
* Defines the water color blended with the refraction (near).
*/
_this.waterColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.1, 0.1, 0.6);
/**
* Defines the blend factor related to the water color.
*/
_this.colorBlendFactor = 0.2;
/**
* Defines the water color blended with the reflection (far).
*/
_this.waterColor2 = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.1, 0.1, 0.6);
/**
* Defines the blend factor related to the water color (reflection, far).
*/
_this.colorBlendFactor2 = 0.2;
/**
* Defines the maximum length of a wave.
*/
_this.waveLength = 0.1;
/**
* Defines the waves speed.
*/
_this.waveSpeed = 1.0;
/**
* Defines the number of times waves are repeated. This is typically used to adjust waves count according to the ground's size where the material is applied on.
*/
_this.waveCount = 20;
/**
* Sets or gets whether or not automatic clipping should be enabled or not. Setting to true will save performances and
* will avoid calculating useless pixels in the pixel shader of the water material.
*/
_this.disableClipPlane = false;
/**
* Defines whether or not to use world coordinates for wave deformations.
* The default value is false, meaning that the deformation is applied in object (local) space.
* You will probably need to set it to true if you are using instances or thin instances for your water objects.
*/
_this._useWorldCoordinatesForWaveDeformation = false;
_this._renderTargets = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SmartArray(16);
/*
* Private members
*/
_this._mesh = null;
_this._reflectionTransform = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Matrix.Zero();
_this._lastTime = 0;
_this._lastDeltaTime = 0;
_this._createRenderTargets(_this.getScene(), renderTargetSize);
// Create render targets
_this.getRenderTargetTextures = function () {
_this._renderTargets.reset();
_this._renderTargets.push(_this._reflectionRTT);
_this._renderTargets.push(_this._refractionRTT);
return _this._renderTargets;
};
_this._imageProcessingConfiguration = _this.getScene().imageProcessingConfiguration;
if (_this._imageProcessingConfiguration) {
_this._imageProcessingObserver = _this._imageProcessingConfiguration.onUpdateParameters.add(function () {
_this._markAllSubMeshesAsImageProcessingDirty();
});
}
return _this;
}
Object.defineProperty(WaterMaterial.prototype, "hasRenderTargetTextures", {
/**
* Gets a boolean indicating that current material needs to register RTT
*/
get: function () {
return true;
},
enumerable: false,
configurable: true
});
Object.defineProperty(WaterMaterial.prototype, "refractionTexture", {
// Get / Set
get: function () {
return this._refractionRTT;
},
enumerable: false,
configurable: true
});
Object.defineProperty(WaterMaterial.prototype, "reflectionTexture", {
get: function () {
return this._reflectionRTT;
},
enumerable: false,
configurable: true
});
// Methods
WaterMaterial.prototype.addToRenderList = function (node) {
if (this._refractionRTT && this._refractionRTT.renderList) {
this._refractionRTT.renderList.push(node);
}
if (this._reflectionRTT && this._reflectionRTT.renderList) {
this._reflectionRTT.renderList.push(node);
}
};
WaterMaterial.prototype.removeFromRenderList = function (node) {
if (this._refractionRTT && this._refractionRTT.renderList) {
var idx = this._refractionRTT.renderList.indexOf(node);
if (idx !== -1) {
this._refractionRTT.renderList.splice(idx, 1);
}
}
if (this._reflectionRTT && this._reflectionRTT.renderList) {
var idx = this._reflectionRTT.renderList.indexOf(node);
if (idx !== -1) {
this._reflectionRTT.renderList.splice(idx, 1);
}
}
};
WaterMaterial.prototype.enableRenderTargets = function (enable) {
var refreshRate = enable ? 1 : 0;
if (this._refractionRTT) {
this._refractionRTT.refreshRate = refreshRate;
}
if (this._reflectionRTT) {
this._reflectionRTT.refreshRate = refreshRate;
}
};
WaterMaterial.prototype.getRenderList = function () {
return this._refractionRTT ? this._refractionRTT.renderList : [];
};
Object.defineProperty(WaterMaterial.prototype, "renderTargetsEnabled", {
get: function () {
return !(this._refractionRTT && this._refractionRTT.refreshRate === 0);
},
enumerable: false,
configurable: true
});
WaterMaterial.prototype.needAlphaBlending = function () {
return this.alpha < 1.0;
};
WaterMaterial.prototype.needAlphaTesting = function () {
return false;
};
WaterMaterial.prototype.getAlphaTestTexture = function () {
return null;
};
WaterMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {
var drawWrapper = subMesh._drawWrapper;
if (this.isFrozen) {
if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {
return true;
}
}
if (!subMesh.materialDefines) {
subMesh.materialDefines = new WaterMaterialDefines();
}
var defines = subMesh.materialDefines;
var scene = this.getScene();
if (this._isReadyForSubMesh(subMesh)) {
return true;
}
var engine = scene.getEngine();
// Textures
if (defines._areTexturesDirty) {
defines._needUVs = false;
if (scene.texturesEnabled) {
if (this.bumpTexture && babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.MaterialFlags.BumpTextureEnabled) {
if (!this.bumpTexture.isReady()) {
return false;
}
else {
defines._needUVs = true;
defines.BUMP = true;
}
}
if (babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.MaterialFlags.ReflectionTextureEnabled) {
defines.REFLECTION = true;
}
}
}
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.PrepareDefinesForFrameBoundValues)(scene, engine, this, defines, useInstances ? true : false);
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.PrepareDefinesForMisc)(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
if (defines._areMiscDirty) {
defines.FRESNELSEPARATE = this._fresnelSeparate;
defines.BUMPSUPERIMPOSE = this._bumpSuperimpose;
defines.BUMPAFFECTSREFLECTION = this._bumpAffectsReflection;
defines.USE_WORLD_COORDINATES = this._useWorldCoordinatesForWaveDeformation;
}
// Lights
defines._needNormals = (0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.PrepareDefinesForLights)(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);
// Image processing
if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {
if (!this._imageProcessingConfiguration.isReady()) {
return false;
}
this._imageProcessingConfiguration.prepareDefines(defines);
defines.IS_REFLECTION_LINEAR = this.reflectionTexture != null && !this.reflectionTexture.gammaSpace;
defines.IS_REFRACTION_LINEAR = this.refractionTexture != null && !this.refractionTexture.gammaSpace;
}
// Attribs
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.PrepareDefinesForAttributes)(mesh, defines, true, true);
// Configure this
this._mesh = mesh;
if (this._waitingRenderList) {
for (var i = 0; i < this._waitingRenderList.length; i++) {
this.addToRenderList(scene.getNodeById(this._waitingRenderList[i]));
}
this._waitingRenderList = null;
}
// Get correct effect
if (defines.isDirty) {
defines.markAsProcessed();
scene.resetCachedMaterial();
// Fallbacks
var fallbacks = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.EffectFallbacks();
if (defines.FOG) {
fallbacks.addFallback(1, "FOG");
}
if (defines.LOGARITHMICDEPTH) {
fallbacks.addFallback(0, "LOGARITHMICDEPTH");
}
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.HandleFallbacksForShadows)(defines, fallbacks, this.maxSimultaneousLights);
if (defines.NUM_BONE_INFLUENCERS > 0) {
fallbacks.addCPUSkinningFallback(0, mesh);
}
//Attributes
var attribs = [babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.PositionKind];
if (defines.NORMAL) {
attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.NormalKind);
}
if (defines.UV1) {
attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UVKind);
}
if (defines.UV2) {
attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.UV2Kind);
}
if (defines.VERTEXCOLOR) {
attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.ColorKind);
}
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.PrepareAttributesForBones)(attribs, mesh, defines, fallbacks);
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.PrepareAttributesForInstances)(attribs, defines);
// Legacy browser patch
var shaderName = "water";
var join = defines.toString();
var uniforms = [
"world",
"view",
"viewProjection",
"vEyePosition",
"vLightsType",
"vDiffuseColor",
"vSpecularColor",
"vFogInfos",
"vFogColor",
"pointSize",
"vNormalInfos",
"mBones",
"normalMatrix",
"logarithmicDepthConstant",
// Water
"reflectionViewProjection",
"windDirection",
"waveLength",
"time",
"windForce",
"cameraPosition",
"bumpHeight",
"waveHeight",
"waterColor",
"waterColor2",
"colorBlendFactor",
"colorBlendFactor2",
"waveSpeed",
"waveCount",
];
var samplers = [
"normalSampler",
// Water
"refractionSampler",
"reflectionSampler",
];
var uniformBuffers = [];
if (babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.ImageProcessingConfiguration) {
babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.ImageProcessingConfiguration.PrepareUniforms(uniforms, defines);
babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.ImageProcessingConfiguration.PrepareSamplers(samplers, defines);
}
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.addClipPlaneUniforms)(uniforms);
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.PrepareUniformsAndSamplersList)({
uniformsNames: uniforms,
uniformBuffersNames: uniformBuffers,
samplers: samplers,
defines: defines,
maxSimultaneousLights: this.maxSimultaneousLights,
});
subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
attributes: attribs,
uniformsNames: uniforms,
uniformBuffersNames: uniformBuffers,
samplers: samplers,
defines: join,
fallbacks: fallbacks,
onCompiled: this.onCompiled,
onError: this.onError,
indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights },
}, engine), defines, this._materialContext);
}
if (!subMesh.effect || !subMesh.effect.isReady()) {
return false;
}
defines._renderId = scene.getRenderId();
drawWrapper._wasPreviouslyReady = true;
drawWrapper._wasPreviouslyUsingInstances = !!useInstances;
return true;
};
WaterMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {
var scene = this.getScene();
var defines = subMesh.materialDefines;
if (!defines) {
return;
}
var effect = subMesh.effect;
if (!effect || !this._mesh) {
return;
}
this._activeEffect = effect;
// Matrices
this.bindOnlyWorldMatrix(world);
this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
// Bones
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.BindBonesParameters)(mesh, this._activeEffect);
if (this._mustRebind(scene, effect, subMesh)) {
// Textures
if (this.bumpTexture && babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.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());
}
// Clip plane
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.bindClipPlane)(effect, this, scene);
// Point size
if (this.pointsCloud) {
this._activeEffect.setFloat("pointSize", this.pointSize);
}
// Log. depth
if (this._useLogarithmicDepth) {
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.BindLogDepth)(defines, effect, scene);
}
scene.bindEyePosition(effect);
}
this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
if (defines.SPECULARTERM) {
this._activeEffect.setColor4("vSpecularColor", this.specularColor, this.specularPower);
}
if (scene.lightsEnabled && !this.disableLighting) {
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.BindLights)(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);
}
// View
if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Scene.FOGMODE_NONE) {
this._activeEffect.setMatrix("view", scene.getViewMatrix());
}
// Fog
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.BindFogParameters)(scene, mesh, this._activeEffect);
// Log. depth
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.BindLogDepth)(defines, this._activeEffect, scene);
// Water
if (babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.MaterialFlags.ReflectionTextureEnabled) {
this._activeEffect.setTexture("refractionSampler", this._refractionRTT);
this._activeEffect.setTexture("reflectionSampler", this._reflectionRTT);
}
var wrvp = this._reflectionTransform.multiply(scene.getProjectionMatrix());
// Add delta time. Prevent adding delta time if it hasn't changed.
var deltaTime = scene.getEngine().getDeltaTime();
if (deltaTime !== this._lastDeltaTime) {
this._lastDeltaTime = deltaTime;
this._lastTime += this._lastDeltaTime;
}
this._activeEffect.setMatrix("reflectionViewProjection", wrvp);
this._activeEffect.setVector2("windDirection", this.windDirection);
this._activeEffect.setFloat("waveLength", this.waveLength);
this._activeEffect.setFloat("time", this._lastTime / 100000);
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.0);
this._activeEffect.setFloat("colorBlendFactor", this.colorBlendFactor);
this._activeEffect.setColor4("waterColor2", this.waterColor2, 1.0);
this._activeEffect.setFloat("colorBlendFactor2", this.colorBlendFactor2);
this._activeEffect.setFloat("waveSpeed", this.waveSpeed);
this._activeEffect.setFloat("waveCount", this.waveCount);
// image processing
if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {
this._imageProcessingConfiguration.bind(this._activeEffect);
}
this._afterBind(mesh, this._activeEffect, subMesh);
};
WaterMaterial.prototype._createRenderTargets = function (scene, renderTargetSize) {
var _this = this;
// Render targets
this._refractionRTT = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RenderTargetTexture(name + "_refraction", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);
this._refractionRTT.wrapU = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Constants.TEXTURE_MIRROR_ADDRESSMODE;
this._refractionRTT.wrapV = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Constants.TEXTURE_MIRROR_ADDRESSMODE;
this._refractionRTT.ignoreCameraViewport = true;
this._reflectionRTT = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RenderTargetTexture(name + "_reflection", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);
this._reflectionRTT.wrapU = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Constants.TEXTURE_MIRROR_ADDRESSMODE;
this._reflectionRTT.wrapV = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Constants.TEXTURE_MIRROR_ADDRESSMODE;
this._reflectionRTT.ignoreCameraViewport = true;
var isVisible;
var clipPlane = null;
var savedViewMatrix;
var mirrorMatrix = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Matrix.Zero();
this._refractionRTT.onBeforeRender = function () {
if (_this._mesh) {
isVisible = _this._mesh.isVisible;
_this._mesh.isVisible = false;
}
// Clip plane
if (!_this.disableClipPlane) {
clipPlane = scene.clipPlane;
var positiony = _this._mesh ? _this._mesh.absolutePosition.y : 0.0;
scene.clipPlane = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Plane.FromPositionAndNormal(new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Vector3(0, positiony + 0.05, 0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Vector3(0, 1, 0));
}
};
this._refractionRTT.onAfterRender = function () {
if (_this._mesh) {
_this._mesh.isVisible = isVisible;
}
// Clip plane
if (!_this.disableClipPlane) {
scene.clipPlane = clipPlane;
}
};
this._reflectionRTT.onBeforeRender = function () {
if (_this._mesh) {
isVisible = _this._mesh.isVisible;
_this._mesh.isVisible = false;
}
// Clip plane
if (!_this.disableClipPlane) {
clipPlane = scene.clipPlane;
var positiony = _this._mesh ? _this._mesh.absolutePosition.y : 0.0;
scene.clipPlane = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Plane.FromPositionAndNormal(new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Vector3(0, positiony - 0.05, 0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Vector3(0, -1, 0));
babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Matrix.ReflectionToRef(scene.clipPlane, mirrorMatrix);
}
// Transform
savedViewMatrix = scene.getViewMatrix();
mirrorMatrix.multiplyToRef(savedViewMatrix, _this._reflectionTransform);
scene.setTransformMatrix(_this._reflectionTransform, scene.getProjectionMatrix());
scene._mirroredCameraPosition = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Vector3.TransformCoordinates(scene.activeCamera.position, mirrorMatrix);
};
this._reflectionRTT.onAfterRender = function () {
if (_this._mesh) {
_this._mesh.isVisible = isVisible;
}
// Clip plane
scene.clipPlane = clipPlane;
// Transform
scene.setTransformMatrix(savedViewMatrix, scene.getProjectionMatrix());
scene._mirroredCameraPosition = null;
};
};
WaterMaterial.prototype.getAnimatables = function () {
var results = [];
if (this.bumpTexture && this.bumpTexture.animations && this.bumpTexture.animations.length > 0) {
results.push(this.bumpTexture);
}
if (this._reflectionRTT && this._reflectionRTT.animations && this._reflectionRTT.animations.length > 0) {
results.push(this._reflectionRTT);
}
if (this._refractionRTT && this._refractionRTT.animations && this._refractionRTT.animations.length > 0) {
results.push(this._refractionRTT);
}
return results;
};
WaterMaterial.prototype.getActiveTextures = function () {
var activeTextures = _super.prototype.getActiveTextures.call(this);
if (this._bumpTexture) {
activeTextures.push(this._bumpTexture);
}
return activeTextures;
};
WaterMaterial.prototype.hasTexture = function (texture) {
if (_super.prototype.hasTexture.call(this, texture)) {
return true;
}
if (this._bumpTexture === texture) {
return true;
}
return false;
};
WaterMaterial.prototype.dispose = function (forceDisposeEffect) {
if (this.bumpTexture) {
this.bumpTexture.dispose();
}
var index = this.getScene().customRenderTargets.indexOf(this._refractionRTT);
if (index != -1) {
this.getScene().customRenderTargets.splice(index, 1);
}
index = -1;
index = this.getScene().customRenderTargets.indexOf(this._reflectionRTT);
if (index != -1) {
this.getScene().customRenderTargets.splice(index, 1);
}
if (this._reflectionRTT) {
this._reflectionRTT.dispose();
}
if (this._refractionRTT) {
this._refractionRTT.dispose();
}
// Remove image-processing observer
if (this._imageProcessingConfiguration && this._imageProcessingObserver) {
this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);
}
_super.prototype.dispose.call(this, forceDisposeEffect);
};
WaterMaterial.prototype.clone = function (name) {
var _this = this;
return babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Clone(function () { return new WaterMaterial(name, _this.getScene()); }, this);
};
WaterMaterial.prototype.serialize = function () {
var serializationObject = _super.prototype.serialize.call(this);
serializationObject.customType = "BABYLON.WaterMaterial";
serializationObject.renderList = [];
if (this._refractionRTT && this._refractionRTT.renderList) {
for (var i = 0; i < this._refractionRTT.renderList.length; i++) {
serializationObject.renderList.push(this._refractionRTT.renderList[i].id);
}
}
return serializationObject;
};
WaterMaterial.prototype.getClassName = function () {
return "WaterMaterial";
};
// Statics
WaterMaterial.Parse = function (source, scene, rootUrl) {
var mat = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Parse(function () { return new WaterMaterial(source.name, scene); }, source, scene, rootUrl);
mat._waitingRenderList = source.renderList;
return mat;
};
WaterMaterial.CreateDefaultMesh = function (name, scene) {
var mesh = (0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.CreateGround)(name, { width: 512, height: 512, subdivisions: 32, updatable: false }, scene);
return mesh;
};
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsTexture)("bumpTexture")
], WaterMaterial.prototype, "_bumpTexture", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.expandToProperty)("_markAllSubMeshesAsTexturesDirty")
], WaterMaterial.prototype, "bumpTexture", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsColor3)()
], WaterMaterial.prototype, "diffuseColor", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsColor3)()
], WaterMaterial.prototype, "specularColor", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
], WaterMaterial.prototype, "specularPower", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)("disableLighting")
], WaterMaterial.prototype, "_disableLighting", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.expandToProperty)("_markAllSubMeshesAsLightsDirty")
], WaterMaterial.prototype, "disableLighting", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)("maxSimultaneousLights")
], WaterMaterial.prototype, "_maxSimultaneousLights", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.expandToProperty)("_markAllSubMeshesAsLightsDirty")
], WaterMaterial.prototype, "maxSimultaneousLights", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
], WaterMaterial.prototype, "windForce", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsVector2)()
], WaterMaterial.prototype, "windDirection", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
], WaterMaterial.prototype, "waveHeight", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
], WaterMaterial.prototype, "bumpHeight", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)("bumpSuperimpose")
], WaterMaterial.prototype, "_bumpSuperimpose", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.expandToProperty)("_markAllSubMeshesAsMiscDirty")
], WaterMaterial.prototype, "bumpSuperimpose", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)("fresnelSeparate")
], WaterMaterial.prototype, "_fresnelSeparate", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.expandToProperty)("_markAllSubMeshesAsMiscDirty")
], WaterMaterial.prototype, "fresnelSeparate", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)("bumpAffectsReflection")
], WaterMaterial.prototype, "_bumpAffectsReflection", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.expandToProperty)("_markAllSubMeshesAsMiscDirty")
], WaterMaterial.prototype, "bumpAffectsReflection", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsColor3)()
], WaterMaterial.prototype, "waterColor", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
], WaterMaterial.prototype, "colorBlendFactor", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsColor3)()
], WaterMaterial.prototype, "waterColor2", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
], WaterMaterial.prototype, "colorBlendFactor2", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
], WaterMaterial.prototype, "waveLength", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
], WaterMaterial.prototype, "waveSpeed", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
], WaterMaterial.prototype, "waveCount", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
], WaterMaterial.prototype, "disableClipPlane", void 0);
(0,tslib__WEBPACK_IMPORTED_MODULE_3__.__decorate)([
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.ser