textmode.js 0.9.0-beta.2 → 0.9.0-beta.3
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/textmode.esm.js +109 -109
- package/dist/textmode.umd.js +11 -11
- package/package.json +1 -1
package/dist/textmode.esm.js
CHANGED
|
@@ -182,7 +182,7 @@ in vec2 A0;in vec2 A1;in vec2 A2;in vec2 A3;in vec3 A4;in vec4 A5;in vec4 A6;in
|
|
|
182
182
|
a(this, "Z", null);
|
|
183
183
|
a(this, "q", /* @__PURE__ */ new Map());
|
|
184
184
|
this.G = e, this.j = i, this.A = t, this.W = X(s, 1, 8), this.K = n, this.l = { filter: "nearest", wrap: "clamp", format: "rgba", type: "unsigned_byte", depth: !0, ...r }, K.V || (K.V = new Q(t, rt, `#version 300 es
|
|
185
|
-
precision highp float;in vec2 v_uv;uniform sampler2D
|
|
185
|
+
precision highp float;in vec2 v_uv;uniform sampler2D U2;uniform sampler2D U3;uniform sampler2D U4;uniform sampler2D U5;uniform vec2 U6;uniform bool U7;uniform bool U8;uniform bool U9;layout(location=0)out vec4 o_character;layout(location=1)out vec4 o_primaryColor;layout(location=2)out vec4 o_secondaryColor;layout(location=3)out vec4 A;void main(){vec2 B=vec2(v_uv.x,1.-v_uv.y);vec2 C=B*U6;vec2 D=(floor(C)+0.5f)/U6;vec4 E=texture(U2,D);vec4 F=U7?texture(U3,D):vec4(0.);if(U7&&F.a==0.){discard;}vec4 G=U8?texture(U4,D):vec4(0.);vec4 H=U9?texture(U5,D):vec4(0.);o_character=E;o_primaryColor=F;o_secondaryColor=G;A=H;}`));
|
|
186
186
|
const h = t.getParameter(t.MAX_DRAW_BUFFERS), c = t.getParameter(t.MAX_COLOR_ATTACHMENTS);
|
|
187
187
|
this.W = Math.min(this.W, h, c), this.N = t.createFramebuffer(), this.J(), this.tt(), this.l.depth && this.st();
|
|
188
188
|
}
|
|
@@ -244,7 +244,7 @@ precision highp float;in vec2 v_uv;uniform sampler2D U0;uniform sampler2D U1;uni
|
|
|
244
244
|
}
|
|
245
245
|
ut() {
|
|
246
246
|
if (!this.K) return;
|
|
247
|
-
const t = this.W > 1, e = this.W > 2, i = this.W > 3, s = {
|
|
247
|
+
const t = this.W > 1, e = this.W > 2, i = this.W > 3, s = { U2: this.Y[0], U3: t ? this.Y[1] : this.Y[0], U4: e ? this.Y[2] : this.Y[0], U5: i ? this.Y[3] : this.Y[0], U6: [this.G, this.j], U7: t, U8: e, U9: i }, r = K.V;
|
|
248
248
|
this.Z = this.K.dt.ft(r, s, !0);
|
|
249
249
|
}
|
|
250
250
|
dispose() {
|
|
@@ -585,17 +585,17 @@ class fe {
|
|
|
585
585
|
a(this, "A");
|
|
586
586
|
a(this, "Qs");
|
|
587
587
|
a(this, "pe");
|
|
588
|
-
a(this, "
|
|
589
|
-
this.A = t, this.Qs = new ce(e, i), this.pe = new le(this.Qs), this.
|
|
588
|
+
a(this, "me");
|
|
589
|
+
this.A = t, this.Qs = new ce(e, i), this.pe = new le(this.Qs), this.me = new ue(t, e);
|
|
590
590
|
}
|
|
591
|
-
|
|
591
|
+
ge(t) {
|
|
592
592
|
var s, r, n, h, c, l, u, f, d, g;
|
|
593
593
|
const e = [0, 0, 0, 0], i = [0, 0, 0, 0];
|
|
594
594
|
return t.Ls && t.Hs ? (e[0] = ((s = t.Os) == null ? void 0 : s[0]) ?? 0, e[1] = ((r = t.Os) == null ? void 0 : r[1]) ?? 0, e[2] = ((n = t.Bs) == null ? void 0 : n[0]) ?? 0, e[3] = ((h = t.Bs) == null ? void 0 : h[1]) ?? 0, i[0] = t.Ls[0], i[1] = t.Ls[1], i[2] = t.Hs[0], i[3] = t.Hs[1]) : t.Ds && (e[0] = t.Ds[0], e[1] = t.Ds[1]), this.ne({ x: t.As[0], y: t.As[1], width: t.Ss[0], height: t.Ss[1], char0: t.Gt[0], char1: t.Gt[1], char2: t.Gt[2], r1: t.jt[0], g1: t.jt[1], b1: t.jt[2], a1: t.jt[3], r2: t.Nt[0], g2: t.Nt[1], b2: t.Nt[2], a2: t.Nt[3], invert: t.Rs[0], flipX: t.Rs[1], flipY: t.Rs[2], charRot: t.Tt, translationX: ((c = t.Es) == null ? void 0 : c[0]) ?? 0, translationY: ((l = t.Es) == null ? void 0 : l[1]) ?? 0, translationZ: ((u = t.Es) == null ? void 0 : u[2]) ?? 0, rotationX: ((f = t.ks) == null ? void 0 : f[0]) ?? 0, rotationY: ((d = t.ks) == null ? void 0 : d[1]) ?? 0, rotationZ: ((g = t.ks) == null ? void 0 : g[2]) ?? 0, curveParams0: e, curveParams1: i, depth: t.Is || 0, baseZ: t.Gs || 0, geometryType: t.js || 0 });
|
|
595
595
|
}
|
|
596
596
|
ne(t) {
|
|
597
597
|
const e = this.pe.ne(t);
|
|
598
|
-
return this.Qs.ee > this.
|
|
598
|
+
return this.Qs.ee > this.me.ee && this.me.le(this.Qs.ee), e;
|
|
599
599
|
}
|
|
600
600
|
get _e() {
|
|
601
601
|
return this.Qs.se;
|
|
@@ -610,17 +610,17 @@ class fe {
|
|
|
610
610
|
const e = this.Qs.se;
|
|
611
611
|
if (e === 0) return;
|
|
612
612
|
const i = this.Qs.te();
|
|
613
|
-
this.
|
|
613
|
+
this.me.ue(i, e), this.me.de(t);
|
|
614
614
|
}
|
|
615
615
|
ve(t) {
|
|
616
|
-
this.
|
|
616
|
+
this.me.ve(t);
|
|
617
617
|
}
|
|
618
618
|
Ms(t, e) {
|
|
619
619
|
const i = this.Qs.se;
|
|
620
620
|
i !== 0 && this.A.drawArraysInstanced(t, 0, e, i);
|
|
621
621
|
}
|
|
622
622
|
Fs() {
|
|
623
|
-
this.
|
|
623
|
+
this.me.Fs();
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
626
|
class O {
|
|
@@ -656,7 +656,7 @@ class O {
|
|
|
656
656
|
this.Ae.Fs(), this.A.deleteBuffer(this.xe);
|
|
657
657
|
}
|
|
658
658
|
$e(t, e, i) {
|
|
659
|
-
return this.Ae.
|
|
659
|
+
return this.Ae.ge(t);
|
|
660
660
|
}
|
|
661
661
|
Pe(t, e, i, s, r, n) {
|
|
662
662
|
const h = r.Lt ?? 0, c = r.Ht ?? 0, l = r.Ot ?? 0, u = r.At ?? 0, f = r.bt ?? 0, d = r.wt ?? 0, g = [0, 0, 0, 0], v = [0, 0, 0, 0];
|
|
@@ -692,14 +692,14 @@ const Ae = { Ce: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Te:
|
|
|
692
692
|
constructor(o, t) {
|
|
693
693
|
super(o, t, F.RECTANGLE, de);
|
|
694
694
|
}
|
|
695
|
-
|
|
695
|
+
ge(o, t) {
|
|
696
696
|
return this.Pe(0, 0, o.width, o.height, t);
|
|
697
697
|
}
|
|
698
698
|
}, [F.LINE]: class extends O {
|
|
699
699
|
constructor(o, t) {
|
|
700
700
|
super(o, t, F.LINE, ge);
|
|
701
701
|
}
|
|
702
|
-
|
|
702
|
+
ge(o, t) {
|
|
703
703
|
const e = o.x2 - o.x1, i = o.y2 - o.y1, s = Math.hypot(e, i), r = Math.atan2(i, e), n = t.Dt || 1, h = o.x1 + e / 2 - s / 2, c = o.y1 + i / 2, l = { ...t, wt: (t.wt || 0) + r };
|
|
704
704
|
return this.Pe(h, c, s, n, l);
|
|
705
705
|
}
|
|
@@ -707,14 +707,14 @@ const Ae = { Ce: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Te:
|
|
|
707
707
|
constructor(o, t) {
|
|
708
708
|
super(o, t, F.ELLIPSE, ve);
|
|
709
709
|
}
|
|
710
|
-
|
|
710
|
+
ge(o, t) {
|
|
711
711
|
return this.Pe(0, 0, o.width, o.height, t);
|
|
712
712
|
}
|
|
713
713
|
}, [F.ARC]: class extends O {
|
|
714
714
|
constructor(o, t) {
|
|
715
715
|
super(o, t, F.ARC, me);
|
|
716
716
|
}
|
|
717
|
-
|
|
717
|
+
ge(o, t) {
|
|
718
718
|
const e = o.start * Math.PI / 180, i = o.stop * Math.PI / 180;
|
|
719
719
|
return this.Pe(0, 0, o.width, o.height, t, { arcStart: e, arcStop: i });
|
|
720
720
|
}
|
|
@@ -722,7 +722,7 @@ const Ae = { Ce: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Te:
|
|
|
722
722
|
constructor(o, t) {
|
|
723
723
|
super(o, t, F.TRIANGLE, Ae);
|
|
724
724
|
}
|
|
725
|
-
|
|
725
|
+
ge(o, t) {
|
|
726
726
|
const e = Math.min(o.x1, o.x2, o.x3), i = Math.max(o.x1, o.x2, o.x3), s = Math.min(o.y1, o.y2, o.y3), r = i - e, n = Math.max(o.y1, o.y2, o.y3) - s;
|
|
727
727
|
return this.Pe(e, s, r, n, t);
|
|
728
728
|
}
|
|
@@ -730,7 +730,7 @@ const Ae = { Ce: new Float32Array([0, 0, 0, 0, 1, 0, 1, 0, 0.5, 1, 0.5, 1]), Te:
|
|
|
730
730
|
constructor(o, t) {
|
|
731
731
|
super(o, t, F.BEZIER_CURVE, pe);
|
|
732
732
|
}
|
|
733
|
-
|
|
733
|
+
ge(o, t) {
|
|
734
734
|
return this.Pe(0, 0, 1, t.Dt || 1, t, { cp1x: o.cp1x, cp1y: o.cp1y, cp2x: o.cp2x, cp2y: o.cp2y, bezStartX: o.x1, bezStartY: o.y1, bezEndX: o.x2, bezEndY: o.y2 });
|
|
735
735
|
}
|
|
736
736
|
} };
|
|
@@ -761,7 +761,7 @@ class Ee {
|
|
|
761
761
|
e.shader.D(), e.shader.H(e.uniforms);
|
|
762
762
|
const n = St(this.A), h = s.length > 0 && s[0].state.St;
|
|
763
763
|
if (e.shader.H({ UJ: n[2] / n[3], UG: [n[2], n[3]], UH: 1, UI: h ? 1 : 0 }), r.Me(), s.forEach((c) => {
|
|
764
|
-
r.
|
|
764
|
+
r.ge(c.params, c.state);
|
|
765
765
|
}), r.Fe()) {
|
|
766
766
|
const c = r.unitGeometry, l = r.unitBuffer;
|
|
767
767
|
try {
|
|
@@ -935,10 +935,10 @@ class Te {
|
|
|
935
935
|
O(t, e) {
|
|
936
936
|
this.ni[t] = e;
|
|
937
937
|
}
|
|
938
|
-
|
|
938
|
+
mi(t) {
|
|
939
939
|
Object.assign(this.ni, t);
|
|
940
940
|
}
|
|
941
|
-
|
|
941
|
+
gi(t) {
|
|
942
942
|
return new Q(this.A, rt, t);
|
|
943
943
|
}
|
|
944
944
|
_i(t, e, i, s) {
|
|
@@ -1602,11 +1602,11 @@ class it {
|
|
|
1602
1602
|
a(this, "dr", { width: 0, height: 0 });
|
|
1603
1603
|
a(this, "vr");
|
|
1604
1604
|
a(this, "pr");
|
|
1605
|
-
a(this, "gr");
|
|
1606
1605
|
a(this, "mr");
|
|
1606
|
+
a(this, "gr");
|
|
1607
1607
|
a(this, "_r");
|
|
1608
1608
|
a(this, "yr", !1);
|
|
1609
|
-
this.cr = e, this.pr = new ze(), this.
|
|
1609
|
+
this.cr = e, this.pr = new ze(), this.mr = new Ne(t), this.gr = new Be(), this._r = new _e();
|
|
1610
1610
|
}
|
|
1611
1611
|
async Ar(t) {
|
|
1612
1612
|
if (this.yr) return;
|
|
@@ -1621,8 +1621,8 @@ class it {
|
|
|
1621
1621
|
}
|
|
1622
1622
|
Cr(t) {
|
|
1623
1623
|
if (t === void 0) return this.cr;
|
|
1624
|
-
this.cr = t, this.dr = this.
|
|
1625
|
-
const e = this.
|
|
1624
|
+
this.cr = t, this.dr = this.gr.Ji(this.nr.map((i) => i.character), this.cr, this.rr);
|
|
1625
|
+
const e = this.mr.Gi(this.nr, this.dr, this.cr, this.rr);
|
|
1626
1626
|
this.ar = e.framebuffer, this.lr = e.columns, this.ur = e.rows;
|
|
1627
1627
|
}
|
|
1628
1628
|
async Mr(t) {
|
|
@@ -1644,8 +1644,8 @@ class it {
|
|
|
1644
1644
|
}
|
|
1645
1645
|
async wr() {
|
|
1646
1646
|
const t = this.pr.Di(this.rr), { array: e, map: i } = this._r.sr(t, this.rr);
|
|
1647
|
-
this.nr = e, this.hr = i, this.dr = this.
|
|
1648
|
-
const s = this.
|
|
1647
|
+
this.nr = e, this.hr = i, this.dr = this.gr.Ji(t, this.cr, this.rr);
|
|
1648
|
+
const s = this.mr.Gi(this.nr, this.dr, this.cr, this.rr);
|
|
1649
1649
|
this.ar = s.framebuffer, this.lr = s.columns, this.ur = s.rows, this.yr = !0;
|
|
1650
1650
|
}
|
|
1651
1651
|
Fr(t) {
|
|
@@ -1934,8 +1934,8 @@ class zt {
|
|
|
1934
1934
|
a(this, "Bt", 0);
|
|
1935
1935
|
a(this, "It", 0);
|
|
1936
1936
|
a(this, "Tt", 0);
|
|
1937
|
-
a(this, "
|
|
1938
|
-
a(this, "
|
|
1937
|
+
a(this, "mn", "sampled");
|
|
1938
|
+
a(this, "gn", "fixed");
|
|
1939
1939
|
a(this, "jt", [1, 1, 1, 1]);
|
|
1940
1940
|
a(this, "Nt", [0, 0, 0, 1]);
|
|
1941
1941
|
a(this, "_n", [0, 0, 0, 1]);
|
|
@@ -1962,10 +1962,10 @@ class zt {
|
|
|
1962
1962
|
return this.Tt = Mt(t), this.Z = null, this;
|
|
1963
1963
|
}
|
|
1964
1964
|
charColorMode(t) {
|
|
1965
|
-
return this.
|
|
1965
|
+
return this.mn = t, this.Z = null, this;
|
|
1966
1966
|
}
|
|
1967
1967
|
cellColorMode(t) {
|
|
1968
|
-
return this.
|
|
1968
|
+
return this.gn = t, this.Z = null, this;
|
|
1969
1969
|
}
|
|
1970
1970
|
charColor(t, e, i, s) {
|
|
1971
1971
|
return this.bn(this.jt, t, e, i, s), this.Z = null, this;
|
|
@@ -2017,7 +2017,7 @@ class zt {
|
|
|
2017
2017
|
this.yn = e.length > 0 ? e : this.yn;
|
|
2018
2018
|
}
|
|
2019
2019
|
createBaseConversionUniforms() {
|
|
2020
|
-
return { u_image: this.Fn(), u_invert: !!this.Pt, u_flipX: !!this.Bt, u_flipY: !!this.It, u_charRotation: this.Tt, u_charColorFixed: this.
|
|
2020
|
+
return { u_image: this.Fn(), u_invert: !!this.Pt, u_flipX: !!this.Bt, u_flipY: !!this.It, u_charRotation: this.Tt, u_charColorFixed: this.mn === "fixed", u_charColor: this.jt, u_cellColorFixed: this.gn === "fixed", u_cellColor: this.Nt, u_backgroundColor: this._n, u_charCount: this.yn.length, u_charList: this.yn };
|
|
2021
2021
|
}
|
|
2022
2022
|
Cn() {
|
|
2023
2023
|
if (this.vn && this.vn.id === this.dn) return this.vn;
|
|
@@ -2345,8 +2345,8 @@ class Ot {
|
|
|
2345
2345
|
a(this, "dh");
|
|
2346
2346
|
a(this, "fo", !1);
|
|
2347
2347
|
a(this, "ph");
|
|
2348
|
-
a(this, "gh");
|
|
2349
2348
|
a(this, "mh");
|
|
2349
|
+
a(this, "gh");
|
|
2350
2350
|
a(this, "_h");
|
|
2351
2351
|
a(this, "yh");
|
|
2352
2352
|
a(this, "Ah");
|
|
@@ -2406,10 +2406,10 @@ class Ot {
|
|
|
2406
2406
|
this.ph = t;
|
|
2407
2407
|
}
|
|
2408
2408
|
ko(t) {
|
|
2409
|
-
this.
|
|
2409
|
+
this.mh = t;
|
|
2410
2410
|
}
|
|
2411
2411
|
Qh(t) {
|
|
2412
|
-
this.
|
|
2412
|
+
this.gh = t;
|
|
2413
2413
|
}
|
|
2414
2414
|
Yh(t) {
|
|
2415
2415
|
this._h = t;
|
|
@@ -2457,7 +2457,7 @@ class Ot {
|
|
|
2457
2457
|
const n = this.eh.get(r.id), h = n ? this.ta(n) : void 0;
|
|
2458
2458
|
h && this.ih.set(r.id, h), this.eh.set(r.id, r);
|
|
2459
2459
|
const c = this.rh.get(r.id);
|
|
2460
|
-
c && (c.lastPosition = r, c.lastTime = e, h) && H(h.clientX, h.clientY, r.clientX, r.clientY) > this.Th && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.
|
|
2460
|
+
c && (c.lastPosition = r, c.lastTime = e, h) && H(h.clientX, h.clientY, r.clientX, r.clientY) > this.Th && c.longPressTimer !== null && (window.clearTimeout(c.longPressTimer), c.longPressTimer = null), this.mh && this.mh(this.sa(r, t, h, e));
|
|
2461
2461
|
}
|
|
2462
2462
|
this.eh.size === 2 ? this.ia(t) : this.nh = null;
|
|
2463
2463
|
}
|
|
@@ -2467,7 +2467,7 @@ class Ot {
|
|
|
2467
2467
|
const e = performance.now(), i = this.Jh(t.changedTouches);
|
|
2468
2468
|
for (const s of i) {
|
|
2469
2469
|
const r = this.eh.get(s.id), n = r ? this.ta(r) : void 0, h = this.rh.get(s.id);
|
|
2470
|
-
h && h.longPressTimer !== null && (window.clearTimeout(h.longPressTimer), h.longPressTimer = null), this.
|
|
2470
|
+
h && h.longPressTimer !== null && (window.clearTimeout(h.longPressTimer), h.longPressTimer = null), this.gh && this.gh(this.sa(s, t, n, e)), h && this.ra(h, t), this.rh.delete(s.id), this.ih.delete(s.id), this.eh.delete(s.id);
|
|
2471
2471
|
}
|
|
2472
2472
|
this.eh.size < 2 && (this.nh = null);
|
|
2473
2473
|
}
|
|
@@ -2718,16 +2718,16 @@ const je = (o) => class extends o {
|
|
|
2718
2718
|
this.K.O(t, e);
|
|
2719
2719
|
}
|
|
2720
2720
|
setUniforms(t) {
|
|
2721
|
-
this.K.
|
|
2721
|
+
this.K.mi(t);
|
|
2722
2722
|
}
|
|
2723
2723
|
async createFilterShader(t) {
|
|
2724
2724
|
if (typeof t == "string" && (t.startsWith("./") || t.startsWith("../") || t.endsWith(".frag") || t.endsWith(".glsl"))) {
|
|
2725
2725
|
const e = await fetch(t);
|
|
2726
2726
|
if (!e.ok) throw Error(`Failed to load shader from ${t}: ${e.statusText}`);
|
|
2727
2727
|
const i = await e.text();
|
|
2728
|
-
return this.K.
|
|
2728
|
+
return this.K.gi(i);
|
|
2729
2729
|
}
|
|
2730
|
-
return this.K.
|
|
2730
|
+
return this.K.gi(t);
|
|
2731
2731
|
}
|
|
2732
2732
|
async createShader(t, e) {
|
|
2733
2733
|
let i, s;
|
|
@@ -2864,30 +2864,30 @@ const je = (o) => class extends o {
|
|
|
2864
2864
|
super(...t);
|
|
2865
2865
|
}
|
|
2866
2866
|
keyPressed(t) {
|
|
2867
|
-
this.
|
|
2867
|
+
this.ma.Ro(t);
|
|
2868
2868
|
}
|
|
2869
2869
|
keyReleased(t) {
|
|
2870
|
-
this.
|
|
2870
|
+
this.ma.Eo(t);
|
|
2871
2871
|
}
|
|
2872
2872
|
isKeyPressed(t) {
|
|
2873
|
-
return this.
|
|
2873
|
+
return this.ma.Wo(t);
|
|
2874
2874
|
}
|
|
2875
2875
|
get lastKeyPressed() {
|
|
2876
|
-
return this.
|
|
2876
|
+
return this.ma.Zo();
|
|
2877
2877
|
}
|
|
2878
2878
|
get lastKeyReleased() {
|
|
2879
|
-
return this.
|
|
2879
|
+
return this.ma.qo();
|
|
2880
2880
|
}
|
|
2881
2881
|
get pressedKeys() {
|
|
2882
|
-
return this.
|
|
2882
|
+
return this.ma.Vo();
|
|
2883
2883
|
}
|
|
2884
2884
|
get modifierState() {
|
|
2885
|
-
return this.
|
|
2885
|
+
return this.ma.Jo();
|
|
2886
2886
|
}
|
|
2887
2887
|
};
|
|
2888
2888
|
class It {
|
|
2889
2889
|
constructor(t) {
|
|
2890
|
-
a(this, "
|
|
2890
|
+
a(this, "ga");
|
|
2891
2891
|
a(this, "_a", /* @__PURE__ */ new Map());
|
|
2892
2892
|
a(this, "ya", []);
|
|
2893
2893
|
a(this, "ba", /* @__PURE__ */ new Map());
|
|
@@ -2898,14 +2898,14 @@ class It {
|
|
|
2898
2898
|
a(this, "Ua", /* @__PURE__ */ new Map());
|
|
2899
2899
|
a(this, "Fa", /* @__PURE__ */ new Map());
|
|
2900
2900
|
a(this, "$a", /* @__PURE__ */ new Map());
|
|
2901
|
-
this.
|
|
2901
|
+
this.ga = t;
|
|
2902
2902
|
}
|
|
2903
2903
|
Pa(t) {
|
|
2904
2904
|
for (const e of t) {
|
|
2905
2905
|
if (this._a.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
|
|
2906
2906
|
const i = this.Ta(e.name);
|
|
2907
2907
|
try {
|
|
2908
|
-
const s = e.install(this.
|
|
2908
|
+
const s = e.install(this.ga, i);
|
|
2909
2909
|
s instanceof Promise && s.catch((r) => {
|
|
2910
2910
|
console.error(`[textmode.js] Async plugin "${e.name}" installation error:`, r), this.za(e.name);
|
|
2911
2911
|
});
|
|
@@ -2920,7 +2920,7 @@ class It {
|
|
|
2920
2920
|
if (this._a.has(e.name)) return void console.warn(`[textmode.js] Plugin "${e.name}" is already installed.`);
|
|
2921
2921
|
const i = this.Ta(e.name);
|
|
2922
2922
|
try {
|
|
2923
|
-
await e.install(this.
|
|
2923
|
+
await e.install(this.ga, i);
|
|
2924
2924
|
} catch (s) {
|
|
2925
2925
|
throw this.za(e.name), s;
|
|
2926
2926
|
}
|
|
@@ -2931,7 +2931,7 @@ class It {
|
|
|
2931
2931
|
const e = this._a.get(t);
|
|
2932
2932
|
if (!e) return;
|
|
2933
2933
|
const i = this.Ta(t);
|
|
2934
|
-
e.uninstall && await e.uninstall(this.
|
|
2934
|
+
e.uninstall && await e.uninstall(this.ga, i), this._a.delete(t), this.ya.splice(this.ya.indexOf(t), 1), this.za(t);
|
|
2935
2935
|
}
|
|
2936
2936
|
Ea() {
|
|
2937
2937
|
this.ka(this.ba);
|
|
@@ -2959,7 +2959,7 @@ class It {
|
|
|
2959
2959
|
for (const e of t) await this.Ra(e);
|
|
2960
2960
|
}
|
|
2961
2961
|
Ta(t) {
|
|
2962
|
-
const e = this.
|
|
2962
|
+
const e = this.ga, i = this;
|
|
2963
2963
|
return { get renderer() {
|
|
2964
2964
|
return e.K;
|
|
2965
2965
|
}, get canvas() {
|
|
@@ -3039,11 +3039,11 @@ class It {
|
|
|
3039
3039
|
s || this.Ka(e);
|
|
3040
3040
|
}
|
|
3041
3041
|
Za(t, e) {
|
|
3042
|
-
const i = Object.getPrototypeOf(this.
|
|
3042
|
+
const i = Object.getPrototypeOf(this.ga.layers.base);
|
|
3043
3043
|
Object.defineProperty(i, t, { value: e, writable: !0, configurable: !0, enumerable: !1 });
|
|
3044
3044
|
}
|
|
3045
3045
|
Ka(t) {
|
|
3046
|
-
const e = Object.getPrototypeOf(this.
|
|
3046
|
+
const e = Object.getPrototypeOf(this.ga.layers.base), i = Object.getOwnPropertyDescriptor(e, t);
|
|
3047
3047
|
i && i.configurable && delete e[t];
|
|
3048
3048
|
}
|
|
3049
3049
|
}
|
|
@@ -3107,10 +3107,10 @@ class Kt {
|
|
|
3107
3107
|
get vc() {
|
|
3108
3108
|
return this.uc;
|
|
3109
3109
|
}
|
|
3110
|
-
get
|
|
3110
|
+
get mc() {
|
|
3111
3111
|
return this.uc !== "disabled";
|
|
3112
3112
|
}
|
|
3113
|
-
get
|
|
3113
|
+
get gc() {
|
|
3114
3114
|
return this.uc === "active" || this.uc === "transitioning" || this.uc === "error";
|
|
3115
3115
|
}
|
|
3116
3116
|
get _c() {
|
|
@@ -3325,7 +3325,7 @@ class st {
|
|
|
3325
3325
|
return t instanceof it ? (this.rr = t, this.rr.Pr || await this.rr.Ar()) : await this.rr.Mr(t), this.Vc(), this.rr;
|
|
3326
3326
|
}
|
|
3327
3327
|
va(t, e, i) {
|
|
3328
|
-
if (!this.kc) return;
|
|
3328
|
+
if (!this.kc || !this.Nc || !this.Qc) return;
|
|
3329
3329
|
const s = this.Gc.renderer, r = this.jc;
|
|
3330
3330
|
t.Jc.Oa(this), this.Nc.begin(), s.state.Kt(), t.ua = this;
|
|
3331
3331
|
try {
|
|
@@ -3335,7 +3335,7 @@ class st {
|
|
|
3335
3335
|
}
|
|
3336
3336
|
if (this.Nc.end(), t.Jc.Ia(this), i === "2d") {
|
|
3337
3337
|
const n = this.Kc.length > 0, h = n ? this.Yc : this.Qc;
|
|
3338
|
-
h.begin(), s.fi(e), e.H({ u_characterTexture: this.rr.fontFramebuffer, u_charsetDimensions: [this.rr.textureColumns, this.rr.textureRows],
|
|
3338
|
+
h.begin(), s.fi(e), e.H({ u_characterTexture: this.rr.fontFramebuffer, u_charsetDimensions: [this.rr.textureColumns, this.rr.textureRows], Ud: this.Nc.textures[0], Ue: this.Nc.textures[1], Uf: this.Nc.textures[2], Ug: [r.cols, r.rows], Uh: [h.width, h.height], Ui: [0, 0, 0, 0] }), s.Ai(0, 0, r.width, r.height), h.end(), n && this.Gc.filterManager.tl(this.Yc.textures[0], this.Qc, this.Kc, this.Qc.width, this.Qc.height, this.Xc);
|
|
3339
3339
|
}
|
|
3340
3340
|
this.Kc = [];
|
|
3341
3341
|
}
|
|
@@ -3377,11 +3377,11 @@ class st {
|
|
|
3377
3377
|
}
|
|
3378
3378
|
const z = `#version 300 es
|
|
3379
3379
|
layout(location=0)in vec2 A;layout(location=1)in vec2 B;out vec2 v_uv;void main(){v_uv=B;gl_Position=vec4(A,0.,1.);}`, kt = `#version 300 es
|
|
3380
|
-
precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D
|
|
3380
|
+
precision highp float;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D Ue;uniform sampler2D Uf;uniform sampler2D Ud;uniform vec2 Ug;uniform vec2 Uh;uniform vec4 Ui;in vec2 v_uv;out vec4 fragColor;mat2 A(float B){float C=sin(B);float D=cos(B);return mat2(D,-C,C,D);}void main(){vec2 E=gl_FragCoord.xy/Uh;vec2 F=E*Ug;vec2 G=floor(F);vec2 H=(G+0.5)/Ug;vec4 I=texture(Ue,H);vec4 J=texture(Uf,H);vec4 K=texture(Ud,H);int L=int(K.b*255.+0.5);bool M=(L&1)!=0;bool N=(L&2)!=0;bool O=(L&4)!=0;int P=int(K.r*255.+0.5)+int(K.g*255.+0.5)*256;int Q=int(u_charsetDimensions.x);int R=P/Q;int S=P-(R*Q);float T=(u_charsetDimensions.y-1.)-float(R);vec2 U=1./u_charsetDimensions;vec2 V=vec2(float(S),T)*U;vec2 W=V+U;float X=-K.a*360.*0.017453292;vec2 Y=fract(F)-0.5f;vec2 Z=vec2(N?-1.:1.,O?-1.:1.);Y*=Z;Y=A(X)*Y+0.5;vec2 a=V+clamp(Y,0.,1.)*U;const float b=0.0001;if(any(lessThan(a,V-b))||any(greaterThan(a,W+b))){fragColor=M?I:J;return;}vec4 c=texture(u_characterTexture,a);if(M)c.rgb=mix(c.rgb,1.-c.rgb,float(M));vec4 d=mix(Ui,J,J.a);fragColor=mix(d,I,c);}`, yt = `#version 300 es
|
|
3381
3381
|
precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){fragColor=texture(u_texture,v_uv);}`, qe = { message: "LOADING...", tone: "auto", transition: "fade", transitionDuration: 500 };
|
|
3382
3382
|
class Wt {
|
|
3383
3383
|
constructor(t, e, i) {
|
|
3384
|
-
a(this, "
|
|
3384
|
+
a(this, "ga");
|
|
3385
3385
|
a(this, "l");
|
|
3386
3386
|
a(this, "sl");
|
|
3387
3387
|
a(this, "Rc");
|
|
@@ -3396,19 +3396,19 @@ class Wt {
|
|
|
3396
3396
|
a(this, "ll", !1);
|
|
3397
3397
|
a(this, "yr", !1);
|
|
3398
3398
|
a(this, "vl");
|
|
3399
|
-
this.
|
|
3399
|
+
this.ga = t, this.l = { ...qe, ...e ?? {} }, this.sl = new Kt("active"), this.Rc = new Xt(), this.el = new Yt(this.l.transition, this.l.transitionDuration), this.il = new Nt(60), this.hl = mt(this.l, i);
|
|
3400
3400
|
const s = Gt(this.hl);
|
|
3401
|
-
this.ol = Ht(s, this.
|
|
3401
|
+
this.ol = Ht(s, this.ga), this.nl = this.ul(), this.Rc.nc((r) => {
|
|
3402
3402
|
r >= 0.999 && this.wc();
|
|
3403
3403
|
});
|
|
3404
3404
|
}
|
|
3405
3405
|
async Ar() {
|
|
3406
3406
|
if (this.yr) return;
|
|
3407
|
-
const t = this.
|
|
3407
|
+
const t = this.ga.K, e = this.ga.Er;
|
|
3408
3408
|
this.rl = new st(t, { visible: !0, opacity: 1, fontSize: 16 }), await this.rl.qc({ renderer: t, canvas: e, filterManager: null, createFramebuffer: (i, s, r = 1, n) => t.$i(i, s, r, n) }), this.yr = !0;
|
|
3409
3409
|
}
|
|
3410
|
-
get
|
|
3411
|
-
return this.sl.
|
|
3410
|
+
get gc() {
|
|
3411
|
+
return this.sl.gc && this.ll;
|
|
3412
3412
|
}
|
|
3413
3413
|
In() {
|
|
3414
3414
|
this.ll || (this.ll = !0, this.al = performance.now(), this.cl = 0, this.il.In(() => this.fl()));
|
|
@@ -3446,7 +3446,7 @@ class Wt {
|
|
|
3446
3446
|
this.sl.Mc(t);
|
|
3447
3447
|
}
|
|
3448
3448
|
fl() {
|
|
3449
|
-
if (this.sl.
|
|
3449
|
+
if (this.sl.gc) {
|
|
3450
3450
|
if (this.cl++, this.sl.vc === "transitioning" && this.el.et())
|
|
3451
3451
|
return this.sl.Cc(), this.dl(), void this.Gn();
|
|
3452
3452
|
this.ml();
|
|
@@ -3454,15 +3454,15 @@ class Wt {
|
|
|
3454
3454
|
}
|
|
3455
3455
|
ml() {
|
|
3456
3456
|
if (!this.yr) return;
|
|
3457
|
-
const t = this.rl, e = t.grid, i = this.
|
|
3457
|
+
const t = this.rl, e = t.grid, i = this.ga.K, s = this.ga.K.di(z, kt), r = this.ga.K.di(z, yt), n = { textmodifier: this.ga, grid: e, progress: this.progress, elapsedMs: performance.now() - this.al, frameCount: this.cl, message: this.l.message, palette: this.ol, theme: this.hl, phases: this.Rc.lc(), transitionOpacity: this.el.zc, isError: this.sl.vc === "error", errorMessage: this.sl._c || void 0, errorDetails: this.sl.yc || void 0 };
|
|
3458
3458
|
t.draw(() => {
|
|
3459
|
-
this.
|
|
3459
|
+
this.ga.clear(), this.ga.push();
|
|
3460
3460
|
try {
|
|
3461
3461
|
this.nl(n);
|
|
3462
3462
|
} finally {
|
|
3463
|
-
this.
|
|
3463
|
+
this.ga.pop();
|
|
3464
3464
|
}
|
|
3465
|
-
}), t.va(this.
|
|
3465
|
+
}), t.va(this.ga, s, "2d");
|
|
3466
3466
|
const h = t.texture;
|
|
3467
3467
|
h && (i.ye(...i.state.canvasBackgroundColor), i.fi(r), r.H({ u_texture: h }), i.Ai(e.offsetX, e.offsetY, e.width, e.height));
|
|
3468
3468
|
}
|
|
@@ -3493,7 +3493,7 @@ class Qt {
|
|
|
3493
3493
|
a(this, "Xc");
|
|
3494
3494
|
a(this, "bl", 0);
|
|
3495
3495
|
this.K = t, this.Al = t.di(z, `#version 300 es
|
|
3496
|
-
precision highp float;uniform sampler2D
|
|
3496
|
+
precision highp float;uniform sampler2D Uj;uniform sampler2D Uk;uniform vec2 Ul;uniform vec2 Um;uniform vec2 Un;uniform float Uo;uniform float Up;uniform int Uq;in vec2 v_uv;out vec4 fragColor;const int A=0;const int B=1;const int C=2;const int D=3;const int E=4;const int F=5;const int G=6;const int H=7;const int I=8;const int J=9;const int K=10;const int L=11;const int M=12;const int N=13;vec3 O(vec3 P,vec3 Q){return Q;}vec3 R(vec3 P,vec3 Q){return P+Q;}vec3 S(vec3 P,vec3 Q){return P*Q;}vec3 T(vec3 P,vec3 Q){return 1.-(1.-P)*(1.-Q);}vec3 U(vec3 P,vec3 Q){return max(P-Q,0.);}vec3 V(vec3 P,vec3 Q){return min(P,Q);}vec3 W(vec3 P,vec3 Q){return max(P,Q);}vec3 X(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,P));}vec3 Y(vec3 P,vec3 Q){return mix(P-(1.-2.*Q)*P*(1.-P),mix(P+(2.*Q-1.)*(P*(3.-2.*P)-P),P+(2.*Q-1.)*(sqrt(P)-P),step(0.25,P)),step(0.5,Q));}vec3 Z(vec3 P,vec3 Q){return mix(2.*P*Q,1.-2.*(1.-P)*(1.-Q),step(0.5,Q));}vec3 a(vec3 P,vec3 Q){return mix(min(vec3(1.),P/max(1.-Q,0.0001)),vec3(1.),step(1.,Q));}vec3 b(vec3 P,vec3 Q){return mix(1.-min(vec3(1.),(1.-P)/max(Q,0.0001)),vec3(0.),step(Q,vec3(0.)));}vec3 c(vec3 P,vec3 Q){return abs(P-Q);}vec3 d(vec3 P,vec3 Q){return P+Q-2.*P*Q;}vec3 e(int f,vec3 P,vec3 Q){if(f==A)return O(P,Q);if(f==B)return R(P,Q);if(f==C)return S(P,Q);if(f==D)return T(P,Q);if(f==E)return U(P,Q);if(f==F)return V(P,Q);if(f==G)return W(P,Q);if(f==H)return X(P,Q);if(f==I)return Y(P,Q);if(f==J)return Z(P,Q);if(f==K)return a(P,Q);if(f==L)return b(P,Q);if(f==M)return c(P,Q);if(f==N)return d(P,Q);return O(P,Q);}void main(){vec4 g=texture(Uk,v_uv);vec2 h=v_uv*Ul;vec2 i=h-Un;vec2 j=Um*0.5;vec2 k=i-j;float l=cos(-Up);float m=sin(-Up);vec2 n=vec2(k.x*l-k.y*m,k.x*m+k.y*l);i=n+j;bool o=any(lessThan(i,vec2(0.)))||any(greaterThanEqual(i,Um));if(o){fragColor=g;return;}vec2 p=(floor(i)+0.5)/Um;vec4 q=texture(Uj,p);float r=q.a*Uo;if(r<=0.){fragColor=g;return;}vec3 s=e(Uq,g.rgb,q.rgb);vec3 t=mix(g.rgb,s,r);float u=g.a+r*(1.-g.a);fragColor=vec4(t,u);}`), this.Xc = [this.K.$i(e, i, 1), this.K.$i(e, i, 1)];
|
|
3497
3497
|
}
|
|
3498
3498
|
wl(t) {
|
|
3499
3499
|
const e = this.K.context, { base: i, targetFramebuffer: s, backgroundColor: r, layers: n, canvasWidth: h, canvasHeight: c } = t, l = e.isEnabled(e.DEPTH_TEST), u = e.getParameter(e.DEPTH_WRITEMASK);
|
|
@@ -3508,11 +3508,11 @@ precision highp float;uniform sampler2D Ud;uniform sampler2D Ue;uniform vec2 Uf;
|
|
|
3508
3508
|
}
|
|
3509
3509
|
xl(t, e, i, s, r, n, h, c, l, u) {
|
|
3510
3510
|
const f = this.Xc[this.bl], d = this.bl === 0 ? 1 : 0, g = this.Xc[d], v = l * (Math.PI / 180);
|
|
3511
|
-
g.begin(), this.K.fi(this.Al), this.Al.H({
|
|
3511
|
+
g.begin(), this.K.fi(this.Al), this.Al.H({ Uj: t, Uk: f.textures[0], Ul: [e, i], Um: [s, r], Un: [h, c], Uo: n, Up: v, Uq: Ft[u] }), this.K.Ai(0, 0, f.width, f.height), g.end(), this.bl = d;
|
|
3512
3512
|
}
|
|
3513
3513
|
Cl(t, e, i) {
|
|
3514
3514
|
const s = this.Xc[this.bl];
|
|
3515
|
-
t.begin(), this.K.fi(this.Al), this.Al.H({
|
|
3515
|
+
t.begin(), this.K.fi(this.Al), this.Al.H({ Uj: s.textures[0], Uk: s.textures[0], Ul: [e, i], Um: [s.width, s.height], Un: [0, 0], Uo: 1, Up: 0, Uq: Ft.normal }), this.K.Ai(0, 0, e, i), t.end();
|
|
3516
3516
|
}
|
|
3517
3517
|
Vr(t, e) {
|
|
3518
3518
|
this.Xc[0].resize(t, e), this.Xc[1].resize(t, e);
|
|
@@ -3537,8 +3537,8 @@ class Vt {
|
|
|
3537
3537
|
a(this, "kl", 0);
|
|
3538
3538
|
a(this, "Dl", 0);
|
|
3539
3539
|
this.K = t, this.Ml = t.di(z, `#version 300 es
|
|
3540
|
-
precision highp float;const float A=0.001f;const int B=256;in vec2 v_uv;layout(location=0)out vec4 C;layout(location=1)out vec4 D;uniform vec2 u_resolution;uniform float Ur;uniform vec3 Us;uniform vec2
|
|
3541
|
-
precision highp float;const float A=0.001f;const float B=0.0001f;in vec2 v_uv;out vec4 fragColor;uniform sampler2D Uy;uniform sampler2D Uz;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D
|
|
3540
|
+
precision highp float;const float A=0.001f;const int B=256;in vec2 v_uv;layout(location=0)out vec4 C;layout(location=1)out vec4 D;uniform vec2 u_resolution;uniform float Ur;uniform vec3 Us;uniform vec2 Uh;uniform vec3 Uw;uniform mat3 Ux;uniform float Uv;uniform vec3 Ut;uniform int Uu;uniform sampler2D Ud;vec2 E(vec3 F){float G=Us.y*max(1.0f,Us.z);vec2 H;H.x=(Us.x-(F.x+0.5f+A*0.1f))/Us.x;H.y=((F.y+(Us.z-1.0f-F.z)*Us.y)+0.5f+A*0.1f)/G;return vec2(H.x,1.0f-H.y);}bool I(vec3 F){if(F.x<0.0f||F.x>=Us.x||F.y<0.0f||F.y>=Us.y||F.z<0.0f||F.z>=Us.z){return false;}if(Uu!=-1&&int(F.z+0.5f)!=Uu){return false;}vec2 H=E(F);vec4 J=texture(Ud,H);return!(J.r>=1.0f&&J.g>=1.0f);}float K(vec3 L,vec3 M){vec3 N=L-M;vec3 O=Ut*0.5f;vec3 P=abs(N)/O;if(P.x>P.y&&P.x>P.z){return N.x>0.0f?0.0f:1.0f;}else if(P.y>P.z){return N.y>0.0f?2.0f:3.0f;}else{return N.z>0.0f?4.0f:5.0f;}}vec2 Q(vec3 L,vec3 M,float R){vec3 S=L-M;vec2 T;vec2 U;int V=int(R+0.5f);if(V==2||V==3){U=vec2(Ut.x,Ut.z);T=(V==2)?vec2(S.x,S.z):vec2(S.x,-S.z);}else if(V==0||V==1){U=vec2(Ut.y,Ut.z);T=(V==0)?vec2(S.z,S.y):vec2(-S.z,S.y);}else{U=vec2(Ut.x,Ut.y);T=(V==4)?vec2(-S.x,S.y):vec2(S.x,S.y);}return 1.0f-(T/U+0.5f);}struct W{bool X;vec3 F;vec3 M;float Y;};W Z(vec3 a,vec3 b){W c;c.X=false;vec3 d=(Us*Ut)*0.5f;vec3 e=-d;vec3 f=d;vec3 g=1.0f/b;vec3 h=(e-a)*g;vec3 i=(f-a)*g;vec3 j=min(h,i);vec3 k=max(h,i);float l=max(max(j.x,j.y),j.z);float m=min(min(k.x,k.y),k.z);if(m<max(l,0.0f)){return c;}l=max(l,0.0f);vec3 n=a+l*b+b*A;vec3 o=d;float p=floor((n.x+o.x)/Ut.x+A*0.1f);float q=floor((n.y+o.y)/Ut.y+A*0.1f);float r=floor((n.z+o.z)/Ut.z+A*0.1f);vec3 s=abs(b);vec3 step=vec3(b.x>0.0f?1.0f:-1.0f,b.y>0.0f?1.0f:-1.0f,b.z>0.0f?1.0f:-1.0f);float t=(s.x<A)?1e10f:Ut.x/s.x;float u=(s.y<A)?1e10f:Ut.y/s.y;float v=(s.z<A)?1e10f:Ut.z/s.z;vec3 F=vec3(p,q,r);vec3 M=-d+(F+vec3(0.5f))*Ut;float w=(b.x>0.0f)?(M.x+Ut.x*0.5f):(M.x-Ut.x*0.5f);float x=(b.y>0.0f)?(M.y+Ut.y*0.5f):(M.y-Ut.y*0.5f);float y=(b.z>0.0f)?(M.z+Ut.z*0.5f):(M.z-Ut.z*0.5f);float z=(abs(b.x)<A)?1e10f:(w-n.x)/b.x;float AA=(abs(b.y)<A)?1e10f:(x-n.y)/b.y;float AB=(abs(b.z)<A)?1e10f:(y-n.z)/b.z;for(int AC=0;AC<B;AC++){if(I(F)){c.M=-d+(F+vec3(0.5f))*Ut;vec3 AD=c.M-Ut*0.5f;vec3 AE=c.M+Ut*0.5f;vec3 AF=(AD-a)*g;vec3 AG=(AE-a)*g;vec3 AH=min(AF,AG);c.Y=max(max(AH.x,AH.y),max(AH.z,0.0f));c.F=F;c.X=true;return c;}if(z<=AA&&z<=AB){p+=step.x;z+=t;F.x=p;}else if(AA<=AB){q+=step.y;AA+=u;F.y=q;}else{r+=step.z;AB+=v;F.z=r;}float AI=min(min(z,AA),AB);if(AI>m){break;}}return c;}void main(){vec3 d=(Us*Ut)*0.5f;float AJ=max(Uv,0.0001f);vec2 AK=vec2(Us.x,Us.y);vec2 AL=AK*0.5f;vec2 AM=gl_FragCoord.xy/max(Ur,0.0001f);vec2 AN=u_resolution;vec2 AO=Uh;vec2 AP=(AN-AO)*0.5f;vec2 AQ=AM-AP;vec2 AR=AQ/AO;vec2 AS=1.0f-AR;if(any(lessThan(AS,vec2(0.0f)))||any(greaterThan(AS,vec2(1.0f)))){C=vec4(0.0f);D=vec4(0.0f);return;}vec2 AT=clamp(AS,0.0f,1.0f);vec2 AU=AL+((AT*AK)-AL)/AJ;vec2 AV=vec2(Ut.x,Ut.y);vec2 AW=(AU-AL);vec2 AX=AW*AV;float AY=length(Us*Ut);vec3 AZ=vec3(AX,-AY);const vec3 Aa=vec3(0.0f,0.0f,1.0f);mat3 Ab=Ux;vec3 Ac=Ab*(AZ-Uw);vec3 Ad=normalize(Ab*Aa);W c=Z(Ac,Ad);if(c.X){vec3 L=Ac+c.Y*Ad;float R=K(L,c.M);vec2 Ae=Q(L,c.M,R);vec3 Af=c.F/255.0f;C=vec4(Af,1.0f);D=vec4(Ae,R/5.0f,0.0f);}else{C=vec4(0.0f,0.0f,0.0f,0.0f);D=vec4(0.0f);}}`), this.Fl = t.di(z, `#version 300 es
|
|
3541
|
+
precision highp float;const float A=0.001f;const float B=0.0001f;in vec2 v_uv;out vec4 fragColor;uniform sampler2D Uy;uniform sampler2D Uz;uniform sampler2D u_characterTexture;uniform vec2 u_charsetDimensions;uniform sampler2D Ue;uniform sampler2D Uf;uniform sampler2D Ud;uniform vec4 Ui;uniform vec3 Us;uniform vec3 UA;uniform vec3 UB;uniform vec3 UC;uniform vec3 UD;uniform vec3 UE;uniform vec3 UF;mat2 C(float D){float E=sin(D);float F=cos(D);return mat2(F,-E,E,F);}vec2 G(vec3 H){float I=Us.y*max(1.0f,Us.z);vec2 J;J.x=(Us.x-(H.x+0.5f+A*0.1f))/Us.x;J.y=((H.y+(Us.z-1.0f-H.z)*Us.y)+0.5f+A*0.1f)/I;return vec2(J.x,1.0f-J.y);}vec4 K(vec4 L,vec4 M,vec4 N,vec2 O,int P){int Q=int(L.b*255.0f+0.5f);bool R=(Q&1)!=0;bool S=(Q&2)!=0;bool T=(Q&4)!=0;int U=max(1,int(u_charsetDimensions.x));int V=P/U;int W=P-(V*U);float X=(u_charsetDimensions.y-1.0f)-float(V);vec2 Y=1.0f/u_charsetDimensions;vec2 Z=vec2(float(W),X)*Y;vec2 a=Z+Y;float b=-L.a*360.0f*0.017453292f;vec2 c=O-0.5f;vec2 d=vec2(S?-1.0f:1.0f,T?-1.0f:1.0f);c*=d;c=C(b)*c+0.5f;vec2 e=Z+clamp(c,0.0f,1.0f)*Y;if(any(lessThan(e,Z-B))||any(greaterThan(e,a+B))){return R?M:N;}vec4 f=texture(u_characterTexture,e);if(R){f.rgb=1.0f-f.rgb;}vec4 g=mix(Ui,N,N.a);return mix(g,M,f);}vec4 h(vec2 i){vec4 j=texture(Uy,i);vec4 k=texture(Uz,i);float l=j.w;if(l<0.5f){return Ui;}vec3 H=floor(j.xyz*255.0f+0.5f);vec2 O=k.xy;vec2 J=G(H);vec4 L=texture(Ud,J);vec4 M=texture(Ue,J);vec4 N=texture(Uf,J);int P=int(L.r*255.0f+0.5f)+int(L.g*255.0f+0.5f)*256;return K(L,M,N,O,P);}void main(){vec2 i=gl_FragCoord.xy/vec2(textureSize(Uy,0));fragColor=h(i);}`);
|
|
3542
3542
|
}
|
|
3543
3543
|
Ar(t, e, i = 1) {
|
|
3544
3544
|
const s = e * Math.max(1, i);
|
|
@@ -3590,7 +3590,7 @@ precision highp float;const float A=0.001f;const float B=0.0001f;in vec2 v_uv;ou
|
|
|
3590
3590
|
const g = c.camera.getShaderUniforms();
|
|
3591
3591
|
u = g.rotation, f = g.translation, d = g.zoom;
|
|
3592
3592
|
const v = c.normals ?? {};
|
|
3593
|
-
this.zl.begin(), this.K.ye(0, 0, 0, 0), this.K.fi(this.Ml), this.Ml.H({ u_resolution: [n, h], Ur: 1,
|
|
3593
|
+
this.zl.begin(), this.K.ye(0, 0, 0, 0), this.K.fi(this.Ml), this.Ml.H({ u_resolution: [n, h], Ur: 1, Uh: [s.width, s.height], Us: [s.cols, s.rows, e], Ut: l, Ud: this.$l.textures[0], Uu: c.isolatedLayer ?? -1, Uv: d, Uw: f, Ux: u }), this.K.Ai(0, 0, n, h), this.zl.end(), t.begin(), this.K.fi(this.Fl), this.Fl.H({ Uy: this.zl.textures[0], Uz: this.zl.textures[1], u_characterTexture: i.fontFramebuffer, u_charsetDimensions: [i.textureColumns, i.textureRows], Ud: this.$l.textures[0], Ue: this.Pl.textures[0], Uf: this.Tl.textures[0], Us: [s.cols, s.rows, e], Ui: r, UA: v.right ?? I.right, UB: v.left ?? I.left, UC: v.top ?? I.top, UD: v.bottom ?? I.bottom, UE: v.front ?? I.front, UF: v.back ?? I.back }), this.K.Ai(0, 0, n, h), t.end();
|
|
3594
3594
|
}
|
|
3595
3595
|
Bl(t, e) {
|
|
3596
3596
|
this.zl ? this.Rl === t && this.El === e || (this.zl.resize(t, e), this.Rl = t, this.El = e) : (this.zl = this.K.$i(t, e, 2, { depth: !1 }), this.Rl = t, this.El = e);
|
|
@@ -3869,9 +3869,9 @@ class Zt {
|
|
|
3869
3869
|
Vl() {
|
|
3870
3870
|
this.Jl("invert", `#version 300 es
|
|
3871
3871
|
precision highp float;uniform sampler2D u_texture;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);fragColor=vec4(1.-A.rgb,A.a);}`, {}), this.Jl("grayscale", `#version 300 es
|
|
3872
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3873
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3874
|
-
precision highp float;uniform sampler2D u_texture;uniform float
|
|
3872
|
+
precision highp float;uniform sampler2D u_texture;uniform float U0;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));vec3 C=mix(A.rgb,vec3(B),U0);fragColor=vec4(C,A.a);}`, { U0: ["amount", 1] }), this.Jl("sepia", `#version 300 es
|
|
3873
|
+
precision highp float;uniform sampler2D u_texture;uniform float U0;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);vec3 B;B.r=dot(A.rgb,vec3(0.393,0.769,0.189));B.g=dot(A.rgb,vec3(0.349,0.686,0.168));B.b=dot(A.rgb,vec3(0.272,0.534,0.131));vec3 C=mix(A.rgb,B,U0);fragColor=vec4(C,A.a);}`, { U0: ["amount", 1] }), this.Jl("threshold", `#version 300 es
|
|
3874
|
+
precision highp float;uniform sampler2D u_texture;uniform float U1;in vec2 v_uv;out vec4 fragColor;void main(){vec4 A=texture(u_texture,v_uv);float B=dot(A.rgb,vec3(0.299,0.587,0.114));float C=step(U1,B);fragColor=vec4(vec3(C),A.a);}`, { U1: ["threshold", 0.5] });
|
|
3875
3875
|
}
|
|
3876
3876
|
}
|
|
3877
3877
|
class qt {
|
|
@@ -3938,7 +3938,7 @@ class qt {
|
|
|
3938
3938
|
const ri = Object.freeze(Object.defineProperty({ __proto__: null, FilterRegistry: Zt, TextmodeFilterManager: qt }, Symbol.toStringTag, { value: "Module" }));
|
|
3939
3939
|
class Jt {
|
|
3940
3940
|
constructor(t, e) {
|
|
3941
|
-
a(this, "
|
|
3941
|
+
a(this, "ga");
|
|
3942
3942
|
a(this, "K");
|
|
3943
3943
|
a(this, "ou");
|
|
3944
3944
|
a(this, "hu");
|
|
@@ -3951,22 +3951,22 @@ class Jt {
|
|
|
3951
3951
|
a(this, "Wl", !1);
|
|
3952
3952
|
a(this, "vu", "2d");
|
|
3953
3953
|
a(this, "pu", /* @__PURE__ */ new Set());
|
|
3954
|
-
a(this, "
|
|
3955
|
-
a(this, "
|
|
3954
|
+
a(this, "mu", []);
|
|
3955
|
+
a(this, "gu");
|
|
3956
3956
|
a(this, "_u");
|
|
3957
|
-
this.
|
|
3957
|
+
this.ga = t, this.K = t.K, this.cu = this.K.di(z, kt), this.lu = this.K.di(z, yt), this.au = new qt(this.K), this.ou = new Qt(this.K, this.ga.Er.width, this.ga.Er.height), this.hu = new Vt(this.K), this.uu = new ot(), this.fu = new $e({ onRemove: (i) => this.ga.Jc.La(i), onDispose: (i) => i.Fs() }), this.du = new st(this.K, { visible: !0, opacity: 1, fontSize: e.fontSize, fontSource: e.fontSource });
|
|
3958
3958
|
}
|
|
3959
3959
|
async Ar() {
|
|
3960
3960
|
var e, i;
|
|
3961
3961
|
await this.yu(this.du);
|
|
3962
|
-
const t = this.
|
|
3963
|
-
this.
|
|
3962
|
+
const t = this.ga.Er;
|
|
3963
|
+
this.gu = this.K.$i(t.width, t.height, 1), this._u = this.K.$i(t.width, t.height, 1), this.au.Ar(t.width, t.height), await this.fu.initialize((s) => this.yu(s)), this.hu.Ar(((e = this.du.grid) == null ? void 0 : e.cols) || 1, ((i = this.du.grid) == null ? void 0 : i.rows) || 1, 1 + this.fu.length), this.Wl = !0;
|
|
3964
3964
|
}
|
|
3965
3965
|
Au(t, e) {
|
|
3966
|
-
this.
|
|
3966
|
+
this.mu.push({ name: t, params: e });
|
|
3967
3967
|
}
|
|
3968
3968
|
bu() {
|
|
3969
|
-
this.
|
|
3969
|
+
this.mu = [];
|
|
3970
3970
|
}
|
|
3971
3971
|
add(t = {}) {
|
|
3972
3972
|
const e = new st(this.K, t);
|
|
@@ -4000,31 +4000,31 @@ class Jt {
|
|
|
4000
4000
|
this.fu.clear();
|
|
4001
4001
|
}
|
|
4002
4002
|
wu(t) {
|
|
4003
|
-
this.
|
|
4003
|
+
this.ga.Jc.Ea(), this.du.va(this.ga, this.cu, this.vu);
|
|
4004
4004
|
const e = [...this.K.state.canvasBackgroundColor];
|
|
4005
|
-
this.fu.forEach((i) => i.va(this.
|
|
4005
|
+
this.fu.forEach((i) => i.va(this.ga, this.cu, this.vu)), this.vu === "3d" ? this.xu(t, e) : this.Cu(t, e);
|
|
4006
4006
|
}
|
|
4007
4007
|
Mu() {
|
|
4008
|
-
this.wu(this.
|
|
4009
|
-
let t = this.
|
|
4010
|
-
if (this.
|
|
4011
|
-
const i = this.
|
|
4012
|
-
this.au.eu(this.
|
|
4008
|
+
this.wu(this.gu);
|
|
4009
|
+
let t = this.gu.textures[0];
|
|
4010
|
+
if (this.mu.length > 0) {
|
|
4011
|
+
const i = this.ga.Er;
|
|
4012
|
+
this.au.eu(this.gu.textures[0], this._u, this.mu, i.width, i.height), t = this._u.textures[0], this.mu = [];
|
|
4013
4013
|
}
|
|
4014
|
-
const e = this.
|
|
4015
|
-
this.K.ye(0, 0, 0, 0), this.K.fi(this.lu), this.lu.H({ u_texture: t }), this.K.Ai(0, 0, e.width, e.height), this.
|
|
4014
|
+
const e = this.ga.Er;
|
|
4015
|
+
this.K.ye(0, 0, 0, 0), this.K.fi(this.lu), this.lu.H({ u_texture: t }), this.K.Ai(0, 0, e.width, e.height), this.ga.Jc.Da();
|
|
4016
4016
|
}
|
|
4017
4017
|
Cu(t, e) {
|
|
4018
|
-
const i = this.
|
|
4018
|
+
const i = this.ga.Er, s = this.du.grid, r = this.du.texture;
|
|
4019
4019
|
if (!r) return;
|
|
4020
|
-
const n = { layer: this.du, texture: r, width: s.width, height: s.height, offsetX: s.offsetX + this.du.Lc, offsetY: s.offsetY + this.du.Hc }, h = this.fu.map((c) => {
|
|
4020
|
+
const n = { layer: this.du, texture: r, width: s.width, height: s.height, offsetX: s.offsetX + this.du.Lc, offsetY: s.offsetY + this.du.Hc }, h = this.fu.filter((c) => !!c.grid && !!c.texture).map((c) => {
|
|
4021
4021
|
const l = c.grid;
|
|
4022
4022
|
return { layer: c, texture: c.texture, width: l.width, height: l.height, offsetX: l.offsetX + c.Lc, offsetY: l.offsetY + c.Hc };
|
|
4023
4023
|
});
|
|
4024
4024
|
this.ou.wl({ base: n, layers: h, targetFramebuffer: t, backgroundColor: e, canvasWidth: i.width, canvasHeight: i.height });
|
|
4025
4025
|
}
|
|
4026
4026
|
xu(t, e) {
|
|
4027
|
-
const i = this.
|
|
4027
|
+
const i = this.ga.Er, s = this.du.drawFramebuffer, r = this.du.grid;
|
|
4028
4028
|
if (!s || !r) return;
|
|
4029
4029
|
let n = r.cols * r.rows, h = r;
|
|
4030
4030
|
for (const c of this.fu) {
|
|
@@ -4039,7 +4039,7 @@ class Jt {
|
|
|
4039
4039
|
Vr() {
|
|
4040
4040
|
var n, h, c;
|
|
4041
4041
|
if (!this.Wl) return;
|
|
4042
|
-
const t = this.
|
|
4042
|
+
const t = this.ga.Er;
|
|
4043
4043
|
this.du.Vr(), this.fu.forEach((l) => l.Vr()), this.ou.Vr(t.width, t.height);
|
|
4044
4044
|
const e = this.du.grid;
|
|
4045
4045
|
let i = (e == null ? void 0 : e.cols) || 0, s = (e == null ? void 0 : e.rows) || 0;
|
|
@@ -4048,11 +4048,11 @@ class Jt {
|
|
|
4048
4048
|
u && (i = Math.max(i, u.cols), s = Math.max(s, u.rows));
|
|
4049
4049
|
}
|
|
4050
4050
|
const r = 1 + this.fu.length;
|
|
4051
|
-
this.hu.Vr(i, s, r), (n = this.
|
|
4051
|
+
this.hu.Vr(i, s, r), (n = this.gu) == null || n.resize(t.width, t.height), (h = this._u) == null || h.resize(t.width, t.height), (c = this.au) == null || c.Vr(t.width, t.height);
|
|
4052
4052
|
}
|
|
4053
4053
|
Fs() {
|
|
4054
4054
|
var t, e;
|
|
4055
|
-
this.fu.dispose(), this.
|
|
4055
|
+
this.fu.dispose(), this.ga.Jc.La(this.du), this.du.Fs(), this.au.Fs(), this.cu.dispose(), this.lu.dispose(), this.ou.Fs(), this.hu.Fs(), (t = this.gu) == null || t.dispose(), (e = this._u) == null || e.dispose(), this.mu = [];
|
|
4056
4056
|
}
|
|
4057
4057
|
get all() {
|
|
4058
4058
|
return this.fu.all;
|
|
@@ -4082,7 +4082,7 @@ class Jt {
|
|
|
4082
4082
|
}
|
|
4083
4083
|
async yu(t) {
|
|
4084
4084
|
var i;
|
|
4085
|
-
const e = { renderer: this.K, canvas: this.
|
|
4085
|
+
const e = { renderer: this.K, canvas: this.ga.Er, filterManager: this.au, createFramebuffer: (s, r, n = 1, h) => this.K.$i(s, r, n, h) };
|
|
4086
4086
|
await t.qc(e), (i = t.grid) == null || i.Br(() => this.Pu());
|
|
4087
4087
|
}
|
|
4088
4088
|
}
|
|
@@ -4149,7 +4149,7 @@ class ei extends function(e, ...i) {
|
|
|
4149
4149
|
a(this, "da");
|
|
4150
4150
|
a(this, "sh");
|
|
4151
4151
|
a(this, "pa");
|
|
4152
|
-
a(this, "
|
|
4152
|
+
a(this, "ma");
|
|
4153
4153
|
a(this, "Eu");
|
|
4154
4154
|
a(this, "fa");
|
|
4155
4155
|
a(this, "ua");
|
|
@@ -4172,7 +4172,7 @@ class ei extends function(e, ...i) {
|
|
|
4172
4172
|
this.da.Kn = 0, this.Hu = !0;
|
|
4173
4173
|
}), this.fa = new Jt(this, e);
|
|
4174
4174
|
const i = () => this.Qu();
|
|
4175
|
-
this.sh = new Bt(this.Er, i), this.pa = new Ot(this.Er, i, this.sh), this.
|
|
4175
|
+
this.sh = new Bt(this.Er, i), this.pa = new Ot(this.Er, i, this.sh), this.ma = new _t(), this.pn = new te(), this.Jc.Pa(e.plugins ?? []), this.Eu.In(), this.Yu();
|
|
4176
4176
|
}
|
|
4177
4177
|
async Yu() {
|
|
4178
4178
|
await this.fa.Ar(), await this.Eu.Ar();
|
|
@@ -4189,14 +4189,14 @@ class ei extends function(e, ...i) {
|
|
|
4189
4189
|
Xu() {
|
|
4190
4190
|
this.Iu = () => {
|
|
4191
4191
|
this.Nr && this.resizeCanvas(this.Er.targetCanvas.width, this.Er.targetCanvas.height), this.Bu();
|
|
4192
|
-
}, window.addEventListener("resize", this.Iu), this.sh.wo(), this.pa.wo(), this.
|
|
4193
|
-
this.
|
|
4192
|
+
}, window.addEventListener("resize", this.Iu), this.sh.wo(), this.pa.wo(), this.ma.wo(), window.addEventListener("blur", () => {
|
|
4193
|
+
this.ma.th();
|
|
4194
4194
|
}), this.Nr && (this.Gu = new ResizeObserver(() => {
|
|
4195
4195
|
this.resizeCanvas(this.Er.targetCanvas.width, this.Er.targetCanvas.height);
|
|
4196
4196
|
}), this.Gu.observe(this.Er.targetCanvas));
|
|
4197
4197
|
}
|
|
4198
4198
|
va() {
|
|
4199
|
-
if (!this.Eu.
|
|
4199
|
+
if (!this.Eu.gc && this.Hu) {
|
|
4200
4200
|
this.Du = !0;
|
|
4201
4201
|
try {
|
|
4202
4202
|
this.da.Yn(), this.da.Zn(), this.Nr && Ut(this.K.context, this.ju.texture, this.Er.targetCanvas), this.fa.Mu();
|
|
@@ -4214,7 +4214,7 @@ class ei extends function(e, ...i) {
|
|
|
4214
4214
|
}
|
|
4215
4215
|
Wu() {
|
|
4216
4216
|
var e, i, s, r;
|
|
4217
|
-
this.ku = !1, this.Eu.Fs(), this.Jc.Qa(), window.removeEventListener("resize", this.Iu), (e = this.Gu) == null || e.disconnect(), this.sh.To(), this.pa.To(), this.
|
|
4217
|
+
this.ku = !1, this.Eu.Fs(), this.Jc.Qa(), window.removeEventListener("resize", this.Iu), (e = this.Gu) == null || e.disconnect(), this.sh.To(), this.pa.To(), this.ma.To(), (i = this.fa) == null || i.Fs(), (s = this.pn) == null || s.Fs(), this.K.Fs(), (r = this.ju) == null || r.Fs(), this.Er.Fs(), this.Lu = !0;
|
|
4218
4218
|
}
|
|
4219
4219
|
filter(e, i) {
|
|
4220
4220
|
this.fa.Au(e, i);
|
|
@@ -4289,7 +4289,7 @@ class Et {
|
|
|
4289
4289
|
At._(t);
|
|
4290
4290
|
}
|
|
4291
4291
|
static get version() {
|
|
4292
|
-
return "0.9.0-beta.
|
|
4292
|
+
return "0.9.0-beta.3";
|
|
4293
4293
|
}
|
|
4294
4294
|
}
|
|
4295
4295
|
const hi = Object.freeze(Object.defineProperty({ __proto__: null, LoadingPhase: jt, LoadingPhaseTracker: Xt, LoadingScreenManager: Wt, LoadingScreenStateMachine: Kt, LoadingScreenTransition: Yt, resolveColorInputs: Ht, resolveDefaultPalette: Gt, resolveTheme: mt }, Symbol.toStringTag, { value: "Module" })), oi = Object.freeze(Object.defineProperty({ __proto__: null, TextmodeFont: it, TextmodeImage: Z, TextmodeVideo: ht }, Symbol.toStringTag, { value: "Module" })), ai = Object.freeze(Object.defineProperty({ __proto__: null, keyboard: Ge, mouse: Ye, touch: He }, Symbol.toStringTag, { value: "Module" })), ci = Object.freeze(Object.defineProperty({ __proto__: null, Camera3D: ot, Layer3DCompositor: Vt, LayerCompositor: Qt, TextmodeLayer: st, TextmodeLayerManager: Jt }, Symbol.toStringTag, { value: "Module" })), li = Et.create, ui = Et.setErrorLevel, fi = Et.version;
|