babylonjs.proceduralTextures.js 115 KB

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