babylonjs.postProcess.js 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001
  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-post-process", ["babylonjs"], factory);
  6. else if(typeof exports === 'object')
  7. exports["babylonjs-post-process"] = factory(require("babylonjs"));
  8. else
  9. root["POSTPROCESSES"] = 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. !*** D:/Repos/Babylon.js/node_modules/tslib/tslib.es6.js ***!
  101. \***********************************************************/
  102. /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
  103. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  104. "use strict";
  105. __webpack_require__.r(__webpack_exports__);
  106. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
  107. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
  108. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
  109. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
  110. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
  111. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
  112. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
  113. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
  114. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__createBinding", function() { return __createBinding; });
  115. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
  116. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
  117. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
  118. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
  119. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
  120. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
  121. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
  122. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
  123. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
  124. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
  125. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
  126. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
  127. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldGet", function() { return __classPrivateFieldGet; });
  128. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldSet", function() { return __classPrivateFieldSet; });
  129. /*! *****************************************************************************
  130. Copyright (c) Microsoft Corporation.
  131. Permission to use, copy, modify, and/or distribute this software for any
  132. purpose with or without fee is hereby granted.
  133. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  134. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  135. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  136. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  137. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  138. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  139. PERFORMANCE OF THIS SOFTWARE.
  140. ***************************************************************************** */
  141. /* global Reflect, Promise */
  142. var extendStatics = function(d, b) {
  143. extendStatics = Object.setPrototypeOf ||
  144. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  145. function (d, b) { for (var p in b) if (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. /***/ "./asciiArt/asciiArtPostProcess.ts":
  354. /*!*****************************************!*\
  355. !*** ./asciiArt/asciiArtPostProcess.ts ***!
  356. \*****************************************/
  357. /*! exports provided: AsciiArtFontTexture, AsciiArtPostProcess */
  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__, "AsciiArtFontTexture", function() { return AsciiArtFontTexture; });
  362. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsciiArtPostProcess", function() { return AsciiArtPostProcess; });
  363. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  364. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  365. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  366. /* harmony import */ var _asciiart_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./asciiart.fragment */ "./asciiArt/asciiart.fragment.ts");
  367. /**
  368. * AsciiArtFontTexture is the helper class used to easily create your ascii art font texture.
  369. *
  370. * It basically takes care rendering the font front the given font size to a texture.
  371. * This is used later on in the postprocess.
  372. */
  373. var AsciiArtFontTexture = /** @class */ (function (_super) {
  374. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(AsciiArtFontTexture, _super);
  375. /**
  376. * Create a new instance of the Ascii Art FontTexture class
  377. * @param name the name of the texture
  378. * @param font the font to use, use the W3C CSS notation
  379. * @param text the caracter set to use in the rendering.
  380. * @param scene the scene that owns the texture
  381. */
  382. function AsciiArtFontTexture(name, font, text, scene) {
  383. if (scene === void 0) { scene = null; }
  384. var _this = _super.call(this, scene) || this;
  385. scene = _this.getScene();
  386. if (!scene) {
  387. return _this;
  388. }
  389. _this.name = name;
  390. _this._text == text;
  391. _this._font == font;
  392. _this.wrapU = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].CLAMP_ADDRESSMODE;
  393. _this.wrapV = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].CLAMP_ADDRESSMODE;
  394. //this.anisotropicFilteringLevel = 1;
  395. // Get the font specific info.
  396. var maxCharHeight = _this.getFontHeight(font);
  397. var maxCharWidth = _this.getFontWidth(font);
  398. _this._charSize = Math.max(maxCharHeight.height, maxCharWidth);
  399. // This is an approximate size, but should always be able to fit at least the maxCharCount.
  400. var textureWidth = Math.ceil(_this._charSize * text.length);
  401. var textureHeight = _this._charSize;
  402. // Create the texture that will store the font characters.
  403. _this._texture = scene.getEngine().createDynamicTexture(textureWidth, textureHeight, false, babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].NEAREST_SAMPLINGMODE);
  404. //scene.getEngine().setclamp
  405. var textureSize = _this.getSize();
  406. // Create a canvas with the final size: the one matching the texture.
  407. var canvas = document.createElement("canvas");
  408. canvas.width = textureSize.width;
  409. canvas.height = textureSize.height;
  410. var context = canvas.getContext("2d");
  411. context.textBaseline = "top";
  412. context.font = font;
  413. context.fillStyle = "white";
  414. context.imageSmoothingEnabled = false;
  415. // Sets the text in the texture.
  416. for (var i = 0; i < text.length; i++) {
  417. context.fillText(text[i], i * _this._charSize, -maxCharHeight.offset);
  418. }
  419. // Flush the text in the dynamic texture.
  420. scene.getEngine().updateDynamicTexture(_this._texture, canvas, false, true);
  421. return _this;
  422. }
  423. Object.defineProperty(AsciiArtFontTexture.prototype, "charSize", {
  424. /**
  425. * Gets the size of one char in the texture (each char fits in size * size space in the texture).
  426. */
  427. get: function () {
  428. return this._charSize;
  429. },
  430. enumerable: false,
  431. configurable: true
  432. });
  433. /**
  434. * Gets the max char width of a font.
  435. * @param font the font to use, use the W3C CSS notation
  436. * @return the max char width
  437. */
  438. AsciiArtFontTexture.prototype.getFontWidth = function (font) {
  439. var fontDraw = document.createElement("canvas");
  440. var ctx = fontDraw.getContext('2d');
  441. ctx.fillStyle = 'white';
  442. ctx.font = font;
  443. return ctx.measureText("W").width;
  444. };
  445. // More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/
  446. /**
  447. * Gets the max char height of a font.
  448. * @param font the font to use, use the W3C CSS notation
  449. * @return the max char height
  450. */
  451. AsciiArtFontTexture.prototype.getFontHeight = function (font) {
  452. var fontDraw = document.createElement("canvas");
  453. var ctx = fontDraw.getContext('2d');
  454. ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);
  455. ctx.textBaseline = 'top';
  456. ctx.fillStyle = 'white';
  457. ctx.font = font;
  458. ctx.fillText('jH|', 0, 0);
  459. var pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;
  460. var start = -1;
  461. var end = -1;
  462. for (var row = 0; row < fontDraw.height; row++) {
  463. for (var column = 0; column < fontDraw.width; column++) {
  464. var index = (row * fontDraw.width + column) * 4;
  465. if (pixels[index] === 0) {
  466. if (column === fontDraw.width - 1 && start !== -1) {
  467. end = row;
  468. row = fontDraw.height;
  469. break;
  470. }
  471. continue;
  472. }
  473. else {
  474. if (start === -1) {
  475. start = row;
  476. }
  477. break;
  478. }
  479. }
  480. }
  481. return { height: (end - start) + 1, offset: start - 1 };
  482. };
  483. /**
  484. * Clones the current AsciiArtTexture.
  485. * @return the clone of the texture.
  486. */
  487. AsciiArtFontTexture.prototype.clone = function () {
  488. return new AsciiArtFontTexture(this.name, this._font, this._text, this.getScene());
  489. };
  490. /**
  491. * Parses a json object representing the texture and returns an instance of it.
  492. * @param source the source JSON representation
  493. * @param scene the scene to create the texture for
  494. * @return the parsed texture
  495. */
  496. AsciiArtFontTexture.Parse = function (source, scene) {
  497. var texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new AsciiArtFontTexture(source.name, source.font, source.text, scene); }, source, scene, null);
  498. return texture;
  499. };
  500. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  501. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("font")
  502. ], AsciiArtFontTexture.prototype, "_font", void 0);
  503. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  504. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("text")
  505. ], AsciiArtFontTexture.prototype, "_text", void 0);
  506. return AsciiArtFontTexture;
  507. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["BaseTexture"]));
  508. /**
  509. * AsciiArtPostProcess helps rendering everithing in Ascii Art.
  510. *
  511. * Simmply add it to your scene and let the nerd that lives in you have fun.
  512. * Example usage: var pp = new AsciiArtPostProcess("myAscii", "20px Monospace", camera);
  513. */
  514. var AsciiArtPostProcess = /** @class */ (function (_super) {
  515. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(AsciiArtPostProcess, _super);
  516. /**
  517. * Instantiates a new Ascii Art Post Process.
  518. * @param name the name to give to the postprocess
  519. * @camera the camera to apply the post process to.
  520. * @param options can either be the font name or an option object following the IAsciiArtPostProcessOptions format
  521. */
  522. function AsciiArtPostProcess(name, camera, options) {
  523. var _this = _super.call(this, name, 'asciiart', ['asciiArtFontInfos', 'asciiArtOptions'], ['asciiArtFont'], {
  524. width: camera.getEngine().getRenderWidth(),
  525. height: camera.getEngine().getRenderHeight()
  526. }, camera, babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].TRILINEAR_SAMPLINGMODE, camera.getEngine(), true) || this;
  527. /**
  528. * This defines the amount you want to mix the "tile" or caracter space colored in the ascii art.
  529. * This number is defined between 0 and 1;
  530. */
  531. _this.mixToTile = 0;
  532. /**
  533. * This defines the amount you want to mix the normal rendering pass in the ascii art.
  534. * This number is defined between 0 and 1;
  535. */
  536. _this.mixToNormal = 0;
  537. // Default values.
  538. var font = "40px Monospace";
  539. var characterSet = " `-.'_:,\"=^;<+!*?/cL\\zrs7TivJtC{3F)Il(xZfY5S2eajo14[nuyE]P6V9kXpKwGhqAUbOd8#HRDB0$mgMW&Q%N@";
  540. // Use options.
  541. if (options) {
  542. if (typeof (options) === "string") {
  543. font = options;
  544. }
  545. else {
  546. font = options.font || font;
  547. characterSet = options.characterSet || characterSet;
  548. _this.mixToTile = options.mixToTile || _this.mixToTile;
  549. _this.mixToNormal = options.mixToNormal || _this.mixToNormal;
  550. }
  551. }
  552. _this._asciiArtFontTexture = new AsciiArtFontTexture(name, font, characterSet, camera.getScene());
  553. var textureSize = _this._asciiArtFontTexture.getSize();
  554. _this.onApply = function (effect) {
  555. effect.setTexture("asciiArtFont", _this._asciiArtFontTexture);
  556. effect.setFloat4("asciiArtFontInfos", _this._asciiArtFontTexture.charSize, characterSet.length, textureSize.width, textureSize.height);
  557. effect.setFloat4("asciiArtOptions", _this.width, _this.height, _this.mixToNormal, _this.mixToTile);
  558. };
  559. return _this;
  560. }
  561. return AsciiArtPostProcess;
  562. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["PostProcess"]));
  563. /***/ }),
  564. /***/ "./asciiArt/asciiart.fragment.ts":
  565. /*!***************************************!*\
  566. !*** ./asciiArt/asciiart.fragment.ts ***!
  567. \***************************************/
  568. /*! exports provided: asciiartPixelShader */
  569. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  570. "use strict";
  571. __webpack_require__.r(__webpack_exports__);
  572. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asciiartPixelShader", function() { return asciiartPixelShader; });
  573. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  574. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  575. var name = 'asciiartPixelShader';
  576. var shader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D asciiArtFont;\n\nuniform vec4 asciiArtFontInfos;\nuniform vec4 asciiArtOptions;\n\nfloat getLuminance(vec3 color)\n{\nreturn clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);\n}\n\nvoid main(void)\n{\nfloat caracterSize=asciiArtFontInfos.x;\nfloat numChar=asciiArtFontInfos.y-1.0;\nfloat fontx=asciiArtFontInfos.z;\nfloat fonty=asciiArtFontInfos.w;\nfloat screenx=asciiArtOptions.x;\nfloat screeny=asciiArtOptions.y;\nfloat tileX=float(floor((gl_FragCoord.x)/caracterSize))*caracterSize/screenx;\nfloat tileY=float(floor((gl_FragCoord.y)/caracterSize))*caracterSize/screeny;\nvec2 tileUV=vec2(tileX,tileY);\nvec4 tileColor=texture2D(textureSampler,tileUV);\nvec4 baseColor=texture2D(textureSampler,vUV);\nfloat tileLuminance=getLuminance(tileColor.rgb);\nfloat offsetx=(float(floor(tileLuminance*numChar)))*caracterSize/fontx;\nfloat offsety=0.0;\nfloat x=float(mod(gl_FragCoord.x,caracterSize))/fontx;\nfloat y=float(mod(gl_FragCoord.y,caracterSize))/fonty;\nvec4 finalColor=texture2D(asciiArtFont,vec2(offsetx+x,offsety+(caracterSize/fonty-y)));\nfinalColor.rgb*=tileColor.rgb;\nfinalColor.a=1.0;\nfinalColor=mix(finalColor,tileColor,asciiArtOptions.w);\nfinalColor=mix(finalColor,baseColor,asciiArtOptions.z);\ngl_FragColor=finalColor;\n}";
  577. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  578. /** @hidden */
  579. var asciiartPixelShader = { name: name, shader: shader };
  580. /***/ }),
  581. /***/ "./asciiArt/index.ts":
  582. /*!***************************!*\
  583. !*** ./asciiArt/index.ts ***!
  584. \***************************/
  585. /*! exports provided: AsciiArtFontTexture, AsciiArtPostProcess */
  586. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  587. "use strict";
  588. __webpack_require__.r(__webpack_exports__);
  589. /* harmony import */ var _asciiArtPostProcess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asciiArtPostProcess */ "./asciiArt/asciiArtPostProcess.ts");
  590. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AsciiArtFontTexture", function() { return _asciiArtPostProcess__WEBPACK_IMPORTED_MODULE_0__["AsciiArtFontTexture"]; });
  591. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AsciiArtPostProcess", function() { return _asciiArtPostProcess__WEBPACK_IMPORTED_MODULE_0__["AsciiArtPostProcess"]; });
  592. /***/ }),
  593. /***/ "./digitalRain/digitalRainPostProcess.ts":
  594. /*!***********************************************!*\
  595. !*** ./digitalRain/digitalRainPostProcess.ts ***!
  596. \***********************************************/
  597. /*! exports provided: DigitalRainFontTexture, DigitalRainPostProcess */
  598. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  599. "use strict";
  600. __webpack_require__.r(__webpack_exports__);
  601. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DigitalRainFontTexture", function() { return DigitalRainFontTexture; });
  602. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DigitalRainPostProcess", function() { return DigitalRainPostProcess; });
  603. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  604. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  605. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  606. /* harmony import */ var _digitalrain_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./digitalrain.fragment */ "./digitalRain/digitalrain.fragment.ts");
  607. /**
  608. * DigitalRainFontTexture is the helper class used to easily create your digital rain font texture.
  609. *
  610. * It basically takes care rendering the font front the given font size to a texture.
  611. * This is used later on in the postprocess.
  612. */
  613. var DigitalRainFontTexture = /** @class */ (function (_super) {
  614. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DigitalRainFontTexture, _super);
  615. /**
  616. * Create a new instance of the Digital Rain FontTexture class
  617. * @param name the name of the texture
  618. * @param font the font to use, use the W3C CSS notation
  619. * @param text the caracter set to use in the rendering.
  620. * @param scene the scene that owns the texture
  621. */
  622. function DigitalRainFontTexture(name, font, text, scene) {
  623. if (scene === void 0) { scene = null; }
  624. var _this = _super.call(this, scene) || this;
  625. scene = _this.getScene();
  626. if (!scene) {
  627. return _this;
  628. }
  629. _this.name = name;
  630. _this._text == text;
  631. _this._font == font;
  632. _this.wrapU = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].CLAMP_ADDRESSMODE;
  633. _this.wrapV = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].CLAMP_ADDRESSMODE;
  634. // Get the font specific info.
  635. var maxCharHeight = _this.getFontHeight(font);
  636. var maxCharWidth = _this.getFontWidth(font);
  637. _this._charSize = Math.max(maxCharHeight.height, maxCharWidth);
  638. // This is an approximate size, but should always be able to fit at least the maxCharCount.
  639. var textureWidth = _this._charSize;
  640. var textureHeight = Math.ceil(_this._charSize * text.length);
  641. // Create the texture that will store the font characters.
  642. _this._texture = scene.getEngine().createDynamicTexture(textureWidth, textureHeight, false, babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].NEAREST_SAMPLINGMODE);
  643. //scene.getEngine().setclamp
  644. var textureSize = _this.getSize();
  645. // Create a canvas with the final size: the one matching the texture.
  646. var canvas = document.createElement("canvas");
  647. canvas.width = textureSize.width;
  648. canvas.height = textureSize.height;
  649. var context = canvas.getContext("2d");
  650. context.textBaseline = "top";
  651. context.font = font;
  652. context.fillStyle = "white";
  653. context.imageSmoothingEnabled = false;
  654. // Sets the text in the texture.
  655. for (var i = 0; i < text.length; i++) {
  656. context.fillText(text[i], 0, i * _this._charSize - maxCharHeight.offset);
  657. }
  658. // Flush the text in the dynamic texture.
  659. scene.getEngine().updateDynamicTexture(_this._texture, canvas, false, true);
  660. return _this;
  661. }
  662. Object.defineProperty(DigitalRainFontTexture.prototype, "charSize", {
  663. /**
  664. * Gets the size of one char in the texture (each char fits in size * size space in the texture).
  665. */
  666. get: function () {
  667. return this._charSize;
  668. },
  669. enumerable: false,
  670. configurable: true
  671. });
  672. /**
  673. * Gets the max char width of a font.
  674. * @param font the font to use, use the W3C CSS notation
  675. * @return the max char width
  676. */
  677. DigitalRainFontTexture.prototype.getFontWidth = function (font) {
  678. var fontDraw = document.createElement("canvas");
  679. var ctx = fontDraw.getContext('2d');
  680. ctx.fillStyle = 'white';
  681. ctx.font = font;
  682. return ctx.measureText("W").width;
  683. };
  684. // More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/
  685. /**
  686. * Gets the max char height of a font.
  687. * @param font the font to use, use the W3C CSS notation
  688. * @return the max char height
  689. */
  690. DigitalRainFontTexture.prototype.getFontHeight = function (font) {
  691. var fontDraw = document.createElement("canvas");
  692. var ctx = fontDraw.getContext('2d');
  693. ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);
  694. ctx.textBaseline = 'top';
  695. ctx.fillStyle = 'white';
  696. ctx.font = font;
  697. ctx.fillText('jH|', 0, 0);
  698. var pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;
  699. var start = -1;
  700. var end = -1;
  701. for (var row = 0; row < fontDraw.height; row++) {
  702. for (var column = 0; column < fontDraw.width; column++) {
  703. var index = (row * fontDraw.width + column) * 4;
  704. if (pixels[index] === 0) {
  705. if (column === fontDraw.width - 1 && start !== -1) {
  706. end = row;
  707. row = fontDraw.height;
  708. break;
  709. }
  710. continue;
  711. }
  712. else {
  713. if (start === -1) {
  714. start = row;
  715. }
  716. break;
  717. }
  718. }
  719. }
  720. return { height: (end - start) + 1, offset: start - 1 };
  721. };
  722. /**
  723. * Clones the current DigitalRainFontTexture.
  724. * @return the clone of the texture.
  725. */
  726. DigitalRainFontTexture.prototype.clone = function () {
  727. return new DigitalRainFontTexture(this.name, this._font, this._text, this.getScene());
  728. };
  729. /**
  730. * Parses a json object representing the texture and returns an instance of it.
  731. * @param source the source JSON representation
  732. * @param scene the scene to create the texture for
  733. * @return the parsed texture
  734. */
  735. DigitalRainFontTexture.Parse = function (source, scene) {
  736. var texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new DigitalRainFontTexture(source.name, source.font, source.text, scene); }, source, scene, null);
  737. return texture;
  738. };
  739. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  740. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("font")
  741. ], DigitalRainFontTexture.prototype, "_font", void 0);
  742. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  743. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("text")
  744. ], DigitalRainFontTexture.prototype, "_text", void 0);
  745. return DigitalRainFontTexture;
  746. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["BaseTexture"]));
  747. /**
  748. * DigitalRainPostProcess helps rendering everithing in digital rain.
  749. *
  750. * Simmply add it to your scene and let the nerd that lives in you have fun.
  751. * Example usage: var pp = new DigitalRainPostProcess("digitalRain", "20px Monospace", camera);
  752. */
  753. var DigitalRainPostProcess = /** @class */ (function (_super) {
  754. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DigitalRainPostProcess, _super);
  755. /**
  756. * Instantiates a new Digital Rain Post Process.
  757. * @param name the name to give to the postprocess
  758. * @camera the camera to apply the post process to.
  759. * @param options can either be the font name or an option object following the IDigitalRainPostProcessOptions format
  760. */
  761. function DigitalRainPostProcess(name, camera, options) {
  762. var _this = _super.call(this, name, 'digitalrain', ['digitalRainFontInfos', 'digitalRainOptions', 'cosTimeZeroOne', 'matrixSpeed'], ['digitalRainFont'], {
  763. width: camera.getEngine().getRenderWidth(),
  764. height: camera.getEngine().getRenderHeight()
  765. }, camera, babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].TRILINEAR_SAMPLINGMODE, camera.getEngine(), true) || this;
  766. /**
  767. * This defines the amount you want to mix the "tile" or caracter space colored in the digital rain.
  768. * This number is defined between 0 and 1;
  769. */
  770. _this.mixToTile = 0;
  771. /**
  772. * This defines the amount you want to mix the normal rendering pass in the digital rain.
  773. * This number is defined between 0 and 1;
  774. */
  775. _this.mixToNormal = 0;
  776. // Default values.
  777. var font = "15px Monospace";
  778. var characterSet = "古池や蛙飛び込む水の音ふるいけやかわずとびこむみずのおと初しぐれ猿も小蓑をほしげ也はつしぐれさるもこみのをほしげなり江戸の雨何石呑んだ時鳥えどのあめなんごくのんだほととぎす";
  779. // Use options.
  780. if (options) {
  781. if (typeof (options) === "string") {
  782. font = options;
  783. }
  784. else {
  785. font = options.font || font;
  786. _this.mixToTile = options.mixToTile || _this.mixToTile;
  787. _this.mixToNormal = options.mixToNormal || _this.mixToNormal;
  788. }
  789. }
  790. _this._digitalRainFontTexture = new DigitalRainFontTexture(name, font, characterSet, camera.getScene());
  791. var textureSize = _this._digitalRainFontTexture.getSize();
  792. var alpha = 0.0;
  793. var cosTimeZeroOne = 0.0;
  794. var matrix = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Matrix"].FromValues(Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random(), Math.random());
  795. _this.onApply = function (effect) {
  796. effect.setTexture("digitalRainFont", _this._digitalRainFontTexture);
  797. effect.setFloat4("digitalRainFontInfos", _this._digitalRainFontTexture.charSize, characterSet.length, textureSize.width, textureSize.height);
  798. effect.setFloat4("digitalRainOptions", _this.width, _this.height, _this.mixToNormal, _this.mixToTile);
  799. effect.setMatrix("matrixSpeed", matrix);
  800. alpha += 0.003;
  801. cosTimeZeroOne = alpha;
  802. effect.setFloat('cosTimeZeroOne', cosTimeZeroOne);
  803. };
  804. return _this;
  805. }
  806. return DigitalRainPostProcess;
  807. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["PostProcess"]));
  808. /***/ }),
  809. /***/ "./digitalRain/digitalrain.fragment.ts":
  810. /*!*********************************************!*\
  811. !*** ./digitalRain/digitalrain.fragment.ts ***!
  812. \*********************************************/
  813. /*! exports provided: digitalrainPixelShader */
  814. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  815. "use strict";
  816. __webpack_require__.r(__webpack_exports__);
  817. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "digitalrainPixelShader", function() { return digitalrainPixelShader; });
  818. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  819. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  820. var name = 'digitalrainPixelShader';
  821. var shader = "\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D digitalRainFont;\n\nuniform vec4 digitalRainFontInfos;\nuniform vec4 digitalRainOptions;\nuniform mat4 matrixSpeed;\nuniform float cosTimeZeroOne;\n\nfloat getLuminance(vec3 color)\n{\nreturn clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);\n}\n\nvoid main(void)\n{\nfloat caracterSize=digitalRainFontInfos.x;\nfloat numChar=digitalRainFontInfos.y-1.0;\nfloat fontx=digitalRainFontInfos.z;\nfloat fonty=digitalRainFontInfos.w;\nfloat screenx=digitalRainOptions.x;\nfloat screeny=digitalRainOptions.y;\nfloat ratio=screeny/fonty;\nfloat columnx=float(floor((gl_FragCoord.x)/caracterSize));\nfloat tileX=float(floor((gl_FragCoord.x)/caracterSize))*caracterSize/screenx;\nfloat tileY=float(floor((gl_FragCoord.y)/caracterSize))*caracterSize/screeny;\nvec2 tileUV=vec2(tileX,tileY);\nvec4 tileColor=texture2D(textureSampler,tileUV);\nvec4 baseColor=texture2D(textureSampler,vUV);\nfloat tileLuminance=getLuminance(tileColor.rgb);\nint st=int(mod(columnx,4.0));\nfloat speed=cosTimeZeroOne*(sin(tileX*314.5)*0.5+0.6);\nfloat x=float(mod(gl_FragCoord.x,caracterSize))/fontx;\nfloat y=float(mod(speed+gl_FragCoord.y/screeny,1.0));\ny*=ratio;\nvec4 finalColor=texture2D(digitalRainFont,vec2(x,1.0-y));\nvec3 high=finalColor.rgb*(vec3(1.2,1.2,1.2)*pow(1.0-y,30.0));\nfinalColor.rgb*=vec3(pow(tileLuminance,5.0),pow(tileLuminance,1.5),pow(tileLuminance,3.0));\nfinalColor.rgb+=high;\nfinalColor.rgb=clamp(finalColor.rgb,0.,1.);\nfinalColor.a=1.0;\nfinalColor=mix(finalColor,tileColor,digitalRainOptions.w);\nfinalColor=mix(finalColor,baseColor,digitalRainOptions.z);\ngl_FragColor=finalColor;\n}";
  822. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  823. /** @hidden */
  824. var digitalrainPixelShader = { name: name, shader: shader };
  825. /***/ }),
  826. /***/ "./digitalRain/index.ts":
  827. /*!******************************!*\
  828. !*** ./digitalRain/index.ts ***!
  829. \******************************/
  830. /*! exports provided: DigitalRainFontTexture, DigitalRainPostProcess */
  831. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  832. "use strict";
  833. __webpack_require__.r(__webpack_exports__);
  834. /* harmony import */ var _digitalRainPostProcess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./digitalRainPostProcess */ "./digitalRain/digitalRainPostProcess.ts");
  835. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DigitalRainFontTexture", function() { return _digitalRainPostProcess__WEBPACK_IMPORTED_MODULE_0__["DigitalRainFontTexture"]; });
  836. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DigitalRainPostProcess", function() { return _digitalRainPostProcess__WEBPACK_IMPORTED_MODULE_0__["DigitalRainPostProcess"]; });
  837. /***/ }),
  838. /***/ "./index.ts":
  839. /*!******************!*\
  840. !*** ./index.ts ***!
  841. \******************/
  842. /*! exports provided: AsciiArtFontTexture, AsciiArtPostProcess, DigitalRainFontTexture, DigitalRainPostProcess */
  843. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  844. "use strict";
  845. __webpack_require__.r(__webpack_exports__);
  846. /* harmony import */ var _asciiArt__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asciiArt */ "./asciiArt/index.ts");
  847. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AsciiArtFontTexture", function() { return _asciiArt__WEBPACK_IMPORTED_MODULE_0__["AsciiArtFontTexture"]; });
  848. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AsciiArtPostProcess", function() { return _asciiArt__WEBPACK_IMPORTED_MODULE_0__["AsciiArtPostProcess"]; });
  849. /* harmony import */ var _digitalRain__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./digitalRain */ "./digitalRain/index.ts");
  850. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DigitalRainFontTexture", function() { return _digitalRain__WEBPACK_IMPORTED_MODULE_1__["DigitalRainFontTexture"]; });
  851. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DigitalRainPostProcess", function() { return _digitalRain__WEBPACK_IMPORTED_MODULE_1__["DigitalRainPostProcess"]; });
  852. /***/ }),
  853. /***/ "./legacy/legacy.ts":
  854. /*!**************************!*\
  855. !*** ./legacy/legacy.ts ***!
  856. \**************************/
  857. /*! exports provided: AsciiArtFontTexture, AsciiArtPostProcess, DigitalRainFontTexture, DigitalRainPostProcess */
  858. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  859. "use strict";
  860. __webpack_require__.r(__webpack_exports__);
  861. /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../index */ "./index.ts");
  862. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AsciiArtFontTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["AsciiArtFontTexture"]; });
  863. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AsciiArtPostProcess", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["AsciiArtPostProcess"]; });
  864. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DigitalRainFontTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["DigitalRainFontTexture"]; });
  865. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DigitalRainPostProcess", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["DigitalRainPostProcess"]; });
  866. /**
  867. *
  868. * This is the entry point for the UMD module.
  869. * The entry point for a future ESM package should be index.ts
  870. */
  871. var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
  872. if (typeof globalObject !== "undefined") {
  873. for (var key in _index__WEBPACK_IMPORTED_MODULE_0__) {
  874. globalObject.BABYLON[key] = _index__WEBPACK_IMPORTED_MODULE_0__[key];
  875. }
  876. }
  877. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js")))
  878. /***/ }),
  879. /***/ "babylonjs/Misc/decorators":
  880. /*!****************************************************************************************************!*\
  881. !*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
  882. \****************************************************************************************************/
  883. /*! no static exports found */
  884. /***/ (function(module, exports) {
  885. module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__;
  886. /***/ })
  887. /******/ });
  888. });
  889. //# sourceMappingURL=babylonjs.postProcess.js.map