babylonjs.proceduralTextures.js 113 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068
  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, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault */
  103. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  104. "use strict";
  105. __webpack_require__.r(__webpack_exports__);
  106. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
  107. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
  108. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
  109. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
  110. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
  111. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
  112. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
  113. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
  114. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
  115. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
  116. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
  117. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
  118. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
  119. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
  120. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
  121. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
  122. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
  123. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
  124. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
  125. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
  126. /*! *****************************************************************************
  127. Copyright (c) Microsoft Corporation. All rights reserved.
  128. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  129. this file except in compliance with the License. You may obtain a copy of the
  130. License at http://www.apache.org/licenses/LICENSE-2.0
  131. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  132. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  133. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  134. MERCHANTABLITY OR NON-INFRINGEMENT.
  135. See the Apache Version 2.0 License for specific language governing permissions
  136. and limitations under the License.
  137. ***************************************************************************** */
  138. /* global Reflect, Promise */
  139. var extendStatics = function(d, b) {
  140. extendStatics = Object.setPrototypeOf ||
  141. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  142. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  143. return extendStatics(d, b);
  144. };
  145. function __extends(d, b) {
  146. extendStatics(d, b);
  147. function __() { this.constructor = d; }
  148. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  149. }
  150. var __assign = function() {
  151. __assign = Object.assign || function __assign(t) {
  152. for (var s, i = 1, n = arguments.length; i < n; i++) {
  153. s = arguments[i];
  154. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  155. }
  156. return t;
  157. }
  158. return __assign.apply(this, arguments);
  159. }
  160. function __rest(s, e) {
  161. var t = {};
  162. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  163. t[p] = s[p];
  164. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  165. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  166. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  167. t[p[i]] = s[p[i]];
  168. }
  169. return t;
  170. }
  171. function __decorate(decorators, target, key, desc) {
  172. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  173. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  174. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  175. return c > 3 && r && Object.defineProperty(target, key, r), r;
  176. }
  177. function __param(paramIndex, decorator) {
  178. return function (target, key) { decorator(target, key, paramIndex); }
  179. }
  180. function __metadata(metadataKey, metadataValue) {
  181. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  182. }
  183. function __awaiter(thisArg, _arguments, P, generator) {
  184. return new (P || (P = Promise))(function (resolve, reject) {
  185. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  186. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  187. function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
  188. step((generator = generator.apply(thisArg, _arguments || [])).next());
  189. });
  190. }
  191. function __generator(thisArg, body) {
  192. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  193. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  194. function verb(n) { return function (v) { return step([n, v]); }; }
  195. function step(op) {
  196. if (f) throw new TypeError("Generator is already executing.");
  197. while (_) try {
  198. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  199. if (y = 0, t) op = [op[0] & 2, t.value];
  200. switch (op[0]) {
  201. case 0: case 1: t = op; break;
  202. case 4: _.label++; return { value: op[1], done: false };
  203. case 5: _.label++; y = op[1]; op = [0]; continue;
  204. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  205. default:
  206. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  207. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  208. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  209. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  210. if (t[2]) _.ops.pop();
  211. _.trys.pop(); continue;
  212. }
  213. op = body.call(thisArg, _);
  214. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  215. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  216. }
  217. }
  218. function __exportStar(m, exports) {
  219. for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  220. }
  221. function __values(o) {
  222. var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
  223. if (m) return m.call(o);
  224. return {
  225. next: function () {
  226. if (o && i >= o.length) o = void 0;
  227. return { value: o && o[i++], done: !o };
  228. }
  229. };
  230. }
  231. function __read(o, n) {
  232. var m = typeof Symbol === "function" && o[Symbol.iterator];
  233. if (!m) return o;
  234. var i = m.call(o), r, ar = [], e;
  235. try {
  236. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  237. }
  238. catch (error) { e = { error: error }; }
  239. finally {
  240. try {
  241. if (r && !r.done && (m = i["return"])) m.call(i);
  242. }
  243. finally { if (e) throw e.error; }
  244. }
  245. return ar;
  246. }
  247. function __spread() {
  248. for (var ar = [], i = 0; i < arguments.length; i++)
  249. ar = ar.concat(__read(arguments[i]));
  250. return ar;
  251. }
  252. function __spreadArrays() {
  253. for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
  254. for (var r = Array(s), k = 0, i = 0; i < il; i++)
  255. for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
  256. r[k] = a[j];
  257. return r;
  258. };
  259. function __await(v) {
  260. return this instanceof __await ? (this.v = v, this) : new __await(v);
  261. }
  262. function __asyncGenerator(thisArg, _arguments, generator) {
  263. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  264. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  265. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
  266. function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
  267. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  268. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  269. function fulfill(value) { resume("next", value); }
  270. function reject(value) { resume("throw", value); }
  271. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  272. }
  273. function __asyncDelegator(o) {
  274. var i, p;
  275. return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
  276. function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
  277. }
  278. function __asyncValues(o) {
  279. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  280. var m = o[Symbol.asyncIterator], i;
  281. return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
  282. function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
  283. function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  284. }
  285. function __makeTemplateObject(cooked, raw) {
  286. if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  287. return cooked;
  288. };
  289. function __importStar(mod) {
  290. if (mod && mod.__esModule) return mod;
  291. var result = {};
  292. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  293. result.default = mod;
  294. return result;
  295. }
  296. function __importDefault(mod) {
  297. return (mod && mod.__esModule) ? mod : { default: mod };
  298. }
  299. /***/ }),
  300. /***/ "../../node_modules/webpack/buildin/global.js":
  301. /*!***********************************!*\
  302. !*** (webpack)/buildin/global.js ***!
  303. \***********************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports) {
  306. var g;
  307. // This works in non-strict mode
  308. g = (function() {
  309. return this;
  310. })();
  311. try {
  312. // This works if eval is allowed (see CSP)
  313. g = g || new Function("return this")();
  314. } catch (e) {
  315. // This works if the window reference is available
  316. if (typeof window === "object") g = window;
  317. }
  318. // g can still be undefined, but nothing to do about it...
  319. // We return undefined, instead of nothing here, so it's
  320. // easier to handle this case. if(!global) { ...}
  321. module.exports = g;
  322. /***/ }),
  323. /***/ "./brick/brickProceduralTexture.fragment.ts":
  324. /*!**************************************************!*\
  325. !*** ./brick/brickProceduralTexture.fragment.ts ***!
  326. \**************************************************/
  327. /*! exports provided: brickProceduralTexturePixelShader */
  328. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  329. "use strict";
  330. __webpack_require__.r(__webpack_exports__);
  331. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "brickProceduralTexturePixelShader", function() { return brickProceduralTexturePixelShader; });
  332. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  333. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  334. var name = 'brickProceduralTexturePixelShader';
  335. 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}";
  336. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  337. /** @hidden */
  338. var brickProceduralTexturePixelShader = { name: name, shader: shader };
  339. /***/ }),
  340. /***/ "./brick/brickProceduralTexture.ts":
  341. /*!*****************************************!*\
  342. !*** ./brick/brickProceduralTexture.ts ***!
  343. \*****************************************/
  344. /*! exports provided: BrickProceduralTexture */
  345. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  346. "use strict";
  347. __webpack_require__.r(__webpack_exports__);
  348. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BrickProceduralTexture", function() { return BrickProceduralTexture; });
  349. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  350. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  351. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  352. /* harmony import */ var _brickProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./brickProceduralTexture.fragment */ "./brick/brickProceduralTexture.fragment.ts");
  353. var BrickProceduralTexture = /** @class */ (function (_super) {
  354. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(BrickProceduralTexture, _super);
  355. function BrickProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  356. var _this = _super.call(this, name, size, "brickProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  357. _this._numberOfBricksHeight = 15;
  358. _this._numberOfBricksWidth = 5;
  359. _this._jointColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.72, 0.72, 0.72);
  360. _this._brickColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.77, 0.47, 0.40);
  361. _this.updateShaderUniforms();
  362. return _this;
  363. }
  364. BrickProceduralTexture.prototype.updateShaderUniforms = function () {
  365. this.setFloat("numberOfBricksHeight", this._numberOfBricksHeight);
  366. this.setFloat("numberOfBricksWidth", this._numberOfBricksWidth);
  367. this.setColor3("brickColor", this._brickColor);
  368. this.setColor3("jointColor", this._jointColor);
  369. };
  370. Object.defineProperty(BrickProceduralTexture.prototype, "numberOfBricksHeight", {
  371. get: function () {
  372. return this._numberOfBricksHeight;
  373. },
  374. set: function (value) {
  375. this._numberOfBricksHeight = value;
  376. this.updateShaderUniforms();
  377. },
  378. enumerable: true,
  379. configurable: true
  380. });
  381. Object.defineProperty(BrickProceduralTexture.prototype, "numberOfBricksWidth", {
  382. get: function () {
  383. return this._numberOfBricksWidth;
  384. },
  385. set: function (value) {
  386. this._numberOfBricksWidth = value;
  387. this.updateShaderUniforms();
  388. },
  389. enumerable: true,
  390. configurable: true
  391. });
  392. Object.defineProperty(BrickProceduralTexture.prototype, "jointColor", {
  393. get: function () {
  394. return this._jointColor;
  395. },
  396. set: function (value) {
  397. this._jointColor = value;
  398. this.updateShaderUniforms();
  399. },
  400. enumerable: true,
  401. configurable: true
  402. });
  403. Object.defineProperty(BrickProceduralTexture.prototype, "brickColor", {
  404. get: function () {
  405. return this._brickColor;
  406. },
  407. set: function (value) {
  408. this._brickColor = value;
  409. this.updateShaderUniforms();
  410. },
  411. enumerable: true,
  412. configurable: true
  413. });
  414. /**
  415. * Serializes this brick procedural texture
  416. * @returns a serialized brick procedural texture object
  417. */
  418. BrickProceduralTexture.prototype.serialize = function () {
  419. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  420. serializationObject.customType = "BABYLON.BrickProceduralTexture";
  421. return serializationObject;
  422. };
  423. /**
  424. * Creates a Brick Procedural Texture from parsed brick procedural texture data
  425. * @param parsedTexture defines parsed texture data
  426. * @param scene defines the current scene
  427. * @param rootUrl defines the root URL containing brick procedural texture information
  428. * @returns a parsed Brick Procedural Texture
  429. */
  430. BrickProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  431. 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);
  432. return texture;
  433. };
  434. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  435. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  436. ], BrickProceduralTexture.prototype, "numberOfBricksHeight", null);
  437. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  438. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  439. ], BrickProceduralTexture.prototype, "numberOfBricksWidth", null);
  440. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  441. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  442. ], BrickProceduralTexture.prototype, "jointColor", null);
  443. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  444. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  445. ], BrickProceduralTexture.prototype, "brickColor", null);
  446. return BrickProceduralTexture;
  447. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  448. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.BrickProceduralTexture"] = BrickProceduralTexture;
  449. /***/ }),
  450. /***/ "./brick/index.ts":
  451. /*!************************!*\
  452. !*** ./brick/index.ts ***!
  453. \************************/
  454. /*! exports provided: BrickProceduralTexture */
  455. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  456. "use strict";
  457. __webpack_require__.r(__webpack_exports__);
  458. /* harmony import */ var _brickProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./brickProceduralTexture */ "./brick/brickProceduralTexture.ts");
  459. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BrickProceduralTexture", function() { return _brickProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["BrickProceduralTexture"]; });
  460. /***/ }),
  461. /***/ "./cloud/cloudProceduralTexture.fragment.ts":
  462. /*!**************************************************!*\
  463. !*** ./cloud/cloudProceduralTexture.fragment.ts ***!
  464. \**************************************************/
  465. /*! exports provided: cloudProceduralTexturePixelShader */
  466. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  467. "use strict";
  468. __webpack_require__.r(__webpack_exports__);
  469. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloudProceduralTexturePixelShader", function() { return cloudProceduralTexturePixelShader; });
  470. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  471. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  472. var name = 'cloudProceduralTexturePixelShader';
  473. 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";
  474. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  475. /** @hidden */
  476. var cloudProceduralTexturePixelShader = { name: name, shader: shader };
  477. /***/ }),
  478. /***/ "./cloud/cloudProceduralTexture.ts":
  479. /*!*****************************************!*\
  480. !*** ./cloud/cloudProceduralTexture.ts ***!
  481. \*****************************************/
  482. /*! exports provided: CloudProceduralTexture */
  483. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  484. "use strict";
  485. __webpack_require__.r(__webpack_exports__);
  486. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CloudProceduralTexture", function() { return CloudProceduralTexture; });
  487. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  488. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  489. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  490. /* harmony import */ var _cloudProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./cloudProceduralTexture.fragment */ "./cloud/cloudProceduralTexture.fragment.ts");
  491. var CloudProceduralTexture = /** @class */ (function (_super) {
  492. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(CloudProceduralTexture, _super);
  493. function CloudProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  494. var _this = _super.call(this, name, size, "cloudProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  495. _this._skyColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color4"](0.15, 0.68, 1.0, 1.0);
  496. _this._cloudColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color4"](1, 1, 1, 1.0);
  497. _this.updateShaderUniforms();
  498. return _this;
  499. }
  500. CloudProceduralTexture.prototype.updateShaderUniforms = function () {
  501. this.setColor4("skyColor", this._skyColor);
  502. this.setColor4("cloudColor", this._cloudColor);
  503. };
  504. Object.defineProperty(CloudProceduralTexture.prototype, "skyColor", {
  505. get: function () {
  506. return this._skyColor;
  507. },
  508. set: function (value) {
  509. this._skyColor = value;
  510. this.updateShaderUniforms();
  511. },
  512. enumerable: true,
  513. configurable: true
  514. });
  515. Object.defineProperty(CloudProceduralTexture.prototype, "cloudColor", {
  516. get: function () {
  517. return this._cloudColor;
  518. },
  519. set: function (value) {
  520. this._cloudColor = value;
  521. this.updateShaderUniforms();
  522. },
  523. enumerable: true,
  524. configurable: true
  525. });
  526. /**
  527. * Serializes this cloud procedural texture
  528. * @returns a serialized cloud procedural texture object
  529. */
  530. CloudProceduralTexture.prototype.serialize = function () {
  531. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  532. serializationObject.customType = "BABYLON.CloudProceduralTexture";
  533. return serializationObject;
  534. };
  535. /**
  536. * Creates a Cloud Procedural Texture from parsed cloud procedural texture data
  537. * @param parsedTexture defines parsed texture data
  538. * @param scene defines the current scene
  539. * @param rootUrl defines the root URL containing cloud procedural texture information
  540. * @returns a parsed Cloud Procedural Texture
  541. */
  542. CloudProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  543. 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);
  544. return texture;
  545. };
  546. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  547. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor4"])()
  548. ], CloudProceduralTexture.prototype, "skyColor", null);
  549. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  550. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor4"])()
  551. ], CloudProceduralTexture.prototype, "cloudColor", null);
  552. return CloudProceduralTexture;
  553. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  554. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.CloudProceduralTexture"] = CloudProceduralTexture;
  555. /***/ }),
  556. /***/ "./cloud/index.ts":
  557. /*!************************!*\
  558. !*** ./cloud/index.ts ***!
  559. \************************/
  560. /*! exports provided: CloudProceduralTexture */
  561. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  562. "use strict";
  563. __webpack_require__.r(__webpack_exports__);
  564. /* harmony import */ var _cloudProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cloudProceduralTexture */ "./cloud/cloudProceduralTexture.ts");
  565. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CloudProceduralTexture", function() { return _cloudProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["CloudProceduralTexture"]; });
  566. /***/ }),
  567. /***/ "./fire/fireProceduralTexture.fragment.ts":
  568. /*!************************************************!*\
  569. !*** ./fire/fireProceduralTexture.fragment.ts ***!
  570. \************************************************/
  571. /*! exports provided: fireProceduralTexturePixelShader */
  572. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  573. "use strict";
  574. __webpack_require__.r(__webpack_exports__);
  575. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fireProceduralTexturePixelShader", function() { return fireProceduralTexturePixelShader; });
  576. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  577. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  578. var name = 'fireProceduralTexturePixelShader';
  579. 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}";
  580. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  581. /** @hidden */
  582. var fireProceduralTexturePixelShader = { name: name, shader: shader };
  583. /***/ }),
  584. /***/ "./fire/fireProceduralTexture.ts":
  585. /*!***************************************!*\
  586. !*** ./fire/fireProceduralTexture.ts ***!
  587. \***************************************/
  588. /*! exports provided: FireProceduralTexture */
  589. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  590. "use strict";
  591. __webpack_require__.r(__webpack_exports__);
  592. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FireProceduralTexture", function() { return FireProceduralTexture; });
  593. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  594. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  595. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  596. /* harmony import */ var _fireProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fireProceduralTexture.fragment */ "./fire/fireProceduralTexture.fragment.ts");
  597. var FireProceduralTexture = /** @class */ (function (_super) {
  598. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FireProceduralTexture, _super);
  599. function FireProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  600. var _this = _super.call(this, name, size, "fireProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  601. _this._time = 0.0;
  602. _this._speed = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Vector2"](0.5, 0.3);
  603. _this._autoGenerateTime = true;
  604. _this._alphaThreshold = 0.5;
  605. _this._fireColors = FireProceduralTexture.RedFireColors;
  606. _this.updateShaderUniforms();
  607. return _this;
  608. }
  609. FireProceduralTexture.prototype.updateShaderUniforms = function () {
  610. this.setFloat("time", this._time);
  611. this.setVector2("speed", this._speed);
  612. this.setColor3("c1", this._fireColors[0]);
  613. this.setColor3("c2", this._fireColors[1]);
  614. this.setColor3("c3", this._fireColors[2]);
  615. this.setColor3("c4", this._fireColors[3]);
  616. this.setColor3("c5", this._fireColors[4]);
  617. this.setColor3("c6", this._fireColors[5]);
  618. this.setFloat("alphaThreshold", this._alphaThreshold);
  619. };
  620. FireProceduralTexture.prototype.render = function (useCameraPostProcess) {
  621. var scene = this.getScene();
  622. if (this._autoGenerateTime && scene) {
  623. this._time += scene.getAnimationRatio() * 0.03;
  624. this.updateShaderUniforms();
  625. }
  626. _super.prototype.render.call(this, useCameraPostProcess);
  627. };
  628. Object.defineProperty(FireProceduralTexture, "PurpleFireColors", {
  629. get: function () {
  630. return [
  631. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.5, 0.0, 1.0),
  632. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.9, 0.0, 1.0),
  633. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.2, 0.0, 1.0),
  634. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](1.0, 0.9, 1.0),
  635. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.1, 0.1, 1.0),
  636. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.9, 0.9, 1.0)
  637. ];
  638. },
  639. enumerable: true,
  640. configurable: true
  641. });
  642. Object.defineProperty(FireProceduralTexture, "GreenFireColors", {
  643. get: function () {
  644. return [
  645. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.5, 1.0, 0.0),
  646. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.5, 1.0, 0.0),
  647. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.3, 0.4, 0.0),
  648. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.5, 1.0, 0.0),
  649. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.2, 0.0, 0.0),
  650. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.5, 1.0, 0.0)
  651. ];
  652. },
  653. enumerable: true,
  654. configurable: true
  655. });
  656. Object.defineProperty(FireProceduralTexture, "RedFireColors", {
  657. get: function () {
  658. return [
  659. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.5, 0.0, 0.1),
  660. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.9, 0.0, 0.0),
  661. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.2, 0.0, 0.0),
  662. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](1.0, 0.9, 0.0),
  663. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.1, 0.1, 0.1),
  664. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.9, 0.9, 0.9)
  665. ];
  666. },
  667. enumerable: true,
  668. configurable: true
  669. });
  670. Object.defineProperty(FireProceduralTexture, "BlueFireColors", {
  671. get: function () {
  672. return [
  673. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.1, 0.0, 0.5),
  674. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.0, 0.0, 0.5),
  675. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.1, 0.0, 0.2),
  676. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.0, 0.0, 1.0),
  677. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.1, 0.2, 0.3),
  678. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.0, 0.2, 0.9)
  679. ];
  680. },
  681. enumerable: true,
  682. configurable: true
  683. });
  684. Object.defineProperty(FireProceduralTexture.prototype, "autoGenerateTime", {
  685. get: function () {
  686. return this._autoGenerateTime;
  687. },
  688. set: function (value) {
  689. this._autoGenerateTime = value;
  690. },
  691. enumerable: true,
  692. configurable: true
  693. });
  694. Object.defineProperty(FireProceduralTexture.prototype, "fireColors", {
  695. get: function () {
  696. return this._fireColors;
  697. },
  698. set: function (value) {
  699. this._fireColors = value;
  700. this.updateShaderUniforms();
  701. },
  702. enumerable: true,
  703. configurable: true
  704. });
  705. Object.defineProperty(FireProceduralTexture.prototype, "time", {
  706. get: function () {
  707. return this._time;
  708. },
  709. set: function (value) {
  710. this._time = value;
  711. this.updateShaderUniforms();
  712. },
  713. enumerable: true,
  714. configurable: true
  715. });
  716. Object.defineProperty(FireProceduralTexture.prototype, "speed", {
  717. get: function () {
  718. return this._speed;
  719. },
  720. set: function (value) {
  721. this._speed = value;
  722. this.updateShaderUniforms();
  723. },
  724. enumerable: true,
  725. configurable: true
  726. });
  727. Object.defineProperty(FireProceduralTexture.prototype, "alphaThreshold", {
  728. get: function () {
  729. return this._alphaThreshold;
  730. },
  731. set: function (value) {
  732. this._alphaThreshold = value;
  733. this.updateShaderUniforms();
  734. },
  735. enumerable: true,
  736. configurable: true
  737. });
  738. /**
  739. * Serializes this fire procedural texture
  740. * @returns a serialized fire procedural texture object
  741. */
  742. FireProceduralTexture.prototype.serialize = function () {
  743. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  744. serializationObject.customType = "BABYLON.FireProceduralTexture";
  745. serializationObject.fireColors = [];
  746. for (var i = 0; i < this._fireColors.length; i++) {
  747. serializationObject.fireColors.push(this._fireColors[i].asArray());
  748. }
  749. return serializationObject;
  750. };
  751. /**
  752. * Creates a Fire Procedural Texture from parsed fire procedural texture data
  753. * @param parsedTexture defines parsed texture data
  754. * @param scene defines the current scene
  755. * @param rootUrl defines the root URL containing fire procedural texture information
  756. * @returns a parsed Fire Procedural Texture
  757. */
  758. FireProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  759. 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);
  760. var colors = [];
  761. for (var i = 0; i < parsedTexture.fireColors.length; i++) {
  762. colors.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"].FromArray(parsedTexture.fireColors[i]));
  763. }
  764. texture.fireColors = colors;
  765. return texture;
  766. };
  767. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  768. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  769. ], FireProceduralTexture.prototype, "autoGenerateTime", null);
  770. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  771. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  772. ], FireProceduralTexture.prototype, "time", null);
  773. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  774. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsVector2"])()
  775. ], FireProceduralTexture.prototype, "speed", null);
  776. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  777. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  778. ], FireProceduralTexture.prototype, "alphaThreshold", null);
  779. return FireProceduralTexture;
  780. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  781. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.FireProceduralTexture"] = FireProceduralTexture;
  782. /***/ }),
  783. /***/ "./fire/index.ts":
  784. /*!***********************!*\
  785. !*** ./fire/index.ts ***!
  786. \***********************/
  787. /*! exports provided: FireProceduralTexture */
  788. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  789. "use strict";
  790. __webpack_require__.r(__webpack_exports__);
  791. /* harmony import */ var _fireProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fireProceduralTexture */ "./fire/fireProceduralTexture.ts");
  792. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FireProceduralTexture", function() { return _fireProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["FireProceduralTexture"]; });
  793. /***/ }),
  794. /***/ "./grass/grassProceduralTexture.fragment.ts":
  795. /*!**************************************************!*\
  796. !*** ./grass/grassProceduralTexture.fragment.ts ***!
  797. \**************************************************/
  798. /*! exports provided: grassProceduralTexturePixelShader */
  799. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  800. "use strict";
  801. __webpack_require__.r(__webpack_exports__);
  802. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "grassProceduralTexturePixelShader", function() { return grassProceduralTexturePixelShader; });
  803. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  804. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  805. var name = 'grassProceduralTexturePixelShader';
  806. 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}";
  807. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  808. /** @hidden */
  809. var grassProceduralTexturePixelShader = { name: name, shader: shader };
  810. /***/ }),
  811. /***/ "./grass/grassProceduralTexture.ts":
  812. /*!*****************************************!*\
  813. !*** ./grass/grassProceduralTexture.ts ***!
  814. \*****************************************/
  815. /*! exports provided: GrassProceduralTexture */
  816. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  817. "use strict";
  818. __webpack_require__.r(__webpack_exports__);
  819. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GrassProceduralTexture", function() { return GrassProceduralTexture; });
  820. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  821. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  822. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  823. /* harmony import */ var _grassProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./grassProceduralTexture.fragment */ "./grass/grassProceduralTexture.fragment.ts");
  824. var GrassProceduralTexture = /** @class */ (function (_super) {
  825. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(GrassProceduralTexture, _super);
  826. function GrassProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  827. var _this = _super.call(this, name, size, "grassProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  828. _this._groundColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](1, 1, 1);
  829. _this._grassColors = [
  830. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.29, 0.38, 0.02),
  831. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.36, 0.49, 0.09),
  832. new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.51, 0.6, 0.28)
  833. ];
  834. _this.updateShaderUniforms();
  835. return _this;
  836. }
  837. GrassProceduralTexture.prototype.updateShaderUniforms = function () {
  838. this.setColor3("herb1Color", this._grassColors[0]);
  839. this.setColor3("herb2Color", this._grassColors[1]);
  840. this.setColor3("herb3Color", this._grassColors[2]);
  841. this.setColor3("groundColor", this._groundColor);
  842. };
  843. Object.defineProperty(GrassProceduralTexture.prototype, "grassColors", {
  844. get: function () {
  845. return this._grassColors;
  846. },
  847. set: function (value) {
  848. this._grassColors = value;
  849. this.updateShaderUniforms();
  850. },
  851. enumerable: true,
  852. configurable: true
  853. });
  854. Object.defineProperty(GrassProceduralTexture.prototype, "groundColor", {
  855. get: function () {
  856. return this._groundColor;
  857. },
  858. set: function (value) {
  859. this._groundColor = value;
  860. this.updateShaderUniforms();
  861. },
  862. enumerable: true,
  863. configurable: true
  864. });
  865. /**
  866. * Serializes this grass procedural texture
  867. * @returns a serialized grass procedural texture object
  868. */
  869. GrassProceduralTexture.prototype.serialize = function () {
  870. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  871. serializationObject.customType = "BABYLON.GrassProceduralTexture";
  872. serializationObject.grassColors = [];
  873. for (var i = 0; i < this._grassColors.length; i++) {
  874. serializationObject.grassColors.push(this._grassColors[i].asArray());
  875. }
  876. return serializationObject;
  877. };
  878. /**
  879. * Creates a Grass Procedural Texture from parsed grass procedural texture data
  880. * @param parsedTexture defines parsed texture data
  881. * @param scene defines the current scene
  882. * @param rootUrl defines the root URL containing grass procedural texture information
  883. * @returns a parsed Grass Procedural Texture
  884. */
  885. GrassProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  886. 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);
  887. var colors = [];
  888. for (var i = 0; i < parsedTexture.grassColors.length; i++) {
  889. colors.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"].FromArray(parsedTexture.grassColors[i]));
  890. }
  891. texture.grassColors = colors;
  892. return texture;
  893. };
  894. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  895. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  896. ], GrassProceduralTexture.prototype, "groundColor", null);
  897. return GrassProceduralTexture;
  898. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  899. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.GrassProceduralTexture"] = GrassProceduralTexture;
  900. /***/ }),
  901. /***/ "./grass/index.ts":
  902. /*!************************!*\
  903. !*** ./grass/index.ts ***!
  904. \************************/
  905. /*! exports provided: GrassProceduralTexture */
  906. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  907. "use strict";
  908. __webpack_require__.r(__webpack_exports__);
  909. /* harmony import */ var _grassProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./grassProceduralTexture */ "./grass/grassProceduralTexture.ts");
  910. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GrassProceduralTexture", function() { return _grassProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["GrassProceduralTexture"]; });
  911. /***/ }),
  912. /***/ "./index.ts":
  913. /*!******************!*\
  914. !*** ./index.ts ***!
  915. \******************/
  916. /*! exports provided: BrickProceduralTexture, CloudProceduralTexture, FireProceduralTexture, GrassProceduralTexture, MarbleProceduralTexture, NormalMapProceduralTexture, PerlinNoiseProceduralTexture, RoadProceduralTexture, StarfieldProceduralTexture, WoodProceduralTexture */
  917. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  918. "use strict";
  919. __webpack_require__.r(__webpack_exports__);
  920. /* harmony import */ var _brick__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./brick */ "./brick/index.ts");
  921. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BrickProceduralTexture", function() { return _brick__WEBPACK_IMPORTED_MODULE_0__["BrickProceduralTexture"]; });
  922. /* harmony import */ var _cloud__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cloud */ "./cloud/index.ts");
  923. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CloudProceduralTexture", function() { return _cloud__WEBPACK_IMPORTED_MODULE_1__["CloudProceduralTexture"]; });
  924. /* harmony import */ var _fire__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fire */ "./fire/index.ts");
  925. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FireProceduralTexture", function() { return _fire__WEBPACK_IMPORTED_MODULE_2__["FireProceduralTexture"]; });
  926. /* harmony import */ var _grass__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./grass */ "./grass/index.ts");
  927. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GrassProceduralTexture", function() { return _grass__WEBPACK_IMPORTED_MODULE_3__["GrassProceduralTexture"]; });
  928. /* harmony import */ var _marble__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./marble */ "./marble/index.ts");
  929. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MarbleProceduralTexture", function() { return _marble__WEBPACK_IMPORTED_MODULE_4__["MarbleProceduralTexture"]; });
  930. /* harmony import */ var _normalMap__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./normalMap */ "./normalMap/index.ts");
  931. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NormalMapProceduralTexture", function() { return _normalMap__WEBPACK_IMPORTED_MODULE_5__["NormalMapProceduralTexture"]; });
  932. /* harmony import */ var _perlinNoise__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./perlinNoise */ "./perlinNoise/index.ts");
  933. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PerlinNoiseProceduralTexture", function() { return _perlinNoise__WEBPACK_IMPORTED_MODULE_6__["PerlinNoiseProceduralTexture"]; });
  934. /* harmony import */ var _road__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./road */ "./road/index.ts");
  935. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RoadProceduralTexture", function() { return _road__WEBPACK_IMPORTED_MODULE_7__["RoadProceduralTexture"]; });
  936. /* harmony import */ var _starfield__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./starfield */ "./starfield/index.ts");
  937. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StarfieldProceduralTexture", function() { return _starfield__WEBPACK_IMPORTED_MODULE_8__["StarfieldProceduralTexture"]; });
  938. /* harmony import */ var _wood__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./wood */ "./wood/index.ts");
  939. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WoodProceduralTexture", function() { return _wood__WEBPACK_IMPORTED_MODULE_9__["WoodProceduralTexture"]; });
  940. /***/ }),
  941. /***/ "./legacy/legacy.ts":
  942. /*!**************************!*\
  943. !*** ./legacy/legacy.ts ***!
  944. \**************************/
  945. /*! exports provided: BrickProceduralTexture, CloudProceduralTexture, FireProceduralTexture, GrassProceduralTexture, MarbleProceduralTexture, NormalMapProceduralTexture, PerlinNoiseProceduralTexture, RoadProceduralTexture, StarfieldProceduralTexture, WoodProceduralTexture */
  946. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  947. "use strict";
  948. __webpack_require__.r(__webpack_exports__);
  949. /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../index */ "./index.ts");
  950. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BrickProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["BrickProceduralTexture"]; });
  951. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CloudProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["CloudProceduralTexture"]; });
  952. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FireProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["FireProceduralTexture"]; });
  953. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GrassProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["GrassProceduralTexture"]; });
  954. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MarbleProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["MarbleProceduralTexture"]; });
  955. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NormalMapProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["NormalMapProceduralTexture"]; });
  956. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PerlinNoiseProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["PerlinNoiseProceduralTexture"]; });
  957. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RoadProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["RoadProceduralTexture"]; });
  958. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StarfieldProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["StarfieldProceduralTexture"]; });
  959. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WoodProceduralTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["WoodProceduralTexture"]; });
  960. /**
  961. * Legacy support, defining window.BABYLON.GridMaterial... (global variable).
  962. *
  963. * This is the entry point for the UMD module.
  964. * The entry point for a future ESM package should be index.ts
  965. */
  966. var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
  967. if (typeof globalObject !== "undefined") {
  968. globalObject.BABYLON = globalObject.BABYLON || {};
  969. for (var mat in _index__WEBPACK_IMPORTED_MODULE_0__) {
  970. globalObject.BABYLON[mat] = _index__WEBPACK_IMPORTED_MODULE_0__[mat];
  971. }
  972. }
  973. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js")))
  974. /***/ }),
  975. /***/ "./marble/index.ts":
  976. /*!*************************!*\
  977. !*** ./marble/index.ts ***!
  978. \*************************/
  979. /*! exports provided: MarbleProceduralTexture */
  980. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  981. "use strict";
  982. __webpack_require__.r(__webpack_exports__);
  983. /* harmony import */ var _marbleProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./marbleProceduralTexture */ "./marble/marbleProceduralTexture.ts");
  984. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MarbleProceduralTexture", function() { return _marbleProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["MarbleProceduralTexture"]; });
  985. /***/ }),
  986. /***/ "./marble/marbleProceduralTexture.fragment.ts":
  987. /*!****************************************************!*\
  988. !*** ./marble/marbleProceduralTexture.fragment.ts ***!
  989. \****************************************************/
  990. /*! exports provided: marbleProceduralTexturePixelShader */
  991. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  992. "use strict";
  993. __webpack_require__.r(__webpack_exports__);
  994. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "marbleProceduralTexturePixelShader", function() { return marbleProceduralTexturePixelShader; });
  995. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  996. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  997. var name = 'marbleProceduralTexturePixelShader';
  998. 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}";
  999. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  1000. /** @hidden */
  1001. var marbleProceduralTexturePixelShader = { name: name, shader: shader };
  1002. /***/ }),
  1003. /***/ "./marble/marbleProceduralTexture.ts":
  1004. /*!*******************************************!*\
  1005. !*** ./marble/marbleProceduralTexture.ts ***!
  1006. \*******************************************/
  1007. /*! exports provided: MarbleProceduralTexture */
  1008. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1009. "use strict";
  1010. __webpack_require__.r(__webpack_exports__);
  1011. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MarbleProceduralTexture", function() { return MarbleProceduralTexture; });
  1012. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  1013. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  1014. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  1015. /* harmony import */ var _marbleProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./marbleProceduralTexture.fragment */ "./marble/marbleProceduralTexture.fragment.ts");
  1016. var MarbleProceduralTexture = /** @class */ (function (_super) {
  1017. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(MarbleProceduralTexture, _super);
  1018. function MarbleProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  1019. var _this = _super.call(this, name, size, "marbleProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  1020. _this._numberOfTilesHeight = 3;
  1021. _this._numberOfTilesWidth = 3;
  1022. _this._amplitude = 9.0;
  1023. _this._jointColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.72, 0.72, 0.72);
  1024. _this.updateShaderUniforms();
  1025. return _this;
  1026. }
  1027. MarbleProceduralTexture.prototype.updateShaderUniforms = function () {
  1028. this.setFloat("numberOfTilesHeight", this._numberOfTilesHeight);
  1029. this.setFloat("numberOfTilesWidth", this._numberOfTilesWidth);
  1030. this.setFloat("amplitude", this._amplitude);
  1031. this.setColor3("jointColor", this._jointColor);
  1032. };
  1033. Object.defineProperty(MarbleProceduralTexture.prototype, "numberOfTilesHeight", {
  1034. get: function () {
  1035. return this._numberOfTilesHeight;
  1036. },
  1037. set: function (value) {
  1038. this._numberOfTilesHeight = value;
  1039. this.updateShaderUniforms();
  1040. },
  1041. enumerable: true,
  1042. configurable: true
  1043. });
  1044. Object.defineProperty(MarbleProceduralTexture.prototype, "amplitude", {
  1045. get: function () {
  1046. return this._amplitude;
  1047. },
  1048. set: function (value) {
  1049. this._amplitude = value;
  1050. this.updateShaderUniforms();
  1051. },
  1052. enumerable: true,
  1053. configurable: true
  1054. });
  1055. Object.defineProperty(MarbleProceduralTexture.prototype, "numberOfTilesWidth", {
  1056. get: function () {
  1057. return this._numberOfTilesWidth;
  1058. },
  1059. set: function (value) {
  1060. this._numberOfTilesWidth = value;
  1061. this.updateShaderUniforms();
  1062. },
  1063. enumerable: true,
  1064. configurable: true
  1065. });
  1066. Object.defineProperty(MarbleProceduralTexture.prototype, "jointColor", {
  1067. get: function () {
  1068. return this._jointColor;
  1069. },
  1070. set: function (value) {
  1071. this._jointColor = value;
  1072. this.updateShaderUniforms();
  1073. },
  1074. enumerable: true,
  1075. configurable: true
  1076. });
  1077. /**
  1078. * Serializes this marble procedural texture
  1079. * @returns a serialized marble procedural texture object
  1080. */
  1081. MarbleProceduralTexture.prototype.serialize = function () {
  1082. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  1083. serializationObject.customType = "BABYLON.MarbleProceduralTexture";
  1084. return serializationObject;
  1085. };
  1086. /**
  1087. * Creates a Marble Procedural Texture from parsed marble procedural texture data
  1088. * @param parsedTexture defines parsed texture data
  1089. * @param scene defines the current scene
  1090. * @param rootUrl defines the root URL containing marble procedural texture information
  1091. * @returns a parsed Marble Procedural Texture
  1092. */
  1093. MarbleProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  1094. 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);
  1095. return texture;
  1096. };
  1097. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1098. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1099. ], MarbleProceduralTexture.prototype, "numberOfTilesHeight", null);
  1100. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1101. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1102. ], MarbleProceduralTexture.prototype, "amplitude", null);
  1103. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1104. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1105. ], MarbleProceduralTexture.prototype, "numberOfTilesWidth", null);
  1106. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1107. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1108. ], MarbleProceduralTexture.prototype, "jointColor", null);
  1109. return MarbleProceduralTexture;
  1110. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  1111. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.MarbleProceduralTexture"] = MarbleProceduralTexture;
  1112. /***/ }),
  1113. /***/ "./normalMap/index.ts":
  1114. /*!****************************!*\
  1115. !*** ./normalMap/index.ts ***!
  1116. \****************************/
  1117. /*! exports provided: NormalMapProceduralTexture */
  1118. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1119. "use strict";
  1120. __webpack_require__.r(__webpack_exports__);
  1121. /* harmony import */ var _normalMapProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./normalMapProceduralTexture */ "./normalMap/normalMapProceduralTexture.ts");
  1122. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NormalMapProceduralTexture", function() { return _normalMapProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["NormalMapProceduralTexture"]; });
  1123. /***/ }),
  1124. /***/ "./normalMap/normalMapProceduralTexture.fragment.ts":
  1125. /*!**********************************************************!*\
  1126. !*** ./normalMap/normalMapProceduralTexture.fragment.ts ***!
  1127. \**********************************************************/
  1128. /*! exports provided: normalMapProceduralTexturePixelShader */
  1129. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1130. "use strict";
  1131. __webpack_require__.r(__webpack_exports__);
  1132. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalMapProceduralTexturePixelShader", function() { return normalMapProceduralTexturePixelShader; });
  1133. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  1134. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  1135. var name = 'normalMapProceduralTexturePixelShader';
  1136. 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";
  1137. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  1138. /** @hidden */
  1139. var normalMapProceduralTexturePixelShader = { name: name, shader: shader };
  1140. /***/ }),
  1141. /***/ "./normalMap/normalMapProceduralTexture.ts":
  1142. /*!*************************************************!*\
  1143. !*** ./normalMap/normalMapProceduralTexture.ts ***!
  1144. \*************************************************/
  1145. /*! exports provided: NormalMapProceduralTexture */
  1146. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1147. "use strict";
  1148. __webpack_require__.r(__webpack_exports__);
  1149. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NormalMapProceduralTexture", function() { return NormalMapProceduralTexture; });
  1150. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  1151. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  1152. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  1153. /* harmony import */ var _normalMapProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./normalMapProceduralTexture.fragment */ "./normalMap/normalMapProceduralTexture.fragment.ts");
  1154. var NormalMapProceduralTexture = /** @class */ (function (_super) {
  1155. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NormalMapProceduralTexture, _super);
  1156. function NormalMapProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  1157. var _this = _super.call(this, name, size, "normalMapProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  1158. _this.updateShaderUniforms();
  1159. return _this;
  1160. }
  1161. NormalMapProceduralTexture.prototype.updateShaderUniforms = function () {
  1162. this.setTexture("baseSampler", this._baseTexture);
  1163. this.setFloat("size", this.getRenderSize());
  1164. };
  1165. NormalMapProceduralTexture.prototype.render = function (useCameraPostProcess) {
  1166. _super.prototype.render.call(this, useCameraPostProcess);
  1167. };
  1168. NormalMapProceduralTexture.prototype.resize = function (size, generateMipMaps) {
  1169. _super.prototype.resize.call(this, size, generateMipMaps);
  1170. // We need to update the "size" uniform
  1171. this.updateShaderUniforms();
  1172. };
  1173. Object.defineProperty(NormalMapProceduralTexture.prototype, "baseTexture", {
  1174. get: function () {
  1175. return this._baseTexture;
  1176. },
  1177. set: function (texture) {
  1178. this._baseTexture = texture;
  1179. this.updateShaderUniforms();
  1180. },
  1181. enumerable: true,
  1182. configurable: true
  1183. });
  1184. /**
  1185. * Serializes this normal map procedural texture
  1186. * @returns a serialized normal map procedural texture object
  1187. */
  1188. NormalMapProceduralTexture.prototype.serialize = function () {
  1189. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  1190. serializationObject.customType = "BABYLON.NormalMapProceduralTexture";
  1191. return serializationObject;
  1192. };
  1193. /**
  1194. * Creates a Normal Map Procedural Texture from parsed normal map procedural texture data
  1195. * @param parsedTexture defines parsed texture data
  1196. * @param scene defines the current scene
  1197. * @param rootUrl defines the root URL containing normal map procedural texture information
  1198. * @returns a parsed Normal Map Procedural Texture
  1199. */
  1200. NormalMapProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  1201. 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);
  1202. return texture;
  1203. };
  1204. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1205. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsTexture"])()
  1206. ], NormalMapProceduralTexture.prototype, "baseTexture", null);
  1207. return NormalMapProceduralTexture;
  1208. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  1209. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.NormalMapProceduralTexture"] = NormalMapProceduralTexture;
  1210. /***/ }),
  1211. /***/ "./perlinNoise/index.ts":
  1212. /*!******************************!*\
  1213. !*** ./perlinNoise/index.ts ***!
  1214. \******************************/
  1215. /*! exports provided: PerlinNoiseProceduralTexture */
  1216. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1217. "use strict";
  1218. __webpack_require__.r(__webpack_exports__);
  1219. /* harmony import */ var _perlinNoiseProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./perlinNoiseProceduralTexture */ "./perlinNoise/perlinNoiseProceduralTexture.ts");
  1220. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PerlinNoiseProceduralTexture", function() { return _perlinNoiseProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["PerlinNoiseProceduralTexture"]; });
  1221. /***/ }),
  1222. /***/ "./perlinNoise/perlinNoiseProceduralTexture.fragment.ts":
  1223. /*!**************************************************************!*\
  1224. !*** ./perlinNoise/perlinNoiseProceduralTexture.fragment.ts ***!
  1225. \**************************************************************/
  1226. /*! exports provided: perlinNoiseProceduralTexturePixelShader */
  1227. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1228. "use strict";
  1229. __webpack_require__.r(__webpack_exports__);
  1230. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "perlinNoiseProceduralTexturePixelShader", function() { return perlinNoiseProceduralTexturePixelShader; });
  1231. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  1232. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  1233. var name = 'perlinNoiseProceduralTexturePixelShader';
  1234. 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";
  1235. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  1236. /** @hidden */
  1237. var perlinNoiseProceduralTexturePixelShader = { name: name, shader: shader };
  1238. /***/ }),
  1239. /***/ "./perlinNoise/perlinNoiseProceduralTexture.ts":
  1240. /*!*****************************************************!*\
  1241. !*** ./perlinNoise/perlinNoiseProceduralTexture.ts ***!
  1242. \*****************************************************/
  1243. /*! exports provided: PerlinNoiseProceduralTexture */
  1244. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1245. "use strict";
  1246. __webpack_require__.r(__webpack_exports__);
  1247. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PerlinNoiseProceduralTexture", function() { return PerlinNoiseProceduralTexture; });
  1248. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  1249. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  1250. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  1251. /* harmony import */ var _perlinNoiseProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./perlinNoiseProceduralTexture.fragment */ "./perlinNoise/perlinNoiseProceduralTexture.fragment.ts");
  1252. var PerlinNoiseProceduralTexture = /** @class */ (function (_super) {
  1253. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(PerlinNoiseProceduralTexture, _super);
  1254. function PerlinNoiseProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  1255. var _this = _super.call(this, name, size, "perlinNoiseProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  1256. _this.time = 0.0;
  1257. _this.timeScale = 1.0;
  1258. _this.translationSpeed = 1.0;
  1259. _this._currentTranslation = 0;
  1260. _this.updateShaderUniforms();
  1261. return _this;
  1262. }
  1263. PerlinNoiseProceduralTexture.prototype.updateShaderUniforms = function () {
  1264. this.setFloat("size", this.getRenderSize());
  1265. var scene = this.getScene();
  1266. if (!scene) {
  1267. return;
  1268. }
  1269. var deltaTime = scene.getEngine().getDeltaTime();
  1270. this.time += deltaTime;
  1271. this.setFloat("time", this.time * this.timeScale / 1000);
  1272. this._currentTranslation += deltaTime * this.translationSpeed / 1000.0;
  1273. this.setFloat("translationSpeed", this._currentTranslation);
  1274. };
  1275. PerlinNoiseProceduralTexture.prototype.render = function (useCameraPostProcess) {
  1276. this.updateShaderUniforms();
  1277. _super.prototype.render.call(this, useCameraPostProcess);
  1278. };
  1279. PerlinNoiseProceduralTexture.prototype.resize = function (size, generateMipMaps) {
  1280. _super.prototype.resize.call(this, size, generateMipMaps);
  1281. };
  1282. /**
  1283. * Serializes this perlin noise procedural texture
  1284. * @returns a serialized perlin noise procedural texture object
  1285. */
  1286. PerlinNoiseProceduralTexture.prototype.serialize = function () {
  1287. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  1288. serializationObject.customType = "BABYLON.PerlinNoiseProceduralTexture";
  1289. return serializationObject;
  1290. };
  1291. /**
  1292. * Creates a Perlin Noise Procedural Texture from parsed perlin noise procedural texture data
  1293. * @param parsedTexture defines parsed texture data
  1294. * @param scene defines the current scene
  1295. * @param rootUrl defines the root URL containing perlin noise procedural texture information
  1296. * @returns a parsed Perlin Noise Procedural Texture
  1297. */
  1298. PerlinNoiseProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  1299. 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);
  1300. return texture;
  1301. };
  1302. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1303. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1304. ], PerlinNoiseProceduralTexture.prototype, "time", void 0);
  1305. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1306. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1307. ], PerlinNoiseProceduralTexture.prototype, "timeScale", void 0);
  1308. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1309. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1310. ], PerlinNoiseProceduralTexture.prototype, "translationSpeed", void 0);
  1311. return PerlinNoiseProceduralTexture;
  1312. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  1313. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.PerlinNoiseProceduralTexture"] = PerlinNoiseProceduralTexture;
  1314. /***/ }),
  1315. /***/ "./road/index.ts":
  1316. /*!***********************!*\
  1317. !*** ./road/index.ts ***!
  1318. \***********************/
  1319. /*! exports provided: RoadProceduralTexture */
  1320. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1321. "use strict";
  1322. __webpack_require__.r(__webpack_exports__);
  1323. /* harmony import */ var _roadProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./roadProceduralTexture */ "./road/roadProceduralTexture.ts");
  1324. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RoadProceduralTexture", function() { return _roadProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["RoadProceduralTexture"]; });
  1325. /***/ }),
  1326. /***/ "./road/roadProceduralTexture.fragment.ts":
  1327. /*!************************************************!*\
  1328. !*** ./road/roadProceduralTexture.fragment.ts ***!
  1329. \************************************************/
  1330. /*! exports provided: roadProceduralTexturePixelShader */
  1331. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1332. "use strict";
  1333. __webpack_require__.r(__webpack_exports__);
  1334. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "roadProceduralTexturePixelShader", function() { return roadProceduralTexturePixelShader; });
  1335. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  1336. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  1337. var name = 'roadProceduralTexturePixelShader';
  1338. 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}";
  1339. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  1340. /** @hidden */
  1341. var roadProceduralTexturePixelShader = { name: name, shader: shader };
  1342. /***/ }),
  1343. /***/ "./road/roadProceduralTexture.ts":
  1344. /*!***************************************!*\
  1345. !*** ./road/roadProceduralTexture.ts ***!
  1346. \***************************************/
  1347. /*! exports provided: RoadProceduralTexture */
  1348. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1349. "use strict";
  1350. __webpack_require__.r(__webpack_exports__);
  1351. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RoadProceduralTexture", function() { return RoadProceduralTexture; });
  1352. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  1353. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  1354. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  1355. /* harmony import */ var _roadProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./roadProceduralTexture.fragment */ "./road/roadProceduralTexture.fragment.ts");
  1356. var RoadProceduralTexture = /** @class */ (function (_super) {
  1357. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(RoadProceduralTexture, _super);
  1358. function RoadProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  1359. var _this = _super.call(this, name, size, "roadProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  1360. _this._roadColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.53, 0.53, 0.53);
  1361. _this.updateShaderUniforms();
  1362. return _this;
  1363. }
  1364. RoadProceduralTexture.prototype.updateShaderUniforms = function () {
  1365. this.setColor3("roadColor", this._roadColor);
  1366. };
  1367. Object.defineProperty(RoadProceduralTexture.prototype, "roadColor", {
  1368. get: function () {
  1369. return this._roadColor;
  1370. },
  1371. set: function (value) {
  1372. this._roadColor = value;
  1373. this.updateShaderUniforms();
  1374. },
  1375. enumerable: true,
  1376. configurable: true
  1377. });
  1378. /**
  1379. * Serializes this road procedural texture
  1380. * @returns a serialized road procedural texture object
  1381. */
  1382. RoadProceduralTexture.prototype.serialize = function () {
  1383. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  1384. serializationObject.customType = "BABYLON.RoadProceduralTexture";
  1385. return serializationObject;
  1386. };
  1387. /**
  1388. * Creates a Road Procedural Texture from parsed road procedural texture data
  1389. * @param parsedTexture defines parsed texture data
  1390. * @param scene defines the current scene
  1391. * @param rootUrl defines the root URL containing road procedural texture information
  1392. * @returns a parsed Road Procedural Texture
  1393. */
  1394. RoadProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  1395. 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);
  1396. return texture;
  1397. };
  1398. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1399. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  1400. ], RoadProceduralTexture.prototype, "roadColor", null);
  1401. return RoadProceduralTexture;
  1402. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  1403. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.RoadProceduralTexture"] = RoadProceduralTexture;
  1404. /***/ }),
  1405. /***/ "./starfield/index.ts":
  1406. /*!****************************!*\
  1407. !*** ./starfield/index.ts ***!
  1408. \****************************/
  1409. /*! exports provided: StarfieldProceduralTexture */
  1410. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1411. "use strict";
  1412. __webpack_require__.r(__webpack_exports__);
  1413. /* harmony import */ var _starfieldProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./starfieldProceduralTexture */ "./starfield/starfieldProceduralTexture.ts");
  1414. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StarfieldProceduralTexture", function() { return _starfieldProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["StarfieldProceduralTexture"]; });
  1415. /***/ }),
  1416. /***/ "./starfield/starfieldProceduralTexture.fragment.ts":
  1417. /*!**********************************************************!*\
  1418. !*** ./starfield/starfieldProceduralTexture.fragment.ts ***!
  1419. \**********************************************************/
  1420. /*! exports provided: starfieldProceduralTexturePixelShader */
  1421. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1422. "use strict";
  1423. __webpack_require__.r(__webpack_exports__);
  1424. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "starfieldProceduralTexturePixelShader", function() { return starfieldProceduralTexturePixelShader; });
  1425. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  1426. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  1427. var name = 'starfieldProceduralTexturePixelShader';
  1428. 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}";
  1429. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  1430. /** @hidden */
  1431. var starfieldProceduralTexturePixelShader = { name: name, shader: shader };
  1432. /***/ }),
  1433. /***/ "./starfield/starfieldProceduralTexture.ts":
  1434. /*!*************************************************!*\
  1435. !*** ./starfield/starfieldProceduralTexture.ts ***!
  1436. \*************************************************/
  1437. /*! exports provided: StarfieldProceduralTexture */
  1438. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1439. "use strict";
  1440. __webpack_require__.r(__webpack_exports__);
  1441. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StarfieldProceduralTexture", function() { return StarfieldProceduralTexture; });
  1442. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  1443. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  1444. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  1445. /* harmony import */ var _starfieldProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./starfieldProceduralTexture.fragment */ "./starfield/starfieldProceduralTexture.fragment.ts");
  1446. var StarfieldProceduralTexture = /** @class */ (function (_super) {
  1447. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(StarfieldProceduralTexture, _super);
  1448. function StarfieldProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  1449. var _this = _super.call(this, name, size, "starfieldProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  1450. _this._time = 1;
  1451. _this._alpha = 0.5;
  1452. _this._beta = 0.8;
  1453. _this._zoom = 0.8;
  1454. _this._formuparam = 0.53;
  1455. _this._stepsize = 0.1;
  1456. _this._tile = 0.850;
  1457. _this._brightness = 0.0015;
  1458. _this._darkmatter = 0.400;
  1459. _this._distfading = 0.730;
  1460. _this._saturation = 0.850;
  1461. _this.updateShaderUniforms();
  1462. return _this;
  1463. }
  1464. StarfieldProceduralTexture.prototype.updateShaderUniforms = function () {
  1465. this.setFloat("time", this._time);
  1466. this.setFloat("alpha", this._alpha);
  1467. this.setFloat("beta", this._beta);
  1468. this.setFloat("zoom", this._zoom);
  1469. this.setFloat("formuparam", this._formuparam);
  1470. this.setFloat("stepsize", this._stepsize);
  1471. this.setFloat("tile", this._tile);
  1472. this.setFloat("brightness", this._brightness);
  1473. this.setFloat("darkmatter", this._darkmatter);
  1474. this.setFloat("distfading", this._distfading);
  1475. this.setFloat("saturation", this._saturation);
  1476. };
  1477. Object.defineProperty(StarfieldProceduralTexture.prototype, "time", {
  1478. get: function () {
  1479. return this._time;
  1480. },
  1481. set: function (value) {
  1482. this._time = value;
  1483. this.updateShaderUniforms();
  1484. },
  1485. enumerable: true,
  1486. configurable: true
  1487. });
  1488. Object.defineProperty(StarfieldProceduralTexture.prototype, "alpha", {
  1489. get: function () {
  1490. return this._alpha;
  1491. },
  1492. set: function (value) {
  1493. this._alpha = value;
  1494. this.updateShaderUniforms();
  1495. },
  1496. enumerable: true,
  1497. configurable: true
  1498. });
  1499. Object.defineProperty(StarfieldProceduralTexture.prototype, "beta", {
  1500. get: function () {
  1501. return this._beta;
  1502. },
  1503. set: function (value) {
  1504. this._beta = value;
  1505. this.updateShaderUniforms();
  1506. },
  1507. enumerable: true,
  1508. configurable: true
  1509. });
  1510. Object.defineProperty(StarfieldProceduralTexture.prototype, "formuparam", {
  1511. get: function () {
  1512. return this._formuparam;
  1513. },
  1514. set: function (value) {
  1515. this._formuparam = value;
  1516. this.updateShaderUniforms();
  1517. },
  1518. enumerable: true,
  1519. configurable: true
  1520. });
  1521. Object.defineProperty(StarfieldProceduralTexture.prototype, "stepsize", {
  1522. get: function () {
  1523. return this._stepsize;
  1524. },
  1525. set: function (value) {
  1526. this._stepsize = value;
  1527. this.updateShaderUniforms();
  1528. },
  1529. enumerable: true,
  1530. configurable: true
  1531. });
  1532. Object.defineProperty(StarfieldProceduralTexture.prototype, "zoom", {
  1533. get: function () {
  1534. return this._zoom;
  1535. },
  1536. set: function (value) {
  1537. this._zoom = value;
  1538. this.updateShaderUniforms();
  1539. },
  1540. enumerable: true,
  1541. configurable: true
  1542. });
  1543. Object.defineProperty(StarfieldProceduralTexture.prototype, "tile", {
  1544. get: function () {
  1545. return this._tile;
  1546. },
  1547. set: function (value) {
  1548. this._tile = value;
  1549. this.updateShaderUniforms();
  1550. },
  1551. enumerable: true,
  1552. configurable: true
  1553. });
  1554. Object.defineProperty(StarfieldProceduralTexture.prototype, "brightness", {
  1555. get: function () {
  1556. return this._brightness;
  1557. },
  1558. set: function (value) {
  1559. this._brightness = value;
  1560. this.updateShaderUniforms();
  1561. },
  1562. enumerable: true,
  1563. configurable: true
  1564. });
  1565. Object.defineProperty(StarfieldProceduralTexture.prototype, "darkmatter", {
  1566. get: function () {
  1567. return this._darkmatter;
  1568. },
  1569. set: function (value) {
  1570. this._darkmatter = value;
  1571. this.updateShaderUniforms();
  1572. },
  1573. enumerable: true,
  1574. configurable: true
  1575. });
  1576. Object.defineProperty(StarfieldProceduralTexture.prototype, "distfading", {
  1577. get: function () {
  1578. return this._distfading;
  1579. },
  1580. set: function (value) {
  1581. this._distfading = value;
  1582. this.updateShaderUniforms();
  1583. },
  1584. enumerable: true,
  1585. configurable: true
  1586. });
  1587. Object.defineProperty(StarfieldProceduralTexture.prototype, "saturation", {
  1588. get: function () {
  1589. return this._saturation;
  1590. },
  1591. set: function (value) {
  1592. this._saturation = value;
  1593. this.updateShaderUniforms();
  1594. },
  1595. enumerable: true,
  1596. configurable: true
  1597. });
  1598. /**
  1599. * Serializes this starfield procedural texture
  1600. * @returns a serialized starfield procedural texture object
  1601. */
  1602. StarfieldProceduralTexture.prototype.serialize = function () {
  1603. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  1604. serializationObject.customType = "BABYLON.StarfieldProceduralTexture";
  1605. return serializationObject;
  1606. };
  1607. /**
  1608. * Creates a Starfield Procedural Texture from parsed startfield procedural texture data
  1609. * @param parsedTexture defines parsed texture data
  1610. * @param scene defines the current scene
  1611. * @param rootUrl defines the root URL containing startfield procedural texture information
  1612. * @returns a parsed Starfield Procedural Texture
  1613. */
  1614. StarfieldProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  1615. 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);
  1616. return texture;
  1617. };
  1618. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1619. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1620. ], StarfieldProceduralTexture.prototype, "time", null);
  1621. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1622. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1623. ], StarfieldProceduralTexture.prototype, "alpha", null);
  1624. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1625. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1626. ], StarfieldProceduralTexture.prototype, "beta", null);
  1627. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1628. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1629. ], StarfieldProceduralTexture.prototype, "formuparam", null);
  1630. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1631. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1632. ], StarfieldProceduralTexture.prototype, "stepsize", null);
  1633. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1634. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1635. ], StarfieldProceduralTexture.prototype, "zoom", null);
  1636. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1637. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1638. ], StarfieldProceduralTexture.prototype, "tile", null);
  1639. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1640. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1641. ], StarfieldProceduralTexture.prototype, "brightness", null);
  1642. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1643. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1644. ], StarfieldProceduralTexture.prototype, "darkmatter", null);
  1645. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1646. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1647. ], StarfieldProceduralTexture.prototype, "distfading", null);
  1648. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1649. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1650. ], StarfieldProceduralTexture.prototype, "saturation", null);
  1651. return StarfieldProceduralTexture;
  1652. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  1653. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.StarfieldProceduralTexture"] = StarfieldProceduralTexture;
  1654. /***/ }),
  1655. /***/ "./wood/index.ts":
  1656. /*!***********************!*\
  1657. !*** ./wood/index.ts ***!
  1658. \***********************/
  1659. /*! exports provided: WoodProceduralTexture */
  1660. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1661. "use strict";
  1662. __webpack_require__.r(__webpack_exports__);
  1663. /* harmony import */ var _woodProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./woodProceduralTexture */ "./wood/woodProceduralTexture.ts");
  1664. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WoodProceduralTexture", function() { return _woodProceduralTexture__WEBPACK_IMPORTED_MODULE_0__["WoodProceduralTexture"]; });
  1665. /***/ }),
  1666. /***/ "./wood/woodProceduralTexture.fragment.ts":
  1667. /*!************************************************!*\
  1668. !*** ./wood/woodProceduralTexture.fragment.ts ***!
  1669. \************************************************/
  1670. /*! exports provided: woodProceduralTexturePixelShader */
  1671. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1672. "use strict";
  1673. __webpack_require__.r(__webpack_exports__);
  1674. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "woodProceduralTexturePixelShader", function() { return woodProceduralTexturePixelShader; });
  1675. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  1676. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  1677. var name = 'woodProceduralTexturePixelShader';
  1678. 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}";
  1679. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  1680. /** @hidden */
  1681. var woodProceduralTexturePixelShader = { name: name, shader: shader };
  1682. /***/ }),
  1683. /***/ "./wood/woodProceduralTexture.ts":
  1684. /*!***************************************!*\
  1685. !*** ./wood/woodProceduralTexture.ts ***!
  1686. \***************************************/
  1687. /*! exports provided: WoodProceduralTexture */
  1688. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1689. "use strict";
  1690. __webpack_require__.r(__webpack_exports__);
  1691. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WoodProceduralTexture", function() { return WoodProceduralTexture; });
  1692. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  1693. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  1694. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  1695. /* harmony import */ var _woodProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./woodProceduralTexture.fragment */ "./wood/woodProceduralTexture.fragment.ts");
  1696. var WoodProceduralTexture = /** @class */ (function (_super) {
  1697. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(WoodProceduralTexture, _super);
  1698. function WoodProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  1699. var _this = _super.call(this, name, size, "woodProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
  1700. _this._ampScale = 100.0;
  1701. _this._woodColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0.32, 0.17, 0.09);
  1702. _this.updateShaderUniforms();
  1703. return _this;
  1704. }
  1705. WoodProceduralTexture.prototype.updateShaderUniforms = function () {
  1706. this.setFloat("ampScale", this._ampScale);
  1707. this.setColor3("woodColor", this._woodColor);
  1708. };
  1709. Object.defineProperty(WoodProceduralTexture.prototype, "ampScale", {
  1710. get: function () {
  1711. return this._ampScale;
  1712. },
  1713. set: function (value) {
  1714. this._ampScale = value;
  1715. this.updateShaderUniforms();
  1716. },
  1717. enumerable: true,
  1718. configurable: true
  1719. });
  1720. Object.defineProperty(WoodProceduralTexture.prototype, "woodColor", {
  1721. get: function () {
  1722. return this._woodColor;
  1723. },
  1724. set: function (value) {
  1725. this._woodColor = value;
  1726. this.updateShaderUniforms();
  1727. },
  1728. enumerable: true,
  1729. configurable: true
  1730. });
  1731. /**
  1732. * Serializes this wood procedural texture
  1733. * @returns a serialized wood procedural texture object
  1734. */
  1735. WoodProceduralTexture.prototype.serialize = function () {
  1736. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this, _super.prototype.serialize.call(this));
  1737. serializationObject.customType = "BABYLON.WoodProceduralTexture";
  1738. return serializationObject;
  1739. };
  1740. /**
  1741. * Creates a Wood Procedural Texture from parsed wood procedural texture data
  1742. * @param parsedTexture defines parsed texture data
  1743. * @param scene defines the current scene
  1744. * @param rootUrl defines the root URL containing wood procedural texture information
  1745. * @returns a parsed Wood Procedural Texture
  1746. */
  1747. WoodProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
  1748. 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);
  1749. return texture;
  1750. };
  1751. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1752. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  1753. ], WoodProceduralTexture.prototype, "ampScale", null);
  1754. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  1755. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  1756. ], WoodProceduralTexture.prototype, "woodColor", null);
  1757. return WoodProceduralTexture;
  1758. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["ProceduralTexture"]));
  1759. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.WoodProceduralTexture"] = WoodProceduralTexture;
  1760. /***/ }),
  1761. /***/ "babylonjs/Misc/decorators":
  1762. /*!****************************************************************************************************!*\
  1763. !*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
  1764. \****************************************************************************************************/
  1765. /*! no static exports found */
  1766. /***/ (function(module, exports) {
  1767. module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__;
  1768. /***/ })
  1769. /******/ });
  1770. });
  1771. //# sourceMappingURL=babylonjs.proceduralTextures.js.map