babylon.waterMaterial.js 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201
  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["MATERIALS"] = factory(root["BABYLON"]);
  10. })((typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this), function(__WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__) {
  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. /***/ "../../node_modules/tslib/tslib.es6.js":
  99. /*!***********************************************************!*\
  100. !*** C:/Repos/Babylon.js/node_modules/tslib/tslib.es6.js ***!
  101. \***********************************************************/
  102. /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault */
  103. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  104. "use strict";
  105. __webpack_require__.r(__webpack_exports__);
  106. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
  107. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
  108. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
  109. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
  110. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
  111. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
  112. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
  113. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
  114. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
  115. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
  116. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
  117. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
  118. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
  119. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
  120. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
  121. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
  122. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
  123. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
  124. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
  125. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
  126. /*! *****************************************************************************
  127. Copyright (c) Microsoft Corporation. All rights reserved.
  128. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  129. this file except in compliance with the License. You may obtain a copy of the
  130. License at http://www.apache.org/licenses/LICENSE-2.0
  131. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  132. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  133. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  134. MERCHANTABLITY OR NON-INFRINGEMENT.
  135. See the Apache Version 2.0 License for specific language governing permissions
  136. and limitations under the License.
  137. ***************************************************************************** */
  138. /* global Reflect, Promise */
  139. var extendStatics = function(d, b) {
  140. extendStatics = Object.setPrototypeOf ||
  141. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  142. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  143. return extendStatics(d, b);
  144. };
  145. function __extends(d, b) {
  146. extendStatics(d, b);
  147. function __() { this.constructor = d; }
  148. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  149. }
  150. var __assign = function() {
  151. __assign = Object.assign || function __assign(t) {
  152. for (var s, i = 1, n = arguments.length; i < n; i++) {
  153. s = arguments[i];
  154. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  155. }
  156. return t;
  157. }
  158. return __assign.apply(this, arguments);
  159. }
  160. function __rest(s, e) {
  161. var t = {};
  162. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  163. t[p] = s[p];
  164. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  165. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  166. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  167. t[p[i]] = s[p[i]];
  168. }
  169. return t;
  170. }
  171. function __decorate(decorators, target, key, desc) {
  172. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  173. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  174. 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;
  175. return c > 3 && r && Object.defineProperty(target, key, r), r;
  176. }
  177. function __param(paramIndex, decorator) {
  178. return function (target, key) { decorator(target, key, paramIndex); }
  179. }
  180. function __metadata(metadataKey, metadataValue) {
  181. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  182. }
  183. function __awaiter(thisArg, _arguments, P, generator) {
  184. return new (P || (P = Promise))(function (resolve, reject) {
  185. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  186. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  187. function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
  188. step((generator = generator.apply(thisArg, _arguments || [])).next());
  189. });
  190. }
  191. function __generator(thisArg, body) {
  192. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  193. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  194. function verb(n) { return function (v) { return step([n, v]); }; }
  195. function step(op) {
  196. if (f) throw new TypeError("Generator is already executing.");
  197. while (_) try {
  198. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  199. if (y = 0, t) op = [op[0] & 2, t.value];
  200. switch (op[0]) {
  201. case 0: case 1: t = op; break;
  202. case 4: _.label++; return { value: op[1], done: false };
  203. case 5: _.label++; y = op[1]; op = [0]; continue;
  204. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  205. default:
  206. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  207. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  208. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  209. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  210. if (t[2]) _.ops.pop();
  211. _.trys.pop(); continue;
  212. }
  213. op = body.call(thisArg, _);
  214. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  215. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  216. }
  217. }
  218. function __exportStar(m, exports) {
  219. for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  220. }
  221. function __values(o) {
  222. var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
  223. if (m) return m.call(o);
  224. return {
  225. next: function () {
  226. if (o && i >= o.length) o = void 0;
  227. return { value: o && o[i++], done: !o };
  228. }
  229. };
  230. }
  231. function __read(o, n) {
  232. var m = typeof Symbol === "function" && o[Symbol.iterator];
  233. if (!m) return o;
  234. var i = m.call(o), r, ar = [], e;
  235. try {
  236. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  237. }
  238. catch (error) { e = { error: error }; }
  239. finally {
  240. try {
  241. if (r && !r.done && (m = i["return"])) m.call(i);
  242. }
  243. finally { if (e) throw e.error; }
  244. }
  245. return ar;
  246. }
  247. function __spread() {
  248. for (var ar = [], i = 0; i < arguments.length; i++)
  249. ar = ar.concat(__read(arguments[i]));
  250. return ar;
  251. }
  252. function __spreadArrays() {
  253. for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
  254. for (var r = Array(s), k = 0, i = 0; i < il; i++)
  255. for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
  256. r[k] = a[j];
  257. return r;
  258. };
  259. function __await(v) {
  260. return this instanceof __await ? (this.v = v, this) : new __await(v);
  261. }
  262. function __asyncGenerator(thisArg, _arguments, generator) {
  263. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  264. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  265. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
  266. function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
  267. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  268. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  269. function fulfill(value) { resume("next", value); }
  270. function reject(value) { resume("throw", value); }
  271. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  272. }
  273. function __asyncDelegator(o) {
  274. var i, p;
  275. return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
  276. function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
  277. }
  278. function __asyncValues(o) {
  279. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  280. var m = o[Symbol.asyncIterator], i;
  281. return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
  282. function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
  283. function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  284. }
  285. function __makeTemplateObject(cooked, raw) {
  286. if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  287. return cooked;
  288. };
  289. function __importStar(mod) {
  290. if (mod && mod.__esModule) return mod;
  291. var result = {};
  292. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  293. result.default = mod;
  294. return result;
  295. }
  296. function __importDefault(mod) {
  297. return (mod && mod.__esModule) ? mod : { default: mod };
  298. }
  299. /***/ }),
  300. /***/ "../../node_modules/webpack/buildin/global.js":
  301. /*!***********************************!*\
  302. !*** (webpack)/buildin/global.js ***!
  303. \***********************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports) {
  306. var g;
  307. // This works in non-strict mode
  308. g = (function() {
  309. return this;
  310. })();
  311. try {
  312. // This works if eval is allowed (see CSP)
  313. g = g || new Function("return this")();
  314. } catch (e) {
  315. // This works if the window reference is available
  316. if (typeof window === "object") g = window;
  317. }
  318. // g can still be undefined, but nothing to do about it...
  319. // We return undefined, instead of nothing here, so it's
  320. // easier to handle this case. if(!global) { ...}
  321. module.exports = g;
  322. /***/ }),
  323. /***/ "./legacy/legacy-water.ts":
  324. /*!********************************!*\
  325. !*** ./legacy/legacy-water.ts ***!
  326. \********************************/
  327. /*! exports provided: WaterMaterial */
  328. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  329. "use strict";
  330. __webpack_require__.r(__webpack_exports__);
  331. /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _water__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../water */ "./water/index.ts");
  332. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WaterMaterial", function() { return _water__WEBPACK_IMPORTED_MODULE_0__["WaterMaterial"]; });
  333. /**
  334. * This is the entry point for the UMD module.
  335. * The entry point for a future ESM package should be index.ts
  336. */
  337. var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
  338. if (typeof globalObject !== "undefined") {
  339. for (var key in _water__WEBPACK_IMPORTED_MODULE_0__) {
  340. globalObject.BABYLON[key] = _water__WEBPACK_IMPORTED_MODULE_0__[key];
  341. }
  342. }
  343. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js")))
  344. /***/ }),
  345. /***/ "./water/index.ts":
  346. /*!************************!*\
  347. !*** ./water/index.ts ***!
  348. \************************/
  349. /*! exports provided: WaterMaterial */
  350. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  351. "use strict";
  352. __webpack_require__.r(__webpack_exports__);
  353. /* harmony import */ var _waterMaterial__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./waterMaterial */ "./water/waterMaterial.ts");
  354. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WaterMaterial", function() { return _waterMaterial__WEBPACK_IMPORTED_MODULE_0__["WaterMaterial"]; });
  355. /***/ }),
  356. /***/ "./water/water.fragment.ts":
  357. /*!*********************************!*\
  358. !*** ./water/water.fragment.ts ***!
  359. \*********************************/
  360. /*! exports provided: waterPixelShader */
  361. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  362. "use strict";
  363. __webpack_require__.r(__webpack_exports__);
  364. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "waterPixelShader", function() { return waterPixelShader; });
  365. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  366. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  367. var name = 'waterPixelShader';
  368. var shader = "#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#include<imageProcessingDeclaration>\n#include<imageProcessingFunctions>\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\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation*0.5,0.0,1.0);\nvec4 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);\nvec4 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);\nfloat fresnelTerm=clamp(abs(pow(dot(viewDirectionW,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\nvec2 projectedRefractionTexCoords=clamp(vRefractionMapTexCoord.xy/vRefractionMapTexCoord.z+perturbation,0.0,1.0);\nvec4 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);\nvec4 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);\nfloat fresnelTerm=max(dot(viewDirectionW,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>\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#elif IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\ngl_FragColor=color;\n}\n";
  369. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  370. /** @hidden */
  371. var waterPixelShader = { name: name, shader: shader };
  372. /***/ }),
  373. /***/ "./water/water.vertex.ts":
  374. /*!*******************************!*\
  375. !*** ./water/water.vertex.ts ***!
  376. \*******************************/
  377. /*! exports provided: waterVertexShader */
  378. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  379. "use strict";
  380. __webpack_require__.r(__webpack_exports__);
  381. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "waterVertexShader", function() { return waterVertexShader; });
  382. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  383. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  384. var name = 'waterVertexShader';
  385. var shader = "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";
  386. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  387. /** @hidden */
  388. var waterVertexShader = { name: name, shader: shader };
  389. /***/ }),
  390. /***/ "./water/waterMaterial.ts":
  391. /*!********************************!*\
  392. !*** ./water/waterMaterial.ts ***!
  393. \********************************/
  394. /*! exports provided: WaterMaterial */
  395. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  396. "use strict";
  397. __webpack_require__.r(__webpack_exports__);
  398. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WaterMaterial", function() { return WaterMaterial; });
  399. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  400. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  401. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  402. /* harmony import */ var _water_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./water.fragment */ "./water/water.fragment.ts");
  403. /* harmony import */ var _water_vertex__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./water.vertex */ "./water/water.vertex.ts");
  404. var WaterMaterialDefines = /** @class */ (function (_super) {
  405. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](WaterMaterialDefines, _super);
  406. function WaterMaterialDefines() {
  407. var _this = _super.call(this) || this;
  408. _this.BUMP = false;
  409. _this.REFLECTION = false;
  410. _this.CLIPPLANE = false;
  411. _this.CLIPPLANE2 = false;
  412. _this.CLIPPLANE3 = false;
  413. _this.CLIPPLANE4 = false;
  414. _this.ALPHATEST = false;
  415. _this.DEPTHPREPASS = false;
  416. _this.POINTSIZE = false;
  417. _this.FOG = false;
  418. _this.NORMAL = false;
  419. _this.UV1 = false;
  420. _this.UV2 = false;
  421. _this.VERTEXCOLOR = false;
  422. _this.VERTEXALPHA = false;
  423. _this.NUM_BONE_INFLUENCERS = 0;
  424. _this.BonesPerMesh = 0;
  425. _this.INSTANCES = false;
  426. _this.SPECULARTERM = false;
  427. _this.LOGARITHMICDEPTH = false;
  428. _this.FRESNELSEPARATE = false;
  429. _this.BUMPSUPERIMPOSE = false;
  430. _this.BUMPAFFECTSREFLECTION = false;
  431. _this.IMAGEPROCESSING = false;
  432. _this.VIGNETTE = false;
  433. _this.VIGNETTEBLENDMODEMULTIPLY = false;
  434. _this.VIGNETTEBLENDMODEOPAQUE = false;
  435. _this.TONEMAPPING = false;
  436. _this.TONEMAPPING_ACES = false;
  437. _this.CONTRAST = false;
  438. _this.EXPOSURE = false;
  439. _this.COLORCURVES = false;
  440. _this.COLORGRADING = false;
  441. _this.COLORGRADING3D = false;
  442. _this.SAMPLER3DGREENDEPTH = false;
  443. _this.SAMPLER3DBGRMAP = false;
  444. _this.IMAGEPROCESSINGPOSTPROCESS = false;
  445. _this.rebuild();
  446. return _this;
  447. }
  448. return WaterMaterialDefines;
  449. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialDefines"]));
  450. var WaterMaterial = /** @class */ (function (_super) {
  451. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](WaterMaterial, _super);
  452. /**
  453. * Constructor
  454. */
  455. function WaterMaterial(name, scene, renderTargetSize) {
  456. if (renderTargetSize === void 0) { renderTargetSize = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Vector2"](512, 512); }
  457. var _this = _super.call(this, name, scene) || this;
  458. _this.renderTargetSize = renderTargetSize;
  459. _this.diffuseColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](1, 1, 1);
  460. _this.specularColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0, 0, 0);
  461. _this.specularPower = 64;
  462. _this._disableLighting = false;
  463. _this._maxSimultaneousLights = 4;
  464. /**
  465. * @param {number}: Represents the wind force
  466. */
  467. _this.windForce = 6;
  468. /**
  469. * @param {Vector2}: The direction of the wind in the plane (X, Z)
  470. */
  471. _this.windDirection = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Vector2"](0, 1);
  472. /**
  473. * @param {number}: Wave height, represents the height of the waves
  474. */
  475. _this.waveHeight = 0.4;
  476. /**
  477. * @param {number}: Bump height, represents the bump height related to the bump map
  478. */
  479. _this.bumpHeight = 0.4;
  480. /**
  481. * @param {boolean}: Add a smaller moving bump to less steady waves.
  482. */
  483. _this._bumpSuperimpose = false;
  484. /**
  485. * @param {boolean}: Color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.
  486. */
  487. _this._fresnelSeparate = false;
  488. /**
  489. * @param {boolean}: bump Waves modify the reflection.
  490. */
  491. _this._bumpAffectsReflection = false;
  492. /**
  493. * @param {number}: The water color blended with the refraction (near)
  494. */
  495. _this.waterColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.1, 0.1, 0.6);
  496. /**
  497. * @param {number}: The blend factor related to the water color
  498. */
  499. _this.colorBlendFactor = 0.2;
  500. /**
  501. * @param {number}: The water color blended with the reflection (far)
  502. */
  503. _this.waterColor2 = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.1, 0.1, 0.6);
  504. /**
  505. * @param {number}: The blend factor related to the water color (reflection, far)
  506. */
  507. _this.colorBlendFactor2 = 0.2;
  508. /**
  509. * @param {number}: Represents the maximum length of a wave
  510. */
  511. _this.waveLength = 0.1;
  512. /**
  513. * @param {number}: Defines the waves speed
  514. */
  515. _this.waveSpeed = 1.0;
  516. /**
  517. * Sets or gets wether or not automatic clipping should be enabled or not. Setting to true will save performances and
  518. * will avoid calculating useless pixels in the pixel shader of the water material.
  519. */
  520. _this.disableClipPlane = false;
  521. _this._renderTargets = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SmartArray"](16);
  522. /*
  523. * Private members
  524. */
  525. _this._mesh = null;
  526. _this._reflectionTransform = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Matrix"].Zero();
  527. _this._lastTime = 0;
  528. _this._lastDeltaTime = 0;
  529. _this._createRenderTargets(scene, renderTargetSize);
  530. // Create render targets
  531. _this.getRenderTargetTextures = function () {
  532. _this._renderTargets.reset();
  533. _this._renderTargets.push(_this._reflectionRTT);
  534. _this._renderTargets.push(_this._refractionRTT);
  535. return _this._renderTargets;
  536. };
  537. _this._imageProcessingConfiguration = _this.getScene().imageProcessingConfiguration;
  538. if (_this._imageProcessingConfiguration) {
  539. _this._imageProcessingObserver = _this._imageProcessingConfiguration.onUpdateParameters.add(function () {
  540. _this._markAllSubMeshesAsImageProcessingDirty();
  541. });
  542. }
  543. return _this;
  544. }
  545. Object.defineProperty(WaterMaterial.prototype, "hasRenderTargetTextures", {
  546. /**
  547. * Gets a boolean indicating that current material needs to register RTT
  548. */
  549. get: function () {
  550. return true;
  551. },
  552. enumerable: true,
  553. configurable: true
  554. });
  555. Object.defineProperty(WaterMaterial.prototype, "useLogarithmicDepth", {
  556. get: function () {
  557. return this._useLogarithmicDepth;
  558. },
  559. set: function (value) {
  560. this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;
  561. this._markAllSubMeshesAsMiscDirty();
  562. },
  563. enumerable: true,
  564. configurable: true
  565. });
  566. Object.defineProperty(WaterMaterial.prototype, "refractionTexture", {
  567. // Get / Set
  568. get: function () {
  569. return this._refractionRTT;
  570. },
  571. enumerable: true,
  572. configurable: true
  573. });
  574. Object.defineProperty(WaterMaterial.prototype, "reflectionTexture", {
  575. get: function () {
  576. return this._reflectionRTT;
  577. },
  578. enumerable: true,
  579. configurable: true
  580. });
  581. // Methods
  582. WaterMaterial.prototype.addToRenderList = function (node) {
  583. if (this._refractionRTT && this._refractionRTT.renderList) {
  584. this._refractionRTT.renderList.push(node);
  585. }
  586. if (this._reflectionRTT && this._reflectionRTT.renderList) {
  587. this._reflectionRTT.renderList.push(node);
  588. }
  589. };
  590. WaterMaterial.prototype.enableRenderTargets = function (enable) {
  591. var refreshRate = enable ? 1 : 0;
  592. if (this._refractionRTT) {
  593. this._refractionRTT.refreshRate = refreshRate;
  594. }
  595. if (this._reflectionRTT) {
  596. this._reflectionRTT.refreshRate = refreshRate;
  597. }
  598. };
  599. WaterMaterial.prototype.getRenderList = function () {
  600. return this._refractionRTT ? this._refractionRTT.renderList : [];
  601. };
  602. Object.defineProperty(WaterMaterial.prototype, "renderTargetsEnabled", {
  603. get: function () {
  604. return !(this._refractionRTT && this._refractionRTT.refreshRate === 0);
  605. },
  606. enumerable: true,
  607. configurable: true
  608. });
  609. WaterMaterial.prototype.needAlphaBlending = function () {
  610. return (this.alpha < 1.0);
  611. };
  612. WaterMaterial.prototype.needAlphaTesting = function () {
  613. return false;
  614. };
  615. WaterMaterial.prototype.getAlphaTestTexture = function () {
  616. return null;
  617. };
  618. WaterMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {
  619. if (this.isFrozen) {
  620. if (this._wasPreviouslyReady && subMesh.effect) {
  621. return true;
  622. }
  623. }
  624. if (!subMesh._materialDefines) {
  625. subMesh._materialDefines = new WaterMaterialDefines();
  626. }
  627. var defines = subMesh._materialDefines;
  628. var scene = this.getScene();
  629. if (!this.checkReadyOnEveryCall && subMesh.effect) {
  630. if (this._renderId === scene.getRenderId()) {
  631. return true;
  632. }
  633. }
  634. var engine = scene.getEngine();
  635. // Textures
  636. if (defines._areTexturesDirty) {
  637. defines._needUVs = false;
  638. if (scene.texturesEnabled) {
  639. if (this.bumpTexture && babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialFlags"].BumpTextureEnabled) {
  640. if (!this.bumpTexture.isReady()) {
  641. return false;
  642. }
  643. else {
  644. defines._needUVs = true;
  645. defines.BUMP = true;
  646. }
  647. }
  648. if (babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialFlags"].ReflectionTextureEnabled) {
  649. defines.REFLECTION = true;
  650. }
  651. }
  652. }
  653. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);
  654. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
  655. if (defines._areMiscDirty) {
  656. if (this._fresnelSeparate) {
  657. defines.FRESNELSEPARATE = true;
  658. }
  659. if (this._bumpSuperimpose) {
  660. defines.BUMPSUPERIMPOSE = true;
  661. }
  662. if (this._bumpAffectsReflection) {
  663. defines.BUMPAFFECTSREFLECTION = true;
  664. }
  665. }
  666. // Lights
  667. defines._needNormals = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);
  668. // Image processing
  669. if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {
  670. if (!this._imageProcessingConfiguration.isReady()) {
  671. return false;
  672. }
  673. this._imageProcessingConfiguration.prepareDefines(defines);
  674. defines.IS_REFLECTION_LINEAR = (this.reflectionTexture != null && !this.reflectionTexture.gammaSpace);
  675. defines.IS_REFRACTION_LINEAR = (this.refractionTexture != null && !this.refractionTexture.gammaSpace);
  676. }
  677. // Attribs
  678. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareDefinesForAttributes(mesh, defines, true, true);
  679. // Configure this
  680. this._mesh = mesh;
  681. if (this._waitingRenderList) {
  682. for (var i = 0; i < this._waitingRenderList.length; i++) {
  683. this.addToRenderList(scene.getNodeByID(this._waitingRenderList[i]));
  684. }
  685. this._waitingRenderList = null;
  686. }
  687. // Get correct effect
  688. if (defines.isDirty) {
  689. defines.markAsProcessed();
  690. scene.resetCachedMaterial();
  691. // Fallbacks
  692. var fallbacks = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["EffectFallbacks"]();
  693. if (defines.FOG) {
  694. fallbacks.addFallback(1, "FOG");
  695. }
  696. if (defines.LOGARITHMICDEPTH) {
  697. fallbacks.addFallback(0, "LOGARITHMICDEPTH");
  698. }
  699. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);
  700. if (defines.NUM_BONE_INFLUENCERS > 0) {
  701. fallbacks.addCPUSkinningFallback(0, mesh);
  702. }
  703. //Attributes
  704. var attribs = [babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].PositionKind];
  705. if (defines.NORMAL) {
  706. attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].NormalKind);
  707. }
  708. if (defines.UV1) {
  709. attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].UVKind);
  710. }
  711. if (defines.UV2) {
  712. attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].UV2Kind);
  713. }
  714. if (defines.VERTEXCOLOR) {
  715. attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].ColorKind);
  716. }
  717. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
  718. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareAttributesForInstances(attribs, defines);
  719. // Legacy browser patch
  720. var shaderName = "water";
  721. var join = defines.toString();
  722. var uniforms = ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vDiffuseColor", "vSpecularColor",
  723. "vFogInfos", "vFogColor", "pointSize",
  724. "vNormalInfos",
  725. "mBones",
  726. "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "normalMatrix",
  727. "logarithmicDepthConstant",
  728. // Water
  729. "worldReflectionViewProjection", "windDirection", "waveLength", "time", "windForce",
  730. "cameraPosition", "bumpHeight", "waveHeight", "waterColor", "waterColor2", "colorBlendFactor", "colorBlendFactor2", "waveSpeed"
  731. ];
  732. var samplers = ["normalSampler",
  733. // Water
  734. "refractionSampler", "reflectionSampler"
  735. ];
  736. var uniformBuffers = new Array();
  737. if (babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ImageProcessingConfiguration"]) {
  738. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ImageProcessingConfiguration"].PrepareUniforms(uniforms, defines);
  739. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ImageProcessingConfiguration"].PrepareSamplers(samplers, defines);
  740. }
  741. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareUniformsAndSamplersList({
  742. uniformsNames: uniforms,
  743. uniformBuffersNames: uniformBuffers,
  744. samplers: samplers,
  745. defines: defines,
  746. maxSimultaneousLights: this.maxSimultaneousLights
  747. });
  748. subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
  749. attributes: attribs,
  750. uniformsNames: uniforms,
  751. uniformBuffersNames: uniformBuffers,
  752. samplers: samplers,
  753. defines: join,
  754. fallbacks: fallbacks,
  755. onCompiled: this.onCompiled,
  756. onError: this.onError,
  757. indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights }
  758. }, engine), defines);
  759. }
  760. if (!subMesh.effect || !subMesh.effect.isReady()) {
  761. return false;
  762. }
  763. this._renderId = scene.getRenderId();
  764. this._wasPreviouslyReady = true;
  765. return true;
  766. };
  767. WaterMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {
  768. var scene = this.getScene();
  769. var defines = subMesh._materialDefines;
  770. if (!defines) {
  771. return;
  772. }
  773. var effect = subMesh.effect;
  774. if (!effect || !this._mesh) {
  775. return;
  776. }
  777. this._activeEffect = effect;
  778. // Matrices
  779. this.bindOnlyWorldMatrix(world);
  780. this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
  781. // Bones
  782. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindBonesParameters(mesh, this._activeEffect);
  783. if (this._mustRebind(scene, effect)) {
  784. // Textures
  785. if (this.bumpTexture && babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialFlags"].BumpTextureEnabled) {
  786. this._activeEffect.setTexture("normalSampler", this.bumpTexture);
  787. this._activeEffect.setFloat2("vNormalInfos", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);
  788. this._activeEffect.setMatrix("normalMatrix", this.bumpTexture.getTextureMatrix());
  789. }
  790. // Clip plane
  791. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindClipPlane(this._activeEffect, scene);
  792. // Point size
  793. if (this.pointsCloud) {
  794. this._activeEffect.setFloat("pointSize", this.pointSize);
  795. }
  796. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindEyePosition(effect, scene);
  797. }
  798. this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
  799. if (defines.SPECULARTERM) {
  800. this._activeEffect.setColor4("vSpecularColor", this.specularColor, this.specularPower);
  801. }
  802. if (scene.lightsEnabled && !this.disableLighting) {
  803. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);
  804. }
  805. // View
  806. if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Scene"].FOGMODE_NONE) {
  807. this._activeEffect.setMatrix("view", scene.getViewMatrix());
  808. }
  809. // Fog
  810. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindFogParameters(scene, mesh, this._activeEffect);
  811. // Log. depth
  812. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindLogDepth(defines, this._activeEffect, scene);
  813. // Water
  814. if (babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialFlags"].ReflectionTextureEnabled) {
  815. this._activeEffect.setTexture("refractionSampler", this._refractionRTT);
  816. this._activeEffect.setTexture("reflectionSampler", this._reflectionRTT);
  817. }
  818. var wrvp = this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(scene.getProjectionMatrix());
  819. // Add delta time. Prevent adding delta time if it hasn't changed.
  820. var deltaTime = scene.getEngine().getDeltaTime();
  821. if (deltaTime !== this._lastDeltaTime) {
  822. this._lastDeltaTime = deltaTime;
  823. this._lastTime += this._lastDeltaTime;
  824. }
  825. this._activeEffect.setMatrix("worldReflectionViewProjection", wrvp);
  826. this._activeEffect.setVector2("windDirection", this.windDirection);
  827. this._activeEffect.setFloat("waveLength", this.waveLength);
  828. this._activeEffect.setFloat("time", this._lastTime / 100000);
  829. this._activeEffect.setFloat("windForce", this.windForce);
  830. this._activeEffect.setFloat("waveHeight", this.waveHeight);
  831. this._activeEffect.setFloat("bumpHeight", this.bumpHeight);
  832. this._activeEffect.setColor4("waterColor", this.waterColor, 1.0);
  833. this._activeEffect.setFloat("colorBlendFactor", this.colorBlendFactor);
  834. this._activeEffect.setColor4("waterColor2", this.waterColor2, 1.0);
  835. this._activeEffect.setFloat("colorBlendFactor2", this.colorBlendFactor2);
  836. this._activeEffect.setFloat("waveSpeed", this.waveSpeed);
  837. // image processing
  838. if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {
  839. this._imageProcessingConfiguration.bind(this._activeEffect);
  840. }
  841. this._afterBind(mesh, this._activeEffect);
  842. };
  843. WaterMaterial.prototype._createRenderTargets = function (scene, renderTargetSize) {
  844. var _this = this;
  845. // Render targets
  846. this._refractionRTT = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["RenderTargetTexture"](name + "_refraction", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);
  847. this._refractionRTT.wrapU = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Constants"].TEXTURE_MIRROR_ADDRESSMODE;
  848. this._refractionRTT.wrapV = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Constants"].TEXTURE_MIRROR_ADDRESSMODE;
  849. this._refractionRTT.ignoreCameraViewport = true;
  850. this._reflectionRTT = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["RenderTargetTexture"](name + "_reflection", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);
  851. this._reflectionRTT.wrapU = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Constants"].TEXTURE_MIRROR_ADDRESSMODE;
  852. this._reflectionRTT.wrapV = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Constants"].TEXTURE_MIRROR_ADDRESSMODE;
  853. this._reflectionRTT.ignoreCameraViewport = true;
  854. var isVisible;
  855. var clipPlane = null;
  856. var savedViewMatrix;
  857. var mirrorMatrix = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Matrix"].Zero();
  858. this._refractionRTT.onBeforeRender = function () {
  859. if (_this._mesh) {
  860. isVisible = _this._mesh.isVisible;
  861. _this._mesh.isVisible = false;
  862. }
  863. // Clip plane
  864. if (!_this.disableClipPlane) {
  865. clipPlane = scene.clipPlane;
  866. var positiony = _this._mesh ? _this._mesh.position.y : 0.0;
  867. scene.clipPlane = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Plane"].FromPositionAndNormal(new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Vector3"](0, positiony + 0.05, 0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Vector3"](0, 1, 0));
  868. }
  869. };
  870. this._refractionRTT.onAfterRender = function () {
  871. if (_this._mesh) {
  872. _this._mesh.isVisible = isVisible;
  873. }
  874. // Clip plane
  875. if (!_this.disableClipPlane) {
  876. scene.clipPlane = clipPlane;
  877. }
  878. };
  879. this._reflectionRTT.onBeforeRender = function () {
  880. if (_this._mesh) {
  881. isVisible = _this._mesh.isVisible;
  882. _this._mesh.isVisible = false;
  883. }
  884. // Clip plane
  885. if (!_this.disableClipPlane) {
  886. clipPlane = scene.clipPlane;
  887. var positiony = _this._mesh ? _this._mesh.position.y : 0.0;
  888. scene.clipPlane = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Plane"].FromPositionAndNormal(new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Vector3"](0, positiony - 0.05, 0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Vector3"](0, -1, 0));
  889. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Matrix"].ReflectionToRef(scene.clipPlane, mirrorMatrix);
  890. }
  891. // Transform
  892. savedViewMatrix = scene.getViewMatrix();
  893. mirrorMatrix.multiplyToRef(savedViewMatrix, _this._reflectionTransform);
  894. scene.setTransformMatrix(_this._reflectionTransform, scene.getProjectionMatrix());
  895. scene.getEngine().cullBackFaces = false;
  896. scene._mirroredCameraPosition = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Vector3"].TransformCoordinates(scene.activeCamera.position, mirrorMatrix);
  897. };
  898. this._reflectionRTT.onAfterRender = function () {
  899. if (_this._mesh) {
  900. _this._mesh.isVisible = isVisible;
  901. }
  902. // Clip plane
  903. scene.clipPlane = clipPlane;
  904. // Transform
  905. scene.setTransformMatrix(savedViewMatrix, scene.getProjectionMatrix());
  906. scene.getEngine().cullBackFaces = true;
  907. scene._mirroredCameraPosition = null;
  908. };
  909. };
  910. WaterMaterial.prototype.getAnimatables = function () {
  911. var results = [];
  912. if (this.bumpTexture && this.bumpTexture.animations && this.bumpTexture.animations.length > 0) {
  913. results.push(this.bumpTexture);
  914. }
  915. if (this._reflectionRTT && this._reflectionRTT.animations && this._reflectionRTT.animations.length > 0) {
  916. results.push(this._reflectionRTT);
  917. }
  918. if (this._refractionRTT && this._refractionRTT.animations && this._refractionRTT.animations.length > 0) {
  919. results.push(this._refractionRTT);
  920. }
  921. return results;
  922. };
  923. WaterMaterial.prototype.getActiveTextures = function () {
  924. var activeTextures = _super.prototype.getActiveTextures.call(this);
  925. if (this._bumpTexture) {
  926. activeTextures.push(this._bumpTexture);
  927. }
  928. return activeTextures;
  929. };
  930. WaterMaterial.prototype.hasTexture = function (texture) {
  931. if (_super.prototype.hasTexture.call(this, texture)) {
  932. return true;
  933. }
  934. if (this._bumpTexture === texture) {
  935. return true;
  936. }
  937. return false;
  938. };
  939. WaterMaterial.prototype.dispose = function (forceDisposeEffect) {
  940. if (this.bumpTexture) {
  941. this.bumpTexture.dispose();
  942. }
  943. var index = this.getScene().customRenderTargets.indexOf(this._refractionRTT);
  944. if (index != -1) {
  945. this.getScene().customRenderTargets.splice(index, 1);
  946. }
  947. index = -1;
  948. index = this.getScene().customRenderTargets.indexOf(this._reflectionRTT);
  949. if (index != -1) {
  950. this.getScene().customRenderTargets.splice(index, 1);
  951. }
  952. if (this._reflectionRTT) {
  953. this._reflectionRTT.dispose();
  954. }
  955. if (this._refractionRTT) {
  956. this._refractionRTT.dispose();
  957. }
  958. // Remove image-processing observer
  959. if (this._imageProcessingConfiguration && this._imageProcessingObserver) {
  960. this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);
  961. }
  962. _super.prototype.dispose.call(this, forceDisposeEffect);
  963. };
  964. WaterMaterial.prototype.clone = function (name) {
  965. var _this = this;
  966. return babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Clone(function () { return new WaterMaterial(name, _this.getScene()); }, this);
  967. };
  968. WaterMaterial.prototype.serialize = function () {
  969. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this);
  970. serializationObject.customType = "BABYLON.WaterMaterial";
  971. serializationObject.renderList = [];
  972. if (this._refractionRTT && this._refractionRTT.renderList) {
  973. for (var i = 0; i < this._refractionRTT.renderList.length; i++) {
  974. serializationObject.renderList.push(this._refractionRTT.renderList[i].id);
  975. }
  976. }
  977. return serializationObject;
  978. };
  979. WaterMaterial.prototype.getClassName = function () {
  980. return "WaterMaterial";
  981. };
  982. // Statics
  983. WaterMaterial.Parse = function (source, scene, rootUrl) {
  984. var mat = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new WaterMaterial(source.name, scene); }, source, scene, rootUrl);
  985. mat._waitingRenderList = source.renderList;
  986. return mat;
  987. };
  988. WaterMaterial.CreateDefaultMesh = function (name, scene) {
  989. var mesh = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Mesh"].CreateGround(name, 512, 512, 32, scene, false);
  990. return mesh;
  991. };
  992. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  993. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsTexture"])("bumpTexture")
  994. ], WaterMaterial.prototype, "_bumpTexture", void 0);
  995. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  996. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsTexturesDirty")
  997. ], WaterMaterial.prototype, "bumpTexture", void 0);
  998. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  999. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  1000. ], WaterMaterial.prototype, "diffuseColor", void 0);
  1001. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1002. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  1003. ], WaterMaterial.prototype, "specularColor", void 0);
  1004. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1005. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1006. ], WaterMaterial.prototype, "specularPower", void 0);
  1007. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1008. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("disableLighting")
  1009. ], WaterMaterial.prototype, "_disableLighting", void 0);
  1010. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1011. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsLightsDirty")
  1012. ], WaterMaterial.prototype, "disableLighting", void 0);
  1013. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1014. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("maxSimultaneousLights")
  1015. ], WaterMaterial.prototype, "_maxSimultaneousLights", void 0);
  1016. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1017. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsLightsDirty")
  1018. ], WaterMaterial.prototype, "maxSimultaneousLights", void 0);
  1019. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1020. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1021. ], WaterMaterial.prototype, "windForce", void 0);
  1022. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1023. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsVector2"])()
  1024. ], WaterMaterial.prototype, "windDirection", void 0);
  1025. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1026. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1027. ], WaterMaterial.prototype, "waveHeight", void 0);
  1028. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1029. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1030. ], WaterMaterial.prototype, "bumpHeight", void 0);
  1031. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1032. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("bumpSuperimpose")
  1033. ], WaterMaterial.prototype, "_bumpSuperimpose", void 0);
  1034. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1035. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsMiscDirty")
  1036. ], WaterMaterial.prototype, "bumpSuperimpose", void 0);
  1037. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1038. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("fresnelSeparate")
  1039. ], WaterMaterial.prototype, "_fresnelSeparate", void 0);
  1040. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1041. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsMiscDirty")
  1042. ], WaterMaterial.prototype, "fresnelSeparate", void 0);
  1043. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1044. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("bumpAffectsReflection")
  1045. ], WaterMaterial.prototype, "_bumpAffectsReflection", void 0);
  1046. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1047. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsMiscDirty")
  1048. ], WaterMaterial.prototype, "bumpAffectsReflection", void 0);
  1049. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1050. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  1051. ], WaterMaterial.prototype, "waterColor", void 0);
  1052. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1053. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1054. ], WaterMaterial.prototype, "colorBlendFactor", void 0);
  1055. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1056. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  1057. ], WaterMaterial.prototype, "waterColor2", void 0);
  1058. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1059. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1060. ], WaterMaterial.prototype, "colorBlendFactor2", void 0);
  1061. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1062. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1063. ], WaterMaterial.prototype, "waveLength", void 0);
  1064. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1065. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1066. ], WaterMaterial.prototype, "waveSpeed", void 0);
  1067. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1068. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1069. ], WaterMaterial.prototype, "disableClipPlane", void 0);
  1070. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1071. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1072. ], WaterMaterial.prototype, "useLogarithmicDepth", null);
  1073. return WaterMaterial;
  1074. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["PushMaterial"]));
  1075. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.WaterMaterial"] = WaterMaterial;
  1076. /***/ }),
  1077. /***/ "babylonjs/Misc/decorators":
  1078. /*!****************************************************************************************************!*\
  1079. !*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
  1080. \****************************************************************************************************/
  1081. /*! no static exports found */
  1082. /***/ (function(module, exports) {
  1083. module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__;
  1084. /***/ })
  1085. /******/ });
  1086. });
  1087. //# sourceMappingURL=babylon.waterMaterial.js.map