babylon.waterMaterial.js 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory(require("babylonjs"));
  4. else if(typeof define === 'function' && define.amd)
  5. define("babylonjs-materials", ["babylonjs"], factory);
  6. else if(typeof exports === 'object')
  7. exports["babylonjs-materials"] = factory(require("babylonjs"));
  8. else
  9. root["MATLIB"] = factory(root["BABYLON"]);
  10. })(window, function(__WEBPACK_EXTERNAL_MODULE_babylonjs__) {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = "./legacy/legacy-water.ts");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "../Tools/Gulp/node_modules/webpack/buildin/global.js":
  99. /*!************************************************************!*\
  100. !*** ../Tools/Gulp/node_modules/webpack/buildin/global.js ***!
  101. \************************************************************/
  102. /*! no static exports found */
  103. /***/ (function(module, exports) {
  104. var g;
  105. // This works in non-strict mode
  106. g = (function() {
  107. return this;
  108. })();
  109. try {
  110. // This works if eval is allowed (see CSP)
  111. g = g || Function("return this")() || (1, eval)("this");
  112. } catch (e) {
  113. // This works if the window reference is available
  114. if (typeof window === "object") g = window;
  115. }
  116. // g can still be undefined, but nothing to do about it...
  117. // We return undefined, instead of nothing here, so it's
  118. // easier to handle this case. if(!global) { ...}
  119. module.exports = g;
  120. /***/ }),
  121. /***/ "./legacy/legacy-water.ts":
  122. /*!********************************!*\
  123. !*** ./legacy/legacy-water.ts ***!
  124. \********************************/
  125. /*! no static exports found */
  126. /***/ (function(module, exports, __webpack_require__) {
  127. "use strict";
  128. /* WEBPACK VAR INJECTION */(function(global) {
  129. function __export(m) {
  130. for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  131. }
  132. Object.defineProperty(exports, "__esModule", { value: true });
  133. var MatLib = __webpack_require__(/*! ../src/water */ "./src/water/index.ts");
  134. /**
  135. * This is the entry point for the UMD module.
  136. * The entry point for a future ESM package should be index.ts
  137. */
  138. var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
  139. if (typeof globalObject !== "undefined") {
  140. for (var key in MatLib) {
  141. globalObject.BABYLON[key] = MatLib[key];
  142. }
  143. }
  144. __export(__webpack_require__(/*! ../src/water */ "./src/water/index.ts"));
  145. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../Tools/Gulp/node_modules/webpack/buildin/global.js */ "../Tools/Gulp/node_modules/webpack/buildin/global.js")))
  146. /***/ }),
  147. /***/ "./src/water/index.ts":
  148. /*!****************************!*\
  149. !*** ./src/water/index.ts ***!
  150. \****************************/
  151. /*! no static exports found */
  152. /***/ (function(module, exports, __webpack_require__) {
  153. "use strict";
  154. function __export(m) {
  155. for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  156. }
  157. Object.defineProperty(exports, "__esModule", { value: true });
  158. __export(__webpack_require__(/*! ./waterMaterial */ "./src/water/waterMaterial.ts"));
  159. /***/ }),
  160. /***/ "./src/water/water.fragment.fx":
  161. /*!*************************************!*\
  162. !*** ./src/water/water.fragment.fx ***!
  163. \*************************************/
  164. /*! no static exports found */
  165. /***/ (function(module, exports) {
  166. module.exports = "#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include<helperFunctions>\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n\n#ifdef BUMP\nvarying vec2 vNormalUV;\nvarying vec2 vNormalUV2;\nuniform sampler2D normalSampler;\nuniform vec2 vNormalInfos;\n#endif\nuniform sampler2D refractionSampler;\nuniform sampler2D reflectionSampler;\n\nconst float LOG2=1.442695;\nuniform vec3 cameraPosition;\nuniform vec4 waterColor;\nuniform float colorBlendFactor;\nuniform vec4 waterColor2;\nuniform float colorBlendFactor2;\nuniform float bumpHeight;\nuniform float time;\n\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvarying vec3 vPosition;\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n\n#include<fogFragmentDeclaration>\nvoid main(void) {\n\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat 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#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\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));\nif (normalW.y<0.0) {\nnormalW.y=-normalW.y;\n}\n#else\nvec3 normalW=normalize(vNormalW);\n#endif\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\nvec2 perturbation=bumpHeight*(vec2(1.0,1.0)-0.5);\n#endif\n#ifdef FRESNELSEPARATE\n#ifdef REFLECTION\n\nvec3 eyeVector=normalize(vEyePosition-vPosition);\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\nvec2 projectedReflectionTexCoords=clamp(vec2(\nvReflectionMapTexCoord.x/vReflectionMapTexCoord.z+perturbation.x*0.3,\nvReflectionMapTexCoord.y/vReflectionMapTexCoord.z+perturbation.y\n),0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=clamp(abs(pow(dot(eyeVector,upVector),3.0)),0.05,0.65);\nfloat IfresnelTerm=1.0-fresnelTerm;\nrefractiveColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*refractiveColor;\nreflectiveColor=IfresnelTerm*colorBlendFactor2*waterColor+(1.0-colorBlendFactor2*IfresnelTerm)*reflectiveColor;\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*IfresnelTerm;\nbaseColor=combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 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#ifdef VERTEXALPHA\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\n\nvec3 eyeVector=normalize(vEyePosition-vPosition);\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 refractiveColor=texture2D(refractionSampler,projectedRefractionTexCoords);\nvec2 projectedReflectionTexCoords=clamp(vReflectionMapTexCoord.xy/vReflectionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 reflectiveColor=texture2D(reflectionSampler,projectedReflectionTexCoords);\nvec3 upVector=vec3(0.0,1.0,0.0);\nfloat fresnelTerm=max(dot(eyeVector,upVector),0.0);\nvec4 combinedColor=refractiveColor*fresnelTerm+reflectiveColor*(1.0-fresnelTerm);\nbaseColor=colorBlendFactor*waterColor+(1.0-colorBlendFactor)*combinedColor;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularBase=vec3(0.,0.,0.);\nvec3 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#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#endif\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<logDepthFragment>\n#include<fogFragment>\ngl_FragColor=color;\n}\n"
  167. /***/ }),
  168. /***/ "./src/water/water.vertex.fx":
  169. /*!***********************************!*\
  170. !*** ./src/water/water.vertex.fx ***!
  171. \***********************************/
  172. /*! no static exports found */
  173. /***/ (function(module, exports) {
  174. module.exports = "precision highp float;\n\nattribute 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\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef BUMP\nvarying vec2 vNormalUV;\n#ifdef BUMPSUPERIMPOSE\nvarying vec2 vNormalUV2;\n#endif\nuniform mat4 normalMatrix;\nuniform vec2 vNormalInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<logDepthDeclaration>\n\nuniform mat4 worldReflectionViewProjection;\nuniform vec2 windDirection;\nuniform float waveLength;\nuniform float time;\nuniform float windForce;\nuniform float waveHeight;\nuniform float waveSpeed;\n\nvarying vec3 vPosition;\nvarying vec3 vRefractionMapTexCoord;\nvarying vec3 vReflectionMapTexCoord;\nvoid main(void) {\n#include<instancesVertex>\n#include<bonesVertex>\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\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{\nvNormalUV=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{\nvNormalUV=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\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\nvec3 p=position;\nfloat newY=(sin(((p.x/0.05)+time*waveSpeed))*waveHeight*windDirection.x*5.0)\n+(cos(((p.z/0.05)+time*waveSpeed))*waveHeight*windDirection.y*5.0);\np.y+=abs(newY);\ngl_Position=viewProjection*finalWorld*vec4(p,1.0);\n#ifdef REFLECTION\nworldPos=viewProjection*finalWorld*vec4(p,1.0);\n\nvPosition=position;\nvRefractionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvRefractionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvRefractionMapTexCoord.z=worldPos.w;\nworldPos=worldReflectionViewProjection*vec4(position,1.0);\nvReflectionMapTexCoord.x=0.5*(worldPos.w+worldPos.x);\nvReflectionMapTexCoord.y=0.5*(worldPos.w+worldPos.y);\nvReflectionMapTexCoord.z=worldPos.w;\n#endif\n#include<logDepthVertex>\n}\n"
  175. /***/ }),
  176. /***/ "./src/water/waterMaterial.ts":
  177. /*!************************************!*\
  178. !*** ./src/water/waterMaterial.ts ***!
  179. \************************************/
  180. /*! no static exports found */
  181. /***/ (function(module, exports, __webpack_require__) {
  182. "use strict";
  183. var __extends = (this && this.__extends) || (function () {
  184. var extendStatics = function (d, b) {
  185. extendStatics = Object.setPrototypeOf ||
  186. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  187. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  188. return extendStatics(d, b);
  189. }
  190. return function (d, b) {
  191. extendStatics(d, b);
  192. function __() { this.constructor = d; }
  193. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  194. };
  195. })();
  196. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  197. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  198. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  199. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  200. return c > 3 && r && Object.defineProperty(target, key, r), r;
  201. };
  202. Object.defineProperty(exports, "__esModule", { value: true });
  203. var babylonjs_1 = __webpack_require__(/*! babylonjs */ "babylonjs");
  204. babylonjs_1.Effect.ShadersStore["waterPixelShader"] = __webpack_require__(/*! ./water.fragment.fx */ "./src/water/water.fragment.fx");
  205. babylonjs_1.Effect.ShadersStore["waterVertexShader"] = __webpack_require__(/*! ./water.vertex.fx */ "./src/water/water.vertex.fx");
  206. var WaterMaterialDefines = /** @class */ (function (_super) {
  207. __extends(WaterMaterialDefines, _super);
  208. function WaterMaterialDefines() {
  209. var _this = _super.call(this) || this;
  210. _this.BUMP = false;
  211. _this.REFLECTION = false;
  212. _this.CLIPPLANE = false;
  213. _this.CLIPPLANE2 = false;
  214. _this.CLIPPLANE3 = false;
  215. _this.CLIPPLANE4 = false;
  216. _this.ALPHATEST = false;
  217. _this.DEPTHPREPASS = false;
  218. _this.POINTSIZE = false;
  219. _this.FOG = false;
  220. _this.NORMAL = false;
  221. _this.UV1 = false;
  222. _this.UV2 = false;
  223. _this.VERTEXCOLOR = false;
  224. _this.VERTEXALPHA = false;
  225. _this.NUM_BONE_INFLUENCERS = 0;
  226. _this.BonesPerMesh = 0;
  227. _this.INSTANCES = false;
  228. _this.SPECULARTERM = false;
  229. _this.LOGARITHMICDEPTH = false;
  230. _this.FRESNELSEPARATE = false;
  231. _this.BUMPSUPERIMPOSE = false;
  232. _this.BUMPAFFECTSREFLECTION = false;
  233. _this.rebuild();
  234. return _this;
  235. }
  236. return WaterMaterialDefines;
  237. }(babylonjs_1.MaterialDefines));
  238. var WaterMaterial = /** @class */ (function (_super) {
  239. __extends(WaterMaterial, _super);
  240. /**
  241. * Constructor
  242. */
  243. function WaterMaterial(name, scene, renderTargetSize) {
  244. if (renderTargetSize === void 0) { renderTargetSize = new babylonjs_1.Vector2(512, 512); }
  245. var _this = _super.call(this, name, scene) || this;
  246. _this.renderTargetSize = renderTargetSize;
  247. _this.diffuseColor = new babylonjs_1.Color3(1, 1, 1);
  248. _this.specularColor = new babylonjs_1.Color3(0, 0, 0);
  249. _this.specularPower = 64;
  250. _this._disableLighting = false;
  251. _this._maxSimultaneousLights = 4;
  252. /**
  253. * @param {number}: Represents the wind force
  254. */
  255. _this.windForce = 6;
  256. /**
  257. * @param {Vector2}: The direction of the wind in the plane (X, Z)
  258. */
  259. _this.windDirection = new babylonjs_1.Vector2(0, 1);
  260. /**
  261. * @param {number}: Wave height, represents the height of the waves
  262. */
  263. _this.waveHeight = 0.4;
  264. /**
  265. * @param {number}: Bump height, represents the bump height related to the bump map
  266. */
  267. _this.bumpHeight = 0.4;
  268. /**
  269. * @param {boolean}: Add a smaller moving bump to less steady waves.
  270. */
  271. _this._bumpSuperimpose = false;
  272. /**
  273. * @param {boolean}: Color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.
  274. */
  275. _this._fresnelSeparate = false;
  276. /**
  277. * @param {boolean}: bump Waves modify the reflection.
  278. */
  279. _this._bumpAffectsReflection = false;
  280. /**
  281. * @param {number}: The water color blended with the refraction (near)
  282. */
  283. _this.waterColor = new babylonjs_1.Color3(0.1, 0.1, 0.6);
  284. /**
  285. * @param {number}: The blend factor related to the water color
  286. */
  287. _this.colorBlendFactor = 0.2;
  288. /**
  289. * @param {number}: The water color blended with the reflection (far)
  290. */
  291. _this.waterColor2 = new babylonjs_1.Color3(0.1, 0.1, 0.6);
  292. /**
  293. * @param {number}: The blend factor related to the water color (reflection, far)
  294. */
  295. _this.colorBlendFactor2 = 0.2;
  296. /**
  297. * @param {number}: Represents the maximum length of a wave
  298. */
  299. _this.waveLength = 0.1;
  300. /**
  301. * @param {number}: Defines the waves speed
  302. */
  303. _this.waveSpeed = 1.0;
  304. _this._renderTargets = new babylonjs_1.SmartArray(16);
  305. /*
  306. * Private members
  307. */
  308. _this._mesh = null;
  309. _this._reflectionTransform = babylonjs_1.Matrix.Zero();
  310. _this._lastTime = 0;
  311. _this._lastDeltaTime = 0;
  312. _this._createRenderTargets(scene, renderTargetSize);
  313. // Create render targets
  314. _this.getRenderTargetTextures = function () {
  315. _this._renderTargets.reset();
  316. _this._renderTargets.push(_this._reflectionRTT);
  317. _this._renderTargets.push(_this._refractionRTT);
  318. return _this._renderTargets;
  319. };
  320. return _this;
  321. }
  322. Object.defineProperty(WaterMaterial.prototype, "hasRenderTargetTextures", {
  323. /**
  324. * Gets a boolean indicating that current material needs to register RTT
  325. */
  326. get: function () {
  327. return true;
  328. },
  329. enumerable: true,
  330. configurable: true
  331. });
  332. Object.defineProperty(WaterMaterial.prototype, "useLogarithmicDepth", {
  333. get: function () {
  334. return this._useLogarithmicDepth;
  335. },
  336. set: function (value) {
  337. this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;
  338. this._markAllSubMeshesAsMiscDirty();
  339. },
  340. enumerable: true,
  341. configurable: true
  342. });
  343. Object.defineProperty(WaterMaterial.prototype, "refractionTexture", {
  344. // Get / Set
  345. get: function () {
  346. return this._refractionRTT;
  347. },
  348. enumerable: true,
  349. configurable: true
  350. });
  351. Object.defineProperty(WaterMaterial.prototype, "reflectionTexture", {
  352. get: function () {
  353. return this._reflectionRTT;
  354. },
  355. enumerable: true,
  356. configurable: true
  357. });
  358. // Methods
  359. WaterMaterial.prototype.addToRenderList = function (node) {
  360. if (this._refractionRTT && this._refractionRTT.renderList) {
  361. this._refractionRTT.renderList.push(node);
  362. }
  363. if (this._reflectionRTT && this._reflectionRTT.renderList) {
  364. this._reflectionRTT.renderList.push(node);
  365. }
  366. };
  367. WaterMaterial.prototype.enableRenderTargets = function (enable) {
  368. var refreshRate = enable ? 1 : 0;
  369. if (this._refractionRTT) {
  370. this._refractionRTT.refreshRate = refreshRate;
  371. }
  372. if (this._reflectionRTT) {
  373. this._reflectionRTT.refreshRate = refreshRate;
  374. }
  375. };
  376. WaterMaterial.prototype.getRenderList = function () {
  377. return this._refractionRTT ? this._refractionRTT.renderList : [];
  378. };
  379. Object.defineProperty(WaterMaterial.prototype, "renderTargetsEnabled", {
  380. get: function () {
  381. return !(this._refractionRTT && this._refractionRTT.refreshRate === 0);
  382. },
  383. enumerable: true,
  384. configurable: true
  385. });
  386. WaterMaterial.prototype.needAlphaBlending = function () {
  387. return (this.alpha < 1.0);
  388. };
  389. WaterMaterial.prototype.needAlphaTesting = function () {
  390. return false;
  391. };
  392. WaterMaterial.prototype.getAlphaTestTexture = function () {
  393. return null;
  394. };
  395. WaterMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {
  396. if (this.isFrozen) {
  397. if (this._wasPreviouslyReady && subMesh.effect) {
  398. return true;
  399. }
  400. }
  401. if (!subMesh._materialDefines) {
  402. subMesh._materialDefines = new WaterMaterialDefines();
  403. }
  404. var defines = subMesh._materialDefines;
  405. var scene = this.getScene();
  406. if (!this.checkReadyOnEveryCall && subMesh.effect) {
  407. if (this._renderId === scene.getRenderId()) {
  408. return true;
  409. }
  410. }
  411. var engine = scene.getEngine();
  412. // Textures
  413. if (defines._areTexturesDirty) {
  414. defines._needUVs = false;
  415. if (scene.texturesEnabled) {
  416. if (this.bumpTexture && babylonjs_1.StandardMaterial.BumpTextureEnabled) {
  417. if (!this.bumpTexture.isReady()) {
  418. return false;
  419. }
  420. else {
  421. defines._needUVs = true;
  422. defines.BUMP = true;
  423. }
  424. }
  425. if (babylonjs_1.StandardMaterial.ReflectionTextureEnabled) {
  426. defines.REFLECTION = true;
  427. }
  428. }
  429. }
  430. babylonjs_1.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);
  431. babylonjs_1.MaterialHelper.PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
  432. if (defines._areMiscDirty) {
  433. if (this._fresnelSeparate) {
  434. defines.FRESNELSEPARATE = true;
  435. }
  436. if (this._bumpSuperimpose) {
  437. defines.BUMPSUPERIMPOSE = true;
  438. }
  439. if (this._bumpAffectsReflection) {
  440. defines.BUMPAFFECTSREFLECTION = true;
  441. }
  442. }
  443. // Lights
  444. defines._needNormals = babylonjs_1.MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);
  445. // Attribs
  446. babylonjs_1.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);
  447. // Configure this
  448. this._mesh = mesh;
  449. if (this._waitingRenderList) {
  450. for (var i = 0; i < this._waitingRenderList.length; i++) {
  451. this.addToRenderList(scene.getNodeByID(this._waitingRenderList[i]));
  452. }
  453. this._waitingRenderList = null;
  454. }
  455. // Get correct effect
  456. if (defines.isDirty) {
  457. defines.markAsProcessed();
  458. scene.resetCachedMaterial();
  459. // Fallbacks
  460. var fallbacks = new babylonjs_1.EffectFallbacks();
  461. if (defines.FOG) {
  462. fallbacks.addFallback(1, "FOG");
  463. }
  464. if (defines.LOGARITHMICDEPTH) {
  465. fallbacks.addFallback(0, "LOGARITHMICDEPTH");
  466. }
  467. babylonjs_1.MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);
  468. if (defines.NUM_BONE_INFLUENCERS > 0) {
  469. fallbacks.addCPUSkinningFallback(0, mesh);
  470. }
  471. //Attributes
  472. var attribs = [babylonjs_1.VertexBuffer.PositionKind];
  473. if (defines.NORMAL) {
  474. attribs.push(babylonjs_1.VertexBuffer.NormalKind);
  475. }
  476. if (defines.UV1) {
  477. attribs.push(babylonjs_1.VertexBuffer.UVKind);
  478. }
  479. if (defines.UV2) {
  480. attribs.push(babylonjs_1.VertexBuffer.UV2Kind);
  481. }
  482. if (defines.VERTEXCOLOR) {
  483. attribs.push(babylonjs_1.VertexBuffer.ColorKind);
  484. }
  485. babylonjs_1.MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
  486. babylonjs_1.MaterialHelper.PrepareAttributesForInstances(attribs, defines);
  487. // Legacy browser patch
  488. var shaderName = "water";
  489. var join = defines.toString();
  490. var uniforms = ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vDiffuseColor", "vSpecularColor",
  491. "vFogInfos", "vFogColor", "pointSize",
  492. "vNormalInfos",
  493. "mBones",
  494. "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "normalMatrix",
  495. "logarithmicDepthConstant",
  496. // Water
  497. "worldReflectionViewProjection", "windDirection", "waveLength", "time", "windForce",
  498. "cameraPosition", "bumpHeight", "waveHeight", "waterColor", "waterColor2", "colorBlendFactor", "colorBlendFactor2", "waveSpeed"
  499. ];
  500. var samplers = ["normalSampler",
  501. // Water
  502. "refractionSampler", "reflectionSampler"
  503. ];
  504. var uniformBuffers = new Array();
  505. babylonjs_1.MaterialHelper.PrepareUniformsAndSamplersList({
  506. uniformsNames: uniforms,
  507. uniformBuffersNames: uniformBuffers,
  508. samplers: samplers,
  509. defines: defines,
  510. maxSimultaneousLights: this.maxSimultaneousLights
  511. });
  512. subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
  513. attributes: attribs,
  514. uniformsNames: uniforms,
  515. uniformBuffersNames: uniformBuffers,
  516. samplers: samplers,
  517. defines: join,
  518. fallbacks: fallbacks,
  519. onCompiled: this.onCompiled,
  520. onError: this.onError,
  521. indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights }
  522. }, engine), defines);
  523. }
  524. if (!subMesh.effect || !subMesh.effect.isReady()) {
  525. return false;
  526. }
  527. this._renderId = scene.getRenderId();
  528. this._wasPreviouslyReady = true;
  529. return true;
  530. };
  531. WaterMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {
  532. var scene = this.getScene();
  533. var defines = subMesh._materialDefines;
  534. if (!defines) {
  535. return;
  536. }
  537. var effect = subMesh.effect;
  538. if (!effect || !this._mesh) {
  539. return;
  540. }
  541. this._activeEffect = effect;
  542. // Matrices
  543. this.bindOnlyWorldMatrix(world);
  544. this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
  545. // Bones
  546. babylonjs_1.MaterialHelper.BindBonesParameters(mesh, this._activeEffect);
  547. if (this._mustRebind(scene, effect)) {
  548. // Textures
  549. if (this.bumpTexture && babylonjs_1.StandardMaterial.BumpTextureEnabled) {
  550. this._activeEffect.setTexture("normalSampler", this.bumpTexture);
  551. this._activeEffect.setFloat2("vNormalInfos", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);
  552. this._activeEffect.setMatrix("normalMatrix", this.bumpTexture.getTextureMatrix());
  553. }
  554. // Clip plane
  555. babylonjs_1.MaterialHelper.BindClipPlane(this._activeEffect, scene);
  556. // Point size
  557. if (this.pointsCloud) {
  558. this._activeEffect.setFloat("pointSize", this.pointSize);
  559. }
  560. babylonjs_1.MaterialHelper.BindEyePosition(effect, scene);
  561. }
  562. this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
  563. if (defines.SPECULARTERM) {
  564. this._activeEffect.setColor4("vSpecularColor", this.specularColor, this.specularPower);
  565. }
  566. if (scene.lightsEnabled && !this.disableLighting) {
  567. babylonjs_1.MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);
  568. }
  569. // View
  570. if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== babylonjs_1.Scene.FOGMODE_NONE) {
  571. this._activeEffect.setMatrix("view", scene.getViewMatrix());
  572. }
  573. // Fog
  574. babylonjs_1.MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);
  575. // Log. depth
  576. babylonjs_1.MaterialHelper.BindLogDepth(defines, this._activeEffect, scene);
  577. // Water
  578. if (babylonjs_1.StandardMaterial.ReflectionTextureEnabled) {
  579. this._activeEffect.setTexture("refractionSampler", this._refractionRTT);
  580. this._activeEffect.setTexture("reflectionSampler", this._reflectionRTT);
  581. }
  582. var wrvp = this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(scene.getProjectionMatrix());
  583. // Add delta time. Prevent adding delta time if it hasn't changed.
  584. var deltaTime = scene.getEngine().getDeltaTime();
  585. if (deltaTime !== this._lastDeltaTime) {
  586. this._lastDeltaTime = deltaTime;
  587. this._lastTime += this._lastDeltaTime;
  588. }
  589. this._activeEffect.setMatrix("worldReflectionViewProjection", wrvp);
  590. this._activeEffect.setVector2("windDirection", this.windDirection);
  591. this._activeEffect.setFloat("waveLength", this.waveLength);
  592. this._activeEffect.setFloat("time", this._lastTime / 100000);
  593. this._activeEffect.setFloat("windForce", this.windForce);
  594. this._activeEffect.setFloat("waveHeight", this.waveHeight);
  595. this._activeEffect.setFloat("bumpHeight", this.bumpHeight);
  596. this._activeEffect.setColor4("waterColor", this.waterColor, 1.0);
  597. this._activeEffect.setFloat("colorBlendFactor", this.colorBlendFactor);
  598. this._activeEffect.setColor4("waterColor2", this.waterColor2, 1.0);
  599. this._activeEffect.setFloat("colorBlendFactor2", this.colorBlendFactor2);
  600. this._activeEffect.setFloat("waveSpeed", this.waveSpeed);
  601. this._afterBind(mesh, this._activeEffect);
  602. };
  603. WaterMaterial.prototype._createRenderTargets = function (scene, renderTargetSize) {
  604. var _this = this;
  605. // Render targets
  606. this._refractionRTT = new babylonjs_1.RenderTargetTexture(name + "_refraction", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);
  607. this._refractionRTT.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
  608. this._refractionRTT.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
  609. this._refractionRTT.ignoreCameraViewport = true;
  610. this._reflectionRTT = new babylonjs_1.RenderTargetTexture(name + "_reflection", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);
  611. this._reflectionRTT.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
  612. this._reflectionRTT.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
  613. this._reflectionRTT.ignoreCameraViewport = true;
  614. var isVisible;
  615. var clipPlane = null;
  616. var savedViewMatrix;
  617. var mirrorMatrix = babylonjs_1.Matrix.Zero();
  618. this._refractionRTT.onBeforeRender = function () {
  619. if (_this._mesh) {
  620. isVisible = _this._mesh.isVisible;
  621. _this._mesh.isVisible = false;
  622. }
  623. // Clip plane
  624. clipPlane = scene.clipPlane;
  625. var positiony = _this._mesh ? _this._mesh.position.y : 0.0;
  626. scene.clipPlane = babylonjs_1.Plane.FromPositionAndNormal(new babylonjs_1.Vector3(0, positiony + 0.05, 0), new babylonjs_1.Vector3(0, 1, 0));
  627. };
  628. this._refractionRTT.onAfterRender = function () {
  629. if (_this._mesh) {
  630. _this._mesh.isVisible = isVisible;
  631. }
  632. // Clip plane
  633. scene.clipPlane = clipPlane;
  634. };
  635. this._reflectionRTT.onBeforeRender = function () {
  636. if (_this._mesh) {
  637. isVisible = _this._mesh.isVisible;
  638. _this._mesh.isVisible = false;
  639. }
  640. // Clip plane
  641. clipPlane = scene.clipPlane;
  642. var positiony = _this._mesh ? _this._mesh.position.y : 0.0;
  643. scene.clipPlane = babylonjs_1.Plane.FromPositionAndNormal(new babylonjs_1.Vector3(0, positiony - 0.05, 0), new babylonjs_1.Vector3(0, -1, 0));
  644. // Transform
  645. babylonjs_1.Matrix.ReflectionToRef(scene.clipPlane, mirrorMatrix);
  646. savedViewMatrix = scene.getViewMatrix();
  647. mirrorMatrix.multiplyToRef(savedViewMatrix, _this._reflectionTransform);
  648. scene.setTransformMatrix(_this._reflectionTransform, scene.getProjectionMatrix());
  649. scene.getEngine().cullBackFaces = false;
  650. scene._mirroredCameraPosition = babylonjs_1.Vector3.TransformCoordinates(scene.activeCamera.position, mirrorMatrix);
  651. };
  652. this._reflectionRTT.onAfterRender = function () {
  653. if (_this._mesh) {
  654. _this._mesh.isVisible = isVisible;
  655. }
  656. // Clip plane
  657. scene.clipPlane = clipPlane;
  658. // Transform
  659. scene.setTransformMatrix(savedViewMatrix, scene.getProjectionMatrix());
  660. scene.getEngine().cullBackFaces = true;
  661. scene._mirroredCameraPosition = null;
  662. };
  663. };
  664. WaterMaterial.prototype.getAnimatables = function () {
  665. var results = [];
  666. if (this.bumpTexture && this.bumpTexture.animations && this.bumpTexture.animations.length > 0) {
  667. results.push(this.bumpTexture);
  668. }
  669. if (this._reflectionRTT && this._reflectionRTT.animations && this._reflectionRTT.animations.length > 0) {
  670. results.push(this._reflectionRTT);
  671. }
  672. if (this._refractionRTT && this._refractionRTT.animations && this._refractionRTT.animations.length > 0) {
  673. results.push(this._refractionRTT);
  674. }
  675. return results;
  676. };
  677. WaterMaterial.prototype.getActiveTextures = function () {
  678. var activeTextures = _super.prototype.getActiveTextures.call(this);
  679. if (this._bumpTexture) {
  680. activeTextures.push(this._bumpTexture);
  681. }
  682. return activeTextures;
  683. };
  684. WaterMaterial.prototype.hasTexture = function (texture) {
  685. if (_super.prototype.hasTexture.call(this, texture)) {
  686. return true;
  687. }
  688. if (this._bumpTexture === texture) {
  689. return true;
  690. }
  691. return false;
  692. };
  693. WaterMaterial.prototype.dispose = function (forceDisposeEffect) {
  694. if (this.bumpTexture) {
  695. this.bumpTexture.dispose();
  696. }
  697. var index = this.getScene().customRenderTargets.indexOf(this._refractionRTT);
  698. if (index != -1) {
  699. this.getScene().customRenderTargets.splice(index, 1);
  700. }
  701. index = -1;
  702. index = this.getScene().customRenderTargets.indexOf(this._reflectionRTT);
  703. if (index != -1) {
  704. this.getScene().customRenderTargets.splice(index, 1);
  705. }
  706. if (this._reflectionRTT) {
  707. this._reflectionRTT.dispose();
  708. }
  709. if (this._refractionRTT) {
  710. this._refractionRTT.dispose();
  711. }
  712. _super.prototype.dispose.call(this, forceDisposeEffect);
  713. };
  714. WaterMaterial.prototype.clone = function (name) {
  715. var _this = this;
  716. return babylonjs_1.SerializationHelper.Clone(function () { return new WaterMaterial(name, _this.getScene()); }, this);
  717. };
  718. WaterMaterial.prototype.serialize = function () {
  719. var serializationObject = babylonjs_1.SerializationHelper.Serialize(this);
  720. serializationObject.customType = "BABYLON.WaterMaterial";
  721. serializationObject.renderList = [];
  722. if (this._refractionRTT && this._refractionRTT.renderList) {
  723. for (var i = 0; i < this._refractionRTT.renderList.length; i++) {
  724. serializationObject.renderList.push(this._refractionRTT.renderList[i].id);
  725. }
  726. }
  727. return serializationObject;
  728. };
  729. WaterMaterial.prototype.getClassName = function () {
  730. return "WaterMaterial";
  731. };
  732. // Statics
  733. WaterMaterial.Parse = function (source, scene, rootUrl) {
  734. var mat = babylonjs_1.SerializationHelper.Parse(function () { return new WaterMaterial(source.name, scene); }, source, scene, rootUrl);
  735. mat._waitingRenderList = source.renderList;
  736. return mat;
  737. };
  738. WaterMaterial.CreateDefaultMesh = function (name, scene) {
  739. var mesh = babylonjs_1.Mesh.CreateGround(name, 512, 512, 32, scene, false);
  740. return mesh;
  741. };
  742. __decorate([
  743. babylonjs_1.serializeAsTexture("bumpTexture")
  744. ], WaterMaterial.prototype, "_bumpTexture", void 0);
  745. __decorate([
  746. babylonjs_1.expandToProperty("_markAllSubMeshesAsTexturesDirty")
  747. ], WaterMaterial.prototype, "bumpTexture", void 0);
  748. __decorate([
  749. babylonjs_1.serializeAsColor3()
  750. ], WaterMaterial.prototype, "diffuseColor", void 0);
  751. __decorate([
  752. babylonjs_1.serializeAsColor3()
  753. ], WaterMaterial.prototype, "specularColor", void 0);
  754. __decorate([
  755. babylonjs_1.serialize()
  756. ], WaterMaterial.prototype, "specularPower", void 0);
  757. __decorate([
  758. babylonjs_1.serialize("disableLighting")
  759. ], WaterMaterial.prototype, "_disableLighting", void 0);
  760. __decorate([
  761. babylonjs_1.expandToProperty("_markAllSubMeshesAsLightsDirty")
  762. ], WaterMaterial.prototype, "disableLighting", void 0);
  763. __decorate([
  764. babylonjs_1.serialize("maxSimultaneousLights")
  765. ], WaterMaterial.prototype, "_maxSimultaneousLights", void 0);
  766. __decorate([
  767. babylonjs_1.expandToProperty("_markAllSubMeshesAsLightsDirty")
  768. ], WaterMaterial.prototype, "maxSimultaneousLights", void 0);
  769. __decorate([
  770. babylonjs_1.serialize()
  771. ], WaterMaterial.prototype, "windForce", void 0);
  772. __decorate([
  773. babylonjs_1.serializeAsVector2()
  774. ], WaterMaterial.prototype, "windDirection", void 0);
  775. __decorate([
  776. babylonjs_1.serialize()
  777. ], WaterMaterial.prototype, "waveHeight", void 0);
  778. __decorate([
  779. babylonjs_1.serialize()
  780. ], WaterMaterial.prototype, "bumpHeight", void 0);
  781. __decorate([
  782. babylonjs_1.serialize("bumpSuperimpose")
  783. ], WaterMaterial.prototype, "_bumpSuperimpose", void 0);
  784. __decorate([
  785. babylonjs_1.expandToProperty("_markAllSubMeshesAsMiscDirty")
  786. ], WaterMaterial.prototype, "bumpSuperimpose", void 0);
  787. __decorate([
  788. babylonjs_1.serialize("fresnelSeparate")
  789. ], WaterMaterial.prototype, "_fresnelSeparate", void 0);
  790. __decorate([
  791. babylonjs_1.expandToProperty("_markAllSubMeshesAsMiscDirty")
  792. ], WaterMaterial.prototype, "fresnelSeparate", void 0);
  793. __decorate([
  794. babylonjs_1.serialize("bumpAffectsReflection")
  795. ], WaterMaterial.prototype, "_bumpAffectsReflection", void 0);
  796. __decorate([
  797. babylonjs_1.expandToProperty("_markAllSubMeshesAsMiscDirty")
  798. ], WaterMaterial.prototype, "bumpAffectsReflection", void 0);
  799. __decorate([
  800. babylonjs_1.serializeAsColor3()
  801. ], WaterMaterial.prototype, "waterColor", void 0);
  802. __decorate([
  803. babylonjs_1.serialize()
  804. ], WaterMaterial.prototype, "colorBlendFactor", void 0);
  805. __decorate([
  806. babylonjs_1.serializeAsColor3()
  807. ], WaterMaterial.prototype, "waterColor2", void 0);
  808. __decorate([
  809. babylonjs_1.serialize()
  810. ], WaterMaterial.prototype, "colorBlendFactor2", void 0);
  811. __decorate([
  812. babylonjs_1.serialize()
  813. ], WaterMaterial.prototype, "waveLength", void 0);
  814. __decorate([
  815. babylonjs_1.serialize()
  816. ], WaterMaterial.prototype, "waveSpeed", void 0);
  817. __decorate([
  818. babylonjs_1.serialize()
  819. ], WaterMaterial.prototype, "useLogarithmicDepth", null);
  820. return WaterMaterial;
  821. }(babylonjs_1.PushMaterial));
  822. exports.WaterMaterial = WaterMaterial;
  823. /***/ }),
  824. /***/ "babylonjs":
  825. /*!****************************************************************************************************!*\
  826. !*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
  827. \****************************************************************************************************/
  828. /*! no static exports found */
  829. /***/ (function(module, exports) {
  830. module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs__;
  831. /***/ })
  832. /******/ });
  833. });
  834. //# sourceMappingURL=babylon.waterMaterial.js.map