babylonjs-post-process 5.0.0-beta.9 → 5.0.0-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,128 +7,44 @@
7
7
  exports["babylonjs-post-process"] = factory(require("babylonjs"));
8
8
  else
9
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
- /******/ ({
10
+ })((typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this), function(__WEBPACK_EXTERNAL_MODULE_core_Misc_decorators__) {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ({
98
14
 
99
- /***/ "../../node_modules/tslib/tslib.es6.js":
100
- /*!************************************************************************************!*\
101
- !*** C:/Users/raweber/Documents/GitHub/Babylon.js/node_modules/tslib/tslib.es6.js ***!
102
- \************************************************************************************/
103
- /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __spreadArray, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
104
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
15
+ /***/ "../../../../node_modules/tslib/tslib.es6.js":
16
+ /*!***************************************************!*\
17
+ !*** ../../../../node_modules/tslib/tslib.es6.js ***!
18
+ \***************************************************/
19
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
105
20
 
106
- "use strict";
107
21
  __webpack_require__.r(__webpack_exports__);
108
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
109
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
110
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
111
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
112
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
113
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
114
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
115
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
116
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__createBinding", function() { return __createBinding; });
117
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
118
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
119
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
120
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
121
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
122
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArray", function() { return __spreadArray; });
123
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
124
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
125
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
126
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
127
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
128
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
129
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
130
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldGet", function() { return __classPrivateFieldGet; });
131
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldSet", function() { return __classPrivateFieldSet; });
22
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23
+ /* harmony export */ "__assign": () => (/* binding */ __assign),
24
+ /* harmony export */ "__asyncDelegator": () => (/* binding */ __asyncDelegator),
25
+ /* harmony export */ "__asyncGenerator": () => (/* binding */ __asyncGenerator),
26
+ /* harmony export */ "__asyncValues": () => (/* binding */ __asyncValues),
27
+ /* harmony export */ "__await": () => (/* binding */ __await),
28
+ /* harmony export */ "__awaiter": () => (/* binding */ __awaiter),
29
+ /* harmony export */ "__classPrivateFieldGet": () => (/* binding */ __classPrivateFieldGet),
30
+ /* harmony export */ "__classPrivateFieldSet": () => (/* binding */ __classPrivateFieldSet),
31
+ /* harmony export */ "__createBinding": () => (/* binding */ __createBinding),
32
+ /* harmony export */ "__decorate": () => (/* binding */ __decorate),
33
+ /* harmony export */ "__exportStar": () => (/* binding */ __exportStar),
34
+ /* harmony export */ "__extends": () => (/* binding */ __extends),
35
+ /* harmony export */ "__generator": () => (/* binding */ __generator),
36
+ /* harmony export */ "__importDefault": () => (/* binding */ __importDefault),
37
+ /* harmony export */ "__importStar": () => (/* binding */ __importStar),
38
+ /* harmony export */ "__makeTemplateObject": () => (/* binding */ __makeTemplateObject),
39
+ /* harmony export */ "__metadata": () => (/* binding */ __metadata),
40
+ /* harmony export */ "__param": () => (/* binding */ __param),
41
+ /* harmony export */ "__read": () => (/* binding */ __read),
42
+ /* harmony export */ "__rest": () => (/* binding */ __rest),
43
+ /* harmony export */ "__spread": () => (/* binding */ __spread),
44
+ /* harmony export */ "__spreadArray": () => (/* binding */ __spreadArray),
45
+ /* harmony export */ "__spreadArrays": () => (/* binding */ __spreadArrays),
46
+ /* harmony export */ "__values": () => (/* binding */ __values)
47
+ /* harmony export */ });
132
48
  /*! *****************************************************************************
133
49
  Copyright (c) Microsoft Corporation.
134
50
 
@@ -372,647 +288,713 @@ function __classPrivateFieldSet(receiver, state, value, kind, f) {
372
288
 
373
289
  /***/ }),
374
290
 
375
- /***/ "../../node_modules/webpack/buildin/global.js":
376
- /*!***********************************!*\
377
- !*** (webpack)/buildin/global.js ***!
378
- \***********************************/
379
- /*! no static exports found */
380
- /***/ (function(module, exports) {
291
+ /***/ "../../../lts/postProcesses/dist/asciiArt/asciiArtPostProcess.js":
292
+ /*!***********************************************************************!*\
293
+ !*** ../../../lts/postProcesses/dist/asciiArt/asciiArtPostProcess.js ***!
294
+ \***********************************************************************/
295
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
381
296
 
382
- var g;
383
-
384
- // This works in non-strict mode
385
- g = (function() {
386
- return this;
387
- })();
388
-
389
- try {
390
- // This works if eval is allowed (see CSP)
391
- g = g || new Function("return this")();
392
- } catch (e) {
393
- // This works if the window reference is available
394
- if (typeof window === "object") g = window;
395
- }
396
-
397
- // g can still be undefined, but nothing to do about it...
398
- // We return undefined, instead of nothing here, so it's
399
- // easier to handle this case. if(!global) { ...}
297
+ __webpack_require__.r(__webpack_exports__);
298
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
299
+ /* harmony export */ "AsciiArtFontTexture": () => (/* binding */ AsciiArtFontTexture),
300
+ /* harmony export */ "AsciiArtPostProcess": () => (/* binding */ AsciiArtPostProcess)
301
+ /* harmony export */ });
302
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
303
+ /* harmony import */ var core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Engines/Extensions/engine.dynamicTexture */ "core/Misc/decorators");
304
+ /* harmony import */ var core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
305
+ /* harmony import */ var _asciiart_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./asciiart.fragment */ "../../../lts/postProcesses/dist/asciiArt/asciiart.fragment.js");
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+ /**
314
+ * AsciiArtFontTexture is the helper class used to easily create your ascii art font texture.
315
+ *
316
+ * It basically takes care rendering the font front the given font size to a texture.
317
+ * This is used later on in the postprocess.
318
+ */
319
+ var AsciiArtFontTexture = /** @class */ (function (_super) {
320
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(AsciiArtFontTexture, _super);
321
+ /**
322
+ * Create a new instance of the Ascii Art FontTexture class
323
+ * @param name the name of the texture
324
+ * @param font the font to use, use the W3C CSS notation
325
+ * @param text the caracter set to use in the rendering.
326
+ * @param scene the scene that owns the texture
327
+ */
328
+ function AsciiArtFontTexture(name, font, text, scene) {
329
+ if (scene === void 0) { scene = null; }
330
+ var _this = _super.call(this, scene) || this;
331
+ scene = _this.getScene();
332
+ if (!scene) {
333
+ return _this;
334
+ }
335
+ _this.name = name;
336
+ _this._text == text;
337
+ _this._font == font;
338
+ _this.wrapU = core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.CLAMP_ADDRESSMODE;
339
+ _this.wrapV = core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.CLAMP_ADDRESSMODE;
340
+ //this.anisotropicFilteringLevel = 1;
341
+ // Get the font specific info.
342
+ var maxCharHeight = _this._getFontHeight(font);
343
+ var maxCharWidth = _this._getFontWidth(font);
344
+ _this._charSize = Math.max(maxCharHeight.height, maxCharWidth);
345
+ // This is an approximate size, but should always be able to fit at least the maxCharCount.
346
+ var textureWidth = Math.ceil(_this._charSize * text.length);
347
+ var textureHeight = _this._charSize;
348
+ // Create the texture that will store the font characters.
349
+ _this._texture = scene.getEngine().createDynamicTexture(textureWidth, textureHeight, false, core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.NEAREST_SAMPLINGMODE);
350
+ //scene.getEngine().setclamp
351
+ var textureSize = _this.getSize();
352
+ // Create a canvas with the final size: the one matching the texture.
353
+ var canvas = document.createElement("canvas");
354
+ canvas.width = textureSize.width;
355
+ canvas.height = textureSize.height;
356
+ var context = canvas.getContext("2d");
357
+ context.textBaseline = "top";
358
+ context.font = font;
359
+ context.fillStyle = "white";
360
+ context.imageSmoothingEnabled = false;
361
+ // Sets the text in the texture.
362
+ for (var i = 0; i < text.length; i++) {
363
+ context.fillText(text[i], i * _this._charSize, -maxCharHeight.offset);
364
+ }
365
+ // Flush the text in the dynamic texture.
366
+ scene.getEngine().updateDynamicTexture(_this._texture, canvas, false, true);
367
+ return _this;
368
+ }
369
+ Object.defineProperty(AsciiArtFontTexture.prototype, "charSize", {
370
+ /**
371
+ * Gets the size of one char in the texture (each char fits in size * size space in the texture).
372
+ */
373
+ get: function () {
374
+ return this._charSize;
375
+ },
376
+ enumerable: false,
377
+ configurable: true
378
+ });
379
+ /**
380
+ * Gets the max char width of a font.
381
+ * @param font the font to use, use the W3C CSS notation
382
+ * @return the max char width
383
+ */
384
+ AsciiArtFontTexture.prototype._getFontWidth = function (font) {
385
+ var fontDraw = document.createElement("canvas");
386
+ var ctx = fontDraw.getContext("2d");
387
+ ctx.fillStyle = "white";
388
+ ctx.font = font;
389
+ return ctx.measureText("W").width;
390
+ };
391
+ // More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/
392
+ /**
393
+ * Gets the max char height of a font.
394
+ * @param font the font to use, use the W3C CSS notation
395
+ * @return the max char height
396
+ */
397
+ AsciiArtFontTexture.prototype._getFontHeight = function (font) {
398
+ var fontDraw = document.createElement("canvas");
399
+ var ctx = fontDraw.getContext("2d");
400
+ ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);
401
+ ctx.textBaseline = "top";
402
+ ctx.fillStyle = "white";
403
+ ctx.font = font;
404
+ ctx.fillText("jH|", 0, 0);
405
+ var pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;
406
+ var start = -1;
407
+ var end = -1;
408
+ for (var row = 0; row < fontDraw.height; row++) {
409
+ for (var column = 0; column < fontDraw.width; column++) {
410
+ var index = (row * fontDraw.width + column) * 4;
411
+ if (pixels[index] === 0) {
412
+ if (column === fontDraw.width - 1 && start !== -1) {
413
+ end = row;
414
+ row = fontDraw.height;
415
+ break;
416
+ }
417
+ continue;
418
+ }
419
+ else {
420
+ if (start === -1) {
421
+ start = row;
422
+ }
423
+ break;
424
+ }
425
+ }
426
+ }
427
+ return { height: end - start + 1, offset: start - 1 };
428
+ };
429
+ /**
430
+ * Clones the current AsciiArtTexture.
431
+ * @return the clone of the texture.
432
+ */
433
+ AsciiArtFontTexture.prototype.clone = function () {
434
+ return new AsciiArtFontTexture(this.name, this._font, this._text, this.getScene());
435
+ };
436
+ /**
437
+ * Parses a json object representing the texture and returns an instance of it.
438
+ * @param source the source JSON representation
439
+ * @param scene the scene to create the texture for
440
+ * @return the parsed texture
441
+ */
442
+ AsciiArtFontTexture.Parse = function (source, scene) {
443
+ var texture = core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.SerializationHelper.Parse(function () { return new AsciiArtFontTexture(source.name, source.font, source.text, scene); }, source, scene, null);
444
+ return texture;
445
+ };
446
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
447
+ (0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.serialize)("font")
448
+ ], AsciiArtFontTexture.prototype, "_font", void 0);
449
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
450
+ (0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.serialize)("text")
451
+ ], AsciiArtFontTexture.prototype, "_text", void 0);
452
+ return AsciiArtFontTexture;
453
+ }(core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.BaseTexture));
454
+
455
+ /**
456
+ * AsciiArtPostProcess helps rendering everithing in Ascii Art.
457
+ *
458
+ * Simmply add it to your scene and let the nerd that lives in you have fun.
459
+ * Example usage: var pp = new AsciiArtPostProcess("myAscii", "20px Monospace", camera);
460
+ */
461
+ var AsciiArtPostProcess = /** @class */ (function (_super) {
462
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(AsciiArtPostProcess, _super);
463
+ /**
464
+ * Instantiates a new Ascii Art Post Process.
465
+ * @param name the name to give to the postprocess
466
+ * @camera the camera to apply the post process to.
467
+ * @param camera
468
+ * @param options can either be the font name or an option object following the IAsciiArtPostProcessOptions format
469
+ */
470
+ function AsciiArtPostProcess(name, camera, options) {
471
+ var _this = _super.call(this, name, "asciiart", ["asciiArtFontInfos", "asciiArtOptions"], ["asciiArtFont"], {
472
+ width: camera.getEngine().getRenderWidth(),
473
+ height: camera.getEngine().getRenderHeight(),
474
+ }, camera, core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.TRILINEAR_SAMPLINGMODE, camera.getEngine(), true) || this;
475
+ /**
476
+ * This defines the amount you want to mix the "tile" or caracter space colored in the ascii art.
477
+ * This number is defined between 0 and 1;
478
+ */
479
+ _this.mixToTile = 0;
480
+ /**
481
+ * This defines the amount you want to mix the normal rendering pass in the ascii art.
482
+ * This number is defined between 0 and 1;
483
+ */
484
+ _this.mixToNormal = 0;
485
+ // Default values.
486
+ var font = "40px Monospace";
487
+ var characterSet = " `-.'_:,\"=^;<+!*?/cL\\zrs7TivJtC{3F)Il(xZfY5S2eajo14[nuyE]P6V9kXpKwGhqAUbOd8#HRDB0$mgMW&Q%N@";
488
+ // Use options.
489
+ if (options) {
490
+ if (typeof options === "string") {
491
+ font = options;
492
+ }
493
+ else {
494
+ font = options.font || font;
495
+ characterSet = options.characterSet || characterSet;
496
+ _this.mixToTile = options.mixToTile || _this.mixToTile;
497
+ _this.mixToNormal = options.mixToNormal || _this.mixToNormal;
498
+ }
499
+ }
500
+ _this._asciiArtFontTexture = new AsciiArtFontTexture(name, font, characterSet, camera.getScene());
501
+ var textureSize = _this._asciiArtFontTexture.getSize();
502
+ _this.onApply = function (effect) {
503
+ effect.setTexture("asciiArtFont", _this._asciiArtFontTexture);
504
+ effect.setFloat4("asciiArtFontInfos", _this._asciiArtFontTexture.charSize, characterSet.length, textureSize.width, textureSize.height);
505
+ effect.setFloat4("asciiArtOptions", _this.width, _this.height, _this.mixToNormal, _this.mixToTile);
506
+ };
507
+ return _this;
508
+ }
509
+ return AsciiArtPostProcess;
510
+ }(core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.PostProcess));
400
511
 
401
- module.exports = g;
402
512
 
403
513
 
404
514
  /***/ }),
405
515
 
406
- /***/ "./asciiArt/asciiArtPostProcess.ts":
407
- /*!*****************************************!*\
408
- !*** ./asciiArt/asciiArtPostProcess.ts ***!
409
- \*****************************************/
410
- /*! exports provided: AsciiArtFontTexture, AsciiArtPostProcess */
411
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
516
+ /***/ "../../../lts/postProcesses/dist/asciiArt/asciiart.fragment.js":
517
+ /*!*********************************************************************!*\
518
+ !*** ../../../lts/postProcesses/dist/asciiArt/asciiart.fragment.js ***!
519
+ \*********************************************************************/
520
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
412
521
 
413
- "use strict";
414
522
  __webpack_require__.r(__webpack_exports__);
415
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsciiArtFontTexture", function() { return AsciiArtFontTexture; });
416
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsciiArtPostProcess", function() { return AsciiArtPostProcess; });
417
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
418
- /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
419
- /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
420
- /* harmony import */ var _asciiart_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./asciiart.fragment */ "./asciiArt/asciiart.fragment.ts");
421
-
422
-
423
-
424
-
425
-
426
-
427
- /**
428
- * AsciiArtFontTexture is the helper class used to easily create your ascii art font texture.
429
- *
430
- * It basically takes care rendering the font front the given font size to a texture.
431
- * This is used later on in the postprocess.
432
- */
433
- var AsciiArtFontTexture = /** @class */ (function (_super) {
434
- Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(AsciiArtFontTexture, _super);
435
- /**
436
- * Create a new instance of the Ascii Art FontTexture class
437
- * @param name the name of the texture
438
- * @param font the font to use, use the W3C CSS notation
439
- * @param text the caracter set to use in the rendering.
440
- * @param scene the scene that owns the texture
441
- */
442
- function AsciiArtFontTexture(name, font, text, scene) {
443
- if (scene === void 0) { scene = null; }
444
- var _this = _super.call(this, scene) || this;
445
- scene = _this.getScene();
446
- if (!scene) {
447
- return _this;
448
- }
449
- _this.name = name;
450
- _this._text == text;
451
- _this._font == font;
452
- _this.wrapU = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].CLAMP_ADDRESSMODE;
453
- _this.wrapV = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].CLAMP_ADDRESSMODE;
454
- //this.anisotropicFilteringLevel = 1;
455
- // Get the font specific info.
456
- var maxCharHeight = _this.getFontHeight(font);
457
- var maxCharWidth = _this.getFontWidth(font);
458
- _this._charSize = Math.max(maxCharHeight.height, maxCharWidth);
459
- // This is an approximate size, but should always be able to fit at least the maxCharCount.
460
- var textureWidth = Math.ceil(_this._charSize * text.length);
461
- var textureHeight = _this._charSize;
462
- // Create the texture that will store the font characters.
463
- _this._texture = scene.getEngine().createDynamicTexture(textureWidth, textureHeight, false, babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].NEAREST_SAMPLINGMODE);
464
- //scene.getEngine().setclamp
465
- var textureSize = _this.getSize();
466
- // Create a canvas with the final size: the one matching the texture.
467
- var canvas = document.createElement("canvas");
468
- canvas.width = textureSize.width;
469
- canvas.height = textureSize.height;
470
- var context = canvas.getContext("2d");
471
- context.textBaseline = "top";
472
- context.font = font;
473
- context.fillStyle = "white";
474
- context.imageSmoothingEnabled = false;
475
- // Sets the text in the texture.
476
- for (var i = 0; i < text.length; i++) {
477
- context.fillText(text[i], i * _this._charSize, -maxCharHeight.offset);
478
- }
479
- // Flush the text in the dynamic texture.
480
- scene.getEngine().updateDynamicTexture(_this._texture, canvas, false, true);
481
- return _this;
482
- }
483
- Object.defineProperty(AsciiArtFontTexture.prototype, "charSize", {
484
- /**
485
- * Gets the size of one char in the texture (each char fits in size * size space in the texture).
486
- */
487
- get: function () {
488
- return this._charSize;
489
- },
490
- enumerable: false,
491
- configurable: true
492
- });
493
- /**
494
- * Gets the max char width of a font.
495
- * @param font the font to use, use the W3C CSS notation
496
- * @return the max char width
497
- */
498
- AsciiArtFontTexture.prototype.getFontWidth = function (font) {
499
- var fontDraw = document.createElement("canvas");
500
- var ctx = fontDraw.getContext('2d');
501
- ctx.fillStyle = 'white';
502
- ctx.font = font;
503
- return ctx.measureText("W").width;
504
- };
505
- // More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/
506
- /**
507
- * Gets the max char height of a font.
508
- * @param font the font to use, use the W3C CSS notation
509
- * @return the max char height
510
- */
511
- AsciiArtFontTexture.prototype.getFontHeight = function (font) {
512
- var fontDraw = document.createElement("canvas");
513
- var ctx = fontDraw.getContext('2d');
514
- ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);
515
- ctx.textBaseline = 'top';
516
- ctx.fillStyle = 'white';
517
- ctx.font = font;
518
- ctx.fillText('jH|', 0, 0);
519
- var pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;
520
- var start = -1;
521
- var end = -1;
522
- for (var row = 0; row < fontDraw.height; row++) {
523
- for (var column = 0; column < fontDraw.width; column++) {
524
- var index = (row * fontDraw.width + column) * 4;
525
- if (pixels[index] === 0) {
526
- if (column === fontDraw.width - 1 && start !== -1) {
527
- end = row;
528
- row = fontDraw.height;
529
- break;
530
- }
531
- continue;
532
- }
533
- else {
534
- if (start === -1) {
535
- start = row;
536
- }
537
- break;
538
- }
539
- }
540
- }
541
- return { height: (end - start) + 1, offset: start - 1 };
542
- };
543
- /**
544
- * Clones the current AsciiArtTexture.
545
- * @return the clone of the texture.
546
- */
547
- AsciiArtFontTexture.prototype.clone = function () {
548
- return new AsciiArtFontTexture(this.name, this._font, this._text, this.getScene());
549
- };
550
- /**
551
- * Parses a json object representing the texture and returns an instance of it.
552
- * @param source the source JSON representation
553
- * @param scene the scene to create the texture for
554
- * @return the parsed texture
555
- */
556
- AsciiArtFontTexture.Parse = function (source, scene) {
557
- 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);
558
- return texture;
559
- };
560
- Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
561
- Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("font")
562
- ], AsciiArtFontTexture.prototype, "_font", void 0);
563
- Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
564
- Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("text")
565
- ], AsciiArtFontTexture.prototype, "_text", void 0);
566
- return AsciiArtFontTexture;
567
- }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["BaseTexture"]));
568
-
569
- /**
570
- * AsciiArtPostProcess helps rendering everithing in Ascii Art.
571
- *
572
- * Simmply add it to your scene and let the nerd that lives in you have fun.
573
- * Example usage: var pp = new AsciiArtPostProcess("myAscii", "20px Monospace", camera);
574
- */
575
- var AsciiArtPostProcess = /** @class */ (function (_super) {
576
- Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(AsciiArtPostProcess, _super);
577
- /**
578
- * Instantiates a new Ascii Art Post Process.
579
- * @param name the name to give to the postprocess
580
- * @camera the camera to apply the post process to.
581
- * @param options can either be the font name or an option object following the IAsciiArtPostProcessOptions format
582
- */
583
- function AsciiArtPostProcess(name, camera, options) {
584
- var _this = _super.call(this, name, 'asciiart', ['asciiArtFontInfos', 'asciiArtOptions'], ['asciiArtFont'], {
585
- width: camera.getEngine().getRenderWidth(),
586
- height: camera.getEngine().getRenderHeight()
587
- }, camera, babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].TRILINEAR_SAMPLINGMODE, camera.getEngine(), true) || this;
588
- /**
589
- * This defines the amount you want to mix the "tile" or caracter space colored in the ascii art.
590
- * This number is defined between 0 and 1;
591
- */
592
- _this.mixToTile = 0;
593
- /**
594
- * This defines the amount you want to mix the normal rendering pass in the ascii art.
595
- * This number is defined between 0 and 1;
596
- */
597
- _this.mixToNormal = 0;
598
- // Default values.
599
- var font = "40px Monospace";
600
- var characterSet = " `-.'_:,\"=^;<+!*?/cL\\zrs7TivJtC{3F)Il(xZfY5S2eajo14[nuyE]P6V9kXpKwGhqAUbOd8#HRDB0$mgMW&Q%N@";
601
- // Use options.
602
- if (options) {
603
- if (typeof (options) === "string") {
604
- font = options;
605
- }
606
- else {
607
- font = options.font || font;
608
- characterSet = options.characterSet || characterSet;
609
- _this.mixToTile = options.mixToTile || _this.mixToTile;
610
- _this.mixToNormal = options.mixToNormal || _this.mixToNormal;
611
- }
612
- }
613
- _this._asciiArtFontTexture = new AsciiArtFontTexture(name, font, characterSet, camera.getScene());
614
- var textureSize = _this._asciiArtFontTexture.getSize();
615
- _this.onApply = function (effect) {
616
- effect.setTexture("asciiArtFont", _this._asciiArtFontTexture);
617
- effect.setFloat4("asciiArtFontInfos", _this._asciiArtFontTexture.charSize, characterSet.length, textureSize.width, textureSize.height);
618
- effect.setFloat4("asciiArtOptions", _this.width, _this.height, _this.mixToNormal, _this.mixToTile);
619
- };
620
- return _this;
621
- }
622
- return AsciiArtPostProcess;
623
- }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["PostProcess"]));
624
-
523
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
524
+ /* harmony export */ "asciiartPixelShader": () => (/* binding */ asciiartPixelShader)
525
+ /* harmony export */ });
526
+ /* harmony import */ var core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Engines/shaderStore */ "core/Misc/decorators");
527
+ /* harmony import */ var core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
528
+ // Do not edit.
625
529
 
626
-
627
- /***/ }),
628
-
629
- /***/ "./asciiArt/asciiart.fragment.ts":
630
- /*!***************************************!*\
631
- !*** ./asciiArt/asciiart.fragment.ts ***!
632
- \***************************************/
633
- /*! exports provided: asciiartPixelShader */
634
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
635
-
636
- "use strict";
637
- __webpack_require__.r(__webpack_exports__);
638
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asciiartPixelShader", function() { return asciiartPixelShader; });
639
- /* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Engines/shaderStore */ "babylonjs/Misc/decorators");
640
- /* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
641
-
642
- var name = 'asciiartPixelShader';
643
- 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\n#define CUSTOM_FRAGMENT_DEFINITIONS\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}";
644
- babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__["ShaderStore"].ShadersStore[name] = shader;
645
- /** @hidden */
646
- var asciiartPixelShader = { name: name, shader: shader };
530
+ var name = "asciiartPixelShader";
531
+ var shader = "varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D asciiArtFont;uniform vec4 asciiArtFontInfos;uniform vec4 asciiArtOptions;float getLuminance(vec3 color)\n{return clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{float caracterSize=asciiArtFontInfos.x;float numChar=asciiArtFontInfos.y-1.0;float fontx=asciiArtFontInfos.z;float fonty=asciiArtFontInfos.w;float screenx=asciiArtOptions.x;float screeny=asciiArtOptions.y;float tileX=float(floor((gl_FragCoord.x)/caracterSize))*caracterSize/screenx;float tileY=float(floor((gl_FragCoord.y)/caracterSize))*caracterSize/screeny;vec2 tileUV=vec2(tileX,tileY);vec4 tileColor=texture2D(textureSampler,tileUV);vec4 baseColor=texture2D(textureSampler,vUV);float tileLuminance=getLuminance(tileColor.rgb);float offsetx=(float(floor(tileLuminance*numChar)))*caracterSize/fontx;float offsety=0.0;float x=float(mod(gl_FragCoord.x,caracterSize))/fontx;float y=float(mod(gl_FragCoord.y,caracterSize))/fonty;vec4 finalColor= texture2D(asciiArtFont,vec2(offsetx+x,offsety+(caracterSize/fonty-y)));finalColor.rgb*=tileColor.rgb;finalColor.a=1.0;finalColor= mix(finalColor,tileColor,asciiArtOptions.w);finalColor= mix(finalColor,baseColor,asciiArtOptions.z);gl_FragColor=finalColor;}";
532
+ // Sideeffect
533
+ core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
534
+ /** @hidden */
535
+ var asciiartPixelShader = { name: name, shader: shader };
647
536
 
648
537
 
649
538
  /***/ }),
650
539
 
651
- /***/ "./asciiArt/index.ts":
652
- /*!***************************!*\
653
- !*** ./asciiArt/index.ts ***!
654
- \***************************/
655
- /*! exports provided: AsciiArtFontTexture, AsciiArtPostProcess */
656
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
540
+ /***/ "../../../lts/postProcesses/dist/asciiArt/index.js":
541
+ /*!*********************************************************!*\
542
+ !*** ../../../lts/postProcesses/dist/asciiArt/index.js ***!
543
+ \*********************************************************/
544
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
657
545
 
658
- "use strict";
659
546
  __webpack_require__.r(__webpack_exports__);
660
- /* harmony import */ var _asciiArtPostProcess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asciiArtPostProcess */ "./asciiArt/asciiArtPostProcess.ts");
661
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AsciiArtFontTexture", function() { return _asciiArtPostProcess__WEBPACK_IMPORTED_MODULE_0__["AsciiArtFontTexture"]; });
662
-
663
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AsciiArtPostProcess", function() { return _asciiArtPostProcess__WEBPACK_IMPORTED_MODULE_0__["AsciiArtPostProcess"]; });
547
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
548
+ /* harmony export */ "AsciiArtFontTexture": () => (/* reexport safe */ _asciiArtPostProcess__WEBPACK_IMPORTED_MODULE_0__.AsciiArtFontTexture),
549
+ /* harmony export */ "AsciiArtPostProcess": () => (/* reexport safe */ _asciiArtPostProcess__WEBPACK_IMPORTED_MODULE_0__.AsciiArtPostProcess)
550
+ /* harmony export */ });
551
+ /* harmony import */ var _asciiArtPostProcess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asciiArtPostProcess */ "../../../lts/postProcesses/dist/asciiArt/asciiArtPostProcess.js");
664
552
 
665
-
666
553
 
667
554
 
668
555
  /***/ }),
669
556
 
670
- /***/ "./digitalRain/digitalRainPostProcess.ts":
671
- /*!***********************************************!*\
672
- !*** ./digitalRain/digitalRainPostProcess.ts ***!
673
- \***********************************************/
674
- /*! exports provided: DigitalRainFontTexture, DigitalRainPostProcess */
675
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
557
+ /***/ "../../../lts/postProcesses/dist/digitalRain/digitalRainPostProcess.js":
558
+ /*!*****************************************************************************!*\
559
+ !*** ../../../lts/postProcesses/dist/digitalRain/digitalRainPostProcess.js ***!
560
+ \*****************************************************************************/
561
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
676
562
 
677
- "use strict";
678
563
  __webpack_require__.r(__webpack_exports__);
679
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DigitalRainFontTexture", function() { return DigitalRainFontTexture; });
680
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DigitalRainPostProcess", function() { return DigitalRainPostProcess; });
681
- /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
682
- /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
683
- /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
684
- /* harmony import */ var _digitalrain_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./digitalrain.fragment */ "./digitalRain/digitalrain.fragment.ts");
685
-
686
-
687
-
688
-
689
-
690
-
691
-
692
- /**
693
- * DigitalRainFontTexture is the helper class used to easily create your digital rain font texture.
694
- *
695
- * It basically takes care rendering the font front the given font size to a texture.
696
- * This is used later on in the postprocess.
697
- */
698
- var DigitalRainFontTexture = /** @class */ (function (_super) {
699
- Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DigitalRainFontTexture, _super);
700
- /**
701
- * Create a new instance of the Digital Rain FontTexture class
702
- * @param name the name of the texture
703
- * @param font the font to use, use the W3C CSS notation
704
- * @param text the caracter set to use in the rendering.
705
- * @param scene the scene that owns the texture
706
- */
707
- function DigitalRainFontTexture(name, font, text, scene) {
708
- if (scene === void 0) { scene = null; }
709
- var _this = _super.call(this, scene) || this;
710
- scene = _this.getScene();
711
- if (!scene) {
712
- return _this;
713
- }
714
- _this.name = name;
715
- _this._text == text;
716
- _this._font == font;
717
- _this.wrapU = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].CLAMP_ADDRESSMODE;
718
- _this.wrapV = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].CLAMP_ADDRESSMODE;
719
- // Get the font specific info.
720
- var maxCharHeight = _this.getFontHeight(font);
721
- var maxCharWidth = _this.getFontWidth(font);
722
- _this._charSize = Math.max(maxCharHeight.height, maxCharWidth);
723
- // This is an approximate size, but should always be able to fit at least the maxCharCount.
724
- var textureWidth = _this._charSize;
725
- var textureHeight = Math.ceil(_this._charSize * text.length);
726
- // Create the texture that will store the font characters.
727
- _this._texture = scene.getEngine().createDynamicTexture(textureWidth, textureHeight, false, babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].NEAREST_SAMPLINGMODE);
728
- //scene.getEngine().setclamp
729
- var textureSize = _this.getSize();
730
- // Create a canvas with the final size: the one matching the texture.
731
- var canvas = document.createElement("canvas");
732
- canvas.width = textureSize.width;
733
- canvas.height = textureSize.height;
734
- var context = canvas.getContext("2d");
735
- context.textBaseline = "top";
736
- context.font = font;
737
- context.fillStyle = "white";
738
- context.imageSmoothingEnabled = false;
739
- // Sets the text in the texture.
740
- for (var i = 0; i < text.length; i++) {
741
- context.fillText(text[i], 0, i * _this._charSize - maxCharHeight.offset);
742
- }
743
- // Flush the text in the dynamic texture.
744
- scene.getEngine().updateDynamicTexture(_this._texture, canvas, false, true);
745
- return _this;
746
- }
747
- Object.defineProperty(DigitalRainFontTexture.prototype, "charSize", {
748
- /**
749
- * Gets the size of one char in the texture (each char fits in size * size space in the texture).
750
- */
751
- get: function () {
752
- return this._charSize;
753
- },
754
- enumerable: false,
755
- configurable: true
756
- });
757
- /**
758
- * Gets the max char width of a font.
759
- * @param font the font to use, use the W3C CSS notation
760
- * @return the max char width
761
- */
762
- DigitalRainFontTexture.prototype.getFontWidth = function (font) {
763
- var fontDraw = document.createElement("canvas");
764
- var ctx = fontDraw.getContext('2d');
765
- ctx.fillStyle = 'white';
766
- ctx.font = font;
767
- return ctx.measureText("W").width;
768
- };
769
- // More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/
770
- /**
771
- * Gets the max char height of a font.
772
- * @param font the font to use, use the W3C CSS notation
773
- * @return the max char height
774
- */
775
- DigitalRainFontTexture.prototype.getFontHeight = function (font) {
776
- var fontDraw = document.createElement("canvas");
777
- var ctx = fontDraw.getContext('2d');
778
- ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);
779
- ctx.textBaseline = 'top';
780
- ctx.fillStyle = 'white';
781
- ctx.font = font;
782
- ctx.fillText('jH|', 0, 0);
783
- var pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;
784
- var start = -1;
785
- var end = -1;
786
- for (var row = 0; row < fontDraw.height; row++) {
787
- for (var column = 0; column < fontDraw.width; column++) {
788
- var index = (row * fontDraw.width + column) * 4;
789
- if (pixels[index] === 0) {
790
- if (column === fontDraw.width - 1 && start !== -1) {
791
- end = row;
792
- row = fontDraw.height;
793
- break;
794
- }
795
- continue;
796
- }
797
- else {
798
- if (start === -1) {
799
- start = row;
800
- }
801
- break;
802
- }
803
- }
804
- }
805
- return { height: (end - start) + 1, offset: start - 1 };
806
- };
807
- /**
808
- * Clones the current DigitalRainFontTexture.
809
- * @return the clone of the texture.
810
- */
811
- DigitalRainFontTexture.prototype.clone = function () {
812
- return new DigitalRainFontTexture(this.name, this._font, this._text, this.getScene());
813
- };
814
- /**
815
- * Parses a json object representing the texture and returns an instance of it.
816
- * @param source the source JSON representation
817
- * @param scene the scene to create the texture for
818
- * @return the parsed texture
819
- */
820
- DigitalRainFontTexture.Parse = function (source, scene) {
821
- 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);
822
- return texture;
823
- };
824
- Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
825
- Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("font")
826
- ], DigitalRainFontTexture.prototype, "_font", void 0);
827
- Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
828
- Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("text")
829
- ], DigitalRainFontTexture.prototype, "_text", void 0);
830
- return DigitalRainFontTexture;
831
- }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["BaseTexture"]));
832
-
833
- /**
834
- * DigitalRainPostProcess helps rendering everithing in digital rain.
835
- *
836
- * Simmply add it to your scene and let the nerd that lives in you have fun.
837
- * Example usage: var pp = new DigitalRainPostProcess("digitalRain", "20px Monospace", camera);
838
- */
839
- var DigitalRainPostProcess = /** @class */ (function (_super) {
840
- Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DigitalRainPostProcess, _super);
841
- /**
842
- * Instantiates a new Digital Rain Post Process.
843
- * @param name the name to give to the postprocess
844
- * @camera the camera to apply the post process to.
845
- * @param options can either be the font name or an option object following the IDigitalRainPostProcessOptions format
846
- */
847
- function DigitalRainPostProcess(name, camera, options) {
848
- var _this = _super.call(this, name, 'digitalrain', ['digitalRainFontInfos', 'digitalRainOptions', 'cosTimeZeroOne', 'matrixSpeed'], ['digitalRainFont'], {
849
- width: camera.getEngine().getRenderWidth(),
850
- height: camera.getEngine().getRenderHeight()
851
- }, camera, babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Texture"].TRILINEAR_SAMPLINGMODE, camera.getEngine(), true) || this;
852
- /**
853
- * This defines the amount you want to mix the "tile" or caracter space colored in the digital rain.
854
- * This number is defined between 0 and 1;
855
- */
856
- _this.mixToTile = 0;
857
- /**
858
- * This defines the amount you want to mix the normal rendering pass in the digital rain.
859
- * This number is defined between 0 and 1;
860
- */
861
- _this.mixToNormal = 0;
862
- /**
863
- * Speed of the effect
864
- */
865
- _this.speed = 0.003;
866
- // Default values.
867
- var font = "15px Monospace";
868
- var characterSet = "古池や蛙飛び込む水の音ふるいけやかわずとびこむみずのおと初しぐれ猿も小蓑をほしげ也はつしぐれさるもこみのをほしげなり江戸の雨何石呑んだ時鳥えどのあめなんごくのんだほととぎす";
869
- // Use options.
870
- if (options) {
871
- if (typeof (options) === "string") {
872
- font = options;
873
- }
874
- else {
875
- font = options.font || font;
876
- _this.mixToTile = options.mixToTile || _this.mixToTile;
877
- _this.mixToNormal = options.mixToNormal || _this.mixToNormal;
878
- }
879
- }
880
- _this._digitalRainFontTexture = new DigitalRainFontTexture(name, font, characterSet, camera.getScene());
881
- var textureSize = _this._digitalRainFontTexture.getSize();
882
- var alpha = 0.0;
883
- var cosTimeZeroOne = 0.0;
884
- 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());
885
- _this.onApply = function (effect) {
886
- effect.setTexture("digitalRainFont", _this._digitalRainFontTexture);
887
- effect.setFloat4("digitalRainFontInfos", _this._digitalRainFontTexture.charSize, characterSet.length, textureSize.width, textureSize.height);
888
- effect.setFloat4("digitalRainOptions", _this.width, _this.height, _this.mixToNormal, _this.mixToTile);
889
- effect.setMatrix("matrixSpeed", matrix);
890
- alpha += _this.speed;
891
- cosTimeZeroOne = alpha;
892
- effect.setFloat('cosTimeZeroOne', cosTimeZeroOne);
893
- };
894
- return _this;
895
- }
896
- return DigitalRainPostProcess;
897
- }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["PostProcess"]));
898
-
564
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
565
+ /* harmony export */ "DigitalRainFontTexture": () => (/* binding */ DigitalRainFontTexture),
566
+ /* harmony export */ "DigitalRainPostProcess": () => (/* binding */ DigitalRainPostProcess)
567
+ /* harmony export */ });
568
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
569
+ /* harmony import */ var core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Engines/Extensions/engine.dynamicTexture */ "core/Misc/decorators");
570
+ /* harmony import */ var core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
571
+ /* harmony import */ var _digitalrain_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./digitalrain.fragment */ "../../../lts/postProcesses/dist/digitalRain/digitalrain.fragment.js");
572
+
573
+
574
+
575
+
576
+
577
+
578
+
579
+
580
+ /**
581
+ * DigitalRainFontTexture is the helper class used to easily create your digital rain font texture.
582
+ *
583
+ * It basically takes care rendering the font front the given font size to a texture.
584
+ * This is used later on in the postprocess.
585
+ */
586
+ var DigitalRainFontTexture = /** @class */ (function (_super) {
587
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(DigitalRainFontTexture, _super);
588
+ /**
589
+ * Create a new instance of the Digital Rain FontTexture class
590
+ * @param name the name of the texture
591
+ * @param font the font to use, use the W3C CSS notation
592
+ * @param text the caracter set to use in the rendering.
593
+ * @param scene the scene that owns the texture
594
+ */
595
+ function DigitalRainFontTexture(name, font, text, scene) {
596
+ if (scene === void 0) { scene = null; }
597
+ var _this = _super.call(this, scene) || this;
598
+ scene = _this.getScene();
599
+ if (!scene) {
600
+ return _this;
601
+ }
602
+ _this.name = name;
603
+ _this._text == text;
604
+ _this._font == font;
605
+ _this.wrapU = core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.CLAMP_ADDRESSMODE;
606
+ _this.wrapV = core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.CLAMP_ADDRESSMODE;
607
+ // Get the font specific info.
608
+ var maxCharHeight = _this._getFontHeight(font);
609
+ var maxCharWidth = _this._getFontWidth(font);
610
+ _this._charSize = Math.max(maxCharHeight.height, maxCharWidth);
611
+ // This is an approximate size, but should always be able to fit at least the maxCharCount.
612
+ var textureWidth = _this._charSize;
613
+ var textureHeight = Math.ceil(_this._charSize * text.length);
614
+ // Create the texture that will store the font characters.
615
+ _this._texture = scene.getEngine().createDynamicTexture(textureWidth, textureHeight, false, core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.NEAREST_SAMPLINGMODE);
616
+ //scene.getEngine().setclamp
617
+ var textureSize = _this.getSize();
618
+ // Create a canvas with the final size: the one matching the texture.
619
+ var canvas = document.createElement("canvas");
620
+ canvas.width = textureSize.width;
621
+ canvas.height = textureSize.height;
622
+ var context = canvas.getContext("2d");
623
+ context.textBaseline = "top";
624
+ context.font = font;
625
+ context.fillStyle = "white";
626
+ context.imageSmoothingEnabled = false;
627
+ // Sets the text in the texture.
628
+ for (var i = 0; i < text.length; i++) {
629
+ context.fillText(text[i], 0, i * _this._charSize - maxCharHeight.offset);
630
+ }
631
+ // Flush the text in the dynamic texture.
632
+ scene.getEngine().updateDynamicTexture(_this._texture, canvas, false, true);
633
+ return _this;
634
+ }
635
+ Object.defineProperty(DigitalRainFontTexture.prototype, "charSize", {
636
+ /**
637
+ * Gets the size of one char in the texture (each char fits in size * size space in the texture).
638
+ */
639
+ get: function () {
640
+ return this._charSize;
641
+ },
642
+ enumerable: false,
643
+ configurable: true
644
+ });
645
+ /**
646
+ * Gets the max char width of a font.
647
+ * @param font the font to use, use the W3C CSS notation
648
+ * @return the max char width
649
+ */
650
+ DigitalRainFontTexture.prototype._getFontWidth = function (font) {
651
+ var fontDraw = document.createElement("canvas");
652
+ var ctx = fontDraw.getContext("2d");
653
+ ctx.fillStyle = "white";
654
+ ctx.font = font;
655
+ return ctx.measureText("W").width;
656
+ };
657
+ // More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/
658
+ /**
659
+ * Gets the max char height of a font.
660
+ * @param font the font to use, use the W3C CSS notation
661
+ * @return the max char height
662
+ */
663
+ DigitalRainFontTexture.prototype._getFontHeight = function (font) {
664
+ var fontDraw = document.createElement("canvas");
665
+ var ctx = fontDraw.getContext("2d");
666
+ ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);
667
+ ctx.textBaseline = "top";
668
+ ctx.fillStyle = "white";
669
+ ctx.font = font;
670
+ ctx.fillText("jH|", 0, 0);
671
+ var pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;
672
+ var start = -1;
673
+ var end = -1;
674
+ for (var row = 0; row < fontDraw.height; row++) {
675
+ for (var column = 0; column < fontDraw.width; column++) {
676
+ var index = (row * fontDraw.width + column) * 4;
677
+ if (pixels[index] === 0) {
678
+ if (column === fontDraw.width - 1 && start !== -1) {
679
+ end = row;
680
+ row = fontDraw.height;
681
+ break;
682
+ }
683
+ continue;
684
+ }
685
+ else {
686
+ if (start === -1) {
687
+ start = row;
688
+ }
689
+ break;
690
+ }
691
+ }
692
+ }
693
+ return { height: end - start + 1, offset: start - 1 };
694
+ };
695
+ /**
696
+ * Clones the current DigitalRainFontTexture.
697
+ * @return the clone of the texture.
698
+ */
699
+ DigitalRainFontTexture.prototype.clone = function () {
700
+ return new DigitalRainFontTexture(this.name, this._font, this._text, this.getScene());
701
+ };
702
+ /**
703
+ * Parses a json object representing the texture and returns an instance of it.
704
+ * @param source the source JSON representation
705
+ * @param scene the scene to create the texture for
706
+ * @return the parsed texture
707
+ */
708
+ DigitalRainFontTexture.Parse = function (source, scene) {
709
+ var texture = core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.SerializationHelper.Parse(function () { return new DigitalRainFontTexture(source.name, source.font, source.text, scene); }, source, scene, null);
710
+ return texture;
711
+ };
712
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
713
+ (0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.serialize)("font")
714
+ ], DigitalRainFontTexture.prototype, "_font", void 0);
715
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
716
+ (0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.serialize)("text")
717
+ ], DigitalRainFontTexture.prototype, "_text", void 0);
718
+ return DigitalRainFontTexture;
719
+ }(core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.BaseTexture));
720
+
721
+ /**
722
+ * DigitalRainPostProcess helps rendering everithing in digital rain.
723
+ *
724
+ * Simmply add it to your scene and let the nerd that lives in you have fun.
725
+ * Example usage: var pp = new DigitalRainPostProcess("digitalRain", "20px Monospace", camera);
726
+ */
727
+ var DigitalRainPostProcess = /** @class */ (function (_super) {
728
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(DigitalRainPostProcess, _super);
729
+ /**
730
+ * Instantiates a new Digital Rain Post Process.
731
+ * @param name the name to give to the postprocess
732
+ * @camera the camera to apply the post process to.
733
+ * @param camera
734
+ * @param options can either be the font name or an option object following the IDigitalRainPostProcessOptions format
735
+ */
736
+ function DigitalRainPostProcess(name, camera, options) {
737
+ var _this = _super.call(this, name, "digitalrain", ["digitalRainFontInfos", "digitalRainOptions", "cosTimeZeroOne", "matrixSpeed"], ["digitalRainFont"], {
738
+ width: camera.getEngine().getRenderWidth(),
739
+ height: camera.getEngine().getRenderHeight(),
740
+ }, camera, core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.TRILINEAR_SAMPLINGMODE, camera.getEngine(), true) || this;
741
+ /**
742
+ * This defines the amount you want to mix the "tile" or caracter space colored in the digital rain.
743
+ * This number is defined between 0 and 1;
744
+ */
745
+ _this.mixToTile = 0;
746
+ /**
747
+ * This defines the amount you want to mix the normal rendering pass in the digital rain.
748
+ * This number is defined between 0 and 1;
749
+ */
750
+ _this.mixToNormal = 0;
751
+ /**
752
+ * Speed of the effect
753
+ */
754
+ _this.speed = 0.003;
755
+ // Default values.
756
+ var font = "15px Monospace";
757
+ var characterSet = "古池や蛙飛び込む水の音ふるいけやかわずとびこむみずのおと初しぐれ猿も小蓑をほしげ也はつしぐれさるもこみのをほしげなり江戸の雨何石呑んだ時鳥えどのあめなんごくのんだほととぎす";
758
+ // Use options.
759
+ if (options) {
760
+ if (typeof options === "string") {
761
+ font = options;
762
+ }
763
+ else {
764
+ font = options.font || font;
765
+ _this.mixToTile = options.mixToTile || _this.mixToTile;
766
+ _this.mixToNormal = options.mixToNormal || _this.mixToNormal;
767
+ }
768
+ }
769
+ _this._digitalRainFontTexture = new DigitalRainFontTexture(name, font, characterSet, camera.getScene());
770
+ var textureSize = _this._digitalRainFontTexture.getSize();
771
+ var alpha = 0.0;
772
+ var cosTimeZeroOne = 0.0;
773
+ var matrix = core_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());
774
+ _this.onApply = function (effect) {
775
+ effect.setTexture("digitalRainFont", _this._digitalRainFontTexture);
776
+ effect.setFloat4("digitalRainFontInfos", _this._digitalRainFontTexture.charSize, characterSet.length, textureSize.width, textureSize.height);
777
+ effect.setFloat4("digitalRainOptions", _this.width, _this.height, _this.mixToNormal, _this.mixToTile);
778
+ effect.setMatrix("matrixSpeed", matrix);
779
+ alpha += _this.speed;
780
+ cosTimeZeroOne = alpha;
781
+ effect.setFloat("cosTimeZeroOne", cosTimeZeroOne);
782
+ };
783
+ return _this;
784
+ }
785
+ return DigitalRainPostProcess;
786
+ }(core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.PostProcess));
787
+
899
788
 
900
789
 
901
790
  /***/ }),
902
791
 
903
- /***/ "./digitalRain/digitalrain.fragment.ts":
904
- /*!*********************************************!*\
905
- !*** ./digitalRain/digitalrain.fragment.ts ***!
906
- \*********************************************/
907
- /*! exports provided: digitalrainPixelShader */
908
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
792
+ /***/ "../../../lts/postProcesses/dist/digitalRain/digitalrain.fragment.js":
793
+ /*!***************************************************************************!*\
794
+ !*** ../../../lts/postProcesses/dist/digitalRain/digitalrain.fragment.js ***!
795
+ \***************************************************************************/
796
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
909
797
 
910
- "use strict";
911
798
  __webpack_require__.r(__webpack_exports__);
912
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "digitalrainPixelShader", function() { return digitalrainPixelShader; });
913
- /* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Engines/shaderStore */ "babylonjs/Misc/decorators");
914
- /* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
915
-
916
- var name = 'digitalrainPixelShader';
917
- 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\n#define CUSTOM_FRAGMENT_DEFINITIONS\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}";
918
- babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__["ShaderStore"].ShadersStore[name] = shader;
919
- /** @hidden */
920
- var digitalrainPixelShader = { name: name, shader: shader };
799
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
800
+ /* harmony export */ "digitalrainPixelShader": () => (/* binding */ digitalrainPixelShader)
801
+ /* harmony export */ });
802
+ /* harmony import */ var core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Engines/shaderStore */ "core/Misc/decorators");
803
+ /* harmony import */ var core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
804
+ // Do not edit.
805
+
806
+ var name = "digitalrainPixelShader";
807
+ var shader = "varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D digitalRainFont;uniform vec4 digitalRainFontInfos;uniform vec4 digitalRainOptions;uniform mat4 matrixSpeed;uniform float cosTimeZeroOne;float getLuminance(vec3 color)\n{return clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) \n{float caracterSize=digitalRainFontInfos.x;float numChar=digitalRainFontInfos.y-1.0;float fontx=digitalRainFontInfos.z;float fonty=digitalRainFontInfos.w;float screenx=digitalRainOptions.x;float screeny=digitalRainOptions.y;float ratio=screeny/fonty;float columnx=float(floor((gl_FragCoord.x)/caracterSize));float tileX=float(floor((gl_FragCoord.x)/caracterSize))*caracterSize/screenx;float tileY=float(floor((gl_FragCoord.y)/caracterSize))*caracterSize/screeny;vec2 tileUV=vec2(tileX,tileY);vec4 tileColor=texture2D(textureSampler,tileUV);vec4 baseColor=texture2D(textureSampler,vUV);float tileLuminance=getLuminance(tileColor.rgb);int st=int(mod(columnx,4.0));float speed=cosTimeZeroOne*(sin(tileX*314.5)*0.5+0.6); \nfloat x=float(mod(gl_FragCoord.x,caracterSize))/fontx;float y=float(mod(speed+gl_FragCoord.y/screeny,1.0));y*=ratio;vec4 finalColor= texture2D(digitalRainFont,vec2(x,1.0-y));vec3 high=finalColor.rgb*(vec3(1.2,1.2,1.2)*pow(1.0-y,30.0));finalColor.rgb*=vec3(pow(tileLuminance,5.0),pow(tileLuminance,1.5),pow(tileLuminance,3.0));finalColor.rgb+=high;finalColor.rgb=clamp(finalColor.rgb,0.,1.);finalColor.a=1.0;finalColor= mix(finalColor,tileColor,digitalRainOptions.w);finalColor= mix(finalColor,baseColor,digitalRainOptions.z);gl_FragColor=finalColor;}";
808
+ // Sideeffect
809
+ core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
810
+ /** @hidden */
811
+ var digitalrainPixelShader = { name: name, shader: shader };
921
812
 
922
813
 
923
814
  /***/ }),
924
815
 
925
- /***/ "./digitalRain/index.ts":
926
- /*!******************************!*\
927
- !*** ./digitalRain/index.ts ***!
928
- \******************************/
929
- /*! exports provided: DigitalRainFontTexture, DigitalRainPostProcess */
930
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
816
+ /***/ "../../../lts/postProcesses/dist/digitalRain/index.js":
817
+ /*!************************************************************!*\
818
+ !*** ../../../lts/postProcesses/dist/digitalRain/index.js ***!
819
+ \************************************************************/
820
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
931
821
 
932
- "use strict";
933
822
  __webpack_require__.r(__webpack_exports__);
934
- /* harmony import */ var _digitalRainPostProcess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./digitalRainPostProcess */ "./digitalRain/digitalRainPostProcess.ts");
935
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DigitalRainFontTexture", function() { return _digitalRainPostProcess__WEBPACK_IMPORTED_MODULE_0__["DigitalRainFontTexture"]; });
823
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
824
+ /* harmony export */ "DigitalRainFontTexture": () => (/* reexport safe */ _digitalRainPostProcess__WEBPACK_IMPORTED_MODULE_0__.DigitalRainFontTexture),
825
+ /* harmony export */ "DigitalRainPostProcess": () => (/* reexport safe */ _digitalRainPostProcess__WEBPACK_IMPORTED_MODULE_0__.DigitalRainPostProcess)
826
+ /* harmony export */ });
827
+ /* harmony import */ var _digitalRainPostProcess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./digitalRainPostProcess */ "../../../lts/postProcesses/dist/digitalRain/digitalRainPostProcess.js");
936
828
 
937
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DigitalRainPostProcess", function() { return _digitalRainPostProcess__WEBPACK_IMPORTED_MODULE_0__["DigitalRainPostProcess"]; });
938
-
939
-
940
829
 
941
830
 
942
831
  /***/ }),
943
832
 
944
- /***/ "./index.ts":
945
- /*!******************!*\
946
- !*** ./index.ts ***!
947
- \******************/
948
- /*! exports provided: AsciiArtFontTexture, AsciiArtPostProcess, DigitalRainFontTexture, DigitalRainPostProcess */
949
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
833
+ /***/ "../../../lts/postProcesses/dist/index.js":
834
+ /*!************************************************!*\
835
+ !*** ../../../lts/postProcesses/dist/index.js ***!
836
+ \************************************************/
837
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
950
838
 
951
- "use strict";
952
839
  __webpack_require__.r(__webpack_exports__);
953
- /* harmony import */ var _asciiArt_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asciiArt/index */ "./asciiArt/index.ts");
954
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AsciiArtFontTexture", function() { return _asciiArt_index__WEBPACK_IMPORTED_MODULE_0__["AsciiArtFontTexture"]; });
955
-
956
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AsciiArtPostProcess", function() { return _asciiArt_index__WEBPACK_IMPORTED_MODULE_0__["AsciiArtPostProcess"]; });
840
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
841
+ /* harmony export */ "AsciiArtFontTexture": () => (/* reexport safe */ _asciiArt_index__WEBPACK_IMPORTED_MODULE_0__.AsciiArtFontTexture),
842
+ /* harmony export */ "AsciiArtPostProcess": () => (/* reexport safe */ _asciiArt_index__WEBPACK_IMPORTED_MODULE_0__.AsciiArtPostProcess),
843
+ /* harmony export */ "DigitalRainFontTexture": () => (/* reexport safe */ _digitalRain_index__WEBPACK_IMPORTED_MODULE_1__.DigitalRainFontTexture),
844
+ /* harmony export */ "DigitalRainPostProcess": () => (/* reexport safe */ _digitalRain_index__WEBPACK_IMPORTED_MODULE_1__.DigitalRainPostProcess)
845
+ /* harmony export */ });
846
+ /* harmony import */ var _asciiArt_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asciiArt/index */ "../../../lts/postProcesses/dist/asciiArt/index.js");
847
+ /* harmony import */ var _digitalRain_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./digitalRain/index */ "../../../lts/postProcesses/dist/digitalRain/index.js");
848
+ /* eslint-disable import/no-internal-modules */
957
849
 
958
- /* harmony import */ var _digitalRain_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./digitalRain/index */ "./digitalRain/index.ts");
959
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DigitalRainFontTexture", function() { return _digitalRain_index__WEBPACK_IMPORTED_MODULE_1__["DigitalRainFontTexture"]; });
960
850
 
961
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DigitalRainPostProcess", function() { return _digitalRain_index__WEBPACK_IMPORTED_MODULE_1__["DigitalRainPostProcess"]; });
962
-
963
-
964
-
965
851
 
966
852
 
967
853
  /***/ }),
968
854
 
969
- /***/ "./legacy/legacy.ts":
970
- /*!**************************!*\
971
- !*** ./legacy/legacy.ts ***!
972
- \**************************/
973
- /*! exports provided: AsciiArtFontTexture, AsciiArtPostProcess, DigitalRainFontTexture, DigitalRainPostProcess */
974
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
855
+ /***/ "../../../lts/postProcesses/dist/legacy/legacy.js":
856
+ /*!********************************************************!*\
857
+ !*** ../../../lts/postProcesses/dist/legacy/legacy.js ***!
858
+ \********************************************************/
859
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
975
860
 
976
- "use strict";
977
861
  __webpack_require__.r(__webpack_exports__);
978
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../index */ "./index.ts");
979
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AsciiArtFontTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["AsciiArtFontTexture"]; });
980
-
981
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AsciiArtPostProcess", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["AsciiArtPostProcess"]; });
862
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
863
+ /* harmony export */ "AsciiArtFontTexture": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.AsciiArtFontTexture),
864
+ /* harmony export */ "AsciiArtPostProcess": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.AsciiArtPostProcess),
865
+ /* harmony export */ "DigitalRainFontTexture": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.DigitalRainFontTexture),
866
+ /* harmony export */ "DigitalRainPostProcess": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.DigitalRainPostProcess)
867
+ /* harmony export */ });
868
+ /* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../index */ "../../../lts/postProcesses/dist/index.js");
869
+ /* eslint-disable import/no-internal-modules */
870
+
871
+ /**
872
+ *
873
+ * This is the entry point for the UMD module.
874
+ * The entry point for a future ESM package should be index.ts
875
+ */
876
+ var globalObject = typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof window !== "undefined" ? window : undefined;
877
+ if (typeof globalObject !== "undefined") {
878
+ for (var key in _index__WEBPACK_IMPORTED_MODULE_0__) {
879
+ globalObject.BABYLON[key] = _index__WEBPACK_IMPORTED_MODULE_0__[key];
880
+ }
881
+ }
982
882
 
983
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DigitalRainFontTexture", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["DigitalRainFontTexture"]; });
984
883
 
985
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DigitalRainPostProcess", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["DigitalRainPostProcess"]; });
986
-
987
-
988
- /**
989
- *
990
- * This is the entry point for the UMD module.
991
- * The entry point for a future ESM package should be index.ts
992
- */
993
- var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
994
- if (typeof globalObject !== "undefined") {
995
- for (var key in _index__WEBPACK_IMPORTED_MODULE_0__) {
996
- globalObject.BABYLON[key] = _index__WEBPACK_IMPORTED_MODULE_0__[key];
997
- }
998
- }
999
-
1000
-
1001
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js")))
1002
884
 
1003
885
  /***/ }),
1004
886
 
1005
- /***/ "babylonjs/Misc/decorators":
887
+ /***/ "core/Misc/decorators":
1006
888
  /*!****************************************************************************************************!*\
1007
889
  !*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
1008
890
  \****************************************************************************************************/
1009
- /*! no static exports found */
1010
- /***/ (function(module, exports) {
891
+ /***/ ((module) => {
1011
892
 
1012
- module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__;
893
+ module.exports = __WEBPACK_EXTERNAL_MODULE_core_Misc_decorators__;
1013
894
 
1014
895
  /***/ })
1015
896
 
1016
- /******/ });
897
+ /******/ });
898
+ /************************************************************************/
899
+ /******/ // The module cache
900
+ /******/ var __webpack_module_cache__ = {};
901
+ /******/
902
+ /******/ // The require function
903
+ /******/ function __webpack_require__(moduleId) {
904
+ /******/ // Check if module is in cache
905
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
906
+ /******/ if (cachedModule !== undefined) {
907
+ /******/ return cachedModule.exports;
908
+ /******/ }
909
+ /******/ // Create a new module (and put it into the cache)
910
+ /******/ var module = __webpack_module_cache__[moduleId] = {
911
+ /******/ // no module.id needed
912
+ /******/ // no module.loaded needed
913
+ /******/ exports: {}
914
+ /******/ };
915
+ /******/
916
+ /******/ // Execute the module function
917
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
918
+ /******/
919
+ /******/ // Return the exports of the module
920
+ /******/ return module.exports;
921
+ /******/ }
922
+ /******/
923
+ /************************************************************************/
924
+ /******/ /* webpack/runtime/compat get default export */
925
+ /******/ (() => {
926
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
927
+ /******/ __webpack_require__.n = (module) => {
928
+ /******/ var getter = module && module.__esModule ?
929
+ /******/ () => (module['default']) :
930
+ /******/ () => (module);
931
+ /******/ __webpack_require__.d(getter, { a: getter });
932
+ /******/ return getter;
933
+ /******/ };
934
+ /******/ })();
935
+ /******/
936
+ /******/ /* webpack/runtime/define property getters */
937
+ /******/ (() => {
938
+ /******/ // define getter functions for harmony exports
939
+ /******/ __webpack_require__.d = (exports, definition) => {
940
+ /******/ for(var key in definition) {
941
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
942
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
943
+ /******/ }
944
+ /******/ }
945
+ /******/ };
946
+ /******/ })();
947
+ /******/
948
+ /******/ /* webpack/runtime/global */
949
+ /******/ (() => {
950
+ /******/ __webpack_require__.g = (function() {
951
+ /******/ if (typeof globalThis === 'object') return globalThis;
952
+ /******/ try {
953
+ /******/ return this || new Function('return this')();
954
+ /******/ } catch (e) {
955
+ /******/ if (typeof window === 'object') return window;
956
+ /******/ }
957
+ /******/ })();
958
+ /******/ })();
959
+ /******/
960
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
961
+ /******/ (() => {
962
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
963
+ /******/ })();
964
+ /******/
965
+ /******/ /* webpack/runtime/make namespace object */
966
+ /******/ (() => {
967
+ /******/ // define __esModule on exports
968
+ /******/ __webpack_require__.r = (exports) => {
969
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
970
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
971
+ /******/ }
972
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
973
+ /******/ };
974
+ /******/ })();
975
+ /******/
976
+ /************************************************************************/
977
+ var __webpack_exports__ = {};
978
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
979
+ (() => {
980
+ /*!**********************!*\
981
+ !*** ./src/index.ts ***!
982
+ \**********************/
983
+ __webpack_require__.r(__webpack_exports__);
984
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
985
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
986
+ /* harmony export */ "postProcess": () => (/* reexport module object */ post_processes_legacy_legacy__WEBPACK_IMPORTED_MODULE_0__)
987
+ /* harmony export */ });
988
+ /* harmony import */ var post_processes_legacy_legacy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! post-processes/legacy/legacy */ "../../../lts/postProcesses/dist/legacy/legacy.js");
989
+
990
+
991
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (post_processes_legacy_legacy__WEBPACK_IMPORTED_MODULE_0__);
992
+
993
+ })();
994
+
995
+ __webpack_exports__ = __webpack_exports__["default"];
996
+ /******/ return __webpack_exports__;
997
+ /******/ })()
998
+ ;
1017
999
  });
1018
1000
  //# sourceMappingURL=babylonjs.postProcess.js.map