babylon.waterMaterial.js 65 KB

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