babylon.waterMaterial.js 68 KB

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