babylonjs-post-process 5.0.0-beta.8 → 5.0.0-beta.8-snapshot
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.
- package/dist/babylonjs.postProcess.js +979 -0
- package/dist/babylonjs.postProcess.js.map +1 -0
- package/dist/babylonjs.postProcess.min.js +2 -0
- package/dist/babylonjs.postProcess.min.js.map +1 -0
- package/dist/babylonjs.postProcess.module.d.ts +286 -0
- package/package.json +25 -30
- package/babylonjs.postProcess.js +0 -1018
- package/babylonjs.postProcess.js.map +0 -1
- package/babylonjs.postProcess.min.js +0 -16
- package/babylonjs.postProcess.module.d.ts +0 -466
- package/readme.md +0 -51
|
@@ -0,0 +1,979 @@
|
|
|
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_core_Misc_decorators__) {
|
|
11
|
+
return /******/ (() => { // webpackBootstrap
|
|
12
|
+
/******/ "use strict";
|
|
13
|
+
/******/ var __webpack_modules__ = ({
|
|
14
|
+
|
|
15
|
+
/***/ "../../../../node_modules/tslib/tslib.es6.js":
|
|
16
|
+
/*!***************************************************!*\
|
|
17
|
+
!*** ../../../../node_modules/tslib/tslib.es6.js ***!
|
|
18
|
+
\***************************************************/
|
|
19
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
20
|
+
|
|
21
|
+
__webpack_require__.r(__webpack_exports__);
|
|
22
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
23
|
+
/* harmony export */ "__extends": () => (/* binding */ __extends),
|
|
24
|
+
/* harmony export */ "__assign": () => (/* binding */ __assign),
|
|
25
|
+
/* harmony export */ "__rest": () => (/* binding */ __rest),
|
|
26
|
+
/* harmony export */ "__decorate": () => (/* binding */ __decorate),
|
|
27
|
+
/* harmony export */ "__param": () => (/* binding */ __param),
|
|
28
|
+
/* harmony export */ "__metadata": () => (/* binding */ __metadata),
|
|
29
|
+
/* harmony export */ "__awaiter": () => (/* binding */ __awaiter),
|
|
30
|
+
/* harmony export */ "__generator": () => (/* binding */ __generator),
|
|
31
|
+
/* harmony export */ "__createBinding": () => (/* binding */ __createBinding),
|
|
32
|
+
/* harmony export */ "__exportStar": () => (/* binding */ __exportStar),
|
|
33
|
+
/* harmony export */ "__values": () => (/* binding */ __values),
|
|
34
|
+
/* harmony export */ "__read": () => (/* binding */ __read),
|
|
35
|
+
/* harmony export */ "__spread": () => (/* binding */ __spread),
|
|
36
|
+
/* harmony export */ "__spreadArrays": () => (/* binding */ __spreadArrays),
|
|
37
|
+
/* harmony export */ "__spreadArray": () => (/* binding */ __spreadArray),
|
|
38
|
+
/* harmony export */ "__await": () => (/* binding */ __await),
|
|
39
|
+
/* harmony export */ "__asyncGenerator": () => (/* binding */ __asyncGenerator),
|
|
40
|
+
/* harmony export */ "__asyncDelegator": () => (/* binding */ __asyncDelegator),
|
|
41
|
+
/* harmony export */ "__asyncValues": () => (/* binding */ __asyncValues),
|
|
42
|
+
/* harmony export */ "__makeTemplateObject": () => (/* binding */ __makeTemplateObject),
|
|
43
|
+
/* harmony export */ "__importStar": () => (/* binding */ __importStar),
|
|
44
|
+
/* harmony export */ "__importDefault": () => (/* binding */ __importDefault),
|
|
45
|
+
/* harmony export */ "__classPrivateFieldGet": () => (/* binding */ __classPrivateFieldGet),
|
|
46
|
+
/* harmony export */ "__classPrivateFieldSet": () => (/* binding */ __classPrivateFieldSet)
|
|
47
|
+
/* harmony export */ });
|
|
48
|
+
/*! *****************************************************************************
|
|
49
|
+
Copyright (c) Microsoft Corporation.
|
|
50
|
+
|
|
51
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
52
|
+
purpose with or without fee is hereby granted.
|
|
53
|
+
|
|
54
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
55
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
56
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
57
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
58
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
59
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
60
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
61
|
+
***************************************************************************** */
|
|
62
|
+
/* global Reflect, Promise */
|
|
63
|
+
|
|
64
|
+
var extendStatics = function(d, b) {
|
|
65
|
+
extendStatics = Object.setPrototypeOf ||
|
|
66
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
67
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
68
|
+
return extendStatics(d, b);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
function __extends(d, b) {
|
|
72
|
+
if (typeof b !== "function" && b !== null)
|
|
73
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
74
|
+
extendStatics(d, b);
|
|
75
|
+
function __() { this.constructor = d; }
|
|
76
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var __assign = function() {
|
|
80
|
+
__assign = Object.assign || function __assign(t) {
|
|
81
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
82
|
+
s = arguments[i];
|
|
83
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
84
|
+
}
|
|
85
|
+
return t;
|
|
86
|
+
}
|
|
87
|
+
return __assign.apply(this, arguments);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function __rest(s, e) {
|
|
91
|
+
var t = {};
|
|
92
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
93
|
+
t[p] = s[p];
|
|
94
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
95
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
96
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
97
|
+
t[p[i]] = s[p[i]];
|
|
98
|
+
}
|
|
99
|
+
return t;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function __decorate(decorators, target, key, desc) {
|
|
103
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
104
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
105
|
+
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;
|
|
106
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function __param(paramIndex, decorator) {
|
|
110
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function __metadata(metadataKey, metadataValue) {
|
|
114
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
118
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
119
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
120
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
121
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
122
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
123
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function __generator(thisArg, body) {
|
|
128
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
129
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
130
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
131
|
+
function step(op) {
|
|
132
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
133
|
+
while (_) try {
|
|
134
|
+
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;
|
|
135
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
136
|
+
switch (op[0]) {
|
|
137
|
+
case 0: case 1: t = op; break;
|
|
138
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
139
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
140
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
141
|
+
default:
|
|
142
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
143
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
144
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
145
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
146
|
+
if (t[2]) _.ops.pop();
|
|
147
|
+
_.trys.pop(); continue;
|
|
148
|
+
}
|
|
149
|
+
op = body.call(thisArg, _);
|
|
150
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
151
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
var __createBinding = Object.create ? (function(o, m, k, k2) {
|
|
156
|
+
if (k2 === undefined) k2 = k;
|
|
157
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
158
|
+
}) : (function(o, m, k, k2) {
|
|
159
|
+
if (k2 === undefined) k2 = k;
|
|
160
|
+
o[k2] = m[k];
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
function __exportStar(m, o) {
|
|
164
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function __values(o) {
|
|
168
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
169
|
+
if (m) return m.call(o);
|
|
170
|
+
if (o && typeof o.length === "number") return {
|
|
171
|
+
next: function () {
|
|
172
|
+
if (o && i >= o.length) o = void 0;
|
|
173
|
+
return { value: o && o[i++], done: !o };
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function __read(o, n) {
|
|
180
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
181
|
+
if (!m) return o;
|
|
182
|
+
var i = m.call(o), r, ar = [], e;
|
|
183
|
+
try {
|
|
184
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
185
|
+
}
|
|
186
|
+
catch (error) { e = { error: error }; }
|
|
187
|
+
finally {
|
|
188
|
+
try {
|
|
189
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
190
|
+
}
|
|
191
|
+
finally { if (e) throw e.error; }
|
|
192
|
+
}
|
|
193
|
+
return ar;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** @deprecated */
|
|
197
|
+
function __spread() {
|
|
198
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
199
|
+
ar = ar.concat(__read(arguments[i]));
|
|
200
|
+
return ar;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** @deprecated */
|
|
204
|
+
function __spreadArrays() {
|
|
205
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
206
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
207
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
208
|
+
r[k] = a[j];
|
|
209
|
+
return r;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function __spreadArray(to, from, pack) {
|
|
213
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
214
|
+
if (ar || !(i in from)) {
|
|
215
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
216
|
+
ar[i] = from[i];
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function __await(v) {
|
|
223
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
227
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
228
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
229
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
230
|
+
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); }); }; }
|
|
231
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
232
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
233
|
+
function fulfill(value) { resume("next", value); }
|
|
234
|
+
function reject(value) { resume("throw", value); }
|
|
235
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function __asyncDelegator(o) {
|
|
239
|
+
var i, p;
|
|
240
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
241
|
+
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; }
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function __asyncValues(o) {
|
|
245
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
246
|
+
var m = o[Symbol.asyncIterator], i;
|
|
247
|
+
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);
|
|
248
|
+
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); }); }; }
|
|
249
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function __makeTemplateObject(cooked, raw) {
|
|
253
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
254
|
+
return cooked;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
var __setModuleDefault = Object.create ? (function(o, v) {
|
|
258
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
259
|
+
}) : function(o, v) {
|
|
260
|
+
o["default"] = v;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
function __importStar(mod) {
|
|
264
|
+
if (mod && mod.__esModule) return mod;
|
|
265
|
+
var result = {};
|
|
266
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
267
|
+
__setModuleDefault(result, mod);
|
|
268
|
+
return result;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function __importDefault(mod) {
|
|
272
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
276
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
277
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
278
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
282
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
283
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
284
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
285
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
/***/ }),
|
|
290
|
+
|
|
291
|
+
/***/ "../../../lts/postProcesses/dist/asciiArt/asciiArtPostProcess.js":
|
|
292
|
+
/*!***********************************************************************!*\
|
|
293
|
+
!*** ../../../lts/postProcesses/dist/asciiArt/asciiArtPostProcess.js ***!
|
|
294
|
+
\***********************************************************************/
|
|
295
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
296
|
+
|
|
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
|
+
class AsciiArtFontTexture extends core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.BaseTexture {
|
|
320
|
+
/**
|
|
321
|
+
* Create a new instance of the Ascii Art FontTexture class
|
|
322
|
+
* @param name the name of the texture
|
|
323
|
+
* @param font the font to use, use the W3C CSS notation
|
|
324
|
+
* @param text the caracter set to use in the rendering.
|
|
325
|
+
* @param scene the scene that owns the texture
|
|
326
|
+
*/
|
|
327
|
+
constructor(name, font, text, scene = null) {
|
|
328
|
+
super(scene);
|
|
329
|
+
scene = this.getScene();
|
|
330
|
+
if (!scene) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
this.name = name;
|
|
334
|
+
this._text == text;
|
|
335
|
+
this._font == font;
|
|
336
|
+
this.wrapU = core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.CLAMP_ADDRESSMODE;
|
|
337
|
+
this.wrapV = core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.CLAMP_ADDRESSMODE;
|
|
338
|
+
//this.anisotropicFilteringLevel = 1;
|
|
339
|
+
// Get the font specific info.
|
|
340
|
+
const maxCharHeight = this.getFontHeight(font);
|
|
341
|
+
const maxCharWidth = this.getFontWidth(font);
|
|
342
|
+
this._charSize = Math.max(maxCharHeight.height, maxCharWidth);
|
|
343
|
+
// This is an approximate size, but should always be able to fit at least the maxCharCount.
|
|
344
|
+
const textureWidth = Math.ceil(this._charSize * text.length);
|
|
345
|
+
const textureHeight = this._charSize;
|
|
346
|
+
// Create the texture that will store the font characters.
|
|
347
|
+
this._texture = scene.getEngine().createDynamicTexture(textureWidth, textureHeight, false, core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.NEAREST_SAMPLINGMODE);
|
|
348
|
+
//scene.getEngine().setclamp
|
|
349
|
+
const textureSize = this.getSize();
|
|
350
|
+
// Create a canvas with the final size: the one matching the texture.
|
|
351
|
+
const canvas = document.createElement("canvas");
|
|
352
|
+
canvas.width = textureSize.width;
|
|
353
|
+
canvas.height = textureSize.height;
|
|
354
|
+
const context = canvas.getContext("2d");
|
|
355
|
+
context.textBaseline = "top";
|
|
356
|
+
context.font = font;
|
|
357
|
+
context.fillStyle = "white";
|
|
358
|
+
context.imageSmoothingEnabled = false;
|
|
359
|
+
// Sets the text in the texture.
|
|
360
|
+
for (let i = 0; i < text.length; i++) {
|
|
361
|
+
context.fillText(text[i], i * this._charSize, -maxCharHeight.offset);
|
|
362
|
+
}
|
|
363
|
+
// Flush the text in the dynamic texture.
|
|
364
|
+
scene.getEngine().updateDynamicTexture(this._texture, canvas, false, true);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Gets the size of one char in the texture (each char fits in size * size space in the texture).
|
|
368
|
+
*/
|
|
369
|
+
get charSize() {
|
|
370
|
+
return this._charSize;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Gets the max char width of a font.
|
|
374
|
+
* @param font the font to use, use the W3C CSS notation
|
|
375
|
+
* @return the max char width
|
|
376
|
+
*/
|
|
377
|
+
getFontWidth(font) {
|
|
378
|
+
const fontDraw = document.createElement("canvas");
|
|
379
|
+
const ctx = fontDraw.getContext("2d");
|
|
380
|
+
ctx.fillStyle = "white";
|
|
381
|
+
ctx.font = font;
|
|
382
|
+
return ctx.measureText("W").width;
|
|
383
|
+
}
|
|
384
|
+
// More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/
|
|
385
|
+
/**
|
|
386
|
+
* Gets the max char height of a font.
|
|
387
|
+
* @param font the font to use, use the W3C CSS notation
|
|
388
|
+
* @return the max char height
|
|
389
|
+
*/
|
|
390
|
+
getFontHeight(font) {
|
|
391
|
+
const fontDraw = document.createElement("canvas");
|
|
392
|
+
const ctx = fontDraw.getContext("2d");
|
|
393
|
+
ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);
|
|
394
|
+
ctx.textBaseline = "top";
|
|
395
|
+
ctx.fillStyle = "white";
|
|
396
|
+
ctx.font = font;
|
|
397
|
+
ctx.fillText("jH|", 0, 0);
|
|
398
|
+
const pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;
|
|
399
|
+
let start = -1;
|
|
400
|
+
let end = -1;
|
|
401
|
+
for (let row = 0; row < fontDraw.height; row++) {
|
|
402
|
+
for (let column = 0; column < fontDraw.width; column++) {
|
|
403
|
+
const index = (row * fontDraw.width + column) * 4;
|
|
404
|
+
if (pixels[index] === 0) {
|
|
405
|
+
if (column === fontDraw.width - 1 && start !== -1) {
|
|
406
|
+
end = row;
|
|
407
|
+
row = fontDraw.height;
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
if (start === -1) {
|
|
414
|
+
start = row;
|
|
415
|
+
}
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return { height: end - start + 1, offset: start - 1 };
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Clones the current AsciiArtTexture.
|
|
424
|
+
* @return the clone of the texture.
|
|
425
|
+
*/
|
|
426
|
+
clone() {
|
|
427
|
+
return new AsciiArtFontTexture(this.name, this._font, this._text, this.getScene());
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Parses a json object representing the texture and returns an instance of it.
|
|
431
|
+
* @param source the source JSON representation
|
|
432
|
+
* @param scene the scene to create the texture for
|
|
433
|
+
* @return the parsed texture
|
|
434
|
+
*/
|
|
435
|
+
static Parse(source, scene) {
|
|
436
|
+
const texture = core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.SerializationHelper.Parse(() => new AsciiArtFontTexture(source.name, source.font, source.text, scene), source, scene, null);
|
|
437
|
+
return texture;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
|
|
441
|
+
(0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.serialize)("font")
|
|
442
|
+
], AsciiArtFontTexture.prototype, "_font", void 0);
|
|
443
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
|
|
444
|
+
(0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.serialize)("text")
|
|
445
|
+
], AsciiArtFontTexture.prototype, "_text", void 0);
|
|
446
|
+
/**
|
|
447
|
+
* AsciiArtPostProcess helps rendering everithing in Ascii Art.
|
|
448
|
+
*
|
|
449
|
+
* Simmply add it to your scene and let the nerd that lives in you have fun.
|
|
450
|
+
* Example usage: var pp = new AsciiArtPostProcess("myAscii", "20px Monospace", camera);
|
|
451
|
+
*/
|
|
452
|
+
class AsciiArtPostProcess extends core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.PostProcess {
|
|
453
|
+
/**
|
|
454
|
+
* Instantiates a new Ascii Art Post Process.
|
|
455
|
+
* @param name the name to give to the postprocess
|
|
456
|
+
* @camera the camera to apply the post process to.
|
|
457
|
+
* @param options can either be the font name or an option object following the IAsciiArtPostProcessOptions format
|
|
458
|
+
*/
|
|
459
|
+
constructor(name, camera, options) {
|
|
460
|
+
super(name, "asciiart", ["asciiArtFontInfos", "asciiArtOptions"], ["asciiArtFont"], {
|
|
461
|
+
width: camera.getEngine().getRenderWidth(),
|
|
462
|
+
height: camera.getEngine().getRenderHeight(),
|
|
463
|
+
}, camera, core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.TRILINEAR_SAMPLINGMODE, camera.getEngine(), true);
|
|
464
|
+
/**
|
|
465
|
+
* This defines the amount you want to mix the "tile" or caracter space colored in the ascii art.
|
|
466
|
+
* This number is defined between 0 and 1;
|
|
467
|
+
*/
|
|
468
|
+
this.mixToTile = 0;
|
|
469
|
+
/**
|
|
470
|
+
* This defines the amount you want to mix the normal rendering pass in the ascii art.
|
|
471
|
+
* This number is defined between 0 and 1;
|
|
472
|
+
*/
|
|
473
|
+
this.mixToNormal = 0;
|
|
474
|
+
// Default values.
|
|
475
|
+
let font = "40px Monospace";
|
|
476
|
+
let characterSet = " `-.'_:,\"=^;<+!*?/cL\\zrs7TivJtC{3F)Il(xZfY5S2eajo14[nuyE]P6V9kXpKwGhqAUbOd8#HRDB0$mgMW&Q%N@";
|
|
477
|
+
// Use options.
|
|
478
|
+
if (options) {
|
|
479
|
+
if (typeof options === "string") {
|
|
480
|
+
font = options;
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
font = options.font || font;
|
|
484
|
+
characterSet = options.characterSet || characterSet;
|
|
485
|
+
this.mixToTile = options.mixToTile || this.mixToTile;
|
|
486
|
+
this.mixToNormal = options.mixToNormal || this.mixToNormal;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
this._asciiArtFontTexture = new AsciiArtFontTexture(name, font, characterSet, camera.getScene());
|
|
490
|
+
const textureSize = this._asciiArtFontTexture.getSize();
|
|
491
|
+
this.onApply = (effect) => {
|
|
492
|
+
effect.setTexture("asciiArtFont", this._asciiArtFontTexture);
|
|
493
|
+
effect.setFloat4("asciiArtFontInfos", this._asciiArtFontTexture.charSize, characterSet.length, textureSize.width, textureSize.height);
|
|
494
|
+
effect.setFloat4("asciiArtOptions", this.width, this.height, this.mixToNormal, this.mixToTile);
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
/***/ }),
|
|
501
|
+
|
|
502
|
+
/***/ "../../../lts/postProcesses/dist/asciiArt/asciiart.fragment.js":
|
|
503
|
+
/*!*********************************************************************!*\
|
|
504
|
+
!*** ../../../lts/postProcesses/dist/asciiArt/asciiart.fragment.js ***!
|
|
505
|
+
\*********************************************************************/
|
|
506
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
507
|
+
|
|
508
|
+
__webpack_require__.r(__webpack_exports__);
|
|
509
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
510
|
+
/* harmony export */ "asciiartPixelShader": () => (/* binding */ asciiartPixelShader)
|
|
511
|
+
/* harmony export */ });
|
|
512
|
+
/* harmony import */ var core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Engines/shaderStore */ "core/Misc/decorators");
|
|
513
|
+
/* harmony import */ var core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
|
|
514
|
+
// Do not edit.
|
|
515
|
+
|
|
516
|
+
const name = "asciiartPixelShader";
|
|
517
|
+
const shader = `varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D asciiArtFont;uniform vec4 asciiArtFontInfos;uniform vec4 asciiArtOptions;float getLuminance(vec3 color)
|
|
518
|
+
{return clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);}
|
|
519
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
520
|
+
void main(void)
|
|
521
|
+
{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;}`;
|
|
522
|
+
// Sideeffect
|
|
523
|
+
core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
|
|
524
|
+
/** @hidden */
|
|
525
|
+
const asciiartPixelShader = { name, shader };
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
/***/ }),
|
|
529
|
+
|
|
530
|
+
/***/ "../../../lts/postProcesses/dist/asciiArt/index.js":
|
|
531
|
+
/*!*********************************************************!*\
|
|
532
|
+
!*** ../../../lts/postProcesses/dist/asciiArt/index.js ***!
|
|
533
|
+
\*********************************************************/
|
|
534
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
535
|
+
|
|
536
|
+
__webpack_require__.r(__webpack_exports__);
|
|
537
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
538
|
+
/* harmony export */ "AsciiArtFontTexture": () => (/* reexport safe */ _asciiArtPostProcess__WEBPACK_IMPORTED_MODULE_0__.AsciiArtFontTexture),
|
|
539
|
+
/* harmony export */ "AsciiArtPostProcess": () => (/* reexport safe */ _asciiArtPostProcess__WEBPACK_IMPORTED_MODULE_0__.AsciiArtPostProcess)
|
|
540
|
+
/* harmony export */ });
|
|
541
|
+
/* harmony import */ var _asciiArtPostProcess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asciiArtPostProcess */ "../../../lts/postProcesses/dist/asciiArt/asciiArtPostProcess.js");
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
/***/ }),
|
|
546
|
+
|
|
547
|
+
/***/ "../../../lts/postProcesses/dist/digitalRain/digitalRainPostProcess.js":
|
|
548
|
+
/*!*****************************************************************************!*\
|
|
549
|
+
!*** ../../../lts/postProcesses/dist/digitalRain/digitalRainPostProcess.js ***!
|
|
550
|
+
\*****************************************************************************/
|
|
551
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
552
|
+
|
|
553
|
+
__webpack_require__.r(__webpack_exports__);
|
|
554
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
555
|
+
/* harmony export */ "DigitalRainFontTexture": () => (/* binding */ DigitalRainFontTexture),
|
|
556
|
+
/* harmony export */ "DigitalRainPostProcess": () => (/* binding */ DigitalRainPostProcess)
|
|
557
|
+
/* harmony export */ });
|
|
558
|
+
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
|
|
559
|
+
/* harmony import */ var core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Engines/Extensions/engine.dynamicTexture */ "core/Misc/decorators");
|
|
560
|
+
/* harmony import */ var core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
|
|
561
|
+
/* harmony import */ var _digitalrain_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./digitalrain.fragment */ "../../../lts/postProcesses/dist/digitalRain/digitalrain.fragment.js");
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* DigitalRainFontTexture is the helper class used to easily create your digital rain font texture.
|
|
572
|
+
*
|
|
573
|
+
* It basically takes care rendering the font front the given font size to a texture.
|
|
574
|
+
* This is used later on in the postprocess.
|
|
575
|
+
*/
|
|
576
|
+
class DigitalRainFontTexture extends core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.BaseTexture {
|
|
577
|
+
/**
|
|
578
|
+
* Create a new instance of the Digital Rain FontTexture class
|
|
579
|
+
* @param name the name of the texture
|
|
580
|
+
* @param font the font to use, use the W3C CSS notation
|
|
581
|
+
* @param text the caracter set to use in the rendering.
|
|
582
|
+
* @param scene the scene that owns the texture
|
|
583
|
+
*/
|
|
584
|
+
constructor(name, font, text, scene = null) {
|
|
585
|
+
super(scene);
|
|
586
|
+
scene = this.getScene();
|
|
587
|
+
if (!scene) {
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
this.name = name;
|
|
591
|
+
this._text == text;
|
|
592
|
+
this._font == font;
|
|
593
|
+
this.wrapU = core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.CLAMP_ADDRESSMODE;
|
|
594
|
+
this.wrapV = core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.CLAMP_ADDRESSMODE;
|
|
595
|
+
// Get the font specific info.
|
|
596
|
+
const maxCharHeight = this.getFontHeight(font);
|
|
597
|
+
const maxCharWidth = this.getFontWidth(font);
|
|
598
|
+
this._charSize = Math.max(maxCharHeight.height, maxCharWidth);
|
|
599
|
+
// This is an approximate size, but should always be able to fit at least the maxCharCount.
|
|
600
|
+
const textureWidth = this._charSize;
|
|
601
|
+
const textureHeight = Math.ceil(this._charSize * text.length);
|
|
602
|
+
// Create the texture that will store the font characters.
|
|
603
|
+
this._texture = scene.getEngine().createDynamicTexture(textureWidth, textureHeight, false, core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.NEAREST_SAMPLINGMODE);
|
|
604
|
+
//scene.getEngine().setclamp
|
|
605
|
+
const textureSize = this.getSize();
|
|
606
|
+
// Create a canvas with the final size: the one matching the texture.
|
|
607
|
+
const canvas = document.createElement("canvas");
|
|
608
|
+
canvas.width = textureSize.width;
|
|
609
|
+
canvas.height = textureSize.height;
|
|
610
|
+
const context = canvas.getContext("2d");
|
|
611
|
+
context.textBaseline = "top";
|
|
612
|
+
context.font = font;
|
|
613
|
+
context.fillStyle = "white";
|
|
614
|
+
context.imageSmoothingEnabled = false;
|
|
615
|
+
// Sets the text in the texture.
|
|
616
|
+
for (let i = 0; i < text.length; i++) {
|
|
617
|
+
context.fillText(text[i], 0, i * this._charSize - maxCharHeight.offset);
|
|
618
|
+
}
|
|
619
|
+
// Flush the text in the dynamic texture.
|
|
620
|
+
scene.getEngine().updateDynamicTexture(this._texture, canvas, false, true);
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Gets the size of one char in the texture (each char fits in size * size space in the texture).
|
|
624
|
+
*/
|
|
625
|
+
get charSize() {
|
|
626
|
+
return this._charSize;
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* Gets the max char width of a font.
|
|
630
|
+
* @param font the font to use, use the W3C CSS notation
|
|
631
|
+
* @return the max char width
|
|
632
|
+
*/
|
|
633
|
+
getFontWidth(font) {
|
|
634
|
+
const fontDraw = document.createElement("canvas");
|
|
635
|
+
const ctx = fontDraw.getContext("2d");
|
|
636
|
+
ctx.fillStyle = "white";
|
|
637
|
+
ctx.font = font;
|
|
638
|
+
return ctx.measureText("W").width;
|
|
639
|
+
}
|
|
640
|
+
// More info here: https://videlais.com/2014/03/16/the-many-and-varied-problems-with-measuring-font-height-for-html5-canvas/
|
|
641
|
+
/**
|
|
642
|
+
* Gets the max char height of a font.
|
|
643
|
+
* @param font the font to use, use the W3C CSS notation
|
|
644
|
+
* @return the max char height
|
|
645
|
+
*/
|
|
646
|
+
getFontHeight(font) {
|
|
647
|
+
const fontDraw = document.createElement("canvas");
|
|
648
|
+
const ctx = fontDraw.getContext("2d");
|
|
649
|
+
ctx.fillRect(0, 0, fontDraw.width, fontDraw.height);
|
|
650
|
+
ctx.textBaseline = "top";
|
|
651
|
+
ctx.fillStyle = "white";
|
|
652
|
+
ctx.font = font;
|
|
653
|
+
ctx.fillText("jH|", 0, 0);
|
|
654
|
+
const pixels = ctx.getImageData(0, 0, fontDraw.width, fontDraw.height).data;
|
|
655
|
+
let start = -1;
|
|
656
|
+
let end = -1;
|
|
657
|
+
for (let row = 0; row < fontDraw.height; row++) {
|
|
658
|
+
for (let column = 0; column < fontDraw.width; column++) {
|
|
659
|
+
const index = (row * fontDraw.width + column) * 4;
|
|
660
|
+
if (pixels[index] === 0) {
|
|
661
|
+
if (column === fontDraw.width - 1 && start !== -1) {
|
|
662
|
+
end = row;
|
|
663
|
+
row = fontDraw.height;
|
|
664
|
+
break;
|
|
665
|
+
}
|
|
666
|
+
continue;
|
|
667
|
+
}
|
|
668
|
+
else {
|
|
669
|
+
if (start === -1) {
|
|
670
|
+
start = row;
|
|
671
|
+
}
|
|
672
|
+
break;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
return { height: end - start + 1, offset: start - 1 };
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Clones the current DigitalRainFontTexture.
|
|
680
|
+
* @return the clone of the texture.
|
|
681
|
+
*/
|
|
682
|
+
clone() {
|
|
683
|
+
return new DigitalRainFontTexture(this.name, this._font, this._text, this.getScene());
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Parses a json object representing the texture and returns an instance of it.
|
|
687
|
+
* @param source the source JSON representation
|
|
688
|
+
* @param scene the scene to create the texture for
|
|
689
|
+
* @return the parsed texture
|
|
690
|
+
*/
|
|
691
|
+
static Parse(source, scene) {
|
|
692
|
+
const texture = core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.SerializationHelper.Parse(() => new DigitalRainFontTexture(source.name, source.font, source.text, scene), source, scene, null);
|
|
693
|
+
return texture;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
|
|
697
|
+
(0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.serialize)("font")
|
|
698
|
+
], DigitalRainFontTexture.prototype, "_font", void 0);
|
|
699
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
|
|
700
|
+
(0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.serialize)("text")
|
|
701
|
+
], DigitalRainFontTexture.prototype, "_text", void 0);
|
|
702
|
+
/**
|
|
703
|
+
* DigitalRainPostProcess helps rendering everithing in digital rain.
|
|
704
|
+
*
|
|
705
|
+
* Simmply add it to your scene and let the nerd that lives in you have fun.
|
|
706
|
+
* Example usage: var pp = new DigitalRainPostProcess("digitalRain", "20px Monospace", camera);
|
|
707
|
+
*/
|
|
708
|
+
class DigitalRainPostProcess extends core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.PostProcess {
|
|
709
|
+
/**
|
|
710
|
+
* Instantiates a new Digital Rain Post Process.
|
|
711
|
+
* @param name the name to give to the postprocess
|
|
712
|
+
* @camera the camera to apply the post process to.
|
|
713
|
+
* @param options can either be the font name or an option object following the IDigitalRainPostProcessOptions format
|
|
714
|
+
*/
|
|
715
|
+
constructor(name, camera, options) {
|
|
716
|
+
super(name, "digitalrain", ["digitalRainFontInfos", "digitalRainOptions", "cosTimeZeroOne", "matrixSpeed"], ["digitalRainFont"], {
|
|
717
|
+
width: camera.getEngine().getRenderWidth(),
|
|
718
|
+
height: camera.getEngine().getRenderHeight(),
|
|
719
|
+
}, camera, core_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__.Texture.TRILINEAR_SAMPLINGMODE, camera.getEngine(), true);
|
|
720
|
+
/**
|
|
721
|
+
* This defines the amount you want to mix the "tile" or caracter space colored in the digital rain.
|
|
722
|
+
* This number is defined between 0 and 1;
|
|
723
|
+
*/
|
|
724
|
+
this.mixToTile = 0;
|
|
725
|
+
/**
|
|
726
|
+
* This defines the amount you want to mix the normal rendering pass in the digital rain.
|
|
727
|
+
* This number is defined between 0 and 1;
|
|
728
|
+
*/
|
|
729
|
+
this.mixToNormal = 0;
|
|
730
|
+
/**
|
|
731
|
+
* Speed of the effect
|
|
732
|
+
*/
|
|
733
|
+
this.speed = 0.003;
|
|
734
|
+
// Default values.
|
|
735
|
+
let font = "15px Monospace";
|
|
736
|
+
const characterSet = "古池や蛙飛び込む水の音ふるいけやかわずとびこむみずのおと初しぐれ猿も小蓑をほしげ也はつしぐれさるもこみのをほしげなり江戸の雨何石呑んだ時鳥えどのあめなんごくのんだほととぎす";
|
|
737
|
+
// Use options.
|
|
738
|
+
if (options) {
|
|
739
|
+
if (typeof options === "string") {
|
|
740
|
+
font = options;
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
font = options.font || font;
|
|
744
|
+
this.mixToTile = options.mixToTile || this.mixToTile;
|
|
745
|
+
this.mixToNormal = options.mixToNormal || this.mixToNormal;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
this._digitalRainFontTexture = new DigitalRainFontTexture(name, font, characterSet, camera.getScene());
|
|
749
|
+
const textureSize = this._digitalRainFontTexture.getSize();
|
|
750
|
+
let alpha = 0.0;
|
|
751
|
+
let cosTimeZeroOne = 0.0;
|
|
752
|
+
const 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());
|
|
753
|
+
this.onApply = (effect) => {
|
|
754
|
+
effect.setTexture("digitalRainFont", this._digitalRainFontTexture);
|
|
755
|
+
effect.setFloat4("digitalRainFontInfos", this._digitalRainFontTexture.charSize, characterSet.length, textureSize.width, textureSize.height);
|
|
756
|
+
effect.setFloat4("digitalRainOptions", this.width, this.height, this.mixToNormal, this.mixToTile);
|
|
757
|
+
effect.setMatrix("matrixSpeed", matrix);
|
|
758
|
+
alpha += this.speed;
|
|
759
|
+
cosTimeZeroOne = alpha;
|
|
760
|
+
effect.setFloat("cosTimeZeroOne", cosTimeZeroOne);
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
/***/ }),
|
|
767
|
+
|
|
768
|
+
/***/ "../../../lts/postProcesses/dist/digitalRain/digitalrain.fragment.js":
|
|
769
|
+
/*!***************************************************************************!*\
|
|
770
|
+
!*** ../../../lts/postProcesses/dist/digitalRain/digitalrain.fragment.js ***!
|
|
771
|
+
\***************************************************************************/
|
|
772
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
773
|
+
|
|
774
|
+
__webpack_require__.r(__webpack_exports__);
|
|
775
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
776
|
+
/* harmony export */ "digitalrainPixelShader": () => (/* binding */ digitalrainPixelShader)
|
|
777
|
+
/* harmony export */ });
|
|
778
|
+
/* harmony import */ var core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core/Engines/shaderStore */ "core/Misc/decorators");
|
|
779
|
+
/* harmony import */ var core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
|
|
780
|
+
// Do not edit.
|
|
781
|
+
|
|
782
|
+
const name = "digitalrainPixelShader";
|
|
783
|
+
const 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)
|
|
784
|
+
{return clamp(dot(color,vec3(0.2126,0.7152,0.0722)),0.,1.);}
|
|
785
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
786
|
+
void main(void)
|
|
787
|
+
{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);
|
|
788
|
+
float 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;}`;
|
|
789
|
+
// Sideeffect
|
|
790
|
+
core_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
|
|
791
|
+
/** @hidden */
|
|
792
|
+
const digitalrainPixelShader = { name, shader };
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
/***/ }),
|
|
796
|
+
|
|
797
|
+
/***/ "../../../lts/postProcesses/dist/digitalRain/index.js":
|
|
798
|
+
/*!************************************************************!*\
|
|
799
|
+
!*** ../../../lts/postProcesses/dist/digitalRain/index.js ***!
|
|
800
|
+
\************************************************************/
|
|
801
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
802
|
+
|
|
803
|
+
__webpack_require__.r(__webpack_exports__);
|
|
804
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
805
|
+
/* harmony export */ "DigitalRainFontTexture": () => (/* reexport safe */ _digitalRainPostProcess__WEBPACK_IMPORTED_MODULE_0__.DigitalRainFontTexture),
|
|
806
|
+
/* harmony export */ "DigitalRainPostProcess": () => (/* reexport safe */ _digitalRainPostProcess__WEBPACK_IMPORTED_MODULE_0__.DigitalRainPostProcess)
|
|
807
|
+
/* harmony export */ });
|
|
808
|
+
/* harmony import */ var _digitalRainPostProcess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./digitalRainPostProcess */ "../../../lts/postProcesses/dist/digitalRain/digitalRainPostProcess.js");
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
/***/ }),
|
|
813
|
+
|
|
814
|
+
/***/ "../../../lts/postProcesses/dist/index.js":
|
|
815
|
+
/*!************************************************!*\
|
|
816
|
+
!*** ../../../lts/postProcesses/dist/index.js ***!
|
|
817
|
+
\************************************************/
|
|
818
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
819
|
+
|
|
820
|
+
__webpack_require__.r(__webpack_exports__);
|
|
821
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
822
|
+
/* harmony export */ "AsciiArtFontTexture": () => (/* reexport safe */ _asciiArt_index__WEBPACK_IMPORTED_MODULE_0__.AsciiArtFontTexture),
|
|
823
|
+
/* harmony export */ "AsciiArtPostProcess": () => (/* reexport safe */ _asciiArt_index__WEBPACK_IMPORTED_MODULE_0__.AsciiArtPostProcess),
|
|
824
|
+
/* harmony export */ "DigitalRainFontTexture": () => (/* reexport safe */ _digitalRain_index__WEBPACK_IMPORTED_MODULE_1__.DigitalRainFontTexture),
|
|
825
|
+
/* harmony export */ "DigitalRainPostProcess": () => (/* reexport safe */ _digitalRain_index__WEBPACK_IMPORTED_MODULE_1__.DigitalRainPostProcess)
|
|
826
|
+
/* harmony export */ });
|
|
827
|
+
/* harmony import */ var _asciiArt_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./asciiArt/index */ "../../../lts/postProcesses/dist/asciiArt/index.js");
|
|
828
|
+
/* harmony import */ var _digitalRain_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./digitalRain/index */ "../../../lts/postProcesses/dist/digitalRain/index.js");
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
/***/ }),
|
|
834
|
+
|
|
835
|
+
/***/ "../../../lts/postProcesses/dist/legacy/legacy.js":
|
|
836
|
+
/*!********************************************************!*\
|
|
837
|
+
!*** ../../../lts/postProcesses/dist/legacy/legacy.js ***!
|
|
838
|
+
\********************************************************/
|
|
839
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
840
|
+
|
|
841
|
+
__webpack_require__.r(__webpack_exports__);
|
|
842
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
843
|
+
/* harmony export */ "AsciiArtFontTexture": () => (/* reexport safe */ post_processes_index__WEBPACK_IMPORTED_MODULE_0__.AsciiArtFontTexture),
|
|
844
|
+
/* harmony export */ "AsciiArtPostProcess": () => (/* reexport safe */ post_processes_index__WEBPACK_IMPORTED_MODULE_0__.AsciiArtPostProcess),
|
|
845
|
+
/* harmony export */ "DigitalRainFontTexture": () => (/* reexport safe */ post_processes_index__WEBPACK_IMPORTED_MODULE_0__.DigitalRainFontTexture),
|
|
846
|
+
/* harmony export */ "DigitalRainPostProcess": () => (/* reexport safe */ post_processes_index__WEBPACK_IMPORTED_MODULE_0__.DigitalRainPostProcess)
|
|
847
|
+
/* harmony export */ });
|
|
848
|
+
/* harmony import */ var post_processes_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! post-processes/index */ "../../../lts/postProcesses/dist/index.js");
|
|
849
|
+
|
|
850
|
+
/**
|
|
851
|
+
*
|
|
852
|
+
* This is the entry point for the UMD module.
|
|
853
|
+
* The entry point for a future ESM package should be index.ts
|
|
854
|
+
*/
|
|
855
|
+
const globalObject = typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof window !== "undefined" ? window : undefined;
|
|
856
|
+
if (typeof globalObject !== "undefined") {
|
|
857
|
+
for (const key in post_processes_index__WEBPACK_IMPORTED_MODULE_0__) {
|
|
858
|
+
globalObject.BABYLON[key] = post_processes_index__WEBPACK_IMPORTED_MODULE_0__[key];
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
/***/ }),
|
|
865
|
+
|
|
866
|
+
/***/ "core/Misc/decorators":
|
|
867
|
+
/*!****************************************************************************************************!*\
|
|
868
|
+
!*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
|
|
869
|
+
\****************************************************************************************************/
|
|
870
|
+
/***/ ((module) => {
|
|
871
|
+
|
|
872
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_core_Misc_decorators__;
|
|
873
|
+
|
|
874
|
+
/***/ })
|
|
875
|
+
|
|
876
|
+
/******/ });
|
|
877
|
+
/************************************************************************/
|
|
878
|
+
/******/ // The module cache
|
|
879
|
+
/******/ var __webpack_module_cache__ = {};
|
|
880
|
+
/******/
|
|
881
|
+
/******/ // The require function
|
|
882
|
+
/******/ function __webpack_require__(moduleId) {
|
|
883
|
+
/******/ // Check if module is in cache
|
|
884
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
885
|
+
/******/ if (cachedModule !== undefined) {
|
|
886
|
+
/******/ return cachedModule.exports;
|
|
887
|
+
/******/ }
|
|
888
|
+
/******/ // Create a new module (and put it into the cache)
|
|
889
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
890
|
+
/******/ // no module.id needed
|
|
891
|
+
/******/ // no module.loaded needed
|
|
892
|
+
/******/ exports: {}
|
|
893
|
+
/******/ };
|
|
894
|
+
/******/
|
|
895
|
+
/******/ // Execute the module function
|
|
896
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
897
|
+
/******/
|
|
898
|
+
/******/ // Return the exports of the module
|
|
899
|
+
/******/ return module.exports;
|
|
900
|
+
/******/ }
|
|
901
|
+
/******/
|
|
902
|
+
/************************************************************************/
|
|
903
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
904
|
+
/******/ (() => {
|
|
905
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
906
|
+
/******/ __webpack_require__.n = (module) => {
|
|
907
|
+
/******/ var getter = module && module.__esModule ?
|
|
908
|
+
/******/ () => (module['default']) :
|
|
909
|
+
/******/ () => (module);
|
|
910
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
911
|
+
/******/ return getter;
|
|
912
|
+
/******/ };
|
|
913
|
+
/******/ })();
|
|
914
|
+
/******/
|
|
915
|
+
/******/ /* webpack/runtime/define property getters */
|
|
916
|
+
/******/ (() => {
|
|
917
|
+
/******/ // define getter functions for harmony exports
|
|
918
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
919
|
+
/******/ for(var key in definition) {
|
|
920
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
921
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
922
|
+
/******/ }
|
|
923
|
+
/******/ }
|
|
924
|
+
/******/ };
|
|
925
|
+
/******/ })();
|
|
926
|
+
/******/
|
|
927
|
+
/******/ /* webpack/runtime/global */
|
|
928
|
+
/******/ (() => {
|
|
929
|
+
/******/ __webpack_require__.g = (function() {
|
|
930
|
+
/******/ if (typeof globalThis === 'object') return globalThis;
|
|
931
|
+
/******/ try {
|
|
932
|
+
/******/ return this || new Function('return this')();
|
|
933
|
+
/******/ } catch (e) {
|
|
934
|
+
/******/ if (typeof window === 'object') return window;
|
|
935
|
+
/******/ }
|
|
936
|
+
/******/ })();
|
|
937
|
+
/******/ })();
|
|
938
|
+
/******/
|
|
939
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
940
|
+
/******/ (() => {
|
|
941
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
942
|
+
/******/ })();
|
|
943
|
+
/******/
|
|
944
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
945
|
+
/******/ (() => {
|
|
946
|
+
/******/ // define __esModule on exports
|
|
947
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
948
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
949
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
950
|
+
/******/ }
|
|
951
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
952
|
+
/******/ };
|
|
953
|
+
/******/ })();
|
|
954
|
+
/******/
|
|
955
|
+
/************************************************************************/
|
|
956
|
+
var __webpack_exports__ = {};
|
|
957
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
958
|
+
(() => {
|
|
959
|
+
/*!**********************!*\
|
|
960
|
+
!*** ./src/index.ts ***!
|
|
961
|
+
\**********************/
|
|
962
|
+
__webpack_require__.r(__webpack_exports__);
|
|
963
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
964
|
+
/* harmony export */ "postProcess": () => (/* reexport module object */ post_processes_legacy_legacy__WEBPACK_IMPORTED_MODULE_0__),
|
|
965
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
966
|
+
/* harmony export */ });
|
|
967
|
+
/* harmony import */ var post_processes_legacy_legacy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! post-processes/legacy/legacy */ "../../../lts/postProcesses/dist/legacy/legacy.js");
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (post_processes_legacy_legacy__WEBPACK_IMPORTED_MODULE_0__);
|
|
971
|
+
|
|
972
|
+
})();
|
|
973
|
+
|
|
974
|
+
__webpack_exports__ = __webpack_exports__["default"];
|
|
975
|
+
/******/ return __webpack_exports__;
|
|
976
|
+
/******/ })()
|
|
977
|
+
;
|
|
978
|
+
});
|
|
979
|
+
//# sourceMappingURL=babylonjs.postProcess.js.map
|