babylonjs-post-process 9.22.1 → 9.23.0
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/babylonjs.postProcess.es5.js +202 -0
- package/package.json +2 -2
- package/rollup.config.umd.mjs +1 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
!function (e, t) { "object" == typeof exports && "undefined" != typeof module ? t(exports, require("babylonjs")) : "function" == typeof define && define.amd ? define(["exports", "babylonjs"], t) : t((e = "undefined" != typeof globalThis ? globalThis : e || self).POSTPROCESSES = e.POSTPROCESSES || {}, e.BABYLON); }(this, function (e, t) {
|
|
18
|
+
"use strict";
|
|
19
|
+
function i(e, t, i, r, o, a) { function n(e) { if (void 0 !== e && "function" != typeof e)
|
|
20
|
+
throw new TypeError("Function expected"); return e; } for (var l, s = r.kind, c = "getter" === s ? "get" : "setter" === s ? "set" : "value", h = !t && e ? r.static ? e : e.prototype : null, d = t || (h ? Object.getOwnPropertyDescriptor(h, r.name) : {}), f = !1, g = i.length - 1; g >= 0; g--) {
|
|
21
|
+
var m = {};
|
|
22
|
+
for (var u in r)
|
|
23
|
+
m[u] = "access" === u ? {} : r[u];
|
|
24
|
+
for (var u in r.access)
|
|
25
|
+
m.access[u] = r.access[u];
|
|
26
|
+
m.addInitializer = function (e) { if (f)
|
|
27
|
+
throw new TypeError("Cannot add initializers after decoration has completed"); a.push(n(e || null)); };
|
|
28
|
+
var x = (0, i[g])("accessor" === s ? { get: d.get, set: d.set } : d[c], m);
|
|
29
|
+
if ("accessor" === s) {
|
|
30
|
+
if (void 0 === x)
|
|
31
|
+
continue;
|
|
32
|
+
if (null === x || "object" != typeof x)
|
|
33
|
+
throw new TypeError("Object expected");
|
|
34
|
+
(l = n(x.get)) && (d.get = l), (l = n(x.set)) && (d.set = l), (l = n(x.init)) && o.unshift(l);
|
|
35
|
+
}
|
|
36
|
+
else
|
|
37
|
+
(l = n(x)) && ("field" === s ? o.unshift(l) : d[c] = l);
|
|
38
|
+
} h && Object.defineProperty(h, r.name, d), f = !0; }
|
|
39
|
+
function r(e, t, i) { for (var r = arguments.length > 2, o = 0; o < t.length; o++)
|
|
40
|
+
i = r ? t[o].call(e, i) : t[o].call(e); return r ? i : void 0; }
|
|
41
|
+
Object.create, Object.create, "function" == typeof SuppressedError && SuppressedError;
|
|
42
|
+
var o = "asciiartPixelShader";
|
|
43
|
+
t.ShaderStore.ShadersStore[o] || (t.ShaderStore.ShadersStore[o] = "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;}");
|
|
44
|
+
var a = (function () { var e; var o, a, n = t.BaseTexture, l = [], s = [], c = [], h = []; return e = /** @class */ (function (_super) {
|
|
45
|
+
__extends(e, _super);
|
|
46
|
+
function e(e, i, o, a) {
|
|
47
|
+
if (a === void 0) { a = null; }
|
|
48
|
+
var _this = this;
|
|
49
|
+
if (_this = _super.call(this, a) || this, _this._font = r(_this, l, void 0), _this._text = (r(_this, s), r(_this, c, void 0)), _this._charSize = r(_this, h), !(a = _this.getScene()))
|
|
50
|
+
return _this;
|
|
51
|
+
_this.name = e, _this._text, _this._font, _this.wrapU = t.Texture.CLAMP_ADDRESSMODE, _this.wrapV = t.Texture.CLAMP_ADDRESSMODE;
|
|
52
|
+
var n = _this._getFontHeight(i), d = _this._getFontWidth(i);
|
|
53
|
+
_this._charSize = Math.max(n.height, d);
|
|
54
|
+
var f = Math.ceil(_this._charSize * o.length), g = _this._charSize;
|
|
55
|
+
_this._texture = a.getEngine().createDynamicTexture(f, g, !1, t.Texture.NEAREST_SAMPLINGMODE);
|
|
56
|
+
var m = _this.getSize(), u = document.createElement("canvas");
|
|
57
|
+
u.width = m.width, u.height = m.height;
|
|
58
|
+
var x = u.getContext("2d");
|
|
59
|
+
x.textBaseline = "top", x.font = i, x.fillStyle = "white", x.imageSmoothingEnabled = !1;
|
|
60
|
+
for (var e_1 = 0; e_1 < o.length; e_1++)
|
|
61
|
+
x.fillText(o[e_1], e_1 * _this._charSize, -n.offset);
|
|
62
|
+
a.getEngine().updateDynamicTexture(_this._texture, u, !1, !0);
|
|
63
|
+
return _this;
|
|
64
|
+
}
|
|
65
|
+
Object.defineProperty(e.prototype, "charSize", {
|
|
66
|
+
get: function () { return this._charSize; },
|
|
67
|
+
enumerable: false,
|
|
68
|
+
configurable: true
|
|
69
|
+
});
|
|
70
|
+
e.prototype._getFontWidth = function (e) { var t = document.createElement("canvas").getContext("2d"); return t.fillStyle = "white", t.font = e, t.measureText("W").width; };
|
|
71
|
+
e.prototype._getFontHeight = function (e) { var t = document.createElement("canvas"), i = t.getContext("2d"); i.fillRect(0, 0, t.width, t.height), i.textBaseline = "top", i.fillStyle = "white", i.font = e, i.fillText("jH|", 0, 0); var r = i.getImageData(0, 0, t.width, t.height).data; var o = -1, a = -1; for (var e_2 = 0; e_2 < t.height; e_2++)
|
|
72
|
+
for (var i_1 = 0; i_1 < t.width; i_1++) {
|
|
73
|
+
if (0 !== r[4 * (e_2 * t.width + i_1)]) {
|
|
74
|
+
-1 === o && (o = e_2);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
if (i_1 === t.width - 1 && -1 !== o) {
|
|
78
|
+
a = e_2, e_2 = t.height;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
} return { height: a - o + 1, offset: o - 1 }; };
|
|
82
|
+
e.prototype.clone = function () { return new e(this.name, this._font, this._text, this.getScene()); };
|
|
83
|
+
e.Parse = function (i, r) { return t.SerializationHelper.Parse(function () { return new e(i.name, i.font, i.text, r); }, i, r, null); };
|
|
84
|
+
return e;
|
|
85
|
+
}(n)), (function () { var r; var d = "function" == typeof Symbol && Symbol.metadata ? Object.create(null !== (r = n[Symbol.metadata]) && void 0 !== r ? r : null) : void 0; o = [t.serialize("font")], a = [t.serialize("text")], i(null, null, o, { kind: "field", name: "_font", static: !1, private: !1, access: { has: function (e) { return "_font" in e; }, get: function (e) { return e._font; }, set: function (e, t) { e._font = t; } }, metadata: d }, l, s), i(null, null, a, { kind: "field", name: "_text", static: !1, private: !1, access: { has: function (e) { return "_text" in e; }, get: function (e) { return e._text; }, set: function (e, t) { e._text = t; } }, metadata: d }, c, h), d && Object.defineProperty(e, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: d }); })(), e; })();
|
|
86
|
+
var n = /** @class */ (function (_super) {
|
|
87
|
+
__extends(n, _super);
|
|
88
|
+
function n(e, i, r) {
|
|
89
|
+
var _this = this;
|
|
90
|
+
_this = _super.call(this, e, "asciiart", ["asciiArtFontInfos", "asciiArtOptions"], ["asciiArtFont"], 1, i, t.Texture.TRILINEAR_SAMPLINGMODE, void 0, !0) || this, _this.mixToTile = 0, _this.mixToNormal = 0;
|
|
91
|
+
var o = "40px Monospace", n = " `-.'_:,\"=^;<+!*?/cL\\zrs7TivJtC{3F)Il(xZfY5S2eajo14[nuyE]P6V9kXpKwGhqAUbOd8#HRDB0$mgMW&Q%N@";
|
|
92
|
+
r && ("string" == typeof r ? o = r : (o = r.font || o, n = r.characterSet || n, _this.mixToTile = r.mixToTile || _this.mixToTile, _this.mixToNormal = r.mixToNormal || _this.mixToNormal));
|
|
93
|
+
var l = (null == i ? void 0 : i.getScene()) || _this._scene;
|
|
94
|
+
_this._asciiArtFontTexture = new a(e, o, n, l);
|
|
95
|
+
var s = _this._asciiArtFontTexture.getSize();
|
|
96
|
+
_this.onApply = function (e) { e.setTexture("asciiArtFont", _this._asciiArtFontTexture), e.setFloat4("asciiArtFontInfos", _this._asciiArtFontTexture.charSize, n.length, s.width, s.height), e.setFloat4("asciiArtOptions", _this.width, _this.height, _this.mixToNormal, _this.mixToTile); };
|
|
97
|
+
return _this;
|
|
98
|
+
}
|
|
99
|
+
return n;
|
|
100
|
+
}(t.PostProcess));
|
|
101
|
+
var l = "digitalrainPixelShader";
|
|
102
|
+
t.ShaderStore.ShadersStore[l] || (t.ShaderStore.ShadersStore[l] = "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;}");
|
|
103
|
+
var s = (function () { var e; var o, a, n = t.BaseTexture, l = [], s = [], c = [], h = []; return e = /** @class */ (function (_super) {
|
|
104
|
+
__extends(e, _super);
|
|
105
|
+
function e(e, i, o, a) {
|
|
106
|
+
if (a === void 0) { a = null; }
|
|
107
|
+
var _this = this;
|
|
108
|
+
if (_this = _super.call(this, a) || this, _this._font = r(_this, l, void 0), _this._text = (r(_this, s), r(_this, c, void 0)), _this._charSize = r(_this, h), !(a = _this.getScene()))
|
|
109
|
+
return _this;
|
|
110
|
+
_this.name = e, _this._text, _this._font, _this.wrapU = t.Texture.CLAMP_ADDRESSMODE, _this.wrapV = t.Texture.CLAMP_ADDRESSMODE;
|
|
111
|
+
var n = _this._getFontHeight(i), d = _this._getFontWidth(i);
|
|
112
|
+
_this._charSize = Math.max(n.height, d);
|
|
113
|
+
var f = _this._charSize, g = Math.ceil(_this._charSize * o.length);
|
|
114
|
+
_this._texture = a.getEngine().createDynamicTexture(f, g, !1, t.Texture.NEAREST_SAMPLINGMODE);
|
|
115
|
+
var m = _this.getSize(), u = document.createElement("canvas");
|
|
116
|
+
u.width = m.width, u.height = m.height;
|
|
117
|
+
var x = u.getContext("2d");
|
|
118
|
+
x.textBaseline = "top", x.font = i, x.fillStyle = "white", x.imageSmoothingEnabled = !1;
|
|
119
|
+
for (var e_3 = 0; e_3 < o.length; e_3++)
|
|
120
|
+
x.fillText(o[e_3], 0, e_3 * _this._charSize - n.offset);
|
|
121
|
+
a.getEngine().updateDynamicTexture(_this._texture, u, !1, !0);
|
|
122
|
+
return _this;
|
|
123
|
+
}
|
|
124
|
+
Object.defineProperty(e.prototype, "charSize", {
|
|
125
|
+
get: function () { return this._charSize; },
|
|
126
|
+
enumerable: false,
|
|
127
|
+
configurable: true
|
|
128
|
+
});
|
|
129
|
+
e.prototype._getFontWidth = function (e) { var t = document.createElement("canvas").getContext("2d"); return t.fillStyle = "white", t.font = e, t.measureText("W").width; };
|
|
130
|
+
e.prototype._getFontHeight = function (e) { var t = document.createElement("canvas"), i = t.getContext("2d"); i.fillRect(0, 0, t.width, t.height), i.textBaseline = "top", i.fillStyle = "white", i.font = e, i.fillText("jH|", 0, 0); var r = i.getImageData(0, 0, t.width, t.height).data; var o = -1, a = -1; for (var e_4 = 0; e_4 < t.height; e_4++)
|
|
131
|
+
for (var i_2 = 0; i_2 < t.width; i_2++) {
|
|
132
|
+
if (0 !== r[4 * (e_4 * t.width + i_2)]) {
|
|
133
|
+
-1 === o && (o = e_4);
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
if (i_2 === t.width - 1 && -1 !== o) {
|
|
137
|
+
a = e_4, e_4 = t.height;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
} return { height: a - o + 1, offset: o - 1 }; };
|
|
141
|
+
e.prototype.clone = function () { return new e(this.name, this._font, this._text, this.getScene()); };
|
|
142
|
+
e.Parse = function (i, r) { return t.SerializationHelper.Parse(function () { return new e(i.name, i.font, i.text, r); }, i, r, null); };
|
|
143
|
+
return e;
|
|
144
|
+
}(n)), (function () { var r; var d = "function" == typeof Symbol && Symbol.metadata ? Object.create(null !== (r = n[Symbol.metadata]) && void 0 !== r ? r : null) : void 0; o = [t.serialize("font")], a = [t.serialize("text")], i(null, null, o, { kind: "field", name: "_font", static: !1, private: !1, access: { has: function (e) { return "_font" in e; }, get: function (e) { return e._font; }, set: function (e, t) { e._font = t; } }, metadata: d }, l, s), i(null, null, a, { kind: "field", name: "_text", static: !1, private: !1, access: { has: function (e) { return "_text" in e; }, get: function (e) { return e._text; }, set: function (e, t) { e._text = t; } }, metadata: d }, c, h), d && Object.defineProperty(e, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: d }); })(), e; })();
|
|
145
|
+
var c = /** @class */ (function (_super) {
|
|
146
|
+
__extends(c, _super);
|
|
147
|
+
function c(e, i, r) {
|
|
148
|
+
var _this = this;
|
|
149
|
+
_this = _super.call(this, e, "digitalrain", ["digitalRainFontInfos", "digitalRainOptions", "cosTimeZeroOne", "matrixSpeed"], ["digitalRainFont"], 1, i, t.Texture.TRILINEAR_SAMPLINGMODE, void 0, !0) || this, _this.mixToTile = 0, _this.mixToNormal = 0, _this.speed = .003;
|
|
150
|
+
var o = "15px Monospace";
|
|
151
|
+
r && ("string" == typeof r ? o = r : (o = r.font || o, _this.mixToTile = r.mixToTile || _this.mixToTile, _this.mixToNormal = r.mixToNormal || _this.mixToNormal));
|
|
152
|
+
var a = (null == i ? void 0 : i.getScene()) || null;
|
|
153
|
+
_this._digitalRainFontTexture = new s(e, o, "古池や蛙飛び込む水の音ふるいけやかわずとびこむみずのおと初しぐれ猿も小蓑をほしげ也はつしぐれさるもこみのをほしげなり江戸の雨何石呑んだ時鳥えどのあめなんごくのんだほととぎす", a);
|
|
154
|
+
var n = _this._digitalRainFontTexture.getSize();
|
|
155
|
+
var l = 0, c = 0;
|
|
156
|
+
var h = t.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());
|
|
157
|
+
_this.onApply = function (e) { e.setTexture("digitalRainFont", _this._digitalRainFontTexture), e.setFloat4("digitalRainFontInfos", _this._digitalRainFontTexture.charSize, 86, n.width, n.height), e.setFloat4("digitalRainOptions", _this.width, _this.height, _this.mixToNormal, _this.mixToTile), e.setMatrix("matrixSpeed", h), l += _this.speed, c = l, e.setFloat("cosTimeZeroOne", c); };
|
|
158
|
+
return _this;
|
|
159
|
+
}
|
|
160
|
+
return c;
|
|
161
|
+
}(t.PostProcess));
|
|
162
|
+
var h = "edgeDetectionPixelShader";
|
|
163
|
+
t.ShaderStore.ShadersStore[h] || (t.ShaderStore.ShadersStore[h] = "precision highp float;varying vec2 vUV;uniform sampler2D textureSampler;uniform sampler2D normalSampler;uniform sampler2D depthSampler;uniform float width;uniform float height;uniform vec3 edgeColor;uniform float edgeIntensity;uniform float edgeWidth;uniform int renderMode; \n#define inline\nvec3 boxBlur(sampler2D sampler,vec2 uv,vec2 texelSize) {vec3 result=vec3(0.0);for (int x=-1; x<=1; x++) {for (int y=-1; y<=1; y++) {vec2 offset=vec2(float(x),float(y))*texelSize;result+=texture2D(sampler,uv+offset).rgb;}}\nreturn result/9.0;}\nvoid main(void) {vec2 texelSize=vec2(1.0/width,1.0/height);vec3 originalColor=texture2D(textureSampler,vUV).rgb;if (renderMode==1 || renderMode==2 || renderMode==3) {if (length(originalColor)==0.0) {originalColor=vec3(1.0,1.0,1.0); }\nif (originalColor.r==1.0 && originalColor.g==0.0 && originalColor.b==0.0) {originalColor=vec3(1.0,1.0,1.0); }}\nvec3 normal=texture2D(normalSampler,vUV).rgb;float depth=texture2D(depthSampler,vUV).r;float edgeStrength=0.0;int range=int(edgeWidth*8.0); \nfor (int x=-range; x<=range; x++) {for (int y=-range; y<=range; y++) {if (x==0 && y==0) {continue;}\nvec3 neighborNormal=texture2D(normalSampler,vUV+texelSize*vec2(float(x),float(y))).rgb;float neighborDepth=texture2D(depthSampler,vUV+texelSize*vec2(float(x),float(y))).r;float normalDiff=length(neighborNormal-normal);float depthDiff=abs(neighborDepth-depth);edgeStrength=max(edgeStrength,max(normalDiff,depthDiff));}}\nedgeStrength=smoothstep(edgeWidth,edgeWidth+edgeIntensity,edgeStrength);vec3 finalColor=mix(originalColor,edgeColor,edgeStrength);gl_FragColor=vec4(finalColor,1.0);}\n");
|
|
164
|
+
var d = (function () { var e; var o, a, n, l, s = t.PostProcess, c = [], h = [], d = [], f = [], g = [], m = [], u = [], x = []; return e = /** @class */ (function (_super) {
|
|
165
|
+
__extends(e, _super);
|
|
166
|
+
function e(e, i, o, a, n, l, s) {
|
|
167
|
+
if (s === void 0) { s = t.Constants.TEXTURETYPE_UNSIGNED_BYTE; }
|
|
168
|
+
var _this = this;
|
|
169
|
+
if (_this = _super.call(this, e, "edgeDetection", ["width", "height", "edgeColor", "edgeIntensity", "edgeWidth", "renderMode"], ["normalSampler", "depthSampler"], o, a, n, i.getEngine(), l, null, s) || this, _this.edgeColor = r(_this, c, new t.Color3(0, 0, 0)), _this.edgeIntensity = (r(_this, h), r(_this, d, .2)), _this.edgeWidth = (r(_this, f), r(_this, g, .2)), _this.renderMode = (r(_this, m), r(_this, u, 0)), _this._geometryBufferRenderer = r(_this, x), _this._geometryBufferRenderer = i.enableGeometryBufferRenderer(), _this._geometryBufferRenderer) {
|
|
170
|
+
var e_5 = new t.RenderTargetTexture("h1", { width: 1, height: 1 }, i, { samplingMode: t.Constants.TEXTURE_NEAREST_NEAREST, generateMipMaps: !1, generateDepthBuffer: !1, type: t.Constants.TEXTURETYPE_HALF_FLOAT });
|
|
171
|
+
_this.onApply = function (t) { t.setFloat("width", _this.width), t.setFloat("height", _this.height), t.setFloat("edgeIntensity", _this.edgeIntensity), t.setFloat("edgeWidth", _this.edgeWidth), t.setColor3("edgeColor", _this.edgeColor); var i = _this._geometryBufferRenderer.getGBuffer().textures[1], r = _this._geometryBufferRenderer.getGBuffer().textures[0]; switch (t.setTexture("normalSampler", i), t.setTexture("depthSampler", r), _this.renderMode) {
|
|
172
|
+
case 0: break;
|
|
173
|
+
case 1:
|
|
174
|
+
t.setTexture("textureSampler", _this._geometryBufferRenderer.getGBuffer().textures[1]), t.setFloat("edgeWidth", 0);
|
|
175
|
+
break;
|
|
176
|
+
case 2:
|
|
177
|
+
t.setTexture("textureSampler", _this._geometryBufferRenderer.getGBuffer().textures[0]), t.setFloat("edgeWidth", 0);
|
|
178
|
+
break;
|
|
179
|
+
case 3: t.setTexture("textureSampler", e_5);
|
|
180
|
+
} t.setInt("renderMode", _this.renderMode); };
|
|
181
|
+
}
|
|
182
|
+
else
|
|
183
|
+
t.Logger.Error("Geometry Buffer Renderer support is required for this post-process.");
|
|
184
|
+
return _this;
|
|
185
|
+
}
|
|
186
|
+
e.prototype.getClassName = function () { return "EdgeDetectionPostProcess"; };
|
|
187
|
+
Object.defineProperty(e, "IsSupported", {
|
|
188
|
+
get: function () { var e = t.EngineStore.LastCreatedEngine; return !!e && e.getCaps().drawBuffersExtension; },
|
|
189
|
+
enumerable: false,
|
|
190
|
+
configurable: true
|
|
191
|
+
});
|
|
192
|
+
e._Parse = function (i, r, o, a) { return t.SerializationHelper.Parse(function () { return new e(i.name, o, i.options, r, i.renderTargetSamplingMode, i.textureType, i.reusable); }, i, o, a); };
|
|
193
|
+
return e;
|
|
194
|
+
}(s)), (function () { var r; var S = "function" == typeof Symbol && Symbol.metadata ? Object.create(null !== (r = s[Symbol.metadata]) && void 0 !== r ? r : null) : void 0; o = [t.serialize()], a = [t.serialize()], n = [t.serialize()], l = [t.serialize()], i(null, null, o, { kind: "field", name: "edgeColor", static: !1, private: !1, access: { has: function (e) { return "edgeColor" in e; }, get: function (e) { return e.edgeColor; }, set: function (e, t) { e.edgeColor = t; } }, metadata: S }, c, h), i(null, null, a, { kind: "field", name: "edgeIntensity", static: !1, private: !1, access: { has: function (e) { return "edgeIntensity" in e; }, get: function (e) { return e.edgeIntensity; }, set: function (e, t) { e.edgeIntensity = t; } }, metadata: S }, d, f), i(null, null, n, { kind: "field", name: "edgeWidth", static: !1, private: !1, access: { has: function (e) { return "edgeWidth" in e; }, get: function (e) { return e.edgeWidth; }, set: function (e, t) { e.edgeWidth = t; } }, metadata: S }, g, m), i(null, null, l, { kind: "field", name: "renderMode", static: !1, private: !1, access: { has: function (e) { return "renderMode" in e; }, get: function (e) { return e.renderMode; }, set: function (e, t) { e.renderMode = t; } }, metadata: S }, u, x), S && Object.defineProperty(e, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: S }); })(), e; })();
|
|
195
|
+
t.RegisterClass("BABYLON.EdgeDetectionPostProcess", d);
|
|
196
|
+
var f = { __proto__: null, AsciiArtFontTexture: a, AsciiArtPostProcess: n, DigitalRainFontTexture: s, DigitalRainPostProcess: c, EdgeDetectionPostProcess: d };
|
|
197
|
+
var g = "undefined" != typeof global ? global : "undefined" != typeof window ? window : void 0;
|
|
198
|
+
if (void 0 !== g)
|
|
199
|
+
for (var e_6 in f)
|
|
200
|
+
g.BABYLON[e_6] = f[e_6];
|
|
201
|
+
e.AsciiArtFontTexture = a, e.AsciiArtPostProcess = n, e.DigitalRainFontTexture = s, e.DigitalRainPostProcess = c, e.EdgeDetectionPostProcess = d;
|
|
202
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babylonjs-post-process",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.23.0",
|
|
4
4
|
"main": "babylonjs.postProcess.min.js",
|
|
5
5
|
"types": "babylonjs.postProcess.module.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"test:escheck": "es-check es6 ./babylonjs.postProcess.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"babylonjs": "9.
|
|
19
|
+
"babylonjs": "9.23.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@dev/build-tools": "1.0.0",
|
package/rollup.config.umd.mjs
CHANGED
|
@@ -22,4 +22,5 @@ export default commonUMDRollupConfiguration({
|
|
|
22
22
|
overrideFilename: (pathData) =>
|
|
23
23
|
pathData.chunk.name === "postProcess" ? `babylonjs.postProcess${production ? ".min" : ""}.js` : `babylon.${pathData.chunk.name}PostProcess${production ? ".min" : ""}.js`,
|
|
24
24
|
minToMax: true,
|
|
25
|
+
es5EntryPoint: "postProcess",
|
|
25
26
|
});
|