babylon.waterMaterial.js 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203
  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_Materials_effect__) {
  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:/Dev/Babylon/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/Materials/effect");
  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 defined(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/Materials/effect");
  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/Materials/effect");
  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. Object(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.CLIPPLANE5 = false;
  415. _this.CLIPPLANE6 = false;
  416. _this.ALPHATEST = false;
  417. _this.DEPTHPREPASS = false;
  418. _this.POINTSIZE = false;
  419. _this.FOG = false;
  420. _this.NORMAL = false;
  421. _this.UV1 = false;
  422. _this.UV2 = false;
  423. _this.VERTEXCOLOR = false;
  424. _this.VERTEXALPHA = false;
  425. _this.NUM_BONE_INFLUENCERS = 0;
  426. _this.BonesPerMesh = 0;
  427. _this.INSTANCES = false;
  428. _this.SPECULARTERM = false;
  429. _this.LOGARITHMICDEPTH = false;
  430. _this.FRESNELSEPARATE = false;
  431. _this.BUMPSUPERIMPOSE = false;
  432. _this.BUMPAFFECTSREFLECTION = false;
  433. _this.IMAGEPROCESSING = false;
  434. _this.VIGNETTE = false;
  435. _this.VIGNETTEBLENDMODEMULTIPLY = false;
  436. _this.VIGNETTEBLENDMODEOPAQUE = false;
  437. _this.TONEMAPPING = false;
  438. _this.TONEMAPPING_ACES = false;
  439. _this.CONTRAST = false;
  440. _this.EXPOSURE = false;
  441. _this.COLORCURVES = false;
  442. _this.COLORGRADING = false;
  443. _this.COLORGRADING3D = false;
  444. _this.SAMPLER3DGREENDEPTH = false;
  445. _this.SAMPLER3DBGRMAP = false;
  446. _this.IMAGEPROCESSINGPOSTPROCESS = false;
  447. _this.rebuild();
  448. return _this;
  449. }
  450. return WaterMaterialDefines;
  451. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialDefines"]));
  452. var WaterMaterial = /** @class */ (function (_super) {
  453. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(WaterMaterial, _super);
  454. /**
  455. * Constructor
  456. */
  457. function WaterMaterial(name, scene, renderTargetSize) {
  458. if (renderTargetSize === void 0) { renderTargetSize = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Vector2"](512, 512); }
  459. var _this = _super.call(this, name, scene) || this;
  460. _this.renderTargetSize = renderTargetSize;
  461. _this.diffuseColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](1, 1, 1);
  462. _this.specularColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0, 0, 0);
  463. _this.specularPower = 64;
  464. _this._disableLighting = false;
  465. _this._maxSimultaneousLights = 4;
  466. /**
  467. * @param {number}: Represents the wind force
  468. */
  469. _this.windForce = 6;
  470. /**
  471. * @param {Vector2}: The direction of the wind in the plane (X, Z)
  472. */
  473. _this.windDirection = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Vector2"](0, 1);
  474. /**
  475. * @param {number}: Wave height, represents the height of the waves
  476. */
  477. _this.waveHeight = 0.4;
  478. /**
  479. * @param {number}: Bump height, represents the bump height related to the bump map
  480. */
  481. _this.bumpHeight = 0.4;
  482. /**
  483. * @param {boolean}: Add a smaller moving bump to less steady waves.
  484. */
  485. _this._bumpSuperimpose = false;
  486. /**
  487. * @param {boolean}: Color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel.
  488. */
  489. _this._fresnelSeparate = false;
  490. /**
  491. * @param {boolean}: bump Waves modify the reflection.
  492. */
  493. _this._bumpAffectsReflection = false;
  494. /**
  495. * @param {number}: The water color blended with the refraction (near)
  496. */
  497. _this.waterColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.1, 0.1, 0.6);
  498. /**
  499. * @param {number}: The blend factor related to the water color
  500. */
  501. _this.colorBlendFactor = 0.2;
  502. /**
  503. * @param {number}: The water color blended with the reflection (far)
  504. */
  505. _this.waterColor2 = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.1, 0.1, 0.6);
  506. /**
  507. * @param {number}: The blend factor related to the water color (reflection, far)
  508. */
  509. _this.colorBlendFactor2 = 0.2;
  510. /**
  511. * @param {number}: Represents the maximum length of a wave
  512. */
  513. _this.waveLength = 0.1;
  514. /**
  515. * @param {number}: Defines the waves speed
  516. */
  517. _this.waveSpeed = 1.0;
  518. /**
  519. * Sets or gets whether or not automatic clipping should be enabled or not. Setting to true will save performances and
  520. * will avoid calculating useless pixels in the pixel shader of the water material.
  521. */
  522. _this.disableClipPlane = false;
  523. _this._renderTargets = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SmartArray"](16);
  524. /*
  525. * Private members
  526. */
  527. _this._mesh = null;
  528. _this._reflectionTransform = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Matrix"].Zero();
  529. _this._lastTime = 0;
  530. _this._lastDeltaTime = 0;
  531. _this._createRenderTargets(scene, renderTargetSize);
  532. // Create render targets
  533. _this.getRenderTargetTextures = function () {
  534. _this._renderTargets.reset();
  535. _this._renderTargets.push(_this._reflectionRTT);
  536. _this._renderTargets.push(_this._refractionRTT);
  537. return _this._renderTargets;
  538. };
  539. _this._imageProcessingConfiguration = _this.getScene().imageProcessingConfiguration;
  540. if (_this._imageProcessingConfiguration) {
  541. _this._imageProcessingObserver = _this._imageProcessingConfiguration.onUpdateParameters.add(function () {
  542. _this._markAllSubMeshesAsImageProcessingDirty();
  543. });
  544. }
  545. return _this;
  546. }
  547. Object.defineProperty(WaterMaterial.prototype, "hasRenderTargetTextures", {
  548. /**
  549. * Gets a boolean indicating that current material needs to register RTT
  550. */
  551. get: function () {
  552. return true;
  553. },
  554. enumerable: true,
  555. configurable: true
  556. });
  557. Object.defineProperty(WaterMaterial.prototype, "useLogarithmicDepth", {
  558. get: function () {
  559. return this._useLogarithmicDepth;
  560. },
  561. set: function (value) {
  562. this._useLogarithmicDepth = value && this.getScene().getEngine().getCaps().fragmentDepthSupported;
  563. this._markAllSubMeshesAsMiscDirty();
  564. },
  565. enumerable: true,
  566. configurable: true
  567. });
  568. Object.defineProperty(WaterMaterial.prototype, "refractionTexture", {
  569. // Get / Set
  570. get: function () {
  571. return this._refractionRTT;
  572. },
  573. enumerable: true,
  574. configurable: true
  575. });
  576. Object.defineProperty(WaterMaterial.prototype, "reflectionTexture", {
  577. get: function () {
  578. return this._reflectionRTT;
  579. },
  580. enumerable: true,
  581. configurable: true
  582. });
  583. // Methods
  584. WaterMaterial.prototype.addToRenderList = function (node) {
  585. if (this._refractionRTT && this._refractionRTT.renderList) {
  586. this._refractionRTT.renderList.push(node);
  587. }
  588. if (this._reflectionRTT && this._reflectionRTT.renderList) {
  589. this._reflectionRTT.renderList.push(node);
  590. }
  591. };
  592. WaterMaterial.prototype.enableRenderTargets = function (enable) {
  593. var refreshRate = enable ? 1 : 0;
  594. if (this._refractionRTT) {
  595. this._refractionRTT.refreshRate = refreshRate;
  596. }
  597. if (this._reflectionRTT) {
  598. this._reflectionRTT.refreshRate = refreshRate;
  599. }
  600. };
  601. WaterMaterial.prototype.getRenderList = function () {
  602. return this._refractionRTT ? this._refractionRTT.renderList : [];
  603. };
  604. Object.defineProperty(WaterMaterial.prototype, "renderTargetsEnabled", {
  605. get: function () {
  606. return !(this._refractionRTT && this._refractionRTT.refreshRate === 0);
  607. },
  608. enumerable: true,
  609. configurable: true
  610. });
  611. WaterMaterial.prototype.needAlphaBlending = function () {
  612. return (this.alpha < 1.0);
  613. };
  614. WaterMaterial.prototype.needAlphaTesting = function () {
  615. return false;
  616. };
  617. WaterMaterial.prototype.getAlphaTestTexture = function () {
  618. return null;
  619. };
  620. WaterMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {
  621. if (this.isFrozen) {
  622. if (subMesh.effect && subMesh.effect._wasPreviouslyReady) {
  623. return true;
  624. }
  625. }
  626. if (!subMesh._materialDefines) {
  627. subMesh._materialDefines = new WaterMaterialDefines();
  628. }
  629. var defines = subMesh._materialDefines;
  630. var scene = this.getScene();
  631. if (!this.checkReadyOnEveryCall && subMesh.effect) {
  632. if (this._renderId === scene.getRenderId()) {
  633. return true;
  634. }
  635. }
  636. var engine = scene.getEngine();
  637. // Textures
  638. if (defines._areTexturesDirty) {
  639. defines._needUVs = false;
  640. if (scene.texturesEnabled) {
  641. if (this.bumpTexture && babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialFlags"].BumpTextureEnabled) {
  642. if (!this.bumpTexture.isReady()) {
  643. return false;
  644. }
  645. else {
  646. defines._needUVs = true;
  647. defines.BUMP = true;
  648. }
  649. }
  650. if (babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialFlags"].ReflectionTextureEnabled) {
  651. defines.REFLECTION = true;
  652. }
  653. }
  654. }
  655. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);
  656. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
  657. if (defines._areMiscDirty) {
  658. if (this._fresnelSeparate) {
  659. defines.FRESNELSEPARATE = true;
  660. }
  661. if (this._bumpSuperimpose) {
  662. defines.BUMPSUPERIMPOSE = true;
  663. }
  664. if (this._bumpAffectsReflection) {
  665. defines.BUMPAFFECTSREFLECTION = true;
  666. }
  667. }
  668. // Lights
  669. defines._needNormals = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareDefinesForLights(scene, mesh, defines, true, this._maxSimultaneousLights, this._disableLighting);
  670. // Image processing
  671. if (defines._areImageProcessingDirty && this._imageProcessingConfiguration) {
  672. if (!this._imageProcessingConfiguration.isReady()) {
  673. return false;
  674. }
  675. this._imageProcessingConfiguration.prepareDefines(defines);
  676. defines.IS_REFLECTION_LINEAR = (this.reflectionTexture != null && !this.reflectionTexture.gammaSpace);
  677. defines.IS_REFRACTION_LINEAR = (this.refractionTexture != null && !this.refractionTexture.gammaSpace);
  678. }
  679. // Attribs
  680. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareDefinesForAttributes(mesh, defines, true, true);
  681. // Configure this
  682. this._mesh = mesh;
  683. if (this._waitingRenderList) {
  684. for (var i = 0; i < this._waitingRenderList.length; i++) {
  685. this.addToRenderList(scene.getNodeByID(this._waitingRenderList[i]));
  686. }
  687. this._waitingRenderList = null;
  688. }
  689. // Get correct effect
  690. if (defines.isDirty) {
  691. defines.markAsProcessed();
  692. scene.resetCachedMaterial();
  693. // Fallbacks
  694. var fallbacks = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["EffectFallbacks"]();
  695. if (defines.FOG) {
  696. fallbacks.addFallback(1, "FOG");
  697. }
  698. if (defines.LOGARITHMICDEPTH) {
  699. fallbacks.addFallback(0, "LOGARITHMICDEPTH");
  700. }
  701. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);
  702. if (defines.NUM_BONE_INFLUENCERS > 0) {
  703. fallbacks.addCPUSkinningFallback(0, mesh);
  704. }
  705. //Attributes
  706. var attribs = [babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].PositionKind];
  707. if (defines.NORMAL) {
  708. attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].NormalKind);
  709. }
  710. if (defines.UV1) {
  711. attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].UVKind);
  712. }
  713. if (defines.UV2) {
  714. attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].UV2Kind);
  715. }
  716. if (defines.VERTEXCOLOR) {
  717. attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].ColorKind);
  718. }
  719. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
  720. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareAttributesForInstances(attribs, defines);
  721. // Legacy browser patch
  722. var shaderName = "water";
  723. var join = defines.toString();
  724. var uniforms = ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vDiffuseColor", "vSpecularColor",
  725. "vFogInfos", "vFogColor", "pointSize",
  726. "vNormalInfos",
  727. "mBones",
  728. "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "vClipPlane5", "vClipPlane6", "normalMatrix",
  729. "logarithmicDepthConstant",
  730. // Water
  731. "worldReflectionViewProjection", "windDirection", "waveLength", "time", "windForce",
  732. "cameraPosition", "bumpHeight", "waveHeight", "waterColor", "waterColor2", "colorBlendFactor", "colorBlendFactor2", "waveSpeed"
  733. ];
  734. var samplers = ["normalSampler",
  735. // Water
  736. "refractionSampler", "reflectionSampler"
  737. ];
  738. var uniformBuffers = new Array();
  739. if (babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ImageProcessingConfiguration"]) {
  740. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ImageProcessingConfiguration"].PrepareUniforms(uniforms, defines);
  741. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ImageProcessingConfiguration"].PrepareSamplers(samplers, defines);
  742. }
  743. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareUniformsAndSamplersList({
  744. uniformsNames: uniforms,
  745. uniformBuffersNames: uniformBuffers,
  746. samplers: samplers,
  747. defines: defines,
  748. maxSimultaneousLights: this.maxSimultaneousLights
  749. });
  750. subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
  751. attributes: attribs,
  752. uniformsNames: uniforms,
  753. uniformBuffersNames: uniformBuffers,
  754. samplers: samplers,
  755. defines: join,
  756. fallbacks: fallbacks,
  757. onCompiled: this.onCompiled,
  758. onError: this.onError,
  759. indexParameters: { maxSimultaneousLights: this._maxSimultaneousLights }
  760. }, engine), defines);
  761. }
  762. if (!subMesh.effect || !subMesh.effect.isReady()) {
  763. return false;
  764. }
  765. this._renderId = scene.getRenderId();
  766. subMesh.effect._wasPreviouslyReady = true;
  767. return true;
  768. };
  769. WaterMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {
  770. var scene = this.getScene();
  771. var defines = subMesh._materialDefines;
  772. if (!defines) {
  773. return;
  774. }
  775. var effect = subMesh.effect;
  776. if (!effect || !this._mesh) {
  777. return;
  778. }
  779. this._activeEffect = effect;
  780. // Matrices
  781. this.bindOnlyWorldMatrix(world);
  782. this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
  783. // Bones
  784. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindBonesParameters(mesh, this._activeEffect);
  785. if (this._mustRebind(scene, effect)) {
  786. // Textures
  787. if (this.bumpTexture && babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialFlags"].BumpTextureEnabled) {
  788. this._activeEffect.setTexture("normalSampler", this.bumpTexture);
  789. this._activeEffect.setFloat2("vNormalInfos", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);
  790. this._activeEffect.setMatrix("normalMatrix", this.bumpTexture.getTextureMatrix());
  791. }
  792. // Clip plane
  793. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindClipPlane(this._activeEffect, scene);
  794. // Point size
  795. if (this.pointsCloud) {
  796. this._activeEffect.setFloat("pointSize", this.pointSize);
  797. }
  798. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindEyePosition(effect, scene);
  799. }
  800. this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
  801. if (defines.SPECULARTERM) {
  802. this._activeEffect.setColor4("vSpecularColor", this.specularColor, this.specularPower);
  803. }
  804. if (scene.lightsEnabled && !this.disableLighting) {
  805. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);
  806. }
  807. // View
  808. if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Scene"].FOGMODE_NONE) {
  809. this._activeEffect.setMatrix("view", scene.getViewMatrix());
  810. }
  811. // Fog
  812. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindFogParameters(scene, mesh, this._activeEffect);
  813. // Log. depth
  814. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindLogDepth(defines, this._activeEffect, scene);
  815. // Water
  816. if (babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialFlags"].ReflectionTextureEnabled) {
  817. this._activeEffect.setTexture("refractionSampler", this._refractionRTT);
  818. this._activeEffect.setTexture("reflectionSampler", this._reflectionRTT);
  819. }
  820. var wrvp = this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(scene.getProjectionMatrix());
  821. // Add delta time. Prevent adding delta time if it hasn't changed.
  822. var deltaTime = scene.getEngine().getDeltaTime();
  823. if (deltaTime !== this._lastDeltaTime) {
  824. this._lastDeltaTime = deltaTime;
  825. this._lastTime += this._lastDeltaTime;
  826. }
  827. this._activeEffect.setMatrix("worldReflectionViewProjection", wrvp);
  828. this._activeEffect.setVector2("windDirection", this.windDirection);
  829. this._activeEffect.setFloat("waveLength", this.waveLength);
  830. this._activeEffect.setFloat("time", this._lastTime / 100000);
  831. this._activeEffect.setFloat("windForce", this.windForce);
  832. this._activeEffect.setFloat("waveHeight", this.waveHeight);
  833. this._activeEffect.setFloat("bumpHeight", this.bumpHeight);
  834. this._activeEffect.setColor4("waterColor", this.waterColor, 1.0);
  835. this._activeEffect.setFloat("colorBlendFactor", this.colorBlendFactor);
  836. this._activeEffect.setColor4("waterColor2", this.waterColor2, 1.0);
  837. this._activeEffect.setFloat("colorBlendFactor2", this.colorBlendFactor2);
  838. this._activeEffect.setFloat("waveSpeed", this.waveSpeed);
  839. // image processing
  840. if (this._imageProcessingConfiguration && !this._imageProcessingConfiguration.applyByPostProcess) {
  841. this._imageProcessingConfiguration.bind(this._activeEffect);
  842. }
  843. this._afterBind(mesh, this._activeEffect);
  844. };
  845. WaterMaterial.prototype._createRenderTargets = function (scene, renderTargetSize) {
  846. var _this = this;
  847. // Render targets
  848. this._refractionRTT = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["RenderTargetTexture"](name + "_refraction", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);
  849. this._refractionRTT.wrapU = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Constants"].TEXTURE_MIRROR_ADDRESSMODE;
  850. this._refractionRTT.wrapV = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Constants"].TEXTURE_MIRROR_ADDRESSMODE;
  851. this._refractionRTT.ignoreCameraViewport = true;
  852. this._reflectionRTT = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["RenderTargetTexture"](name + "_reflection", { width: renderTargetSize.x, height: renderTargetSize.y }, scene, false, true);
  853. this._reflectionRTT.wrapU = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Constants"].TEXTURE_MIRROR_ADDRESSMODE;
  854. this._reflectionRTT.wrapV = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Constants"].TEXTURE_MIRROR_ADDRESSMODE;
  855. this._reflectionRTT.ignoreCameraViewport = true;
  856. var isVisible;
  857. var clipPlane = null;
  858. var savedViewMatrix;
  859. var mirrorMatrix = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Matrix"].Zero();
  860. this._refractionRTT.onBeforeRender = function () {
  861. if (_this._mesh) {
  862. isVisible = _this._mesh.isVisible;
  863. _this._mesh.isVisible = false;
  864. }
  865. // Clip plane
  866. if (!_this.disableClipPlane) {
  867. clipPlane = scene.clipPlane;
  868. var positiony = _this._mesh ? _this._mesh.position.y : 0.0;
  869. 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));
  870. }
  871. };
  872. this._refractionRTT.onAfterRender = function () {
  873. if (_this._mesh) {
  874. _this._mesh.isVisible = isVisible;
  875. }
  876. // Clip plane
  877. if (!_this.disableClipPlane) {
  878. scene.clipPlane = clipPlane;
  879. }
  880. };
  881. this._reflectionRTT.onBeforeRender = function () {
  882. if (_this._mesh) {
  883. isVisible = _this._mesh.isVisible;
  884. _this._mesh.isVisible = false;
  885. }
  886. // Clip plane
  887. if (!_this.disableClipPlane) {
  888. clipPlane = scene.clipPlane;
  889. var positiony = _this._mesh ? _this._mesh.position.y : 0.0;
  890. 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));
  891. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Matrix"].ReflectionToRef(scene.clipPlane, mirrorMatrix);
  892. }
  893. // Transform
  894. savedViewMatrix = scene.getViewMatrix();
  895. mirrorMatrix.multiplyToRef(savedViewMatrix, _this._reflectionTransform);
  896. scene.setTransformMatrix(_this._reflectionTransform, scene.getProjectionMatrix());
  897. scene.getEngine().cullBackFaces = false;
  898. scene._mirroredCameraPosition = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Vector3"].TransformCoordinates(scene.activeCamera.position, mirrorMatrix);
  899. };
  900. this._reflectionRTT.onAfterRender = function () {
  901. if (_this._mesh) {
  902. _this._mesh.isVisible = isVisible;
  903. }
  904. // Clip plane
  905. scene.clipPlane = clipPlane;
  906. // Transform
  907. scene.setTransformMatrix(savedViewMatrix, scene.getProjectionMatrix());
  908. scene.getEngine().cullBackFaces = true;
  909. scene._mirroredCameraPosition = null;
  910. };
  911. };
  912. WaterMaterial.prototype.getAnimatables = function () {
  913. var results = [];
  914. if (this.bumpTexture && this.bumpTexture.animations && this.bumpTexture.animations.length > 0) {
  915. results.push(this.bumpTexture);
  916. }
  917. if (this._reflectionRTT && this._reflectionRTT.animations && this._reflectionRTT.animations.length > 0) {
  918. results.push(this._reflectionRTT);
  919. }
  920. if (this._refractionRTT && this._refractionRTT.animations && this._refractionRTT.animations.length > 0) {
  921. results.push(this._refractionRTT);
  922. }
  923. return results;
  924. };
  925. WaterMaterial.prototype.getActiveTextures = function () {
  926. var activeTextures = _super.prototype.getActiveTextures.call(this);
  927. if (this._bumpTexture) {
  928. activeTextures.push(this._bumpTexture);
  929. }
  930. return activeTextures;
  931. };
  932. WaterMaterial.prototype.hasTexture = function (texture) {
  933. if (_super.prototype.hasTexture.call(this, texture)) {
  934. return true;
  935. }
  936. if (this._bumpTexture === texture) {
  937. return true;
  938. }
  939. return false;
  940. };
  941. WaterMaterial.prototype.dispose = function (forceDisposeEffect) {
  942. if (this.bumpTexture) {
  943. this.bumpTexture.dispose();
  944. }
  945. var index = this.getScene().customRenderTargets.indexOf(this._refractionRTT);
  946. if (index != -1) {
  947. this.getScene().customRenderTargets.splice(index, 1);
  948. }
  949. index = -1;
  950. index = this.getScene().customRenderTargets.indexOf(this._reflectionRTT);
  951. if (index != -1) {
  952. this.getScene().customRenderTargets.splice(index, 1);
  953. }
  954. if (this._reflectionRTT) {
  955. this._reflectionRTT.dispose();
  956. }
  957. if (this._refractionRTT) {
  958. this._refractionRTT.dispose();
  959. }
  960. // Remove image-processing observer
  961. if (this._imageProcessingConfiguration && this._imageProcessingObserver) {
  962. this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver);
  963. }
  964. _super.prototype.dispose.call(this, forceDisposeEffect);
  965. };
  966. WaterMaterial.prototype.clone = function (name) {
  967. var _this = this;
  968. return babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Clone(function () { return new WaterMaterial(name, _this.getScene()); }, this);
  969. };
  970. WaterMaterial.prototype.serialize = function () {
  971. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this);
  972. serializationObject.customType = "BABYLON.WaterMaterial";
  973. serializationObject.renderList = [];
  974. if (this._refractionRTT && this._refractionRTT.renderList) {
  975. for (var i = 0; i < this._refractionRTT.renderList.length; i++) {
  976. serializationObject.renderList.push(this._refractionRTT.renderList[i].id);
  977. }
  978. }
  979. return serializationObject;
  980. };
  981. WaterMaterial.prototype.getClassName = function () {
  982. return "WaterMaterial";
  983. };
  984. // Statics
  985. WaterMaterial.Parse = function (source, scene, rootUrl) {
  986. var mat = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new WaterMaterial(source.name, scene); }, source, scene, rootUrl);
  987. mat._waitingRenderList = source.renderList;
  988. return mat;
  989. };
  990. WaterMaterial.CreateDefaultMesh = function (name, scene) {
  991. var mesh = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Mesh"].CreateGround(name, 512, 512, 32, scene, false);
  992. return mesh;
  993. };
  994. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  995. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsTexture"])("bumpTexture")
  996. ], WaterMaterial.prototype, "_bumpTexture", void 0);
  997. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  998. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsTexturesDirty")
  999. ], WaterMaterial.prototype, "bumpTexture", void 0);
  1000. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1001. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  1002. ], WaterMaterial.prototype, "diffuseColor", void 0);
  1003. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1004. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  1005. ], WaterMaterial.prototype, "specularColor", void 0);
  1006. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1007. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1008. ], WaterMaterial.prototype, "specularPower", void 0);
  1009. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1010. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("disableLighting")
  1011. ], WaterMaterial.prototype, "_disableLighting", void 0);
  1012. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1013. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsLightsDirty")
  1014. ], WaterMaterial.prototype, "disableLighting", void 0);
  1015. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1016. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("maxSimultaneousLights")
  1017. ], WaterMaterial.prototype, "_maxSimultaneousLights", void 0);
  1018. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1019. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsLightsDirty")
  1020. ], WaterMaterial.prototype, "maxSimultaneousLights", void 0);
  1021. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1022. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1023. ], WaterMaterial.prototype, "windForce", void 0);
  1024. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1025. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsVector2"])()
  1026. ], WaterMaterial.prototype, "windDirection", void 0);
  1027. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1028. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1029. ], WaterMaterial.prototype, "waveHeight", void 0);
  1030. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1031. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1032. ], WaterMaterial.prototype, "bumpHeight", void 0);
  1033. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1034. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("bumpSuperimpose")
  1035. ], WaterMaterial.prototype, "_bumpSuperimpose", void 0);
  1036. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1037. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsMiscDirty")
  1038. ], WaterMaterial.prototype, "bumpSuperimpose", void 0);
  1039. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1040. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("fresnelSeparate")
  1041. ], WaterMaterial.prototype, "_fresnelSeparate", void 0);
  1042. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1043. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsMiscDirty")
  1044. ], WaterMaterial.prototype, "fresnelSeparate", void 0);
  1045. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1046. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("bumpAffectsReflection")
  1047. ], WaterMaterial.prototype, "_bumpAffectsReflection", void 0);
  1048. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1049. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsMiscDirty")
  1050. ], WaterMaterial.prototype, "bumpAffectsReflection", void 0);
  1051. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1052. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  1053. ], WaterMaterial.prototype, "waterColor", void 0);
  1054. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1055. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1056. ], WaterMaterial.prototype, "colorBlendFactor", void 0);
  1057. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1058. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  1059. ], WaterMaterial.prototype, "waterColor2", void 0);
  1060. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1061. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1062. ], WaterMaterial.prototype, "colorBlendFactor2", void 0);
  1063. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1064. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1065. ], WaterMaterial.prototype, "waveLength", void 0);
  1066. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1067. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1068. ], WaterMaterial.prototype, "waveSpeed", void 0);
  1069. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1070. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1071. ], WaterMaterial.prototype, "disableClipPlane", void 0);
  1072. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1073. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1074. ], WaterMaterial.prototype, "useLogarithmicDepth", null);
  1075. return WaterMaterial;
  1076. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["PushMaterial"]));
  1077. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.WaterMaterial"] = WaterMaterial;
  1078. /***/ }),
  1079. /***/ "babylonjs/Materials/effect":
  1080. /*!****************************************************************************************************!*\
  1081. !*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
  1082. \****************************************************************************************************/
  1083. /*! no static exports found */
  1084. /***/ (function(module, exports) {
  1085. module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_Materials_effect__;
  1086. /***/ })
  1087. /******/ });
  1088. });
  1089. //# sourceMappingURL=babylon.waterMaterial.js.map