babylonjs.proceduralTextures.js 112 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056
  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-procedural-textures", ["babylonjs"], factory);
  6. else if(typeof exports === 'object')
  7. exports["babylonjs-procedural-textures"] = factory(require("babylonjs"));
  8. else
  9. root["PROCEDURALTEXTURES"] = 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.ts");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "../../node_modules/tslib/tslib.es6.js":
  99. /*!***********************************************************!*\
  100. !*** C:/Repos/Babylon.js/node_modules/tslib/tslib.es6.js ***!
  101. \***********************************************************/
  102. /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __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. /***/ "./brick/brickProceduralTexture.fragment.ts":
  314. /*!**************************************************!*\
  315. !*** ./brick/brickProceduralTexture.fragment.ts ***!
  316. \**************************************************/
  317. /*! exports provided: brickProceduralTexturePixelShader */
  318. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  319. "use strict";
  320. __webpack_require__.r(__webpack_exports__);
  321. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "brickProceduralTexturePixelShader", function() { return brickProceduralTexturePixelShader; });
  322. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  323. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  324. var name = 'brickProceduralTexturePixelShader';
  325. var shader = "precision highp float;\nvarying vec2 vPosition;\nvarying vec2 vUV;\nuniform float numberOfBricksHeight;\nuniform float numberOfBricksWidth;\nuniform vec3 brickColor;\nuniform vec3 jointColor;\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat fbm(vec2 n) {\nfloat total=0.0,amplitude=1.0;\nfor (int i=0; i<4; i++) {\ntotal+=noise(n)*amplitude;\nn+=n;\namplitude*=0.5;\n}\nreturn total;\n}\nfloat roundF(float number){\nreturn sign(number)*floor(abs(number)+0.5);\n}\nvoid main(void)\n{\nfloat brickW=1.0/numberOfBricksWidth;\nfloat brickH=1.0/numberOfBricksHeight;\nfloat jointWPercentage=0.01;\nfloat jointHPercentage=0.05;\nvec3 color=brickColor;\nfloat yi=vUV.y/brickH;\nfloat nyi=roundF(yi);\nfloat xi=vUV.x/brickW;\nif (mod(floor(yi),2.0) == 0.0){\nxi=xi-0.5;\n}\nfloat nxi=roundF(xi);\nvec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/brickW);\nif (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){\ncolor=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);\n}\nelse if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){\ncolor=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);\n}\nelse {\nfloat brickColorSwitch=mod(floor(yi)+floor(xi),3.0);\nif (brickColorSwitch == 0.0)\ncolor=mix(color,vec3(0.33,0.33,0.33),0.3);\nelse if (brickColorSwitch == 2.0)\ncolor=mix(color,vec3(0.11,0.11,0.11),0.3);\n}\ngl_FragColor=vec4(color,1.0);\n}";
  326. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  327. /** @hidden */
  328. var brickProceduralTexturePixelShader = { name: name, shader: shader };
  329. /***/ }),
  330. /***/ "./brick/brickProceduralTexture.ts":
  331. /*!*****************************************!*\
  332. !*** ./brick/brickProceduralTexture.ts ***!
  333. \*****************************************/
  334. /*! exports provided: BrickProceduralTexture */
  335. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  336. "use strict";
  337. __webpack_require__.r(__webpack_exports__);
  338. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BrickProceduralTexture", function() { return BrickProceduralTexture; });
  339. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  340. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  341. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  342. /* harmony import */ var _brickProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./brickProceduralTexture.fragment */ "./brick/brickProceduralTexture.fragment.ts");
  343. var BrickProceduralTexture = /** @class */ (function (_super) {
  344. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](BrickProceduralTexture, _super);
  345. function BrickProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  346. var _this = _super.call(this, name, size, "brickProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  347. _this._numberOfBricksHeight = 15;
  348. _this._numberOfBricksWidth = 5;
  349. _this._jointColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.72, 0.72, 0.72);
  350. _this._brickColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.77, 0.47, 0.40);
  351. _this.updateShaderUniforms();
  352. return _this;
  353. }
  354. BrickProceduralTexture.prototype.updateShaderUniforms = function () {
  355. this.setFloat("numberOfBricksHeight", this._numberOfBricksHeight);
  356. this.setFloat("numberOfBricksWidth", this._numberOfBricksWidth);
  357. this.setColor3("brickColor", this._brickColor);
  358. this.setColor3("jointColor", this._jointColor);
  359. };
  360. Object.defineProperty(BrickProceduralTexture.prototype, "numberOfBricksHeight", {
  361. get: function () {
  362. return this._numberOfBricksHeight;
  363. },
  364. set: function (value) {
  365. this._numberOfBricksHeight = value;
  366. this.updateShaderUniforms();
  367. },
  368. enumerable: true,
  369. configurable: true
  370. });
  371. Object.defineProperty(BrickProceduralTexture.prototype, "numberOfBricksWidth", {
  372. get: function () {
  373. return this._numberOfBricksWidth;
  374. },
  375. set: function (value) {
  376. this._numberOfBricksWidth = value;
  377. this.updateShaderUniforms();
  378. },
  379. enumerable: true,
  380. configurable: true
  381. });
  382. Object.defineProperty(BrickProceduralTexture.prototype, "jointColor", {
  383. get: function () {
  384. return this._jointColor;
  385. },
  386. set: function (value) {
  387. this._jointColor = value;
  388. this.updateShaderUniforms();
  389. },
  390. enumerable: true,
  391. configurable: true
  392. });
  393. Object.defineProperty(BrickProceduralTexture.prototype, "brickColor", {
  394. get: function () {
  395. return this._brickColor;
  396. },
  397. set: function (value) {
  398. this._brickColor = value;
  399. this.updateShaderUniforms();
  400. },
  401. enumerable: true,
  402. configurable: true
  403. });
  404. /**
  405. * Serializes this brick procedural texture
  406. * @returns a serialized brick procedural texture object
  407. */
  408. BrickProceduralTexture.prototype.serialize = function () {
  409. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  410. serializationObject.customType = "BABYLON.BrickProceduralTexture";
  411. return serializationObject;
  412. };
  413. /**
  414. * Creates a Brick Procedural Texture from parsed brick procedural texture data
  415. * @param parsedTexture defines parsed texture data
  416. * @param scene defines the current scene
  417. * @param rootUrl defines the root URL containing brick procedural texture information
  418. * @returns a parsed Brick Procedural Texture
  419. */
  420. BrickProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  421. var texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new BrickProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
  422. return texture;
  423. };
  424. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  425. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  426. ], BrickProceduralTexture.prototype, "numberOfBricksHeight", null);
  427. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  428. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  429. ], BrickProceduralTexture.prototype, "numberOfBricksWidth", null);
  430. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  431. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  432. ], BrickProceduralTexture.prototype, "jointColor", null);
  433. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  434. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  435. ], BrickProceduralTexture.prototype, "brickColor", null);
  436. return BrickProceduralTexture;
  437. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  438. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.BrickProceduralTexture"] = BrickProceduralTexture;
  439. /***/ }),
  440. /***/ "./brick/index.ts":
  441. /*!************************!*\
  442. !*** ./brick/index.ts ***!
  443. \************************/
  444. /*! exports provided: BrickProceduralTexture */
  445. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  446. "use strict";
  447. __webpack_require__.r(__webpack_exports__);
  448. /* harmony import */ var _brickProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./brickProceduralTexture */ "./brick/brickProceduralTexture.ts");
  449. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BrickProceduralTexture", function() { return _brickProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["BrickProceduralTexture"]; });
  450. /***/ }),
  451. /***/ "./cloud/cloudProceduralTexture.fragment.ts":
  452. /*!**************************************************!*\
  453. !*** ./cloud/cloudProceduralTexture.fragment.ts ***!
  454. \**************************************************/
  455. /*! exports provided: cloudProceduralTexturePixelShader */
  456. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  457. "use strict";
  458. __webpack_require__.r(__webpack_exports__);
  459. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloudProceduralTexturePixelShader", function() { return cloudProceduralTexturePixelShader; });
  460. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  461. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  462. var name = 'cloudProceduralTexturePixelShader';
  463. var shader = "precision highp float;\nvarying vec2 vUV;\nuniform vec4 skyColor;\nuniform vec4 cloudColor;\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat fbm(vec2 n) {\nfloat total=0.0,amplitude=1.0;\nfor (int i=0; i<4; i++) {\ntotal+=noise(n)*amplitude;\nn+=n;\namplitude*=0.5;\n}\nreturn total;\n}\nvoid main() {\nvec2 p=vUV*12.0;\nvec4 c=mix(skyColor,cloudColor,fbm(p));\ngl_FragColor=c;\n}\n";
  464. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  465. /** @hidden */
  466. var cloudProceduralTexturePixelShader = { name: name, shader: shader };
  467. /***/ }),
  468. /***/ "./cloud/cloudProceduralTexture.ts":
  469. /*!*****************************************!*\
  470. !*** ./cloud/cloudProceduralTexture.ts ***!
  471. \*****************************************/
  472. /*! exports provided: CloudProceduralTexture */
  473. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  474. "use strict";
  475. __webpack_require__.r(__webpack_exports__);
  476. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CloudProceduralTexture", function() { return CloudProceduralTexture; });
  477. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  478. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  479. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  480. /* harmony import */ var _cloudProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./cloudProceduralTexture.fragment */ "./cloud/cloudProceduralTexture.fragment.ts");
  481. var CloudProceduralTexture = /** @class */ (function (_super) {
  482. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](CloudProceduralTexture, _super);
  483. function CloudProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  484. var _this = _super.call(this, name, size, "cloudProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  485. _this._skyColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color4"](0.15, 0.68, 1.0, 1.0);
  486. _this._cloudColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color4"](1, 1, 1, 1.0);
  487. _this.updateShaderUniforms();
  488. return _this;
  489. }
  490. CloudProceduralTexture.prototype.updateShaderUniforms = function () {
  491. this.setColor4("skyColor", this._skyColor);
  492. this.setColor4("cloudColor", this._cloudColor);
  493. };
  494. Object.defineProperty(CloudProceduralTexture.prototype, "skyColor", {
  495. get: function () {
  496. return this._skyColor;
  497. },
  498. set: function (value) {
  499. this._skyColor = value;
  500. this.updateShaderUniforms();
  501. },
  502. enumerable: true,
  503. configurable: true
  504. });
  505. Object.defineProperty(CloudProceduralTexture.prototype, "cloudColor", {
  506. get: function () {
  507. return this._cloudColor;
  508. },
  509. set: function (value) {
  510. this._cloudColor = value;
  511. this.updateShaderUniforms();
  512. },
  513. enumerable: true,
  514. configurable: true
  515. });
  516. /**
  517. * Serializes this cloud procedural texture
  518. * @returns a serialized cloud procedural texture object
  519. */
  520. CloudProceduralTexture.prototype.serialize = function () {
  521. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  522. serializationObject.customType = "BABYLON.CloudProceduralTexture";
  523. return serializationObject;
  524. };
  525. /**
  526. * Creates a Cloud Procedural Texture from parsed cloud procedural texture data
  527. * @param parsedTexture defines parsed texture data
  528. * @param scene defines the current scene
  529. * @param rootUrl defines the root URL containing cloud procedural texture information
  530. * @returns a parsed Cloud Procedural Texture
  531. */
  532. CloudProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  533. var texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new CloudProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
  534. return texture;
  535. };
  536. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  537. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor4"])()
  538. ], CloudProceduralTexture.prototype, "skyColor", null);
  539. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  540. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor4"])()
  541. ], CloudProceduralTexture.prototype, "cloudColor", null);
  542. return CloudProceduralTexture;
  543. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  544. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.CloudProceduralTexture"] = CloudProceduralTexture;
  545. /***/ }),
  546. /***/ "./cloud/index.ts":
  547. /*!************************!*\
  548. !*** ./cloud/index.ts ***!
  549. \************************/
  550. /*! exports provided: CloudProceduralTexture */
  551. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  552. "use strict";
  553. __webpack_require__.r(__webpack_exports__);
  554. /* harmony import */ var _cloudProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cloudProceduralTexture */ "./cloud/cloudProceduralTexture.ts");
  555. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CloudProceduralTexture", function() { return _cloudProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["CloudProceduralTexture"]; });
  556. /***/ }),
  557. /***/ "./fire/fireProceduralTexture.fragment.ts":
  558. /*!************************************************!*\
  559. !*** ./fire/fireProceduralTexture.fragment.ts ***!
  560. \************************************************/
  561. /*! exports provided: fireProceduralTexturePixelShader */
  562. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  563. "use strict";
  564. __webpack_require__.r(__webpack_exports__);
  565. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fireProceduralTexturePixelShader", function() { return fireProceduralTexturePixelShader; });
  566. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  567. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  568. var name = 'fireProceduralTexturePixelShader';
  569. var shader = "precision highp float;\nuniform float time;\nuniform vec3 c1;\nuniform vec3 c2;\nuniform vec3 c3;\nuniform vec3 c4;\nuniform vec3 c5;\nuniform vec3 c6;\nuniform vec2 speed;\nuniform float shift;\nuniform float alphaThreshold;\nvarying vec2 vUV;\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat fbm(vec2 n) {\nfloat total=0.0,amplitude=1.0;\nfor (int i=0; i<4; i++) {\ntotal+=noise(n)*amplitude;\nn+=n;\namplitude*=0.5;\n}\nreturn total;\n}\nvoid main() {\nvec2 p=vUV*8.0;\nfloat q=fbm(p-time*0.1);\nvec2 r=vec2(fbm(p+q+time*speed.x-p.x-p.y),fbm(p+q-time*speed.y));\nvec3 c=mix(c1,c2,fbm(p+r))+mix(c3,c4,r.x)-mix(c5,c6,r.y);\nvec3 color=c*cos(shift*vUV.y);\nfloat luminance=dot(color.rgb,vec3(0.3,0.59,0.11));\ngl_FragColor=vec4(color,luminance*alphaThreshold+(1.0-alphaThreshold));\n}";
  570. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  571. /** @hidden */
  572. var fireProceduralTexturePixelShader = { name: name, shader: shader };
  573. /***/ }),
  574. /***/ "./fire/fireProceduralTexture.ts":
  575. /*!***************************************!*\
  576. !*** ./fire/fireProceduralTexture.ts ***!
  577. \***************************************/
  578. /*! exports provided: FireProceduralTexture */
  579. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  580. "use strict";
  581. __webpack_require__.r(__webpack_exports__);
  582. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FireProceduralTexture", function() { return FireProceduralTexture; });
  583. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  584. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  585. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  586. /* harmony import */ var _fireProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fireProceduralTexture.fragment */ "./fire/fireProceduralTexture.fragment.ts");
  587. var FireProceduralTexture = /** @class */ (function (_super) {
  588. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](FireProceduralTexture, _super);
  589. function FireProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  590. var _this = _super.call(this, name, size, "fireProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  591. _this._time = 0.0;
  592. _this._speed = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Vector2"](0.5, 0.3);
  593. _this._autoGenerateTime = true;
  594. _this._alphaThreshold = 0.5;
  595. _this._fireColors = FireProceduralTexture.RedFireColors;
  596. _this.updateShaderUniforms();
  597. return _this;
  598. }
  599. FireProceduralTexture.prototype.updateShaderUniforms = function () {
  600. this.setFloat("time", this._time);
  601. this.setVector2("speed", this._speed);
  602. this.setColor3("c1", this._fireColors[0]);
  603. this.setColor3("c2", this._fireColors[1]);
  604. this.setColor3("c3", this._fireColors[2]);
  605. this.setColor3("c4", this._fireColors[3]);
  606. this.setColor3("c5", this._fireColors[4]);
  607. this.setColor3("c6", this._fireColors[5]);
  608. this.setFloat("alphaThreshold", this._alphaThreshold);
  609. };
  610. FireProceduralTexture.prototype.render = function (useCameraPostProcess) {
  611. var scene = this.getScene();
  612. if (this._autoGenerateTime && scene) {
  613. this._time += scene.getAnimationRatio() * 0.03;
  614. this.updateShaderUniforms();
  615. }
  616. _super.prototype.render.call(this, useCameraPostProcess);
  617. };
  618. Object.defineProperty(FireProceduralTexture, "PurpleFireColors", {
  619. get: function () {
  620. return [
  621. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.5, 0.0, 1.0),
  622. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.9, 0.0, 1.0),
  623. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.2, 0.0, 1.0),
  624. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](1.0, 0.9, 1.0),
  625. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.1, 0.1, 1.0),
  626. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.9, 0.9, 1.0)
  627. ];
  628. },
  629. enumerable: true,
  630. configurable: true
  631. });
  632. Object.defineProperty(FireProceduralTexture, "GreenFireColors", {
  633. get: function () {
  634. return [
  635. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.5, 1.0, 0.0),
  636. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.5, 1.0, 0.0),
  637. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.3, 0.4, 0.0),
  638. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.5, 1.0, 0.0),
  639. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.2, 0.0, 0.0),
  640. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.5, 1.0, 0.0)
  641. ];
  642. },
  643. enumerable: true,
  644. configurable: true
  645. });
  646. Object.defineProperty(FireProceduralTexture, "RedFireColors", {
  647. get: function () {
  648. return [
  649. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.5, 0.0, 0.1),
  650. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.9, 0.0, 0.0),
  651. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.2, 0.0, 0.0),
  652. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](1.0, 0.9, 0.0),
  653. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.1, 0.1, 0.1),
  654. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.9, 0.9, 0.9)
  655. ];
  656. },
  657. enumerable: true,
  658. configurable: true
  659. });
  660. Object.defineProperty(FireProceduralTexture, "BlueFireColors", {
  661. get: function () {
  662. return [
  663. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.1, 0.0, 0.5),
  664. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.0, 0.0, 0.5),
  665. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.1, 0.0, 0.2),
  666. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.0, 0.0, 1.0),
  667. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.1, 0.2, 0.3),
  668. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.0, 0.2, 0.9)
  669. ];
  670. },
  671. enumerable: true,
  672. configurable: true
  673. });
  674. Object.defineProperty(FireProceduralTexture.prototype, "autoGenerateTime", {
  675. get: function () {
  676. return this._autoGenerateTime;
  677. },
  678. set: function (value) {
  679. this._autoGenerateTime = value;
  680. },
  681. enumerable: true,
  682. configurable: true
  683. });
  684. Object.defineProperty(FireProceduralTexture.prototype, "fireColors", {
  685. get: function () {
  686. return this._fireColors;
  687. },
  688. set: function (value) {
  689. this._fireColors = value;
  690. this.updateShaderUniforms();
  691. },
  692. enumerable: true,
  693. configurable: true
  694. });
  695. Object.defineProperty(FireProceduralTexture.prototype, "time", {
  696. get: function () {
  697. return this._time;
  698. },
  699. set: function (value) {
  700. this._time = value;
  701. this.updateShaderUniforms();
  702. },
  703. enumerable: true,
  704. configurable: true
  705. });
  706. Object.defineProperty(FireProceduralTexture.prototype, "speed", {
  707. get: function () {
  708. return this._speed;
  709. },
  710. set: function (value) {
  711. this._speed = value;
  712. this.updateShaderUniforms();
  713. },
  714. enumerable: true,
  715. configurable: true
  716. });
  717. Object.defineProperty(FireProceduralTexture.prototype, "alphaThreshold", {
  718. get: function () {
  719. return this._alphaThreshold;
  720. },
  721. set: function (value) {
  722. this._alphaThreshold = value;
  723. this.updateShaderUniforms();
  724. },
  725. enumerable: true,
  726. configurable: true
  727. });
  728. /**
  729. * Serializes this fire procedural texture
  730. * @returns a serialized fire procedural texture object
  731. */
  732. FireProceduralTexture.prototype.serialize = function () {
  733. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  734. serializationObject.customType = "BABYLON.FireProceduralTexture";
  735. serializationObject.fireColors = [];
  736. for (var i = 0; i < this._fireColors.length; i++) {
  737. serializationObject.fireColors.push(this._fireColors[i].asArray());
  738. }
  739. return serializationObject;
  740. };
  741. /**
  742. * Creates a Fire Procedural Texture from parsed fire procedural texture data
  743. * @param parsedTexture defines parsed texture data
  744. * @param scene defines the current scene
  745. * @param rootUrl defines the root URL containing fire procedural texture information
  746. * @returns a parsed Fire Procedural Texture
  747. */
  748. FireProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  749. var texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new FireProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
  750. var colors = [];
  751. for (var i = 0; i < parsedTexture.fireColors.length; i++) {
  752. colors.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"].FromArray(parsedTexture.fireColors[i]));
  753. }
  754. texture.fireColors = colors;
  755. return texture;
  756. };
  757. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  758. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  759. ], FireProceduralTexture.prototype, "autoGenerateTime", null);
  760. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  761. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  762. ], FireProceduralTexture.prototype, "time", null);
  763. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  764. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsVector2"])()
  765. ], FireProceduralTexture.prototype, "speed", null);
  766. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  767. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  768. ], FireProceduralTexture.prototype, "alphaThreshold", null);
  769. return FireProceduralTexture;
  770. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  771. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.FireProceduralTexture"] = FireProceduralTexture;
  772. /***/ }),
  773. /***/ "./fire/index.ts":
  774. /*!***********************!*\
  775. !*** ./fire/index.ts ***!
  776. \***********************/
  777. /*! exports provided: FireProceduralTexture */
  778. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  779. "use strict";
  780. __webpack_require__.r(__webpack_exports__);
  781. /* harmony import */ var _fireProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fireProceduralTexture */ "./fire/fireProceduralTexture.ts");
  782. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FireProceduralTexture", function() { return _fireProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["FireProceduralTexture"]; });
  783. /***/ }),
  784. /***/ "./grass/grassProceduralTexture.fragment.ts":
  785. /*!**************************************************!*\
  786. !*** ./grass/grassProceduralTexture.fragment.ts ***!
  787. \**************************************************/
  788. /*! exports provided: grassProceduralTexturePixelShader */
  789. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  790. "use strict";
  791. __webpack_require__.r(__webpack_exports__);
  792. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "grassProceduralTexturePixelShader", function() { return grassProceduralTexturePixelShader; });
  793. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  794. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  795. var name = 'grassProceduralTexturePixelShader';
  796. var shader = "precision highp float;\nvarying vec2 vPosition;\nvarying vec2 vUV;\nuniform vec3 herb1Color;\nuniform vec3 herb2Color;\nuniform vec3 herb3Color;\nuniform vec3 groundColor;\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat fbm(vec2 n) {\nfloat total=0.0,amplitude=1.0;\nfor (int i=0; i<4; i++) {\ntotal+=noise(n)*amplitude;\nn+=n;\namplitude*=0.5;\n}\nreturn total;\n}\nvoid main(void) {\nvec3 color=mix(groundColor,herb1Color,rand(gl_FragCoord.xy*4.0));\ncolor=mix(color,herb2Color,rand(gl_FragCoord.xy*8.0));\ncolor=mix(color,herb3Color,rand(gl_FragCoord.xy));\ncolor=mix(color,herb1Color,fbm(gl_FragCoord.xy*16.0));\ngl_FragColor=vec4(color,1.0);\n}";
  797. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  798. /** @hidden */
  799. var grassProceduralTexturePixelShader = { name: name, shader: shader };
  800. /***/ }),
  801. /***/ "./grass/grassProceduralTexture.ts":
  802. /*!*****************************************!*\
  803. !*** ./grass/grassProceduralTexture.ts ***!
  804. \*****************************************/
  805. /*! exports provided: GrassProceduralTexture */
  806. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  807. "use strict";
  808. __webpack_require__.r(__webpack_exports__);
  809. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GrassProceduralTexture", function() { return GrassProceduralTexture; });
  810. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  811. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  812. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  813. /* harmony import */ var _grassProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./grassProceduralTexture.fragment */ "./grass/grassProceduralTexture.fragment.ts");
  814. var GrassProceduralTexture = /** @class */ (function (_super) {
  815. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](GrassProceduralTexture, _super);
  816. function GrassProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  817. var _this = _super.call(this, name, size, "grassProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  818. _this._groundColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](1, 1, 1);
  819. _this._grassColors = [
  820. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.29, 0.38, 0.02),
  821. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.36, 0.49, 0.09),
  822. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.51, 0.6, 0.28)
  823. ];
  824. _this.updateShaderUniforms();
  825. return _this;
  826. }
  827. GrassProceduralTexture.prototype.updateShaderUniforms = function () {
  828. this.setColor3("herb1Color", this._grassColors[0]);
  829. this.setColor3("herb2Color", this._grassColors[1]);
  830. this.setColor3("herb3Color", this._grassColors[2]);
  831. this.setColor3("groundColor", this._groundColor);
  832. };
  833. Object.defineProperty(GrassProceduralTexture.prototype, "grassColors", {
  834. get: function () {
  835. return this._grassColors;
  836. },
  837. set: function (value) {
  838. this._grassColors = value;
  839. this.updateShaderUniforms();
  840. },
  841. enumerable: true,
  842. configurable: true
  843. });
  844. Object.defineProperty(GrassProceduralTexture.prototype, "groundColor", {
  845. get: function () {
  846. return this._groundColor;
  847. },
  848. set: function (value) {
  849. this._groundColor = value;
  850. this.updateShaderUniforms();
  851. },
  852. enumerable: true,
  853. configurable: true
  854. });
  855. /**
  856. * Serializes this grass procedural texture
  857. * @returns a serialized grass procedural texture object
  858. */
  859. GrassProceduralTexture.prototype.serialize = function () {
  860. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  861. serializationObject.customType = "BABYLON.GrassProceduralTexture";
  862. serializationObject.grassColors = [];
  863. for (var i = 0; i < this._grassColors.length; i++) {
  864. serializationObject.grassColors.push(this._grassColors[i].asArray());
  865. }
  866. return serializationObject;
  867. };
  868. /**
  869. * Creates a Grass Procedural Texture from parsed grass procedural texture data
  870. * @param parsedTexture defines parsed texture data
  871. * @param scene defines the current scene
  872. * @param rootUrl defines the root URL containing grass procedural texture information
  873. * @returns a parsed Grass Procedural Texture
  874. */
  875. GrassProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  876. var texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new GrassProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
  877. var colors = [];
  878. for (var i = 0; i < parsedTexture.grassColors.length; i++) {
  879. colors.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"].FromArray(parsedTexture.grassColors[i]));
  880. }
  881. texture.grassColors = colors;
  882. return texture;
  883. };
  884. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  885. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  886. ], GrassProceduralTexture.prototype, "groundColor", null);
  887. return GrassProceduralTexture;
  888. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  889. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.GrassProceduralTexture"] = GrassProceduralTexture;
  890. /***/ }),
  891. /***/ "./grass/index.ts":
  892. /*!************************!*\
  893. !*** ./grass/index.ts ***!
  894. \************************/
  895. /*! exports provided: GrassProceduralTexture */
  896. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  897. "use strict";
  898. __webpack_require__.r(__webpack_exports__);
  899. /* harmony import */ var _grassProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./grassProceduralTexture */ "./grass/grassProceduralTexture.ts");
  900. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GrassProceduralTexture", function() { return _grassProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["GrassProceduralTexture"]; });
  901. /***/ }),
  902. /***/ "./index.ts":
  903. /*!******************!*\
  904. !*** ./index.ts ***!
  905. \******************/
  906. /*! exports provided: BrickProceduralTexture, CloudProceduralTexture, FireProceduralTexture, GrassProceduralTexture, MarbleProceduralTexture, NormalMapProceduralTexture, PerlinNoiseProceduralTexture, RoadProceduralTexture, StarfieldProceduralTexture, WoodProceduralTexture */
  907. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  908. "use strict";
  909. __webpack_require__.r(__webpack_exports__);
  910. /* harmony import */ var _brick__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./brick */ "./brick/index.ts");
  911. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BrickProceduralTexture", function() { return _brick__WEBPACK_IMPORTED_MODULE_0__["BrickProceduralTexture"]; });
  912. /* harmony import */ var _cloud__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cloud */ "./cloud/index.ts");
  913. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CloudProceduralTexture", function() { return _cloud__WEBPACK_IMPORTED_MODULE_1__["CloudProceduralTexture"]; });
  914. /* harmony import */ var _fire__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fire */ "./fire/index.ts");
  915. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FireProceduralTexture", function() { return _fire__WEBPACK_IMPORTED_MODULE_2__["FireProceduralTexture"]; });
  916. /* harmony import */ var _grass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./grass */ "./grass/index.ts");
  917. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GrassProceduralTexture", function() { return _grass__WEBPACK_IMPORTED_MODULE_3__["GrassProceduralTexture"]; });
  918. /* harmony import */ var _marble__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./marble */ "./marble/index.ts");
  919. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MarbleProceduralTexture", function() { return _marble__WEBPACK_IMPORTED_MODULE_4__["MarbleProceduralTexture"]; });
  920. /* harmony import */ var _normalMap__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./normalMap */ "./normalMap/index.ts");
  921. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NormalMapProceduralTexture", function() { return _normalMap__WEBPACK_IMPORTED_MODULE_5__["NormalMapProceduralTexture"]; });
  922. /* harmony import */ var _perlinNoise__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./perlinNoise */ "./perlinNoise/index.ts");
  923. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PerlinNoiseProceduralTexture", function() { return _perlinNoise__WEBPACK_IMPORTED_MODULE_6__["PerlinNoiseProceduralTexture"]; });
  924. /* harmony import */ var _road__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./road */ "./road/index.ts");
  925. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RoadProceduralTexture", function() { return _road__WEBPACK_IMPORTED_MODULE_7__["RoadProceduralTexture"]; });
  926. /* harmony import */ var _starfield__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./starfield */ "./starfield/index.ts");
  927. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StarfieldProceduralTexture", function() { return _starfield__WEBPACK_IMPORTED_MODULE_8__["StarfieldProceduralTexture"]; });
  928. /* harmony import */ var _wood__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./wood */ "./wood/index.ts");
  929. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WoodProceduralTexture", function() { return _wood__WEBPACK_IMPORTED_MODULE_9__["WoodProceduralTexture"]; });
  930. /***/ }),
  931. /***/ "./legacy/legacy.ts":
  932. /*!**************************!*\
  933. !*** ./legacy/legacy.ts ***!
  934. \**************************/
  935. /*! exports provided: BrickProceduralTexture, CloudProceduralTexture, FireProceduralTexture, GrassProceduralTexture, MarbleProceduralTexture, NormalMapProceduralTexture, PerlinNoiseProceduralTexture, RoadProceduralTexture, StarfieldProceduralTexture, WoodProceduralTexture */
  936. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  937. "use strict";
  938. __webpack_require__.r(__webpack_exports__);
  939. /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../index */ "./index.ts");
  940. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BrickProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["BrickProceduralTexture"]; });
  941. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CloudProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["CloudProceduralTexture"]; });
  942. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FireProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["FireProceduralTexture"]; });
  943. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GrassProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["GrassProceduralTexture"]; });
  944. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MarbleProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["MarbleProceduralTexture"]; });
  945. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NormalMapProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["NormalMapProceduralTexture"]; });
  946. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PerlinNoiseProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["PerlinNoiseProceduralTexture"]; });
  947. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RoadProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["RoadProceduralTexture"]; });
  948. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StarfieldProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["StarfieldProceduralTexture"]; });
  949. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WoodProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["WoodProceduralTexture"]; });
  950. /**
  951. * Legacy support, defining window.BABYLON.GridMaterial... (global variable).
  952. *
  953. * This is the entry point for the UMD module.
  954. * The entry point for a future ESM package should be index.ts
  955. */
  956. var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
  957. if (typeof globalObject !== "undefined") {
  958. globalObject.BABYLON = globalObject.BABYLON || {};
  959. for (var mat in _index__WEBPACK_IMPORTED_MODULE_0__) {
  960. globalObject.BABYLON[mat] = _index__WEBPACK_IMPORTED_MODULE_0__[mat];
  961. }
  962. }
  963. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js")))
  964. /***/ }),
  965. /***/ "./marble/index.ts":
  966. /*!*************************!*\
  967. !*** ./marble/index.ts ***!
  968. \*************************/
  969. /*! exports provided: MarbleProceduralTexture */
  970. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  971. "use strict";
  972. __webpack_require__.r(__webpack_exports__);
  973. /* harmony import */ var _marbleProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./marbleProceduralTexture */ "./marble/marbleProceduralTexture.ts");
  974. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MarbleProceduralTexture", function() { return _marbleProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["MarbleProceduralTexture"]; });
  975. /***/ }),
  976. /***/ "./marble/marbleProceduralTexture.fragment.ts":
  977. /*!****************************************************!*\
  978. !*** ./marble/marbleProceduralTexture.fragment.ts ***!
  979. \****************************************************/
  980. /*! exports provided: marbleProceduralTexturePixelShader */
  981. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  982. "use strict";
  983. __webpack_require__.r(__webpack_exports__);
  984. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "marbleProceduralTexturePixelShader", function() { return marbleProceduralTexturePixelShader; });
  985. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  986. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  987. var name = 'marbleProceduralTexturePixelShader';
  988. var shader = "precision highp float;\nvarying vec2 vPosition;\nvarying vec2 vUV;\nuniform float numberOfTilesHeight;\nuniform float numberOfTilesWidth;\nuniform float amplitude;\nuniform vec3 marbleColor;\nuniform vec3 jointColor;\nconst vec3 tileSize=vec3(1.1,1.0,1.1);\nconst vec3 tilePct=vec3(0.98,1.0,0.98);\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat turbulence(vec2 P)\n{\nfloat val=0.0;\nfloat freq=1.0;\nfor (int i=0; i<4; i++)\n{\nval+=abs(noise(P*freq)/freq);\nfreq*=2.07;\n}\nreturn val;\n}\nfloat roundF(float number){\nreturn sign(number)*floor(abs(number)+0.5);\n}\nvec3 marble_color(float x)\n{\nvec3 col;\nx=0.5*(x+1.);\nx=sqrt(x);\nx=sqrt(x);\nx=sqrt(x);\ncol=vec3(.2+.75*x);\ncol.b*=0.95;\nreturn col;\n}\nvoid main()\n{\nfloat brickW=1.0/numberOfTilesWidth;\nfloat brickH=1.0/numberOfTilesHeight;\nfloat jointWPercentage=0.01;\nfloat jointHPercentage=0.01;\nvec3 color=marbleColor;\nfloat yi=vUV.y/brickH;\nfloat nyi=roundF(yi);\nfloat xi=vUV.x/brickW;\nif (mod(floor(yi),2.0) == 0.0){\nxi=xi-0.5;\n}\nfloat nxi=roundF(xi);\nvec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/brickW);\nif (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){\ncolor=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);\n}\nelse if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){\ncolor=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);\n}\nelse {\nfloat t=6.28*brickvUV.x/(tileSize.x+noise(vec2(vUV)*6.0));\nt+=amplitude*turbulence(brickvUV.xy);\nt=sin(t);\ncolor=marble_color(t);\n}\ngl_FragColor=vec4(color,0.0);\n}";
  989. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  990. /** @hidden */
  991. var marbleProceduralTexturePixelShader = { name: name, shader: shader };
  992. /***/ }),
  993. /***/ "./marble/marbleProceduralTexture.ts":
  994. /*!*******************************************!*\
  995. !*** ./marble/marbleProceduralTexture.ts ***!
  996. \*******************************************/
  997. /*! exports provided: MarbleProceduralTexture */
  998. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  999. "use strict";
  1000. __webpack_require__.r(__webpack_exports__);
  1001. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarbleProceduralTexture", function() { return MarbleProceduralTexture; });
  1002. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  1003. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  1004. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  1005. /* harmony import */ var _marbleProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./marbleProceduralTexture.fragment */ "./marble/marbleProceduralTexture.fragment.ts");
  1006. var MarbleProceduralTexture = /** @class */ (function (_super) {
  1007. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](MarbleProceduralTexture, _super);
  1008. function MarbleProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  1009. var _this = _super.call(this, name, size, "marbleProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  1010. _this._numberOfTilesHeight = 3;
  1011. _this._numberOfTilesWidth = 3;
  1012. _this._amplitude = 9.0;
  1013. _this._jointColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.72, 0.72, 0.72);
  1014. _this.updateShaderUniforms();
  1015. return _this;
  1016. }
  1017. MarbleProceduralTexture.prototype.updateShaderUniforms = function () {
  1018. this.setFloat("numberOfTilesHeight", this._numberOfTilesHeight);
  1019. this.setFloat("numberOfTilesWidth", this._numberOfTilesWidth);
  1020. this.setFloat("amplitude", this._amplitude);
  1021. this.setColor3("jointColor", this._jointColor);
  1022. };
  1023. Object.defineProperty(MarbleProceduralTexture.prototype, "numberOfTilesHeight", {
  1024. get: function () {
  1025. return this._numberOfTilesHeight;
  1026. },
  1027. set: function (value) {
  1028. this._numberOfTilesHeight = value;
  1029. this.updateShaderUniforms();
  1030. },
  1031. enumerable: true,
  1032. configurable: true
  1033. });
  1034. Object.defineProperty(MarbleProceduralTexture.prototype, "amplitude", {
  1035. get: function () {
  1036. return this._amplitude;
  1037. },
  1038. set: function (value) {
  1039. this._amplitude = value;
  1040. this.updateShaderUniforms();
  1041. },
  1042. enumerable: true,
  1043. configurable: true
  1044. });
  1045. Object.defineProperty(MarbleProceduralTexture.prototype, "numberOfTilesWidth", {
  1046. get: function () {
  1047. return this._numberOfTilesWidth;
  1048. },
  1049. set: function (value) {
  1050. this._numberOfTilesWidth = value;
  1051. this.updateShaderUniforms();
  1052. },
  1053. enumerable: true,
  1054. configurable: true
  1055. });
  1056. Object.defineProperty(MarbleProceduralTexture.prototype, "jointColor", {
  1057. get: function () {
  1058. return this._jointColor;
  1059. },
  1060. set: function (value) {
  1061. this._jointColor = value;
  1062. this.updateShaderUniforms();
  1063. },
  1064. enumerable: true,
  1065. configurable: true
  1066. });
  1067. /**
  1068. * Serializes this marble procedural texture
  1069. * @returns a serialized marble procedural texture object
  1070. */
  1071. MarbleProceduralTexture.prototype.serialize = function () {
  1072. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  1073. serializationObject.customType = "BABYLON.MarbleProceduralTexture";
  1074. return serializationObject;
  1075. };
  1076. /**
  1077. * Creates a Marble Procedural Texture from parsed marble procedural texture data
  1078. * @param parsedTexture defines parsed texture data
  1079. * @param scene defines the current scene
  1080. * @param rootUrl defines the root URL containing marble procedural texture information
  1081. * @returns a parsed Marble Procedural Texture
  1082. */
  1083. MarbleProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  1084. var texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new MarbleProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
  1085. return texture;
  1086. };
  1087. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1088. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1089. ], MarbleProceduralTexture.prototype, "numberOfTilesHeight", null);
  1090. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1091. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1092. ], MarbleProceduralTexture.prototype, "amplitude", null);
  1093. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1094. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1095. ], MarbleProceduralTexture.prototype, "numberOfTilesWidth", null);
  1096. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1097. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1098. ], MarbleProceduralTexture.prototype, "jointColor", null);
  1099. return MarbleProceduralTexture;
  1100. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  1101. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.MarbleProceduralTexture"] = MarbleProceduralTexture;
  1102. /***/ }),
  1103. /***/ "./normalMap/index.ts":
  1104. /*!****************************!*\
  1105. !*** ./normalMap/index.ts ***!
  1106. \****************************/
  1107. /*! exports provided: NormalMapProceduralTexture */
  1108. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1109. "use strict";
  1110. __webpack_require__.r(__webpack_exports__);
  1111. /* harmony import */ var _normalMapProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./normalMapProceduralTexture */ "./normalMap/normalMapProceduralTexture.ts");
  1112. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NormalMapProceduralTexture", function() { return _normalMapProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["NormalMapProceduralTexture"]; });
  1113. /***/ }),
  1114. /***/ "./normalMap/normalMapProceduralTexture.fragment.ts":
  1115. /*!**********************************************************!*\
  1116. !*** ./normalMap/normalMapProceduralTexture.fragment.ts ***!
  1117. \**********************************************************/
  1118. /*! exports provided: normalMapProceduralTexturePixelShader */
  1119. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1120. "use strict";
  1121. __webpack_require__.r(__webpack_exports__);
  1122. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalMapProceduralTexturePixelShader", function() { return normalMapProceduralTexturePixelShader; });
  1123. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  1124. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  1125. var name = 'normalMapProceduralTexturePixelShader';
  1126. var shader = "precision highp float;\n\nuniform sampler2D baseSampler;\nuniform float size;\n\nvarying vec2 vUV;\n\nconst vec3 LUMA_COEFFICIENT=vec3(0.2126,0.7152,0.0722);\nfloat lumaAtCoord(vec2 coord)\n{\nvec3 pixel=texture2D(baseSampler,coord).rgb;\nfloat luma=dot(pixel,LUMA_COEFFICIENT);\nreturn luma;\n}\nvoid main()\n{\nfloat lumaU0=lumaAtCoord(vUV+vec2(-1.0,0.0)/size);\nfloat lumaU1=lumaAtCoord(vUV+vec2( 1.0,0.0)/size);\nfloat lumaV0=lumaAtCoord(vUV+vec2( 0.0,-1.0)/size);\nfloat lumaV1=lumaAtCoord(vUV+vec2( 0.0,1.0)/size);\nvec2 slope=(vec2(lumaU0-lumaU1,lumaV0-lumaV1)+1.0)*0.5;\ngl_FragColor=vec4(slope,1.0,1.0);\n}\n";
  1127. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  1128. /** @hidden */
  1129. var normalMapProceduralTexturePixelShader = { name: name, shader: shader };
  1130. /***/ }),
  1131. /***/ "./normalMap/normalMapProceduralTexture.ts":
  1132. /*!*************************************************!*\
  1133. !*** ./normalMap/normalMapProceduralTexture.ts ***!
  1134. \*************************************************/
  1135. /*! exports provided: NormalMapProceduralTexture */
  1136. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1137. "use strict";
  1138. __webpack_require__.r(__webpack_exports__);
  1139. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NormalMapProceduralTexture", function() { return NormalMapProceduralTexture; });
  1140. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  1141. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  1142. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  1143. /* harmony import */ var _normalMapProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./normalMapProceduralTexture.fragment */ "./normalMap/normalMapProceduralTexture.fragment.ts");
  1144. var NormalMapProceduralTexture = /** @class */ (function (_super) {
  1145. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](NormalMapProceduralTexture, _super);
  1146. function NormalMapProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  1147. var _this = _super.call(this, name, size, "normalMapProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  1148. _this.updateShaderUniforms();
  1149. return _this;
  1150. }
  1151. NormalMapProceduralTexture.prototype.updateShaderUniforms = function () {
  1152. this.setTexture("baseSampler", this._baseTexture);
  1153. this.setFloat("size", this.getRenderSize());
  1154. };
  1155. NormalMapProceduralTexture.prototype.render = function (useCameraPostProcess) {
  1156. _super.prototype.render.call(this, useCameraPostProcess);
  1157. };
  1158. NormalMapProceduralTexture.prototype.resize = function (size, generateMipMaps) {
  1159. _super.prototype.resize.call(this, size, generateMipMaps);
  1160. // We need to update the "size" uniform
  1161. this.updateShaderUniforms();
  1162. };
  1163. Object.defineProperty(NormalMapProceduralTexture.prototype, "baseTexture", {
  1164. get: function () {
  1165. return this._baseTexture;
  1166. },
  1167. set: function (texture) {
  1168. this._baseTexture = texture;
  1169. this.updateShaderUniforms();
  1170. },
  1171. enumerable: true,
  1172. configurable: true
  1173. });
  1174. /**
  1175. * Serializes this normal map procedural texture
  1176. * @returns a serialized normal map procedural texture object
  1177. */
  1178. NormalMapProceduralTexture.prototype.serialize = function () {
  1179. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  1180. serializationObject.customType = "BABYLON.NormalMapProceduralTexture";
  1181. return serializationObject;
  1182. };
  1183. /**
  1184. * Creates a Normal Map Procedural Texture from parsed normal map procedural texture data
  1185. * @param parsedTexture defines parsed texture data
  1186. * @param scene defines the current scene
  1187. * @param rootUrl defines the root URL containing normal map procedural texture information
  1188. * @returns a parsed Normal Map Procedural Texture
  1189. */
  1190. NormalMapProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  1191. var texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new NormalMapProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
  1192. return texture;
  1193. };
  1194. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1195. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsTexture"])()
  1196. ], NormalMapProceduralTexture.prototype, "baseTexture", null);
  1197. return NormalMapProceduralTexture;
  1198. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  1199. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.NormalMapProceduralTexture"] = NormalMapProceduralTexture;
  1200. /***/ }),
  1201. /***/ "./perlinNoise/index.ts":
  1202. /*!******************************!*\
  1203. !*** ./perlinNoise/index.ts ***!
  1204. \******************************/
  1205. /*! exports provided: PerlinNoiseProceduralTexture */
  1206. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1207. "use strict";
  1208. __webpack_require__.r(__webpack_exports__);
  1209. /* harmony import */ var _perlinNoiseProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./perlinNoiseProceduralTexture */ "./perlinNoise/perlinNoiseProceduralTexture.ts");
  1210. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PerlinNoiseProceduralTexture", function() { return _perlinNoiseProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["PerlinNoiseProceduralTexture"]; });
  1211. /***/ }),
  1212. /***/ "./perlinNoise/perlinNoiseProceduralTexture.fragment.ts":
  1213. /*!**************************************************************!*\
  1214. !*** ./perlinNoise/perlinNoiseProceduralTexture.fragment.ts ***!
  1215. \**************************************************************/
  1216. /*! exports provided: perlinNoiseProceduralTexturePixelShader */
  1217. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1218. "use strict";
  1219. __webpack_require__.r(__webpack_exports__);
  1220. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "perlinNoiseProceduralTexturePixelShader", function() { return perlinNoiseProceduralTexturePixelShader; });
  1221. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  1222. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  1223. var name = 'perlinNoiseProceduralTexturePixelShader';
  1224. var shader = "\nprecision highp float;\n\nuniform float size;\nuniform float time;\nuniform float translationSpeed;\n\nvarying vec2 vUV;\n\nfloat r(float n)\n{\nreturn fract(cos(n*89.42)*343.42);\n}\nvec2 r(vec2 n)\n{\nreturn vec2(r(n.x*23.62-300.0+n.y*34.35),r(n.x*45.13+256.0+n.y*38.89));\n}\nfloat worley(vec2 n,float s)\n{\nfloat dis=1.0;\nfor(int x=-1; x<=1; x++)\n{\nfor(int y=-1; y<=1; y++)\n{\nvec2 p=floor(n/s)+vec2(x,y);\nfloat d=length(r(p)+vec2(x,y)-fract(n/s));\nif (dis>d)\ndis=d;\n}\n}\nreturn 1.0-dis;\n}\nvec3 hash33(vec3 p3)\n{\np3=fract(p3*vec3(0.1031,0.11369,0.13787));\np3+=dot(p3,p3.yxz+19.19);\nreturn -1.0+2.0*fract(vec3((p3.x+p3.y)*p3.z,(p3.x+p3.z)*p3.y,(p3.y+p3.z)*p3.x));\n}\nfloat perlinNoise(vec3 p)\n{\nvec3 pi=floor(p);\nvec3 pf=p-pi;\nvec3 w=pf*pf*(3.0-2.0*pf);\nreturn mix(\nmix(\nmix(\ndot(pf-vec3(0,0,0),hash33(pi+vec3(0,0,0))),\ndot(pf-vec3(1,0,0),hash33(pi+vec3(1,0,0))),\nw.x\n),\nmix(\ndot(pf-vec3(0,0,1),hash33(pi+vec3(0,0,1))),\ndot(pf-vec3(1,0,1),hash33(pi+vec3(1,0,1))),\nw.x\n),\nw.z\n),\nmix(\nmix(\ndot(pf-vec3(0,1,0),hash33(pi+vec3(0,1,0))),\ndot(pf-vec3(1,1,0),hash33(pi+vec3(1,1,0))),\nw.x\n),\nmix(\ndot(pf-vec3(0,1,1),hash33(pi+vec3(0,1,1))),\ndot(pf-vec3(1,1,1),hash33(pi+vec3(1,1,1))),\nw.x\n),\nw.z\n),\nw.y\n);\n}\n\nvoid main(void)\n{\nvec2 uv=gl_FragCoord.xy+translationSpeed;\nfloat dis=(\n1.0+perlinNoise(vec3(uv/vec2(size,size),time*0.05)*8.0))\n*(1.0+(worley(uv,32.0)+ 0.5*worley(2.0*uv,32.0)+0.25*worley(4.0*uv,32.0))\n);\ngl_FragColor=vec4(vec3(dis/4.0),1.0);\n}\n";
  1225. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  1226. /** @hidden */
  1227. var perlinNoiseProceduralTexturePixelShader = { name: name, shader: shader };
  1228. /***/ }),
  1229. /***/ "./perlinNoise/perlinNoiseProceduralTexture.ts":
  1230. /*!*****************************************************!*\
  1231. !*** ./perlinNoise/perlinNoiseProceduralTexture.ts ***!
  1232. \*****************************************************/
  1233. /*! exports provided: PerlinNoiseProceduralTexture */
  1234. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1235. "use strict";
  1236. __webpack_require__.r(__webpack_exports__);
  1237. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PerlinNoiseProceduralTexture", function() { return PerlinNoiseProceduralTexture; });
  1238. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  1239. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  1240. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  1241. /* harmony import */ var _perlinNoiseProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./perlinNoiseProceduralTexture.fragment */ "./perlinNoise/perlinNoiseProceduralTexture.fragment.ts");
  1242. var PerlinNoiseProceduralTexture = /** @class */ (function (_super) {
  1243. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](PerlinNoiseProceduralTexture, _super);
  1244. function PerlinNoiseProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  1245. var _this = _super.call(this, name, size, "perlinNoiseProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  1246. _this.time = 0.0;
  1247. _this.timeScale = 1.0;
  1248. _this.translationSpeed = 1.0;
  1249. _this._currentTranslation = 0;
  1250. _this.updateShaderUniforms();
  1251. return _this;
  1252. }
  1253. PerlinNoiseProceduralTexture.prototype.updateShaderUniforms = function () {
  1254. this.setFloat("size", this.getRenderSize());
  1255. var scene = this.getScene();
  1256. if (!scene) {
  1257. return;
  1258. }
  1259. var deltaTime = scene.getEngine().getDeltaTime();
  1260. this.time += deltaTime;
  1261. this.setFloat("time", this.time * this.timeScale / 1000);
  1262. this._currentTranslation += deltaTime * this.translationSpeed / 1000.0;
  1263. this.setFloat("translationSpeed", this._currentTranslation);
  1264. };
  1265. PerlinNoiseProceduralTexture.prototype.render = function (useCameraPostProcess) {
  1266. this.updateShaderUniforms();
  1267. _super.prototype.render.call(this, useCameraPostProcess);
  1268. };
  1269. PerlinNoiseProceduralTexture.prototype.resize = function (size, generateMipMaps) {
  1270. _super.prototype.resize.call(this, size, generateMipMaps);
  1271. };
  1272. /**
  1273. * Serializes this perlin noise procedural texture
  1274. * @returns a serialized perlin noise procedural texture object
  1275. */
  1276. PerlinNoiseProceduralTexture.prototype.serialize = function () {
  1277. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  1278. serializationObject.customType = "BABYLON.PerlinNoiseProceduralTexture";
  1279. return serializationObject;
  1280. };
  1281. /**
  1282. * Creates a Perlin Noise Procedural Texture from parsed perlin noise procedural texture data
  1283. * @param parsedTexture defines parsed texture data
  1284. * @param scene defines the current scene
  1285. * @param rootUrl defines the root URL containing perlin noise procedural texture information
  1286. * @returns a parsed Perlin Noise Procedural Texture
  1287. */
  1288. PerlinNoiseProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  1289. var texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new PerlinNoiseProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
  1290. return texture;
  1291. };
  1292. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1293. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1294. ], PerlinNoiseProceduralTexture.prototype, "time", void 0);
  1295. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1296. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1297. ], PerlinNoiseProceduralTexture.prototype, "timeScale", void 0);
  1298. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1299. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1300. ], PerlinNoiseProceduralTexture.prototype, "translationSpeed", void 0);
  1301. return PerlinNoiseProceduralTexture;
  1302. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  1303. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.PerlinNoiseProceduralTexture"] = PerlinNoiseProceduralTexture;
  1304. /***/ }),
  1305. /***/ "./road/index.ts":
  1306. /*!***********************!*\
  1307. !*** ./road/index.ts ***!
  1308. \***********************/
  1309. /*! exports provided: RoadProceduralTexture */
  1310. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1311. "use strict";
  1312. __webpack_require__.r(__webpack_exports__);
  1313. /* harmony import */ var _roadProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./roadProceduralTexture */ "./road/roadProceduralTexture.ts");
  1314. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RoadProceduralTexture", function() { return _roadProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["RoadProceduralTexture"]; });
  1315. /***/ }),
  1316. /***/ "./road/roadProceduralTexture.fragment.ts":
  1317. /*!************************************************!*\
  1318. !*** ./road/roadProceduralTexture.fragment.ts ***!
  1319. \************************************************/
  1320. /*! exports provided: roadProceduralTexturePixelShader */
  1321. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1322. "use strict";
  1323. __webpack_require__.r(__webpack_exports__);
  1324. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "roadProceduralTexturePixelShader", function() { return roadProceduralTexturePixelShader; });
  1325. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  1326. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  1327. var name = 'roadProceduralTexturePixelShader';
  1328. var shader = "precision highp float;\nvarying vec2 vUV;\nuniform vec3 roadColor;\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat fbm(vec2 n) {\nfloat total=0.0,amplitude=1.0;\nfor (int i=0; i<4; i++) {\ntotal+=noise(n)*amplitude;\nn+=n;\namplitude*=0.5;\n}\nreturn total;\n}\nvoid main(void) {\nfloat ratioy=mod(gl_FragCoord.y*100.0 ,fbm(vUV*2.0));\nvec3 color=roadColor*ratioy;\ngl_FragColor=vec4(color,1.0);\n}";
  1329. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  1330. /** @hidden */
  1331. var roadProceduralTexturePixelShader = { name: name, shader: shader };
  1332. /***/ }),
  1333. /***/ "./road/roadProceduralTexture.ts":
  1334. /*!***************************************!*\
  1335. !*** ./road/roadProceduralTexture.ts ***!
  1336. \***************************************/
  1337. /*! exports provided: RoadProceduralTexture */
  1338. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1339. "use strict";
  1340. __webpack_require__.r(__webpack_exports__);
  1341. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RoadProceduralTexture", function() { return RoadProceduralTexture; });
  1342. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  1343. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  1344. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  1345. /* harmony import */ var _roadProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./roadProceduralTexture.fragment */ "./road/roadProceduralTexture.fragment.ts");
  1346. var RoadProceduralTexture = /** @class */ (function (_super) {
  1347. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](RoadProceduralTexture, _super);
  1348. function RoadProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  1349. var _this = _super.call(this, name, size, "roadProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  1350. _this._roadColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.53, 0.53, 0.53);
  1351. _this.updateShaderUniforms();
  1352. return _this;
  1353. }
  1354. RoadProceduralTexture.prototype.updateShaderUniforms = function () {
  1355. this.setColor3("roadColor", this._roadColor);
  1356. };
  1357. Object.defineProperty(RoadProceduralTexture.prototype, "roadColor", {
  1358. get: function () {
  1359. return this._roadColor;
  1360. },
  1361. set: function (value) {
  1362. this._roadColor = value;
  1363. this.updateShaderUniforms();
  1364. },
  1365. enumerable: true,
  1366. configurable: true
  1367. });
  1368. /**
  1369. * Serializes this road procedural texture
  1370. * @returns a serialized road procedural texture object
  1371. */
  1372. RoadProceduralTexture.prototype.serialize = function () {
  1373. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  1374. serializationObject.customType = "BABYLON.RoadProceduralTexture";
  1375. return serializationObject;
  1376. };
  1377. /**
  1378. * Creates a Road Procedural Texture from parsed road procedural texture data
  1379. * @param parsedTexture defines parsed texture data
  1380. * @param scene defines the current scene
  1381. * @param rootUrl defines the root URL containing road procedural texture information
  1382. * @returns a parsed Road Procedural Texture
  1383. */
  1384. RoadProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  1385. var texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new RoadProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
  1386. return texture;
  1387. };
  1388. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1389. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  1390. ], RoadProceduralTexture.prototype, "roadColor", null);
  1391. return RoadProceduralTexture;
  1392. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  1393. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.RoadProceduralTexture"] = RoadProceduralTexture;
  1394. /***/ }),
  1395. /***/ "./starfield/index.ts":
  1396. /*!****************************!*\
  1397. !*** ./starfield/index.ts ***!
  1398. \****************************/
  1399. /*! exports provided: StarfieldProceduralTexture */
  1400. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1401. "use strict";
  1402. __webpack_require__.r(__webpack_exports__);
  1403. /* harmony import */ var _starfieldProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./starfieldProceduralTexture */ "./starfield/starfieldProceduralTexture.ts");
  1404. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StarfieldProceduralTexture", function() { return _starfieldProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["StarfieldProceduralTexture"]; });
  1405. /***/ }),
  1406. /***/ "./starfield/starfieldProceduralTexture.fragment.ts":
  1407. /*!**********************************************************!*\
  1408. !*** ./starfield/starfieldProceduralTexture.fragment.ts ***!
  1409. \**********************************************************/
  1410. /*! exports provided: starfieldProceduralTexturePixelShader */
  1411. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1412. "use strict";
  1413. __webpack_require__.r(__webpack_exports__);
  1414. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "starfieldProceduralTexturePixelShader", function() { return starfieldProceduralTexturePixelShader; });
  1415. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  1416. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  1417. var name = 'starfieldProceduralTexturePixelShader';
  1418. var shader = "precision highp float;\n\n#define volsteps 20\n#define iterations 15\nvarying vec2 vPosition;\nvarying vec2 vUV;\nuniform float time;\nuniform float alpha;\nuniform float beta;\nuniform float zoom;\nuniform float formuparam;\nuniform float stepsize;\nuniform float tile;\nuniform float brightness;\nuniform float darkmatter;\nuniform float distfading;\nuniform float saturation;\nvoid main()\n{\nvec3 dir=vec3(vUV*zoom,1.);\nfloat localTime=time*0.0001;\n\nmat2 rot1=mat2(cos(alpha),sin(alpha),-sin(alpha),cos(alpha));\nmat2 rot2=mat2(cos(beta),sin(beta),-sin(beta),cos(beta));\ndir.xz*=rot1;\ndir.xy*=rot2;\nvec3 from=vec3(1.,.5,0.5);\nfrom+=vec3(-2.,localTime*2.,localTime);\nfrom.xz*=rot1;\nfrom.xy*=rot2;\n\nfloat s=0.1,fade=1.;\nvec3 v=vec3(0.);\nfor (int r=0; r<volsteps; r++) {\nvec3 p=from+s*dir*.5;\np=abs(vec3(tile)-mod(p,vec3(tile*2.)));\nfloat pa,a=pa=0.;\nfor (int i=0; i<iterations; i++) {\np=abs(p)/dot(p,p)-formuparam;\na+=abs(length(p)-pa);\npa=length(p);\n}\nfloat dm=max(0.,darkmatter-a*a*.001);\na*=a*a;\nif (r>6) fade*=1.-dm;\n\nv+=fade;\nv+=vec3(s,s*s,s*s*s*s)*a*brightness*fade;\nfade*=distfading;\ns+=stepsize;\n}\nv=mix(vec3(length(v)),v,saturation);\ngl_FragColor=vec4(v*.01,1.);\n}";
  1419. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  1420. /** @hidden */
  1421. var starfieldProceduralTexturePixelShader = { name: name, shader: shader };
  1422. /***/ }),
  1423. /***/ "./starfield/starfieldProceduralTexture.ts":
  1424. /*!*************************************************!*\
  1425. !*** ./starfield/starfieldProceduralTexture.ts ***!
  1426. \*************************************************/
  1427. /*! exports provided: StarfieldProceduralTexture */
  1428. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1429. "use strict";
  1430. __webpack_require__.r(__webpack_exports__);
  1431. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StarfieldProceduralTexture", function() { return StarfieldProceduralTexture; });
  1432. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  1433. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  1434. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  1435. /* harmony import */ var _starfieldProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./starfieldProceduralTexture.fragment */ "./starfield/starfieldProceduralTexture.fragment.ts");
  1436. var StarfieldProceduralTexture = /** @class */ (function (_super) {
  1437. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](StarfieldProceduralTexture, _super);
  1438. function StarfieldProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  1439. var _this = _super.call(this, name, size, "starfieldProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  1440. _this._time = 1;
  1441. _this._alpha = 0.5;
  1442. _this._beta = 0.8;
  1443. _this._zoom = 0.8;
  1444. _this._formuparam = 0.53;
  1445. _this._stepsize = 0.1;
  1446. _this._tile = 0.850;
  1447. _this._brightness = 0.0015;
  1448. _this._darkmatter = 0.400;
  1449. _this._distfading = 0.730;
  1450. _this._saturation = 0.850;
  1451. _this.updateShaderUniforms();
  1452. return _this;
  1453. }
  1454. StarfieldProceduralTexture.prototype.updateShaderUniforms = function () {
  1455. this.setFloat("time", this._time);
  1456. this.setFloat("alpha", this._alpha);
  1457. this.setFloat("beta", this._beta);
  1458. this.setFloat("zoom", this._zoom);
  1459. this.setFloat("formuparam", this._formuparam);
  1460. this.setFloat("stepsize", this._stepsize);
  1461. this.setFloat("tile", this._tile);
  1462. this.setFloat("brightness", this._brightness);
  1463. this.setFloat("darkmatter", this._darkmatter);
  1464. this.setFloat("distfading", this._distfading);
  1465. this.setFloat("saturation", this._saturation);
  1466. };
  1467. Object.defineProperty(StarfieldProceduralTexture.prototype, "time", {
  1468. get: function () {
  1469. return this._time;
  1470. },
  1471. set: function (value) {
  1472. this._time = value;
  1473. this.updateShaderUniforms();
  1474. },
  1475. enumerable: true,
  1476. configurable: true
  1477. });
  1478. Object.defineProperty(StarfieldProceduralTexture.prototype, "alpha", {
  1479. get: function () {
  1480. return this._alpha;
  1481. },
  1482. set: function (value) {
  1483. this._alpha = value;
  1484. this.updateShaderUniforms();
  1485. },
  1486. enumerable: true,
  1487. configurable: true
  1488. });
  1489. Object.defineProperty(StarfieldProceduralTexture.prototype, "beta", {
  1490. get: function () {
  1491. return this._beta;
  1492. },
  1493. set: function (value) {
  1494. this._beta = value;
  1495. this.updateShaderUniforms();
  1496. },
  1497. enumerable: true,
  1498. configurable: true
  1499. });
  1500. Object.defineProperty(StarfieldProceduralTexture.prototype, "formuparam", {
  1501. get: function () {
  1502. return this._formuparam;
  1503. },
  1504. set: function (value) {
  1505. this._formuparam = value;
  1506. this.updateShaderUniforms();
  1507. },
  1508. enumerable: true,
  1509. configurable: true
  1510. });
  1511. Object.defineProperty(StarfieldProceduralTexture.prototype, "stepsize", {
  1512. get: function () {
  1513. return this._stepsize;
  1514. },
  1515. set: function (value) {
  1516. this._stepsize = value;
  1517. this.updateShaderUniforms();
  1518. },
  1519. enumerable: true,
  1520. configurable: true
  1521. });
  1522. Object.defineProperty(StarfieldProceduralTexture.prototype, "zoom", {
  1523. get: function () {
  1524. return this._zoom;
  1525. },
  1526. set: function (value) {
  1527. this._zoom = value;
  1528. this.updateShaderUniforms();
  1529. },
  1530. enumerable: true,
  1531. configurable: true
  1532. });
  1533. Object.defineProperty(StarfieldProceduralTexture.prototype, "tile", {
  1534. get: function () {
  1535. return this._tile;
  1536. },
  1537. set: function (value) {
  1538. this._tile = value;
  1539. this.updateShaderUniforms();
  1540. },
  1541. enumerable: true,
  1542. configurable: true
  1543. });
  1544. Object.defineProperty(StarfieldProceduralTexture.prototype, "brightness", {
  1545. get: function () {
  1546. return this._brightness;
  1547. },
  1548. set: function (value) {
  1549. this._brightness = value;
  1550. this.updateShaderUniforms();
  1551. },
  1552. enumerable: true,
  1553. configurable: true
  1554. });
  1555. Object.defineProperty(StarfieldProceduralTexture.prototype, "darkmatter", {
  1556. get: function () {
  1557. return this._darkmatter;
  1558. },
  1559. set: function (value) {
  1560. this._darkmatter = value;
  1561. this.updateShaderUniforms();
  1562. },
  1563. enumerable: true,
  1564. configurable: true
  1565. });
  1566. Object.defineProperty(StarfieldProceduralTexture.prototype, "distfading", {
  1567. get: function () {
  1568. return this._distfading;
  1569. },
  1570. set: function (value) {
  1571. this._distfading = value;
  1572. this.updateShaderUniforms();
  1573. },
  1574. enumerable: true,
  1575. configurable: true
  1576. });
  1577. Object.defineProperty(StarfieldProceduralTexture.prototype, "saturation", {
  1578. get: function () {
  1579. return this._saturation;
  1580. },
  1581. set: function (value) {
  1582. this._saturation = value;
  1583. this.updateShaderUniforms();
  1584. },
  1585. enumerable: true,
  1586. configurable: true
  1587. });
  1588. /**
  1589. * Serializes this starfield procedural texture
  1590. * @returns a serialized starfield procedural texture object
  1591. */
  1592. StarfieldProceduralTexture.prototype.serialize = function () {
  1593. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  1594. serializationObject.customType = "BABYLON.StarfieldProceduralTexture";
  1595. return serializationObject;
  1596. };
  1597. /**
  1598. * Creates a Starfield Procedural Texture from parsed startfield procedural texture data
  1599. * @param parsedTexture defines parsed texture data
  1600. * @param scene defines the current scene
  1601. * @param rootUrl defines the root URL containing startfield procedural texture information
  1602. * @returns a parsed Starfield Procedural Texture
  1603. */
  1604. StarfieldProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  1605. var texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new StarfieldProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
  1606. return texture;
  1607. };
  1608. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1609. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1610. ], StarfieldProceduralTexture.prototype, "time", null);
  1611. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1612. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1613. ], StarfieldProceduralTexture.prototype, "alpha", null);
  1614. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1615. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1616. ], StarfieldProceduralTexture.prototype, "beta", null);
  1617. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1618. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1619. ], StarfieldProceduralTexture.prototype, "formuparam", null);
  1620. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1621. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1622. ], StarfieldProceduralTexture.prototype, "stepsize", null);
  1623. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1624. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1625. ], StarfieldProceduralTexture.prototype, "zoom", null);
  1626. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1627. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1628. ], StarfieldProceduralTexture.prototype, "tile", null);
  1629. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1630. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1631. ], StarfieldProceduralTexture.prototype, "brightness", null);
  1632. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1633. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1634. ], StarfieldProceduralTexture.prototype, "darkmatter", null);
  1635. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1636. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1637. ], StarfieldProceduralTexture.prototype, "distfading", null);
  1638. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1639. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1640. ], StarfieldProceduralTexture.prototype, "saturation", null);
  1641. return StarfieldProceduralTexture;
  1642. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  1643. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.StarfieldProceduralTexture"] = StarfieldProceduralTexture;
  1644. /***/ }),
  1645. /***/ "./wood/index.ts":
  1646. /*!***********************!*\
  1647. !*** ./wood/index.ts ***!
  1648. \***********************/
  1649. /*! exports provided: WoodProceduralTexture */
  1650. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1651. "use strict";
  1652. __webpack_require__.r(__webpack_exports__);
  1653. /* harmony import */ var _woodProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./woodProceduralTexture */ "./wood/woodProceduralTexture.ts");
  1654. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WoodProceduralTexture", function() { return _woodProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["WoodProceduralTexture"]; });
  1655. /***/ }),
  1656. /***/ "./wood/woodProceduralTexture.fragment.ts":
  1657. /*!************************************************!*\
  1658. !*** ./wood/woodProceduralTexture.fragment.ts ***!
  1659. \************************************************/
  1660. /*! exports provided: woodProceduralTexturePixelShader */
  1661. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1662. "use strict";
  1663. __webpack_require__.r(__webpack_exports__);
  1664. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "woodProceduralTexturePixelShader", function() { return woodProceduralTexturePixelShader; });
  1665. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  1666. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  1667. var name = 'woodProceduralTexturePixelShader';
  1668. var shader = "precision highp float;\nvarying vec2 vPosition;\nvarying vec2 vUV;\nuniform float ampScale;\nuniform vec3 woodColor;\nfloat rand(vec2 n) {\nreturn fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);\n}\nfloat noise(vec2 n) {\nconst vec2 d=vec2(0.0,1.0);\nvec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));\nreturn mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);\n}\nfloat fbm(vec2 n) {\nfloat total=0.0,amplitude=1.0;\nfor (int i=0; i<4; i++) {\ntotal+=noise(n)*amplitude;\nn+=n;\namplitude*=0.5;\n}\nreturn total;\n}\nvoid main(void) {\nfloat ratioy=mod(vUV.x*ampScale,2.0+fbm(vUV*0.8));\nvec3 wood=woodColor*ratioy;\ngl_FragColor=vec4(wood,1.0);\n}";
  1669. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  1670. /** @hidden */
  1671. var woodProceduralTexturePixelShader = { name: name, shader: shader };
  1672. /***/ }),
  1673. /***/ "./wood/woodProceduralTexture.ts":
  1674. /*!***************************************!*\
  1675. !*** ./wood/woodProceduralTexture.ts ***!
  1676. \***************************************/
  1677. /*! exports provided: WoodProceduralTexture */
  1678. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1679. "use strict";
  1680. __webpack_require__.r(__webpack_exports__);
  1681. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WoodProceduralTexture", function() { return WoodProceduralTexture; });
  1682. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  1683. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  1684. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  1685. /* harmony import */ var _woodProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./woodProceduralTexture.fragment */ "./wood/woodProceduralTexture.fragment.ts");
  1686. var WoodProceduralTexture = /** @class */ (function (_super) {
  1687. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](WoodProceduralTexture, _super);
  1688. function WoodProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  1689. var _this = _super.call(this, name, size, "woodProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  1690. _this._ampScale = 100.0;
  1691. _this._woodColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.32, 0.17, 0.09);
  1692. _this.updateShaderUniforms();
  1693. return _this;
  1694. }
  1695. WoodProceduralTexture.prototype.updateShaderUniforms = function () {
  1696. this.setFloat("ampScale", this._ampScale);
  1697. this.setColor3("woodColor", this._woodColor);
  1698. };
  1699. Object.defineProperty(WoodProceduralTexture.prototype, "ampScale", {
  1700. get: function () {
  1701. return this._ampScale;
  1702. },
  1703. set: function (value) {
  1704. this._ampScale = value;
  1705. this.updateShaderUniforms();
  1706. },
  1707. enumerable: true,
  1708. configurable: true
  1709. });
  1710. Object.defineProperty(WoodProceduralTexture.prototype, "woodColor", {
  1711. get: function () {
  1712. return this._woodColor;
  1713. },
  1714. set: function (value) {
  1715. this._woodColor = value;
  1716. this.updateShaderUniforms();
  1717. },
  1718. enumerable: true,
  1719. configurable: true
  1720. });
  1721. /**
  1722. * Serializes this wood procedural texture
  1723. * @returns a serialized wood procedural texture object
  1724. */
  1725. WoodProceduralTexture.prototype.serialize = function () {
  1726. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  1727. serializationObject.customType = "BABYLON.WoodProceduralTexture";
  1728. return serializationObject;
  1729. };
  1730. /**
  1731. * Creates a Wood Procedural Texture from parsed wood procedural texture data
  1732. * @param parsedTexture defines parsed texture data
  1733. * @param scene defines the current scene
  1734. * @param rootUrl defines the root URL containing wood procedural texture information
  1735. * @returns a parsed Wood Procedural Texture
  1736. */
  1737. WoodProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  1738. var texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new WoodProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
  1739. return texture;
  1740. };
  1741. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1742. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1743. ], WoodProceduralTexture.prototype, "ampScale", null);
  1744. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  1745. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  1746. ], WoodProceduralTexture.prototype, "woodColor", null);
  1747. return WoodProceduralTexture;
  1748. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  1749. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.WoodProceduralTexture"] = WoodProceduralTexture;
  1750. /***/ }),
  1751. /***/ "babylonjs/Misc/decorators":
  1752. /*!****************************************************************************************************!*\
  1753. !*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
  1754. \****************************************************************************************************/
  1755. /*! no static exports found */
  1756. /***/ (function(module, exports) {
  1757. module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__;
  1758. /***/ })
  1759. /******/ });
  1760. });
  1761. //# sourceMappingURL=babylonjs.proceduralTextures.js.map