shaders 2.2.2 → 2.2.4
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/core/index.js +511 -504
- package/dist/core/renderer.d.ts.map +1 -1
- package/dist/react/index.cjs +64 -64
- package/dist/react/index.js +3918 -3911
- package/dist/svelte/index.js +3760 -3753
- package/dist/vue/index.js +4113 -4106
- package/package.json +1 -1
package/dist/core/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { n as ce, t as
|
|
1
|
+
import { A as G, B as Yn, D as C, E as Me, F as dn, H as In, I as Je, J as Hn, K as Wn, L as jn, M as X, N as x, P as Se, R as Qn, S as Ce, T as kn, U as Jn, V as Kn, _ as Ae, c as Zn, d as Z, g as Ke, h as Ze, i as er, k as pe, l as wn, m as z, n as y, o as nr, q as rr, s as tr, t as or, v as i, w as sr, x as ee, z as ar } from "./three.tsl-BqgDcRt9.js";
|
|
2
|
+
import { n as ce, t as Re } from "./edges-B-tVdqcI.js";
|
|
3
3
|
import { t as oo } from "./time-5uQ65blS.js";
|
|
4
4
|
import "./transformations-DBjTkQ5b.js";
|
|
5
5
|
import { n as ir } from "./AngularBlur-BTUdXC0g.js";
|
|
@@ -29,8 +29,8 @@ import "./ColorAdjustment-CKwpE_4M.js";
|
|
|
29
29
|
import { n as Mr } from "./Grayscale-oWIF3PV5.js";
|
|
30
30
|
import { n as Ar } from "./Grid-Bov7AA9m.js";
|
|
31
31
|
import { n as $r } from "./GridDistortion-CWYom5Dw.js";
|
|
32
|
-
import { n as
|
|
33
|
-
import { n as
|
|
32
|
+
import { n as Dr } from "./Group-CPk-7fiA.js";
|
|
33
|
+
import { n as zr } from "./Halftone-F7fsdu7W.js";
|
|
34
34
|
import { n as Fr } from "./HueShift-CiS4hdtk.js";
|
|
35
35
|
import { n as Er } from "./ImageTexture-B3Q29OHX.js";
|
|
36
36
|
import { n as Or } from "./Invert-Cyc4JHWc.js";
|
|
@@ -58,132 +58,132 @@ import { n as rt } from "./Vibrance-DtekSkcz.js";
|
|
|
58
58
|
import { n as tt } from "./WaveDistortion-C65qO_cZ.js";
|
|
59
59
|
import { n as ot } from "./ZoomBlur-B97ZjhXe.js";
|
|
60
60
|
import { WebGLRenderer as st } from "three";
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
jn();
|
|
62
|
+
z();
|
|
63
63
|
function at(e, n, a = 1) {
|
|
64
|
-
const r = i(n.a, a), m =
|
|
65
|
-
return x(
|
|
64
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r)));
|
|
65
|
+
return x(y(i(n.rgb, r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
var
|
|
69
|
-
const n = e.x, a = e.y, r = e.z, m = n.mul(0.4122214708).add(a.mul(0.5363325363)).add(r.mul(0.0514459929)), p = n.mul(0.2119034982).add(a.mul(0.6806995451).add(r.mul(0.1073969566))), h = n.mul(0.0883024619).add(a.mul(0.2817188376)).add(r.mul(0.6299787005)), d = ee(m, Z(1 / 3)), R = ee(p, Z(1 / 3)),
|
|
70
|
-
return
|
|
67
|
+
z();
|
|
68
|
+
var hn = (e) => X(e.x.mul(1.2249401).sub(e.y.mul(0.2249404)).sub(e.z.mul(0)), e.x.mul(-0.0420569).add(e.y.mul(1.0420571)).add(e.z.mul(0)), e.x.mul(-0.0196376).sub(e.y.mul(0.0786361)).add(e.z.mul(1.0982735))), it = (e) => X(e.x.mul(0.8224621).add(e.y.mul(0.177538)).add(e.z.mul(0)), e.x.mul(0.0331941).add(e.y.mul(0.9668058)).add(e.z.mul(0)), e.x.mul(0.0170826).add(e.y.mul(0.0723974)).add(e.z.mul(0.9105199))), pn = (e) => {
|
|
69
|
+
const n = e.x, a = e.y, r = e.z, m = n.mul(0.4122214708).add(a.mul(0.5363325363)).add(r.mul(0.0514459929)), p = n.mul(0.2119034982).add(a.mul(0.6806995451).add(r.mul(0.1073969566))), h = n.mul(0.0883024619).add(a.mul(0.2817188376)).add(r.mul(0.6299787005)), d = ee(m, Z(1 / 3)), R = ee(p, Z(1 / 3)), U = ee(h, Z(1 / 3));
|
|
70
|
+
return X(d.mul(0.2104542553).add(R.mul(0.793617785)).sub(U.mul(0.0040720468)), d.mul(1.9779984951).sub(R.mul(2.428592205)).add(U.mul(0.4505937099)), d.mul(0.0259040371).add(R.mul(0.7827717662)).sub(U.mul(0.808675766)));
|
|
71
71
|
}, lt = (e) => {
|
|
72
|
-
const n = e.x, a = e.y, r = e.z, m = n.add(a.mul(0.3963377774)).add(r.mul(0.2158037573)), p = n.sub(a.mul(0.1055613458)).sub(r.mul(0.0638541728)), h = n.sub(a.mul(0.0894841775)).sub(r.mul(1.291485548)), d = ee(m, Z(3)), R = ee(p, Z(3)),
|
|
73
|
-
return
|
|
74
|
-
},
|
|
72
|
+
const n = e.x, a = e.y, r = e.z, m = n.add(a.mul(0.3963377774)).add(r.mul(0.2158037573)), p = n.sub(a.mul(0.1055613458)).sub(r.mul(0.0638541728)), h = n.sub(a.mul(0.0894841775)).sub(r.mul(1.291485548)), d = ee(m, Z(3)), R = ee(p, Z(3)), U = ee(h, Z(3));
|
|
73
|
+
return X(d.mul(4.0767416621).sub(R.mul(3.3077115913)).add(U.mul(0.2309699292)), d.mul(-1.2684380046).add(R.mul(2.6097574011)).sub(U.mul(0.3413193965)), d.mul(-0.0041960863).sub(R.mul(0.7034186147)).add(U.mul(1.707614701)));
|
|
74
|
+
}, gn = (e) => {
|
|
75
75
|
const n = e.x, a = e.y, r = e.z;
|
|
76
|
-
return
|
|
76
|
+
return X(n, kn(a.mul(a).add(r.mul(r))), er(r, a));
|
|
77
77
|
}, ct = (e) => {
|
|
78
78
|
const n = e.x, a = e.y, r = e.z;
|
|
79
|
-
return
|
|
79
|
+
return X(n, a.mul(tr(r)), a.mul(sr(r)));
|
|
80
80
|
};
|
|
81
81
|
function ft(e, n, a = 1) {
|
|
82
|
-
const r = i(n.a, a), m =
|
|
83
|
-
return x(it(lt(ct(
|
|
82
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r))), p = hn(X(e.r, e.g, e.b)), h = hn(X(n.r, n.g, n.b)), d = pn(p), R = pn(h), U = gn(d);
|
|
83
|
+
return x(it(lt(ct(y(i(gn(R), r), i(U, i(e.a, C(1, r))))))), m);
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
var
|
|
87
|
-
const n = e.x, a = e.y, r = e.z, m = n.mul(0.4122214708).add(a.mul(0.5363325363)).add(r.mul(0.0514459929)), p = n.mul(0.2119034982).add(a.mul(0.6806995451).add(r.mul(0.1073969566))), h = n.mul(0.0883024619).add(a.mul(0.2817188376)).add(r.mul(0.6299787005)), d = ee(m, Z(1 / 3)), R = ee(p, Z(1 / 3)),
|
|
88
|
-
return
|
|
85
|
+
z();
|
|
86
|
+
var bn = (e) => X(e.x.mul(1.2249401).sub(e.y.mul(0.2249404)).sub(e.z.mul(0)), e.x.mul(-0.0420569).add(e.y.mul(1.0420571)).add(e.z.mul(0)), e.x.mul(-0.0196376).sub(e.y.mul(0.0786361)).add(e.z.mul(1.0982735))), mt = (e) => X(e.x.mul(0.8224621).add(e.y.mul(0.177538)).add(e.z.mul(0)), e.x.mul(0.0331941).add(e.y.mul(0.9668058)).add(e.z.mul(0)), e.x.mul(0.0170826).add(e.y.mul(0.0723974)).add(e.z.mul(0.9105199))), vn = (e) => {
|
|
87
|
+
const n = e.x, a = e.y, r = e.z, m = n.mul(0.4122214708).add(a.mul(0.5363325363)).add(r.mul(0.0514459929)), p = n.mul(0.2119034982).add(a.mul(0.6806995451).add(r.mul(0.1073969566))), h = n.mul(0.0883024619).add(a.mul(0.2817188376)).add(r.mul(0.6299787005)), d = ee(m, Z(1 / 3)), R = ee(p, Z(1 / 3)), U = ee(h, Z(1 / 3));
|
|
88
|
+
return X(d.mul(0.2104542553).add(R.mul(0.793617785)).sub(U.mul(0.0040720468)), d.mul(1.9779984951).sub(R.mul(2.428592205)).add(U.mul(0.4505937099)), d.mul(0.0259040371).add(R.mul(0.7827717662)).sub(U.mul(0.808675766)));
|
|
89
89
|
}, ut = (e) => {
|
|
90
|
-
const n = e.x, a = e.y, r = e.z, m = n.add(a.mul(0.3963377774)).add(r.mul(0.2158037573)), p = n.sub(a.mul(0.1055613458)).sub(r.mul(0.0638541728)), h = n.sub(a.mul(0.0894841775)).sub(r.mul(1.291485548)), d = ee(m, Z(3)), R = ee(p, Z(3)),
|
|
91
|
-
return
|
|
90
|
+
const n = e.x, a = e.y, r = e.z, m = n.add(a.mul(0.3963377774)).add(r.mul(0.2158037573)), p = n.sub(a.mul(0.1055613458)).sub(r.mul(0.0638541728)), h = n.sub(a.mul(0.0894841775)).sub(r.mul(1.291485548)), d = ee(m, Z(3)), R = ee(p, Z(3)), U = ee(h, Z(3));
|
|
91
|
+
return X(d.mul(4.0767416621).sub(R.mul(3.3077115913)).add(U.mul(0.2309699292)), d.mul(-1.2684380046).add(R.mul(2.6097574011)).sub(U.mul(0.3413193965)), d.mul(-0.0041960863).sub(R.mul(0.7034186147)).add(U.mul(1.707614701)));
|
|
92
92
|
};
|
|
93
93
|
function dt(e, n, a = 1) {
|
|
94
|
-
const r = i(n.a, a), m =
|
|
95
|
-
return x(mt(ut(
|
|
94
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r))), p = bn(X(e.r, e.g, e.b)), h = bn(X(n.r, n.g, n.b)), d = vn(p);
|
|
95
|
+
return x(mt(ut(y(i(vn(h), r), i(d, i(e.a, C(1, r)))))), m);
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
z();
|
|
98
98
|
function ht(e, n, a = 1) {
|
|
99
|
-
const r = i(n.a, a), m =
|
|
100
|
-
return x(
|
|
99
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r)));
|
|
100
|
+
return x(y(i(i(e.rgb, n.rgb), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
z();
|
|
103
103
|
function pt(e, n, a = 1) {
|
|
104
|
-
const r = i(n.a, a), m =
|
|
105
|
-
return x(
|
|
104
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r)));
|
|
105
|
+
return x(y(i(C(1, i(C(1, e.rgb), C(1, n.rgb))), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
106
106
|
}
|
|
107
|
-
|
|
107
|
+
z();
|
|
108
108
|
function gt(e, n, a = 1) {
|
|
109
|
-
const r = i(n.a, a), m =
|
|
110
|
-
return x(
|
|
109
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r)));
|
|
110
|
+
return x(y(i(Ke(y(e.rgb, n.rgb), 1), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
z();
|
|
113
113
|
function bt(e, n, a = 1) {
|
|
114
|
-
const r = i(n.a, a), m =
|
|
115
|
-
return x(
|
|
114
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r)));
|
|
115
|
+
return x(y(i(Ae(i(2, i(e.rgb, n.rgb)), C(1, i(2, i(C(1, e.rgb), C(1, n.rgb)))), Me(0.5, e.rgb)), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
116
116
|
}
|
|
117
|
-
|
|
117
|
+
z();
|
|
118
118
|
function vt(e, n, a = 1) {
|
|
119
|
-
const r = i(n.a, a), m =
|
|
120
|
-
return x(
|
|
119
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r)));
|
|
120
|
+
return x(y(i(or(C(e.rgb, n.rgb)), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
z();
|
|
123
123
|
function Ct(e, n, a = 1) {
|
|
124
|
-
const r = i(n.a, a), m =
|
|
125
|
-
return x(
|
|
124
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r)));
|
|
125
|
+
return x(y(i(Ae(e.rgb, Ke(Zn(e.rgb, C(1, n.rgb)), 1), Me(1e-3, C(1, n.rgb))), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
126
126
|
}
|
|
127
|
-
|
|
127
|
+
z();
|
|
128
128
|
function Rt(e, n, a = 1) {
|
|
129
|
-
const r = i(n.a, a), m =
|
|
130
|
-
return x(
|
|
129
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r)));
|
|
130
|
+
return x(y(i(C(y(e.rgb, n.rgb), i(2, i(e.rgb, n.rgb))), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
131
131
|
}
|
|
132
|
-
|
|
132
|
+
z();
|
|
133
133
|
function me(e) {
|
|
134
|
-
return
|
|
134
|
+
return y(y(i(e.r, 0.2126), i(e.g, 0.7152)), i(e.b, 0.0722));
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
z();
|
|
137
137
|
function Tt(e, n, a = 1) {
|
|
138
|
-
const r = i(n.a, a), m =
|
|
139
|
-
return x(
|
|
138
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r))), p = C(me(e.rgb), me(n.rgb));
|
|
139
|
+
return x(y(i(y(n.rgb, p), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
z();
|
|
142
142
|
function kt(e, n, a = 1) {
|
|
143
|
-
const r = i(n.a, a), m =
|
|
144
|
-
return x(
|
|
143
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r))), p = me(e.rgb), h = me(n.rgb).div(y(p, 1e-4));
|
|
144
|
+
return x(y(i(i(e.rgb, h), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
z();
|
|
147
147
|
function wt(e, n, a = 1) {
|
|
148
|
-
const r = i(n.a, a), m =
|
|
149
|
-
return x(
|
|
148
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r)));
|
|
149
|
+
return x(y(i(Ke(e.rgb, n.rgb), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
z();
|
|
152
152
|
function yt(e, n, a = 1) {
|
|
153
|
-
const r = i(n.a, a), m =
|
|
154
|
-
return x(
|
|
153
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r)));
|
|
154
|
+
return x(y(i(Ze(e.rgb, n.rgb), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
z();
|
|
157
157
|
function St(e, n, a = 1) {
|
|
158
|
-
const r = i(n.a, a), m =
|
|
159
|
-
return x(
|
|
158
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r)));
|
|
159
|
+
return x(y(i(Ae(x(0, 0, 0, 1).rgb, Ze(C(1, C(1, e.rgb).div(y(n.rgb, 1e-4))), 0), Me(1e-4, n.rgb)), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
160
160
|
}
|
|
161
|
-
|
|
161
|
+
z();
|
|
162
162
|
function Ut(e, n, a = 1) {
|
|
163
|
-
const r = i(n.a, a), m =
|
|
164
|
-
return x(
|
|
163
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r)));
|
|
164
|
+
return x(y(i(Ze(y(y(e.rgb, n.rgb), -1), 0), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
z();
|
|
167
167
|
function xt(e, n, a = 1) {
|
|
168
|
-
const r = i(n.a, a), m =
|
|
169
|
-
return x(
|
|
168
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r))), p = y(i(2, i(e.rgb, n.rgb)), i(i(e.rgb, e.rgb), C(1, i(2, n.rgb)))), h = kn(e.rgb);
|
|
169
|
+
return x(y(i(Ae(p, y(i(2, i(e.rgb, C(1, n.rgb))), i(h, C(i(2, n.rgb), 1))), Me(0.5, n.rgb)), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
170
170
|
}
|
|
171
|
-
|
|
171
|
+
z();
|
|
172
172
|
function Mt(e, n, a = 1) {
|
|
173
|
-
const r = i(n.a, a), m =
|
|
174
|
-
return x(
|
|
173
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r)));
|
|
174
|
+
return x(y(i(Ae(i(2, i(e.rgb, n.rgb)), C(1, i(2, i(C(1, e.rgb), C(1, n.rgb)))), Me(0.5, n.rgb)), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
175
175
|
}
|
|
176
|
-
|
|
176
|
+
z();
|
|
177
177
|
function At(e, n, a = 1) {
|
|
178
|
-
const r = i(n.a, a), m =
|
|
179
|
-
return x(
|
|
178
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r))), p = me(e.rgb), h = me(n.rgb), d = e.rgb.sub(p), R = n.rgb.sub(h), U = d.length();
|
|
179
|
+
return x(y(i(y(i(R.normalize(), U), p), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
z();
|
|
182
182
|
function $t(e, n, a = 1) {
|
|
183
|
-
const r = i(n.a, a), m =
|
|
184
|
-
return x(
|
|
183
|
+
const r = i(n.a, a), m = y(r, i(e.a, C(1, r))), p = me(e.rgb), h = me(n.rgb), d = e.rgb.sub(p), R = n.rgb.sub(h);
|
|
184
|
+
return x(y(i(y(i(d.normalize(), R.length()), p), r), i(e.rgb, i(e.a, C(1, r)))), m);
|
|
185
185
|
}
|
|
186
|
-
var
|
|
186
|
+
var Cn = {
|
|
187
187
|
normal: at,
|
|
188
188
|
"normal-oklch": ft,
|
|
189
189
|
"normal-oklab": dt,
|
|
@@ -206,36 +206,36 @@ var Rn = {
|
|
|
206
206
|
saturation: $t
|
|
207
207
|
};
|
|
208
208
|
function K(e, n, a = "normal", r = 1) {
|
|
209
|
-
return (
|
|
209
|
+
return (Cn[a] || Cn.normal)(e, n, r);
|
|
210
210
|
}
|
|
211
|
-
|
|
212
|
-
function
|
|
211
|
+
z();
|
|
212
|
+
function Dt(e, n) {
|
|
213
213
|
const a = i(e.a, n.a);
|
|
214
214
|
return x(e.rgb, a);
|
|
215
215
|
}
|
|
216
|
-
|
|
217
|
-
function
|
|
216
|
+
z();
|
|
217
|
+
function zt(e, n) {
|
|
218
218
|
const a = C(1, n.a), r = i(e.a, a);
|
|
219
219
|
return x(e.rgb, r);
|
|
220
220
|
}
|
|
221
|
-
|
|
221
|
+
z();
|
|
222
222
|
function Ft(e, n) {
|
|
223
|
-
const a =
|
|
223
|
+
const a = X(0.2126, 0.7152, 0.0722), r = wn(n.rgb, a), m = i(e.a, r);
|
|
224
224
|
return x(e.rgb, m);
|
|
225
225
|
}
|
|
226
|
-
|
|
226
|
+
z();
|
|
227
227
|
function Et(e, n) {
|
|
228
|
-
const a =
|
|
228
|
+
const a = X(0.2126, 0.7152, 0.0722), r = C(1, wn(n.rgb, a)), m = i(e.a, r);
|
|
229
229
|
return x(e.rgb, m);
|
|
230
230
|
}
|
|
231
|
-
var
|
|
232
|
-
alpha:
|
|
233
|
-
alphaInverted:
|
|
231
|
+
var Rn = {
|
|
232
|
+
alpha: Dt,
|
|
233
|
+
alphaInverted: zt,
|
|
234
234
|
luminance: Ft,
|
|
235
235
|
luminanceInverted: Et
|
|
236
236
|
};
|
|
237
237
|
function Ot(e, n, a = "alpha") {
|
|
238
|
-
return (
|
|
238
|
+
return (Rn[a] || Rn.alpha)(e, n);
|
|
239
239
|
}
|
|
240
240
|
var Bt = class {
|
|
241
241
|
frameTimesMs = [];
|
|
@@ -349,7 +349,7 @@ var Bt = class {
|
|
|
349
349
|
score: 0,
|
|
350
350
|
label: "N/A"
|
|
351
351
|
};
|
|
352
|
-
const n = this.frameTimesMs.reduce((
|
|
352
|
+
const n = this.frameTimesMs.reduce((U, V) => U + V, 0) / e, a = Math.min(n / 16.67 * 100, 100), r = this.calculateComplexityScore(), m = Math.min(r / 100 * 100, 100);
|
|
353
353
|
let p = 0;
|
|
354
354
|
this.lastGpuTime !== null && (p = Math.min(this.lastGpuTime / 16.67 * 100, 100));
|
|
355
355
|
const h = this.lastGpuTime !== null ? {
|
|
@@ -371,7 +371,7 @@ var Bt = class {
|
|
|
371
371
|
* Gets current performance statistics
|
|
372
372
|
*/
|
|
373
373
|
getStats(e) {
|
|
374
|
-
const n = this.frameTimesMs.length, a = this.frameIntervals.length > 0 ? 1e3 / (this.frameIntervals.reduce((
|
|
374
|
+
const n = this.frameTimesMs.length, a = this.frameIntervals.length > 0 ? 1e3 / (this.frameIntervals.reduce((F, E) => F + E, 0) / this.frameIntervals.length) : 0, r = n > 0 ? this.frameTimesMs.reduce((F, E) => F + E, 0) / n : 0, m = n > 0 ? Math.min(...this.frameTimesMs) : 0, p = n > 0 ? Math.max(...this.frameTimesMs) : 0, h = this.calculateP99(this.frameTimesMs), d = this.calculateStdDev(this.frameTimesMs), R = this.totalFrameCount > 0 ? this.jankFrameCount / this.totalFrameCount * 100 : 0, U = performance.memory, V = U ? U.usedJSHeapSize / (1024 * 1024) : null, B = this.calculateMemoryGrowthRate(), ne = r > 0 ? r / this.targetFrameTime * 100 : 0, Y = e?.render?.calls ?? null, I = e?.programs?.length ?? null, N = e?.memory?.textures ?? null, ae = this.calculateIntensityScore();
|
|
375
375
|
return {
|
|
376
376
|
fps: Math.round(a),
|
|
377
377
|
avgFrameTime: Math.round(r * 100) / 100,
|
|
@@ -389,9 +389,9 @@ var Bt = class {
|
|
|
389
389
|
cpuTime: this.lastCpuTime !== null ? Math.round(this.lastCpuTime * 100) / 100 : null,
|
|
390
390
|
gpuTime: this.lastGpuTime !== null ? Math.round(this.lastGpuTime * 100) / 100 : null,
|
|
391
391
|
budgetUsed: Math.round(ne * 10) / 10,
|
|
392
|
-
drawCalls:
|
|
393
|
-
shaderPrograms:
|
|
394
|
-
textureCount:
|
|
392
|
+
drawCalls: Y,
|
|
393
|
+
shaderPrograms: I,
|
|
394
|
+
textureCount: N,
|
|
395
395
|
intensityScore: ae.score,
|
|
396
396
|
intensityLabel: ae.label,
|
|
397
397
|
isRendering: this.isRendering
|
|
@@ -404,11 +404,11 @@ var Bt = class {
|
|
|
404
404
|
this.frameTimesMs = [], this.frameIntervals = [], this.lastFrameTimestamp = 0, this.jankFrameCount = 0, this.totalFrameCount = 0, this.memorySnapshots = [], this.lastCpuTime = null, this.lastGpuTime = null;
|
|
405
405
|
}
|
|
406
406
|
};
|
|
407
|
-
|
|
408
|
-
var { vec2:
|
|
409
|
-
const fe = (e) => e.offsetX !== 0 || e.offsetY !== 0 || e.rotation !== 0 || e.scale !== 1 || e.anchorX !== 0.5 || e.anchorY !== 0.5,
|
|
410
|
-
const R = r.mul(Lt).div(Vt(180)),
|
|
411
|
-
return
|
|
407
|
+
z();
|
|
408
|
+
var { vec2: Ue, cos: Pt, sin: _t, float: Vt, PI: Lt } = pe;
|
|
409
|
+
const fe = (e) => e.offsetX !== 0 || e.offsetY !== 0 || e.rotation !== 0 || e.scale !== 1 || e.anchorX !== 0.5 || e.anchorY !== 0.5, xe = (e, n, a, r, m, p, h, d) => {
|
|
410
|
+
const R = r.mul(Lt).div(Vt(180)), U = Pt(R), V = _t(R), B = Ue(p, h), ne = e.sub(B).div(m), Y = Ue(ne.x.mul(d), ne.y), I = Ue(Y.x.mul(U).sub(Y.y.mul(V)), Y.x.mul(V).add(Y.y.mul(U)));
|
|
411
|
+
return Ue(I.x.div(d), I.y).sub(Ue(n, a)).add(B);
|
|
412
412
|
};
|
|
413
413
|
var qt = /* @__PURE__ */ rr({
|
|
414
414
|
createUniformsMap: () => Gt,
|
|
@@ -420,12 +420,12 @@ function Gt(e, n, a) {
|
|
|
420
420
|
const h = n[m];
|
|
421
421
|
let d = h;
|
|
422
422
|
if (p.transform) {
|
|
423
|
-
const
|
|
424
|
-
d =
|
|
423
|
+
const U = p.transform(h);
|
|
424
|
+
d = U?.node ?? U;
|
|
425
425
|
}
|
|
426
426
|
if (d == null && (d = p.default, p.transform && d !== null && d !== void 0)) {
|
|
427
|
-
const
|
|
428
|
-
d =
|
|
427
|
+
const U = p.transform(d);
|
|
428
|
+
d = U?.node ?? U;
|
|
429
429
|
}
|
|
430
430
|
d == null && (console.error(`[Shaders] Uniform "${m}" is null/undefined after fallback. PropConfig:`, {
|
|
431
431
|
propName: m,
|
|
@@ -433,7 +433,7 @@ function Gt(e, n, a) {
|
|
|
433
433
|
default: p.default,
|
|
434
434
|
hasTransform: !!p.transform
|
|
435
435
|
}), d = 0);
|
|
436
|
-
const R =
|
|
436
|
+
const R = yn(d).setName(`${m}_${a}`);
|
|
437
437
|
typeof d == "string" && R.value === null && (R.value = d), r[m] = {
|
|
438
438
|
uniform: R,
|
|
439
439
|
transform: p.transform || void 0
|
|
@@ -446,11 +446,11 @@ function Nt(e, n) {
|
|
|
446
446
|
e.uniform.value = r;
|
|
447
447
|
} else e.uniform.value = n;
|
|
448
448
|
}
|
|
449
|
-
var
|
|
450
|
-
|
|
449
|
+
var yn, Sn = Wn({ "src/utilities/uniforms.ts": (() => {
|
|
450
|
+
z(), { uniform: yn } = pe;
|
|
451
451
|
}) });
|
|
452
|
-
|
|
453
|
-
var
|
|
452
|
+
z();
|
|
453
|
+
var Tn = !1, Xt = /* @__PURE__ */ (() => {
|
|
454
454
|
let e = 0;
|
|
455
455
|
const n = /* @__PURE__ */ new Set(), a = (h) => {
|
|
456
456
|
n.forEach((d) => {
|
|
@@ -515,32 +515,32 @@ function cs() {
|
|
|
515
515
|
rootId: null,
|
|
516
516
|
idToNodeId: /* @__PURE__ */ new Map()
|
|
517
517
|
}, d = /* @__PURE__ */ new Map();
|
|
518
|
-
let R = null,
|
|
518
|
+
let R = null, U = null, V = null, B = !1, ne = !1, Y = !1, I = null, N = !1, ae = !0, F = 0, E = 0, te = !1, qe = 0, $e = !1, De = 0.5, ze = 0.5, ue = !1, Fe = !1, Ee = null, Te = null, de = !1;
|
|
519
519
|
const ie = new Bt();
|
|
520
|
-
let oe = [],
|
|
521
|
-
const
|
|
522
|
-
s <= 0 || t <= 0 || s ===
|
|
520
|
+
let oe = [], Ge = !1, Oe = [], ge = null, Be = [], be = null, en = /* @__PURE__ */ new Set(), nn = /* @__PURE__ */ new Set(), Pe = 0, ke = /* @__PURE__ */ new Set(), Ne = /* @__PURE__ */ new Set(), we = null, _e = !1;
|
|
521
|
+
const Xe = (s, t) => {
|
|
522
|
+
s <= 0 || t <= 0 || s === F && t === E || (we = {
|
|
523
523
|
width: s,
|
|
524
524
|
height: t
|
|
525
|
-
},
|
|
526
|
-
if (
|
|
527
|
-
const { width: o, height: l } =
|
|
528
|
-
|
|
525
|
+
}, _e || (_e = !0, requestAnimationFrame(() => {
|
|
526
|
+
if (_e = !1, !we) return;
|
|
527
|
+
const { width: o, height: l } = we;
|
|
528
|
+
we = null, F = o, E = l, Y || (Y = !0), n.setSize(o, l, !1);
|
|
529
529
|
const f = o / l, b = 2, g = b * f;
|
|
530
|
-
a.left = -g / 2, a.right = g / 2, a.top = b / 2, a.bottom = -b / 2, a.updateProjectionMatrix(), m.scale.set(g, b, 1), h.nodes.forEach((
|
|
531
|
-
|
|
530
|
+
a.left = -g / 2, a.right = g / 2, a.top = b / 2, a.bottom = -b / 2, a.updateProjectionMatrix(), m.scale.set(g, b, 1), h.nodes.forEach((k) => {
|
|
531
|
+
k.transformUniforms?.aspectRatio && (k.transformUniforms.aspectRatio.value = f), k.resizeCallbacks.forEach((M) => {
|
|
532
532
|
try {
|
|
533
533
|
M({
|
|
534
534
|
width: o,
|
|
535
535
|
height: l
|
|
536
536
|
});
|
|
537
|
-
} catch (
|
|
538
|
-
console.error("Error in resize callback:",
|
|
537
|
+
} catch ($) {
|
|
538
|
+
console.error("Error in resize callback:", $);
|
|
539
539
|
}
|
|
540
540
|
});
|
|
541
541
|
}), re().catch(console.warn);
|
|
542
542
|
})));
|
|
543
|
-
},
|
|
543
|
+
}, Un = () => B && !!n && !!r && !!a && !!p && F > 0 && E > 0 && N, xn = (s) => {
|
|
544
544
|
if (!n || !a || !m) return;
|
|
545
545
|
const t = s[0];
|
|
546
546
|
if (!t) return;
|
|
@@ -550,80 +550,80 @@ function cs() {
|
|
|
550
550
|
f ? (o = Math.round(f.inlineSize), l = Math.round(f.blockSize)) : (o = Math.round(t.contentRect.width), l = Math.round(t.contentRect.height));
|
|
551
551
|
} else
|
|
552
552
|
o = Math.round(t.contentRect.width), l = Math.round(t.contentRect.height);
|
|
553
|
-
o === 0 || l === 0 ||
|
|
554
|
-
},
|
|
553
|
+
o === 0 || l === 0 || Xe(o, l);
|
|
554
|
+
}, Mn = (s) => {
|
|
555
555
|
const t = s[0];
|
|
556
556
|
if (!t) return;
|
|
557
|
-
const o =
|
|
558
|
-
|
|
557
|
+
const o = N;
|
|
558
|
+
N = t.isIntersecting;
|
|
559
559
|
const l = e?.getBoundingClientRect(), f = te;
|
|
560
|
-
if (te =
|
|
561
|
-
if (
|
|
562
|
-
const { width: b, height: g } = e.getBoundingClientRect(),
|
|
563
|
-
|
|
560
|
+
if (te = N && !!l && l.width > 0 && l.height > 0, N && !o) {
|
|
561
|
+
if ($e = !0, e) {
|
|
562
|
+
const { width: b, height: g } = e.getBoundingClientRect(), k = Math.round(b), M = Math.round(g);
|
|
563
|
+
k > 0 && M > 0 && (F === 0 || E === 0 || k !== F || M !== E ? (Xe(k, M), !f && te && he()) : p && B && h.rootId && (p.needsUpdate = !0, he(), re().catch(console.warn)));
|
|
564
564
|
}
|
|
565
565
|
ae && je();
|
|
566
|
-
} else !
|
|
567
|
-
},
|
|
566
|
+
} else !N && o && Qe();
|
|
567
|
+
}, An = (s, t) => {
|
|
568
568
|
if (s.size !== t.size) return !1;
|
|
569
569
|
for (const o of s) if (!t.has(o)) return !1;
|
|
570
570
|
return !0;
|
|
571
|
-
},
|
|
572
|
-
|
|
573
|
-
const t =
|
|
574
|
-
return
|
|
571
|
+
}, ye = (s) => {
|
|
572
|
+
Pe++;
|
|
573
|
+
const t = nr(s);
|
|
574
|
+
return ke.add(t), t;
|
|
575
575
|
}, rn = () => {
|
|
576
|
-
|
|
576
|
+
Ne.forEach((s) => {
|
|
577
577
|
try {
|
|
578
578
|
s?.renderTarget?.dispose && s.renderTarget.dispose();
|
|
579
579
|
} catch {
|
|
580
580
|
}
|
|
581
|
-
}),
|
|
581
|
+
}), Ne.clear();
|
|
582
582
|
};
|
|
583
583
|
let ve = !1;
|
|
584
584
|
const he = () => {
|
|
585
|
-
if (!h.rootId || !p ||
|
|
586
|
-
if (
|
|
585
|
+
if (!h.rootId || !p || Fe || !h.nodes.get(h.rootId)) return;
|
|
586
|
+
if (F === 0 || E === 0) {
|
|
587
587
|
ve || (ve = !0, requestAnimationFrame(() => {
|
|
588
|
-
ve = !1,
|
|
588
|
+
ve = !1, F > 0 && E > 0 && he();
|
|
589
589
|
}));
|
|
590
590
|
return;
|
|
591
591
|
}
|
|
592
|
-
|
|
592
|
+
Fe = !0;
|
|
593
593
|
const s = performance.now();
|
|
594
594
|
console.log("[Shaders Perf] Starting updateMaterial()");
|
|
595
595
|
try {
|
|
596
596
|
const t = performance.now();
|
|
597
|
-
|
|
597
|
+
Ne = new Set(ke), ke.clear(), console.log(`[Shaders Perf] Texture management: ${(performance.now() - t).toFixed(2)}ms`);
|
|
598
598
|
const o = /* @__PURE__ */ new Set(), l = performance.now();
|
|
599
|
-
nn.clear(), h.nodes.forEach((g,
|
|
600
|
-
(g.requiresRTT || g.transformRTTActive) && nn.add(
|
|
601
|
-
}), console.log(`[Shaders Perf] RTT tracking rebuild: ${(performance.now() - l).toFixed(2)}ms (${h.nodes.size} nodes)`),
|
|
602
|
-
const f = performance.now(), b =
|
|
603
|
-
if (console.log(`[Shaders Perf] composeNodeTree: ${(performance.now() - f).toFixed(2)}ms (RTT ops: ${
|
|
604
|
-
const g =
|
|
605
|
-
if (g ||
|
|
606
|
-
console.log(`[Shaders Perf] Recompilation needed: compositionChanged=${g}, nodeChanged=${
|
|
599
|
+
nn.clear(), h.nodes.forEach((g, k) => {
|
|
600
|
+
(g.requiresRTT || g.transformRTTActive) && nn.add(k);
|
|
601
|
+
}), console.log(`[Shaders Perf] RTT tracking rebuild: ${(performance.now() - l).toFixed(2)}ms (${h.nodes.size} nodes)`), Pe = 0;
|
|
602
|
+
const f = performance.now(), b = j(h.rootId, /* @__PURE__ */ new Set(), o);
|
|
603
|
+
if (console.log(`[Shaders Perf] composeNodeTree: ${(performance.now() - f).toFixed(2)}ms (RTT ops: ${Pe})`), b && p) {
|
|
604
|
+
const g = !An(en, o), k = p.fragmentNode !== b;
|
|
605
|
+
if (g || $e || k) {
|
|
606
|
+
console.log(`[Shaders Perf] Recompilation needed: compositionChanged=${g}, nodeChanged=${k}, needsRefresh=${$e}`);
|
|
607
607
|
const M = performance.now();
|
|
608
608
|
rn(), console.log(`[Shaders Perf] Texture disposal: ${(performance.now() - M).toFixed(2)}ms`);
|
|
609
|
-
const
|
|
609
|
+
const $ = performance.now();
|
|
610
610
|
try {
|
|
611
611
|
p.dispose(), n.renderTarget && n.renderTarget.dispose();
|
|
612
612
|
} catch {
|
|
613
613
|
}
|
|
614
|
-
console.log(`[Shaders Perf] Material disposal: ${(performance.now() -
|
|
615
|
-
const
|
|
616
|
-
u.fragmentNode = b, u.needsUpdate = !0, console.log(`[Shaders Perf] Material creation: ${(performance.now() -
|
|
614
|
+
console.log(`[Shaders Perf] Material disposal: ${(performance.now() - $).toFixed(2)}ms`);
|
|
615
|
+
const w = performance.now(), u = new dn({ transparent: !0 });
|
|
616
|
+
u.fragmentNode = b, u.needsUpdate = !0, console.log(`[Shaders Perf] Material creation: ${(performance.now() - w).toFixed(2)}ms`), m.material = u, p = u, $e = !1, en = o;
|
|
617
617
|
} else console.log("[Shaders Perf] No recompilation needed (composition unchanged)");
|
|
618
618
|
}
|
|
619
619
|
console.log(`[Shaders Perf] TOTAL updateMaterial: ${(performance.now() - s).toFixed(2)}ms`), console.log("========================================");
|
|
620
620
|
} catch (t) {
|
|
621
621
|
console.error("Error composing shader tree:", t), console.log(`[Shaders Perf] FAILED after ${(performance.now() - s).toFixed(2)}ms`);
|
|
622
622
|
} finally {
|
|
623
|
-
|
|
623
|
+
Fe = !1;
|
|
624
624
|
}
|
|
625
|
-
|
|
626
|
-
},
|
|
625
|
+
N && re().catch(console.warn);
|
|
626
|
+
}, W = (s) => {
|
|
627
627
|
const t = d.get(s);
|
|
628
628
|
if (!t) return [];
|
|
629
629
|
const o = [];
|
|
@@ -632,45 +632,50 @@ function cs() {
|
|
|
632
632
|
f && o.push(f);
|
|
633
633
|
}
|
|
634
634
|
return o;
|
|
635
|
-
},
|
|
635
|
+
}, $n = (s) => {
|
|
636
636
|
for (const [t, o] of h.nodes.entries()) if (o.metadata.id === s) return t;
|
|
637
637
|
return null;
|
|
638
|
-
}, se = (s, t, o, l) => {
|
|
638
|
+
}, se = (s, t, o, l, f) => {
|
|
639
639
|
if (!t.metadata.mask?.source) return s;
|
|
640
|
-
const
|
|
641
|
-
if (!
|
|
642
|
-
if (l.has(
|
|
640
|
+
const b = t.metadata.mask.source, g = $n(b);
|
|
641
|
+
if (!g) return s;
|
|
642
|
+
if (l.has(g))
|
|
643
643
|
return console.error("Uh oh, looks like you've got a circular dependency in your shader masks."), s;
|
|
644
|
-
const
|
|
645
|
-
|
|
644
|
+
const k = new Set(l);
|
|
645
|
+
k.add(o);
|
|
646
|
+
const M = j(g, k);
|
|
647
|
+
let $ = M;
|
|
648
|
+
f && ($ = ye(M).sample(f));
|
|
649
|
+
const w = t.metadata.mask.type || "alpha";
|
|
650
|
+
return Ot(s, $, w);
|
|
646
651
|
}, le = (s, t) => {
|
|
647
652
|
if (!t.metadata.transform || !t.transformUniforms || !fe(t.metadata.transform) && !t.transformRTTActive) return s;
|
|
648
|
-
const o =
|
|
649
|
-
return
|
|
650
|
-
},
|
|
653
|
+
const o = ye(s), l = xe(Ce, t.transformUniforms.offsetX, t.transformUniforms.offsetY, t.transformUniforms.rotation, t.transformUniforms.scale, t.transformUniforms.anchorX, t.transformUniforms.anchorY, t.transformUniforms.aspectRatio);
|
|
654
|
+
return Re(l, o.sample(l), o, t.transformUniforms.edges);
|
|
655
|
+
}, H = (s) => !!s.uvTransformFunc && s.requiresChild && s.metadata.blendMode === "normal" && (s.metadata.opacity === void 0 || s.metadata.opacity === 1) && s.metadata.visible !== !1 && !s.metadata.mask?.source && !(s.transformUniforms && s.metadata.transform && fe(s.metadata.transform)), Ye = (s) => {
|
|
651
656
|
const t = [];
|
|
652
657
|
let o = s;
|
|
653
658
|
for (; o; ) {
|
|
654
659
|
const l = h.nodes.get(o);
|
|
655
|
-
if (!l || !
|
|
660
|
+
if (!l || !H(l)) break;
|
|
656
661
|
t.push(l);
|
|
657
|
-
const f =
|
|
662
|
+
const f = W(l.id);
|
|
658
663
|
if (f.length !== 1) break;
|
|
659
664
|
const b = f[0];
|
|
660
|
-
if (
|
|
665
|
+
if (H(b)) o = b.id;
|
|
661
666
|
else break;
|
|
662
667
|
}
|
|
663
668
|
return t;
|
|
664
669
|
}, Dn = (s) => {
|
|
665
670
|
if (s.length === 0) return null;
|
|
666
|
-
const t = s[s.length - 1], o =
|
|
671
|
+
const t = s[s.length - 1], o = W(t.id);
|
|
667
672
|
return o.length === 0 ? null : o.length === 1 ? o[0] : null;
|
|
668
|
-
},
|
|
669
|
-
if (!s.uvTransformFunc || !
|
|
670
|
-
const t =
|
|
673
|
+
}, Ve = (s) => {
|
|
674
|
+
if (!s.uvTransformFunc || !H(s)) return !1;
|
|
675
|
+
const t = W(s.id);
|
|
671
676
|
if (t.length !== 1) return !1;
|
|
672
677
|
const o = t[0];
|
|
673
|
-
return o.acceptsUVContext && !o.requiresChild ? !0 : o.uvTransformFunc &&
|
|
678
|
+
return o.acceptsUVContext && !o.requiresChild ? !0 : o.uvTransformFunc && H(o) ? Ve(o) : !1;
|
|
674
679
|
}, Ie = (s, t, o) => {
|
|
675
680
|
const l = [];
|
|
676
681
|
let f = s;
|
|
@@ -678,9 +683,9 @@ function cs() {
|
|
|
678
683
|
const v = h.nodes.get(f);
|
|
679
684
|
if (!v) break;
|
|
680
685
|
if (l.length >= 2)
|
|
681
|
-
return console.log(`[Shaders Perf] UV chain depth limit reached (${l.length}), falling back to RTT`),
|
|
686
|
+
return console.log(`[Shaders Perf] UV chain depth limit reached (${l.length}), falling back to RTT`), j(s, t, o, !0);
|
|
682
687
|
if (l.push(v), o && o.add(v.id), v.acceptsUVContext && !v.requiresChild) break;
|
|
683
|
-
const c =
|
|
688
|
+
const c = W(f);
|
|
684
689
|
if (c.length !== 1) break;
|
|
685
690
|
f = c[0].id;
|
|
686
691
|
}
|
|
@@ -692,50 +697,50 @@ function cs() {
|
|
|
692
697
|
c.uvTransformFunc && (g = c.uvTransformFunc({
|
|
693
698
|
uv: g,
|
|
694
699
|
uniforms: c.uniforms,
|
|
695
|
-
viewportSize:
|
|
696
|
-
})), c.transformUniforms && c.metadata.transform && fe(c.metadata.transform) && (g =
|
|
700
|
+
viewportSize: Se
|
|
701
|
+
})), c.transformUniforms && c.metadata.transform && fe(c.metadata.transform) && (g = xe(g, c.transformUniforms.offsetX, c.transformUniforms.offsetY, c.transformUniforms.rotation, c.transformUniforms.scale, c.transformUniforms.anchorX, c.transformUniforms.anchorY, c.transformUniforms.aspectRatio), c.transformUniforms.edges && (g = ce(g, c.transformUniforms.edges)), c.transformRTTActive = !0);
|
|
697
702
|
}
|
|
698
703
|
for (let v = 0; v < l.length - 1; v++) {
|
|
699
704
|
const c = l[v];
|
|
700
705
|
if (!c.requiresChild) continue;
|
|
701
|
-
const
|
|
702
|
-
c.cleanupCallbacks.push(
|
|
703
|
-
}, P = (
|
|
704
|
-
c.beforeRenderCallbacks.push(
|
|
705
|
-
}, T = (
|
|
706
|
-
c.afterRenderCallbacks.push(
|
|
707
|
-
},
|
|
708
|
-
c.resizeCallbacks.push(
|
|
706
|
+
const D = (O) => {
|
|
707
|
+
c.cleanupCallbacks.push(O);
|
|
708
|
+
}, P = (O) => {
|
|
709
|
+
c.beforeRenderCallbacks.push(O);
|
|
710
|
+
}, T = (O) => {
|
|
711
|
+
c.afterRenderCallbacks.push(O);
|
|
712
|
+
}, S = (O) => {
|
|
713
|
+
c.resizeCallbacks.push(O);
|
|
709
714
|
};
|
|
710
|
-
c.cleanupCallbacks.forEach((
|
|
715
|
+
c.cleanupCallbacks.forEach((O) => {
|
|
711
716
|
try {
|
|
712
|
-
|
|
713
|
-
} catch (
|
|
714
|
-
console.error("Error in cleanup callback:",
|
|
717
|
+
O();
|
|
718
|
+
} catch (Q) {
|
|
719
|
+
console.error("Error in cleanup callback:", Q);
|
|
715
720
|
}
|
|
716
721
|
}), c.cleanupCallbacks = [], c.beforeRenderCallbacks = [], c.afterRenderCallbacks = [], c.resizeCallbacks = [], c.fragmentNodeFunc({
|
|
717
722
|
uniforms: c.uniforms ?? {},
|
|
718
723
|
childNode: void 0,
|
|
719
724
|
uvContext: void 0,
|
|
720
|
-
onCleanup:
|
|
725
|
+
onCleanup: D,
|
|
721
726
|
onBeforeRender: P,
|
|
722
727
|
onAfterRender: T,
|
|
723
|
-
onResize:
|
|
728
|
+
onResize: S,
|
|
724
729
|
canvas: e,
|
|
725
730
|
dimensions: {
|
|
726
|
-
width:
|
|
727
|
-
height:
|
|
731
|
+
width: F,
|
|
732
|
+
height: E
|
|
728
733
|
},
|
|
729
734
|
renderer: n
|
|
730
735
|
});
|
|
731
736
|
}
|
|
732
|
-
const
|
|
737
|
+
const k = (v) => {
|
|
733
738
|
b.cleanupCallbacks.push(v);
|
|
734
739
|
}, M = (v) => {
|
|
735
740
|
b.beforeRenderCallbacks.push(v);
|
|
736
|
-
},
|
|
741
|
+
}, $ = (v) => {
|
|
737
742
|
b.afterRenderCallbacks.push(v);
|
|
738
|
-
},
|
|
743
|
+
}, w = (v) => {
|
|
739
744
|
b.resizeCallbacks.push(v);
|
|
740
745
|
};
|
|
741
746
|
b.cleanupCallbacks.forEach((v) => {
|
|
@@ -749,232 +754,234 @@ function cs() {
|
|
|
749
754
|
uniforms: b.uniforms ?? {},
|
|
750
755
|
childNode: void 0,
|
|
751
756
|
uvContext: g,
|
|
752
|
-
onCleanup:
|
|
757
|
+
onCleanup: k,
|
|
753
758
|
onBeforeRender: M,
|
|
754
|
-
onAfterRender:
|
|
755
|
-
onResize:
|
|
759
|
+
onAfterRender: $,
|
|
760
|
+
onResize: w,
|
|
756
761
|
canvas: e,
|
|
757
762
|
dimensions: {
|
|
758
|
-
width:
|
|
759
|
-
height:
|
|
763
|
+
width: F,
|
|
764
|
+
height: E
|
|
760
765
|
},
|
|
761
766
|
renderer: n
|
|
762
767
|
});
|
|
763
|
-
for (const v of l) if (v.uniforms.edges?.uniform) return
|
|
768
|
+
for (const v of l) if (v.uniforms.edges?.uniform) return Re(g, u, null, v.uniforms.edges.uniform);
|
|
764
769
|
return u;
|
|
765
770
|
}, He = (s, t, o) => {
|
|
766
771
|
if (s.length === 0) return x(0, 0, 0, 0);
|
|
767
772
|
const l = Dn(s);
|
|
768
773
|
let f;
|
|
769
|
-
if (l) f =
|
|
774
|
+
if (l) f = j(l.id, t, o);
|
|
770
775
|
else return x(0, 0, 0, 0);
|
|
771
|
-
const b =
|
|
776
|
+
const b = ye(f);
|
|
772
777
|
let g = Ce;
|
|
773
|
-
for (let
|
|
774
|
-
const
|
|
775
|
-
|
|
778
|
+
for (let $ = s.length - 1; $ >= 0; $--) {
|
|
779
|
+
const w = s[$];
|
|
780
|
+
w.uvTransformFunc && (g = w.uvTransformFunc({
|
|
776
781
|
uv: g,
|
|
777
|
-
uniforms:
|
|
778
|
-
viewportSize:
|
|
779
|
-
}),
|
|
782
|
+
uniforms: w.uniforms,
|
|
783
|
+
viewportSize: Se
|
|
784
|
+
}), w.uniforms.edges?.uniform && (g = ce(g, w.uniforms.edges.uniform))), o && o.add(w.id);
|
|
780
785
|
}
|
|
781
|
-
const
|
|
782
|
-
return M.uniforms.edges?.uniform ?
|
|
786
|
+
const k = b.sample(g), M = s[0];
|
|
787
|
+
return M.uniforms.edges?.uniform ? Re(g, k, b, M.uniforms.edges.uniform) : k;
|
|
783
788
|
}, tn = (s, t) => {
|
|
784
789
|
const o = [];
|
|
785
790
|
for (let l = t; l < s.length; l++) {
|
|
786
791
|
const f = s[l];
|
|
787
|
-
if (!
|
|
792
|
+
if (!H(f) || W(f.id).length > 0) break;
|
|
788
793
|
o.push(f);
|
|
789
794
|
}
|
|
790
795
|
return o;
|
|
791
796
|
}, on = (s, t, o) => {
|
|
792
797
|
if (s.length === 0) return t;
|
|
793
|
-
const l =
|
|
798
|
+
const l = ye(t);
|
|
794
799
|
let f = Ce;
|
|
795
|
-
for (let
|
|
796
|
-
const M = s[
|
|
800
|
+
for (let k = s.length - 1; k >= 0; k--) {
|
|
801
|
+
const M = s[k];
|
|
797
802
|
M.uvTransformFunc && (f = M.uvTransformFunc({
|
|
798
803
|
uv: f,
|
|
799
804
|
uniforms: M.uniforms,
|
|
800
|
-
viewportSize:
|
|
805
|
+
viewportSize: Se
|
|
801
806
|
}), M.uniforms.edges?.uniform && (f = ce(f, M.uniforms.edges.uniform))), o && o.add(M.id);
|
|
802
807
|
}
|
|
803
808
|
const b = l.sample(f), g = s[s.length - 1];
|
|
804
|
-
return g.uniforms.edges?.uniform ?
|
|
809
|
+
return g.uniforms.edges?.uniform ? Re(f, b, l, g.uniforms.edges.uniform) : b;
|
|
805
810
|
}, sn = (s) => {
|
|
806
811
|
const t = [], o = [];
|
|
807
812
|
let l = !1;
|
|
808
813
|
for (let g = 0; g < s.length; g++) {
|
|
809
|
-
const
|
|
810
|
-
|
|
814
|
+
const k = s[g], M = W(k.id).length > 0;
|
|
815
|
+
k.acceptsUVContext && !k.requiresChild && t.push(g), H(k) && !M && (o.push(g), t.length > 0 && (l = !0));
|
|
811
816
|
}
|
|
812
817
|
if (t.length === 0 || o.length === 0 || !l) return !1;
|
|
813
818
|
const f = Math.min(...t), b = Math.max(...o);
|
|
814
819
|
for (let g = f + 1; g < b; g++) {
|
|
815
|
-
const
|
|
816
|
-
if (
|
|
820
|
+
const k = s[g];
|
|
821
|
+
if (k.requiresRTT && !H(k) && !(k.acceptsUVContext && !k.requiresChild)) return !1;
|
|
817
822
|
}
|
|
818
823
|
return o.length > 2 ? (console.log(`[Shaders Perf] Too many distortions in sibling group (${o.length}), skipping UV propagation`), !1) : !0;
|
|
819
824
|
}, an = (s, t, o) => {
|
|
820
825
|
const l = performance.now();
|
|
821
826
|
console.log(`[Shaders Perf] composeSiblingsWithUVContext (${s.length} children)`);
|
|
822
827
|
const f = performance.now(), b = [], g = [];
|
|
823
|
-
s.forEach((
|
|
824
|
-
const v =
|
|
825
|
-
|
|
826
|
-
node:
|
|
828
|
+
s.forEach((w, u) => {
|
|
829
|
+
const v = W(w.id).length > 0;
|
|
830
|
+
H(w) && !v ? g.push({
|
|
831
|
+
node: w,
|
|
827
832
|
index: u
|
|
828
|
-
}) :
|
|
829
|
-
node:
|
|
833
|
+
}) : w.acceptsUVContext && !w.requiresChild && !v && b.push({
|
|
834
|
+
node: w,
|
|
830
835
|
index: u
|
|
831
836
|
});
|
|
832
837
|
}), console.log(`[Shaders Perf] Categorization: ${(performance.now() - f).toFixed(2)}ms (${b.length} gens, ${g.length} dists)`);
|
|
833
|
-
const
|
|
834
|
-
for (const
|
|
835
|
-
const u =
|
|
838
|
+
const k = performance.now();
|
|
839
|
+
for (const w of g) {
|
|
840
|
+
const u = w.node;
|
|
836
841
|
u.cleanupCallbacks.forEach((T) => {
|
|
837
842
|
try {
|
|
838
843
|
T();
|
|
839
|
-
} catch (
|
|
840
|
-
console.error("Cleanup error:",
|
|
844
|
+
} catch (S) {
|
|
845
|
+
console.error("Cleanup error:", S);
|
|
841
846
|
}
|
|
842
847
|
}), u.cleanupCallbacks = [], u.beforeRenderCallbacks = [], u.afterRenderCallbacks = [], u.resizeCallbacks = [];
|
|
843
|
-
const v = (T) => u.cleanupCallbacks.push(T), c = (T) => u.beforeRenderCallbacks.push(T),
|
|
848
|
+
const v = (T) => u.cleanupCallbacks.push(T), c = (T) => u.beforeRenderCallbacks.push(T), D = (T) => u.afterRenderCallbacks.push(T), P = (T) => u.resizeCallbacks.push(T);
|
|
844
849
|
u.fragmentNodeFunc({
|
|
845
850
|
uniforms: u.uniforms ?? {},
|
|
846
851
|
childNode: void 0,
|
|
847
852
|
uvContext: void 0,
|
|
848
853
|
onCleanup: v,
|
|
849
854
|
onBeforeRender: c,
|
|
850
|
-
onAfterRender:
|
|
855
|
+
onAfterRender: D,
|
|
851
856
|
onResize: P,
|
|
852
857
|
canvas: e,
|
|
853
858
|
dimensions: {
|
|
854
|
-
width:
|
|
855
|
-
height:
|
|
859
|
+
width: F,
|
|
860
|
+
height: E
|
|
856
861
|
},
|
|
857
862
|
renderer: n
|
|
858
863
|
}), o && o.add(u.id);
|
|
859
864
|
}
|
|
860
|
-
console.log(`[Shaders Perf] Callback registration: ${(performance.now() -
|
|
865
|
+
console.log(`[Shaders Perf] Callback registration: ${(performance.now() - k).toFixed(2)}ms (${g.length} distortions)`);
|
|
861
866
|
const M = performance.now();
|
|
862
|
-
let
|
|
863
|
-
for (let
|
|
864
|
-
const u = s[
|
|
867
|
+
let $;
|
|
868
|
+
for (let w = 0; w < s.length; w++) {
|
|
869
|
+
const u = s[w];
|
|
865
870
|
if (u.metadata.visible === !1) continue;
|
|
866
871
|
const v = u.metadata.opacity ?? 1;
|
|
867
872
|
u.opacityUniform.value = v, o && o.add(u.id);
|
|
868
|
-
const c =
|
|
869
|
-
let
|
|
870
|
-
const P = b.find((T) => T.index ===
|
|
873
|
+
const c = W(u.id).length > 0;
|
|
874
|
+
let D;
|
|
875
|
+
const P = b.find((T) => T.index === w);
|
|
871
876
|
if (P) {
|
|
872
877
|
const T = g.filter((_) => _.index > P.index).sort((_, q) => _.index - q.index).map((_) => _.node);
|
|
873
|
-
let
|
|
878
|
+
let S = Ce;
|
|
874
879
|
for (let _ = T.length - 1; _ >= 0; _--) {
|
|
875
880
|
const q = T[_];
|
|
876
|
-
q.uvTransformFunc && (
|
|
877
|
-
uv:
|
|
881
|
+
q.uvTransformFunc && (S = q.uvTransformFunc({
|
|
882
|
+
uv: S,
|
|
878
883
|
uniforms: q.uniforms,
|
|
879
|
-
viewportSize:
|
|
880
|
-
})), q.transformUniforms && q.metadata.transform && fe(q.metadata.transform) && (
|
|
884
|
+
viewportSize: Se
|
|
885
|
+
})), q.transformUniforms && q.metadata.transform && fe(q.metadata.transform) && (S = xe(S, q.transformUniforms.offsetX, q.transformUniforms.offsetY, q.transformUniforms.rotation, q.transformUniforms.scale, q.transformUniforms.anchorX, q.transformUniforms.anchorY, q.transformUniforms.aspectRatio), q.transformUniforms.edges && (S = ce(S, q.transformUniforms.edges)), q.transformRTTActive = !0), q.uniforms.edges?.uniform && (S = ce(S, q.uniforms.edges.uniform));
|
|
881
886
|
}
|
|
882
|
-
P.node.transformUniforms && P.node.metadata.transform && fe(P.node.metadata.transform) && (
|
|
887
|
+
P.node.transformUniforms && P.node.metadata.transform && fe(P.node.metadata.transform) && (S = xe(S, P.node.transformUniforms.offsetX, P.node.transformUniforms.offsetY, P.node.transformUniforms.rotation, P.node.transformUniforms.scale, P.node.transformUniforms.anchorX, P.node.transformUniforms.anchorY, P.node.transformUniforms.aspectRatio), P.node.transformUniforms.edges && (S = ce(S, P.node.transformUniforms.edges)), P.node.transformRTTActive = !0), u.cleanupCallbacks.forEach((_) => {
|
|
883
888
|
try {
|
|
884
889
|
_();
|
|
885
890
|
} catch (q) {
|
|
886
891
|
console.error("Cleanup error:", q);
|
|
887
892
|
}
|
|
888
893
|
}), u.cleanupCallbacks = [], u.beforeRenderCallbacks = [], u.afterRenderCallbacks = [], u.resizeCallbacks = [];
|
|
889
|
-
const
|
|
894
|
+
const O = (_) => u.cleanupCallbacks.push(_), Q = (_) => u.beforeRenderCallbacks.push(_), J = (_) => u.afterRenderCallbacks.push(_), A = (_) => u.resizeCallbacks.push(_);
|
|
890
895
|
let L = u.fragmentNodeFunc({
|
|
891
896
|
uniforms: u.uniforms ?? {},
|
|
892
897
|
childNode: void 0,
|
|
893
|
-
uvContext:
|
|
894
|
-
onCleanup:
|
|
895
|
-
onBeforeRender:
|
|
896
|
-
onAfterRender:
|
|
897
|
-
onResize:
|
|
898
|
+
uvContext: S,
|
|
899
|
+
onCleanup: O,
|
|
900
|
+
onBeforeRender: Q,
|
|
901
|
+
onAfterRender: J,
|
|
902
|
+
onResize: A,
|
|
898
903
|
canvas: e,
|
|
899
904
|
dimensions: {
|
|
900
|
-
width:
|
|
901
|
-
height:
|
|
905
|
+
width: F,
|
|
906
|
+
height: E
|
|
902
907
|
},
|
|
903
908
|
renderer: n
|
|
904
909
|
});
|
|
905
910
|
if (T.length > 0) {
|
|
906
911
|
const _ = T[0];
|
|
907
|
-
_.uniforms.edges?.uniform && (L =
|
|
912
|
+
_.uniforms.edges?.uniform && (L = Re(S, L, null, _.uniforms.edges.uniform));
|
|
908
913
|
}
|
|
909
|
-
|
|
914
|
+
D = se(L, u, u.id, t, S);
|
|
910
915
|
} else {
|
|
911
|
-
if (g.find((T) => T.index ===
|
|
916
|
+
if (g.find((T) => T.index === w)) continue;
|
|
912
917
|
if (c) {
|
|
913
|
-
if (
|
|
914
|
-
else if (
|
|
915
|
-
const
|
|
916
|
-
|
|
917
|
-
} else
|
|
918
|
-
const T = g.filter((
|
|
918
|
+
if (Ve(u)) D = Ie(u.id, t, o);
|
|
919
|
+
else if (H(u)) {
|
|
920
|
+
const S = Ye(u.id);
|
|
921
|
+
S.length > 1 ? D = He(S, t, o) : D = j(u.id, t, o);
|
|
922
|
+
} else D = j(u.id, t, o);
|
|
923
|
+
const T = g.filter((S) => S.index > w).sort((S, O) => S.index - O.index).map((S) => S.node);
|
|
919
924
|
if (T.length > 0) {
|
|
920
|
-
const
|
|
921
|
-
let
|
|
922
|
-
for (let
|
|
923
|
-
const
|
|
924
|
-
|
|
925
|
-
uv:
|
|
926
|
-
uniforms:
|
|
927
|
-
viewportSize:
|
|
928
|
-
})),
|
|
925
|
+
const S = ye(D);
|
|
926
|
+
let O = Ce;
|
|
927
|
+
for (let J = T.length - 1; J >= 0; J--) {
|
|
928
|
+
const A = T[J];
|
|
929
|
+
A.uvTransformFunc && (O = A.uvTransformFunc({
|
|
930
|
+
uv: O,
|
|
931
|
+
uniforms: A.uniforms,
|
|
932
|
+
viewportSize: Se
|
|
933
|
+
})), A.transformUniforms && A.metadata.transform && fe(A.metadata.transform) && (O = xe(O, A.transformUniforms.offsetX, A.transformUniforms.offsetY, A.transformUniforms.rotation, A.transformUniforms.scale, A.transformUniforms.anchorX, A.transformUniforms.anchorY, A.transformUniforms.aspectRatio), A.transformUniforms.edges && (O = ce(O, A.transformUniforms.edges)), A.transformRTTActive = !0), A.uniforms.edges?.uniform && (O = ce(O, A.uniforms.edges.uniform));
|
|
929
934
|
}
|
|
930
|
-
|
|
935
|
+
D = S.sample(O);
|
|
936
|
+
const Q = T[T.length - 1];
|
|
937
|
+
Q.transformUniforms?.edges && (D = Re(O, D, S, Q.transformUniforms.edges));
|
|
931
938
|
}
|
|
932
939
|
} else {
|
|
933
|
-
u.cleanupCallbacks.forEach((
|
|
940
|
+
u.cleanupCallbacks.forEach((A) => {
|
|
934
941
|
try {
|
|
935
|
-
|
|
942
|
+
A();
|
|
936
943
|
} catch (L) {
|
|
937
944
|
console.error("Cleanup error:", L);
|
|
938
945
|
}
|
|
939
946
|
}), u.cleanupCallbacks = [], u.beforeRenderCallbacks = [], u.afterRenderCallbacks = [], u.resizeCallbacks = [];
|
|
940
|
-
const T = (
|
|
941
|
-
let
|
|
942
|
-
u.requiresRTT &&
|
|
947
|
+
const T = (A) => u.cleanupCallbacks.push(A), S = (A) => u.beforeRenderCallbacks.push(A), O = (A) => u.afterRenderCallbacks.push(A), Q = (A) => u.resizeCallbacks.push(A);
|
|
948
|
+
let J = $;
|
|
949
|
+
u.requiresRTT && $ !== void 0 && (J = K(x(0, 0, 0, 0), $, "normal", 1)), D = se(le(u.fragmentNodeFunc({
|
|
943
950
|
uniforms: u.uniforms ?? {},
|
|
944
|
-
childNode:
|
|
951
|
+
childNode: J,
|
|
945
952
|
onCleanup: T,
|
|
946
|
-
onBeforeRender:
|
|
947
|
-
onAfterRender:
|
|
948
|
-
onResize:
|
|
953
|
+
onBeforeRender: S,
|
|
954
|
+
onAfterRender: O,
|
|
955
|
+
onResize: Q,
|
|
949
956
|
canvas: e,
|
|
950
957
|
dimensions: {
|
|
951
|
-
width:
|
|
952
|
-
height:
|
|
958
|
+
width: F,
|
|
959
|
+
height: E
|
|
953
960
|
},
|
|
954
961
|
renderer: n
|
|
955
962
|
}), u), u, u.id, t);
|
|
956
963
|
}
|
|
957
964
|
}
|
|
958
|
-
u.requiresChild && u.metadata.blendMode === "normal" && !c ?
|
|
965
|
+
u.requiresChild && u.metadata.blendMode === "normal" && !c ? $ = K(x(0, 0, 0, 0), D, "normal", u.opacityUniform) : $ === void 0 ? $ = K(x(1, 1, 1, 0), D, u.metadata.blendMode, u.opacityUniform) : $ = K($, D, u.metadata.blendMode, u.opacityUniform);
|
|
959
966
|
}
|
|
960
|
-
return console.log(`[Shaders Perf] Node processing: ${(performance.now() - M).toFixed(2)}ms`), console.log(`[Shaders Perf] TOTAL composeSiblingsWithUVContext: ${(performance.now() - l).toFixed(2)}ms`),
|
|
961
|
-
},
|
|
962
|
-
if (
|
|
967
|
+
return console.log(`[Shaders Perf] Node processing: ${(performance.now() - M).toFixed(2)}ms`), console.log(`[Shaders Perf] TOTAL composeSiblingsWithUVContext: ${(performance.now() - l).toFixed(2)}ms`), $ ?? x(0, 0, 0, 0);
|
|
968
|
+
}, j = (s, t = /* @__PURE__ */ new Set(), o, l = !1) => {
|
|
969
|
+
if (F === 0 || E === 0) return x(0, 0, 0, 0);
|
|
963
970
|
const f = h.nodes.get(s);
|
|
964
971
|
if (!f) return x(0, 0, 0, 0);
|
|
965
|
-
const b = (
|
|
966
|
-
f.cleanupCallbacks.push(
|
|
967
|
-
}, g = (
|
|
968
|
-
f.beforeRenderCallbacks.push(
|
|
969
|
-
},
|
|
970
|
-
f.afterRenderCallbacks.push(
|
|
971
|
-
}, M = (
|
|
972
|
-
f.resizeCallbacks.push(
|
|
973
|
-
},
|
|
974
|
-
if (
|
|
975
|
-
return f.requiresRTT && !te ? x(0, 0, 0, 0) : (f.cleanupCallbacks.forEach((
|
|
972
|
+
const b = (w) => {
|
|
973
|
+
f.cleanupCallbacks.push(w);
|
|
974
|
+
}, g = (w) => {
|
|
975
|
+
f.beforeRenderCallbacks.push(w);
|
|
976
|
+
}, k = (w) => {
|
|
977
|
+
f.afterRenderCallbacks.push(w);
|
|
978
|
+
}, M = (w) => {
|
|
979
|
+
f.resizeCallbacks.push(w);
|
|
980
|
+
}, $ = W(s);
|
|
981
|
+
if ($.length === 0)
|
|
982
|
+
return f.requiresRTT && !te ? x(0, 0, 0, 0) : (f.cleanupCallbacks.forEach((w) => {
|
|
976
983
|
try {
|
|
977
|
-
|
|
984
|
+
w();
|
|
978
985
|
} catch (u) {
|
|
979
986
|
console.error("Error in cleanup callback:", u);
|
|
980
987
|
}
|
|
@@ -983,54 +990,54 @@ function cs() {
|
|
|
983
990
|
childNode: void 0,
|
|
984
991
|
onCleanup: b,
|
|
985
992
|
onBeforeRender: g,
|
|
986
|
-
onAfterRender:
|
|
993
|
+
onAfterRender: k,
|
|
987
994
|
onResize: M,
|
|
988
995
|
canvas: e,
|
|
989
996
|
dimensions: {
|
|
990
|
-
width:
|
|
991
|
-
height:
|
|
997
|
+
width: F,
|
|
998
|
+
height: E
|
|
992
999
|
},
|
|
993
1000
|
renderer: n
|
|
994
1001
|
}), f), f, s, t));
|
|
995
1002
|
{
|
|
996
|
-
const
|
|
1003
|
+
const w = [...$].sort((u, v) => u.metadata.renderOrder - v.metadata.renderOrder);
|
|
997
1004
|
if (f.parentId === null) {
|
|
998
|
-
if (!l && sn(
|
|
1005
|
+
if (!l && sn(w)) return se(le(an(w, t, o), f), f, s, t);
|
|
999
1006
|
let u;
|
|
1000
|
-
for (let v = 0; v <
|
|
1001
|
-
const c =
|
|
1002
|
-
let
|
|
1003
|
-
if (c.metadata.opacity === void 0 ? (
|
|
1007
|
+
for (let v = 0; v < w.length; v++) {
|
|
1008
|
+
const c = w[v];
|
|
1009
|
+
let D;
|
|
1010
|
+
if (c.metadata.opacity === void 0 ? (D = 1, c.opacityUniform.value = D) : (D = c.metadata.opacity, c.opacityUniform.value = D), c.metadata.visible === !1) continue;
|
|
1004
1011
|
o && o.add(c.id);
|
|
1005
|
-
const P =
|
|
1012
|
+
const P = W(c.id).length > 0;
|
|
1006
1013
|
let T;
|
|
1007
|
-
if (P) if (l) T =
|
|
1008
|
-
else if (
|
|
1009
|
-
else if (
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1012
|
-
} else T =
|
|
1014
|
+
if (P) if (l) T = j(c.id, t, o, !0);
|
|
1015
|
+
else if (Ve(c)) T = Ie(c.id, t, o);
|
|
1016
|
+
else if (H(c)) {
|
|
1017
|
+
const S = Ye(c.id);
|
|
1018
|
+
S.length > 1 ? T = He(S, t, o) : T = j(c.id, t, o);
|
|
1019
|
+
} else T = j(c.id, t, o);
|
|
1013
1020
|
else {
|
|
1014
|
-
if (
|
|
1015
|
-
const
|
|
1016
|
-
if (
|
|
1017
|
-
T = on(
|
|
1021
|
+
if (H(c) && c.requiresChild && u !== void 0) {
|
|
1022
|
+
const S = tn(w, v);
|
|
1023
|
+
if (S.length > 1) {
|
|
1024
|
+
T = on(S, u, o), v += S.length - 1, u = T;
|
|
1018
1025
|
continue;
|
|
1019
1026
|
}
|
|
1020
1027
|
}
|
|
1021
1028
|
if (c.requiresRTT && !te) T = x(0, 0, 0, 0);
|
|
1022
1029
|
else {
|
|
1023
|
-
const
|
|
1030
|
+
const S = (L) => {
|
|
1024
1031
|
c.cleanupCallbacks.push(L);
|
|
1025
|
-
},
|
|
1032
|
+
}, O = (L) => {
|
|
1026
1033
|
c.beforeRenderCallbacks.push(L);
|
|
1027
|
-
},
|
|
1034
|
+
}, Q = (L) => {
|
|
1028
1035
|
c.afterRenderCallbacks.push(L);
|
|
1029
|
-
},
|
|
1036
|
+
}, J = (L) => {
|
|
1030
1037
|
c.resizeCallbacks.push(L);
|
|
1031
1038
|
};
|
|
1032
|
-
let
|
|
1033
|
-
c.requiresRTT && u !== void 0 && (
|
|
1039
|
+
let A = u;
|
|
1040
|
+
c.requiresRTT && u !== void 0 && (A = K(x(0, 0, 0, 0), u, "normal", 1)), c.cleanupCallbacks.forEach((L) => {
|
|
1034
1041
|
try {
|
|
1035
1042
|
L();
|
|
1036
1043
|
} catch (_) {
|
|
@@ -1038,21 +1045,21 @@ function cs() {
|
|
|
1038
1045
|
}
|
|
1039
1046
|
}), c.cleanupCallbacks = [], c.beforeRenderCallbacks = [], c.afterRenderCallbacks = [], c.resizeCallbacks = [], T = se(le(c.fragmentNodeFunc({
|
|
1040
1047
|
uniforms: c.uniforms ?? {},
|
|
1041
|
-
childNode:
|
|
1042
|
-
onCleanup:
|
|
1043
|
-
onBeforeRender:
|
|
1044
|
-
onAfterRender:
|
|
1045
|
-
onResize:
|
|
1048
|
+
childNode: A,
|
|
1049
|
+
onCleanup: S,
|
|
1050
|
+
onBeforeRender: O,
|
|
1051
|
+
onAfterRender: Q,
|
|
1052
|
+
onResize: J,
|
|
1046
1053
|
canvas: e,
|
|
1047
1054
|
dimensions: {
|
|
1048
|
-
width:
|
|
1049
|
-
height:
|
|
1055
|
+
width: F,
|
|
1056
|
+
height: E
|
|
1050
1057
|
},
|
|
1051
1058
|
renderer: n
|
|
1052
1059
|
}), c), c, c.id, t);
|
|
1053
1060
|
}
|
|
1054
1061
|
}
|
|
1055
|
-
c.requiresChild && c.metadata.blendMode === "normal" && !P ? u = K(x(0, 0, 0, 0), T, "normal", c.opacityUniform) : u === void 0 ? f.requiresRTT ||
|
|
1062
|
+
c.requiresChild && c.metadata.blendMode === "normal" && !P ? u = K(x(0, 0, 0, 0), T, "normal", c.opacityUniform) : u === void 0 ? f.requiresRTT || D !== 1 ? u = K(x(1, 1, 1, 0), T, c.metadata.blendMode, c.opacityUniform) : u = T : u = K(u, T, c.metadata.blendMode, c.opacityUniform);
|
|
1056
1063
|
}
|
|
1057
1064
|
return f.requiresRTT && !te ? x(0, 0, 0, 0) : (f.cleanupCallbacks.forEach((v) => {
|
|
1058
1065
|
try {
|
|
@@ -1065,84 +1072,84 @@ function cs() {
|
|
|
1065
1072
|
childNode: u,
|
|
1066
1073
|
onCleanup: b,
|
|
1067
1074
|
onBeforeRender: g,
|
|
1068
|
-
onAfterRender:
|
|
1075
|
+
onAfterRender: k,
|
|
1069
1076
|
onResize: M,
|
|
1070
1077
|
canvas: e,
|
|
1071
1078
|
dimensions: {
|
|
1072
|
-
width:
|
|
1073
|
-
height:
|
|
1079
|
+
width: F,
|
|
1080
|
+
height: E
|
|
1074
1081
|
},
|
|
1075
1082
|
renderer: n
|
|
1076
1083
|
}), f), f, s, t));
|
|
1077
1084
|
} else {
|
|
1078
|
-
if (!l && sn(
|
|
1079
|
-
const v = an(
|
|
1085
|
+
if (!l && sn(w)) {
|
|
1086
|
+
const v = an(w, t, o);
|
|
1080
1087
|
return se(le(f.fragmentNodeFunc({
|
|
1081
1088
|
uniforms: f.uniforms ?? {},
|
|
1082
1089
|
childNode: v,
|
|
1083
1090
|
onCleanup: b,
|
|
1084
1091
|
onBeforeRender: g,
|
|
1085
|
-
onAfterRender:
|
|
1092
|
+
onAfterRender: k,
|
|
1086
1093
|
onResize: M,
|
|
1087
1094
|
canvas: e,
|
|
1088
1095
|
dimensions: {
|
|
1089
|
-
width:
|
|
1090
|
-
height:
|
|
1096
|
+
width: F,
|
|
1097
|
+
height: E
|
|
1091
1098
|
},
|
|
1092
1099
|
renderer: n
|
|
1093
1100
|
}), f), f, s, t);
|
|
1094
1101
|
}
|
|
1095
1102
|
let u;
|
|
1096
|
-
for (let v = 0; v <
|
|
1097
|
-
const c =
|
|
1098
|
-
let
|
|
1099
|
-
if (c.metadata.opacity === void 0 ? (
|
|
1103
|
+
for (let v = 0; v < w.length; v++) {
|
|
1104
|
+
const c = w[v];
|
|
1105
|
+
let D;
|
|
1106
|
+
if (c.metadata.opacity === void 0 ? (D = 1, c.opacityUniform.value = D) : (D = c.metadata.opacity, c.opacityUniform.value = D), c.metadata.visible === !1) continue;
|
|
1100
1107
|
o && o.add(c.id);
|
|
1101
|
-
const P =
|
|
1108
|
+
const P = W(c.id).length > 0;
|
|
1102
1109
|
let T;
|
|
1103
|
-
if (P) if (l) T =
|
|
1104
|
-
else if (
|
|
1105
|
-
else if (
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1108
|
-
} else T =
|
|
1110
|
+
if (P) if (l) T = j(c.id, t, o, !0);
|
|
1111
|
+
else if (Ve(c)) T = Ie(c.id, t, o);
|
|
1112
|
+
else if (H(c)) {
|
|
1113
|
+
const S = Ye(c.id);
|
|
1114
|
+
S.length > 1 ? T = He(S, t, o) : T = j(c.id, t, o);
|
|
1115
|
+
} else T = j(c.id, t, o);
|
|
1109
1116
|
else {
|
|
1110
|
-
if (
|
|
1111
|
-
const
|
|
1112
|
-
if (
|
|
1113
|
-
T = on(
|
|
1117
|
+
if (H(c) && c.requiresChild && u !== void 0) {
|
|
1118
|
+
const S = tn(w, v);
|
|
1119
|
+
if (S.length > 1) {
|
|
1120
|
+
T = on(S, u, o), v += S.length - 1, u = T;
|
|
1114
1121
|
continue;
|
|
1115
1122
|
}
|
|
1116
1123
|
}
|
|
1117
1124
|
if (c.requiresRTT && !te) T = x(0, 0, 0, 0);
|
|
1118
1125
|
else {
|
|
1119
|
-
const
|
|
1126
|
+
const S = (L) => {
|
|
1120
1127
|
c.cleanupCallbacks.push(L);
|
|
1121
|
-
},
|
|
1128
|
+
}, O = (L) => {
|
|
1122
1129
|
c.beforeRenderCallbacks.push(L);
|
|
1123
|
-
},
|
|
1130
|
+
}, Q = (L) => {
|
|
1124
1131
|
c.afterRenderCallbacks.push(L);
|
|
1125
|
-
},
|
|
1132
|
+
}, J = (L) => {
|
|
1126
1133
|
c.resizeCallbacks.push(L);
|
|
1127
1134
|
};
|
|
1128
|
-
let
|
|
1129
|
-
c.requiresRTT && u !== void 0 && (
|
|
1135
|
+
let A = u;
|
|
1136
|
+
c.requiresRTT && u !== void 0 && (A = K(x(0, 0, 0, 0), u, "normal", 1)), c.cleanupCallbacks = [], c.beforeRenderCallbacks = [], c.afterRenderCallbacks = [], c.resizeCallbacks = [], T = se(le(c.fragmentNodeFunc({
|
|
1130
1137
|
uniforms: c.uniforms ?? {},
|
|
1131
|
-
childNode:
|
|
1132
|
-
onCleanup:
|
|
1133
|
-
onBeforeRender:
|
|
1134
|
-
onAfterRender:
|
|
1135
|
-
onResize:
|
|
1138
|
+
childNode: A,
|
|
1139
|
+
onCleanup: S,
|
|
1140
|
+
onBeforeRender: O,
|
|
1141
|
+
onAfterRender: Q,
|
|
1142
|
+
onResize: J,
|
|
1136
1143
|
canvas: e,
|
|
1137
1144
|
dimensions: {
|
|
1138
|
-
width:
|
|
1139
|
-
height:
|
|
1145
|
+
width: F,
|
|
1146
|
+
height: E
|
|
1140
1147
|
},
|
|
1141
1148
|
renderer: n
|
|
1142
1149
|
}), c), c, c.id, t);
|
|
1143
1150
|
}
|
|
1144
1151
|
}
|
|
1145
|
-
c.requiresChild && c.metadata.blendMode === "normal" && !P ? u = K(x(0, 0, 0, 0), T, "normal", c.opacityUniform) : u === void 0 ? f.requiresRTT ||
|
|
1152
|
+
c.requiresChild && c.metadata.blendMode === "normal" && !P ? u = K(x(0, 0, 0, 0), T, "normal", c.opacityUniform) : u === void 0 ? f.requiresRTT || D !== 1 ? u = K(x(1, 1, 1, 0), T, c.metadata.blendMode, c.opacityUniform) : u = T : u = K(u, T, c.metadata.blendMode, c.opacityUniform);
|
|
1146
1153
|
}
|
|
1147
1154
|
return f.requiresRTT && !te ? x(0, 0, 0, 0) : (f.cleanupCallbacks.forEach((v) => {
|
|
1148
1155
|
try {
|
|
@@ -1155,12 +1162,12 @@ function cs() {
|
|
|
1155
1162
|
childNode: u,
|
|
1156
1163
|
onCleanup: b,
|
|
1157
1164
|
onBeforeRender: g,
|
|
1158
|
-
onAfterRender:
|
|
1165
|
+
onAfterRender: k,
|
|
1159
1166
|
onResize: M,
|
|
1160
1167
|
canvas: e,
|
|
1161
1168
|
dimensions: {
|
|
1162
|
-
width:
|
|
1163
|
-
height:
|
|
1169
|
+
width: F,
|
|
1170
|
+
height: E
|
|
1164
1171
|
},
|
|
1165
1172
|
renderer: n
|
|
1166
1173
|
}), f), f, s, t));
|
|
@@ -1176,7 +1183,7 @@ function cs() {
|
|
|
1176
1183
|
We(s);
|
|
1177
1184
|
return;
|
|
1178
1185
|
}
|
|
1179
|
-
if (!
|
|
1186
|
+
if (!Ge) {
|
|
1180
1187
|
const u = oe.findIndex((v) => v.id === s);
|
|
1181
1188
|
u !== -1 ? oe[u] = {
|
|
1182
1189
|
id: s,
|
|
@@ -1201,35 +1208,35 @@ function cs() {
|
|
|
1201
1208
|
if (u && u.size > 0) {
|
|
1202
1209
|
let v = 0;
|
|
1203
1210
|
for (const c of u) {
|
|
1204
|
-
const
|
|
1205
|
-
|
|
1211
|
+
const D = h.nodes.get(c);
|
|
1212
|
+
D && D.metadata.renderOrder > v && (v = D.metadata.renderOrder);
|
|
1206
1213
|
}
|
|
1207
1214
|
g = v + 1;
|
|
1208
1215
|
}
|
|
1209
1216
|
}
|
|
1210
|
-
const
|
|
1217
|
+
const k = G(l?.opacity !== void 0 ? l.opacity : 1);
|
|
1211
1218
|
let M;
|
|
1212
1219
|
if (l?.transform) {
|
|
1213
|
-
const u =
|
|
1220
|
+
const u = F / Math.max(1, E);
|
|
1214
1221
|
M = {
|
|
1215
|
-
offsetX:
|
|
1216
|
-
offsetY:
|
|
1217
|
-
rotation:
|
|
1218
|
-
scale:
|
|
1219
|
-
anchorX:
|
|
1220
|
-
anchorY:
|
|
1221
|
-
edges:
|
|
1222
|
-
aspectRatio:
|
|
1222
|
+
offsetX: G(l.transform.offsetX),
|
|
1223
|
+
offsetY: G(l.transform.offsetY),
|
|
1224
|
+
rotation: G(l.transform.rotation),
|
|
1225
|
+
scale: G(l.transform.scale),
|
|
1226
|
+
anchorX: G(l.transform.anchorX),
|
|
1227
|
+
anchorY: G(l.transform.anchorY),
|
|
1228
|
+
edges: G(l.transform.edges === "stretch" ? 0 : l.transform.edges === "transparent" ? 1 : l.transform.edges === "mirror" ? 2 : 3),
|
|
1229
|
+
aspectRatio: G(u)
|
|
1223
1230
|
};
|
|
1224
1231
|
}
|
|
1225
|
-
const
|
|
1232
|
+
const $ = {
|
|
1226
1233
|
id: s,
|
|
1227
1234
|
componentName: b?.name || "Unknown",
|
|
1228
1235
|
fragmentNodeFunc: t,
|
|
1229
1236
|
parentId: o,
|
|
1230
1237
|
requiresRTT: b?.requiresRTT || !1,
|
|
1231
1238
|
requiresChild: b?.requiresChild || !1,
|
|
1232
|
-
opacityUniform:
|
|
1239
|
+
opacityUniform: k,
|
|
1233
1240
|
metadata: {
|
|
1234
1241
|
blendMode: l?.blendMode || "normal",
|
|
1235
1242
|
opacity: l?.opacity,
|
|
@@ -1249,25 +1256,25 @@ function cs() {
|
|
|
1249
1256
|
uvTransformFunc: b?.uvTransformNode,
|
|
1250
1257
|
acceptsUVContext: b?.acceptsUVContext || !1
|
|
1251
1258
|
};
|
|
1252
|
-
h.nodes.set(s,
|
|
1253
|
-
const
|
|
1254
|
-
|
|
1255
|
-
ge = null,
|
|
1259
|
+
h.nodes.set(s, $), o === null && (h.rootId = s);
|
|
1260
|
+
const w = d.get(o) || /* @__PURE__ */ new Set();
|
|
1261
|
+
w.add(s), d.set(o, w), p && B && F > 0 && E > 0 ? (Oe.includes(s) || Oe.push(s), ge === null && (ge = requestAnimationFrame(() => {
|
|
1262
|
+
ge = null, Oe = [], he();
|
|
1256
1263
|
}))) : p && B && (ve || (ve = !0, requestAnimationFrame(() => {
|
|
1257
|
-
ve = !1,
|
|
1264
|
+
ve = !1, F > 0 && E > 0 && he();
|
|
1258
1265
|
})));
|
|
1259
|
-
},
|
|
1266
|
+
}, zn = (s, t, o) => {
|
|
1260
1267
|
const l = h.nodes.get(s);
|
|
1261
1268
|
if (!l || !l.uniforms) return;
|
|
1262
1269
|
const f = l.uniforms[t];
|
|
1263
1270
|
if (!(!f || !f.uniform)) {
|
|
1264
1271
|
if (f.transform) {
|
|
1265
|
-
const { updateUniformValue: b } = (
|
|
1272
|
+
const { updateUniformValue: b } = (Sn(), Hn(qt));
|
|
1266
1273
|
b(f, o);
|
|
1267
1274
|
} else f.uniform.value = o;
|
|
1268
|
-
|
|
1275
|
+
N && re();
|
|
1269
1276
|
}
|
|
1270
|
-
},
|
|
1277
|
+
}, Fn = (s, t) => {
|
|
1271
1278
|
const o = h.nodes.get(s);
|
|
1272
1279
|
if (!o) return;
|
|
1273
1280
|
let l = !1;
|
|
@@ -1276,23 +1283,23 @@ function cs() {
|
|
|
1276
1283
|
if (o.metadata.visible !== f && (o.metadata.visible = f, l = !0), t.id !== void 0 && o.metadata.id !== t.id && (o.metadata.id = t.id, l = !0), t.mask !== void 0 && (o.metadata.mask?.source !== t.mask?.source || o.metadata.mask?.type !== t.mask?.type) && (o.metadata.mask = t.mask, l = !0), t.transform !== void 0) {
|
|
1277
1284
|
const b = o.metadata.transform ? fe(o.metadata.transform) : !1, g = fe(t.transform);
|
|
1278
1285
|
if (o.metadata.transform = t.transform, !o.transformUniforms && t.transform) {
|
|
1279
|
-
const
|
|
1286
|
+
const k = F / Math.max(1, E);
|
|
1280
1287
|
o.transformUniforms = {
|
|
1281
|
-
offsetX:
|
|
1282
|
-
offsetY:
|
|
1283
|
-
rotation:
|
|
1284
|
-
scale:
|
|
1285
|
-
anchorX:
|
|
1286
|
-
anchorY:
|
|
1287
|
-
edges:
|
|
1288
|
-
aspectRatio:
|
|
1288
|
+
offsetX: G(t.transform.offsetX),
|
|
1289
|
+
offsetY: G(t.transform.offsetY),
|
|
1290
|
+
rotation: G(t.transform.rotation),
|
|
1291
|
+
scale: G(t.transform.scale),
|
|
1292
|
+
anchorX: G(t.transform.anchorX),
|
|
1293
|
+
anchorY: G(t.transform.anchorY),
|
|
1294
|
+
edges: G(t.transform.edges === "stretch" ? 0 : t.transform.edges === "transparent" ? 1 : t.transform.edges === "mirror" ? 2 : 3),
|
|
1295
|
+
aspectRatio: G(k)
|
|
1289
1296
|
};
|
|
1290
1297
|
} else o.transformUniforms && (o.transformUniforms.offsetX.value = t.transform.offsetX, o.transformUniforms.offsetY.value = t.transform.offsetY, o.transformUniforms.rotation.value = t.transform.rotation, o.transformUniforms.scale.value = t.transform.scale, o.transformUniforms.anchorX.value = t.transform.anchorX, o.transformUniforms.anchorY.value = t.transform.anchorY, o.transformUniforms.edges.value = t.transform.edges === "stretch" ? 0 : t.transform.edges === "transparent" ? 1 : t.transform.edges === "mirror" ? 2 : 3);
|
|
1291
1298
|
g && !o.transformRTTActive && (o.transformRTTActive = !0, l = !0), !b && g && !o.transformRTTActive && (l = !0);
|
|
1292
1299
|
}
|
|
1293
|
-
l && p && B ? (
|
|
1294
|
-
be = null,
|
|
1295
|
-
}))) :
|
|
1300
|
+
l && p && B ? (Be.includes(s) || Be.push(s), be === null && (be = requestAnimationFrame(() => {
|
|
1301
|
+
be = null, Be = [], he();
|
|
1302
|
+
}))) : N && re();
|
|
1296
1303
|
}, We = (s) => {
|
|
1297
1304
|
if (!h.nodes.has(s)) return;
|
|
1298
1305
|
const t = h.nodes.get(s);
|
|
@@ -1301,24 +1308,24 @@ function cs() {
|
|
|
1301
1308
|
} catch (f) {
|
|
1302
1309
|
console.error(`Error executing cleanup callback for node ${s}:`, f);
|
|
1303
1310
|
}
|
|
1304
|
-
const o =
|
|
1311
|
+
const o = W(s);
|
|
1305
1312
|
for (const l of o) We(l.id);
|
|
1306
1313
|
if (h.rootId === s && (h.rootId = null), t) {
|
|
1307
1314
|
const l = d.get(t.parentId);
|
|
1308
1315
|
l && (l.delete(s), l.size === 0 && d.delete(t.parentId));
|
|
1309
1316
|
}
|
|
1310
1317
|
h.nodes.delete(s), p && B && he();
|
|
1311
|
-
},
|
|
1318
|
+
}, En = (s) => {
|
|
1312
1319
|
const t = {
|
|
1313
1320
|
deltaTime: s,
|
|
1314
1321
|
pointer: {
|
|
1315
|
-
x:
|
|
1322
|
+
x: De,
|
|
1316
1323
|
y: ze
|
|
1317
1324
|
},
|
|
1318
1325
|
pointerActive: ue,
|
|
1319
1326
|
dimensions: {
|
|
1320
|
-
width:
|
|
1321
|
-
height:
|
|
1327
|
+
width: F,
|
|
1328
|
+
height: E
|
|
1322
1329
|
}
|
|
1323
1330
|
};
|
|
1324
1331
|
for (const o of h.nodes.values()) if (o.beforeRenderCallbacks.length > 0) for (const l of o.beforeRenderCallbacks) try {
|
|
@@ -1326,17 +1333,17 @@ function cs() {
|
|
|
1326
1333
|
} catch (f) {
|
|
1327
1334
|
console.error(`Error executing before render callback for node ${o.id}:`, f);
|
|
1328
1335
|
}
|
|
1329
|
-
},
|
|
1336
|
+
}, On = (s) => {
|
|
1330
1337
|
const t = {
|
|
1331
1338
|
deltaTime: s,
|
|
1332
1339
|
pointer: {
|
|
1333
|
-
x:
|
|
1340
|
+
x: De,
|
|
1334
1341
|
y: ze
|
|
1335
1342
|
},
|
|
1336
1343
|
pointerActive: ue,
|
|
1337
1344
|
dimensions: {
|
|
1338
|
-
width:
|
|
1339
|
-
height:
|
|
1345
|
+
width: F,
|
|
1346
|
+
height: E
|
|
1340
1347
|
}
|
|
1341
1348
|
};
|
|
1342
1349
|
for (const o of h.nodes.values()) if (o.afterRenderCallbacks.length > 0) for (const l of o.afterRenderCallbacks) try {
|
|
@@ -1345,22 +1352,22 @@ function cs() {
|
|
|
1345
1352
|
console.error(`Error executing after render callback for node ${o.id}:`, f);
|
|
1346
1353
|
}
|
|
1347
1354
|
}, re = async () => {
|
|
1348
|
-
if (!
|
|
1349
|
-
const s = de ? performance.now() : 0, t = s || performance.now(), o =
|
|
1350
|
-
|
|
1355
|
+
if (!Un()) return;
|
|
1356
|
+
const s = de ? performance.now() : 0, t = s || performance.now(), o = qe > 0 ? (t - qe) / 1e3 : 0.016, l = Math.min(o, 0.1);
|
|
1357
|
+
qe = t, de && performance.mark("shader-cpu-start"), En(l);
|
|
1351
1358
|
try {
|
|
1352
|
-
if (
|
|
1359
|
+
if (Fe) return;
|
|
1353
1360
|
de && performance.mark("shader-gpu-start");
|
|
1354
1361
|
const f = performance.now();
|
|
1355
1362
|
n.render(r, a);
|
|
1356
1363
|
const b = performance.now() - f;
|
|
1357
|
-
if (b > 20 && console.log(`[Shaders Perf] renderer.render(): ${b.toFixed(2)}ms`), b > 100 && console.warn(`[Shaders Perf] ⚠️ SLOW RENDER! Likely GPU shader compilation: ${b.toFixed(0)}ms`),
|
|
1364
|
+
if (b > 20 && console.log(`[Shaders Perf] renderer.render(): ${b.toFixed(2)}ms`), b > 100 && console.warn(`[Shaders Perf] ⚠️ SLOW RENDER! Likely GPU shader compilation: ${b.toFixed(0)}ms`), On(l), de) {
|
|
1358
1365
|
if (performance.mark("shader-gpu-end"), n instanceof Je) try {
|
|
1359
1366
|
const g = n.backend;
|
|
1360
1367
|
if (g && g.get && g.get(n)) {
|
|
1361
|
-
const
|
|
1362
|
-
if (
|
|
1363
|
-
const M =
|
|
1368
|
+
const k = g.get(n);
|
|
1369
|
+
if (k?.timestampQuery) {
|
|
1370
|
+
const M = k.timestampQuery.getResult();
|
|
1364
1371
|
M != null && ie.recordGpuTime(M / 1e6);
|
|
1365
1372
|
}
|
|
1366
1373
|
}
|
|
@@ -1377,8 +1384,8 @@ function cs() {
|
|
|
1377
1384
|
performance.mark("shader-cpu-end");
|
|
1378
1385
|
try {
|
|
1379
1386
|
performance.measure("shader-cpu-time", "shader-cpu-start", "shader-cpu-end");
|
|
1380
|
-
const
|
|
1381
|
-
|
|
1387
|
+
const k = performance.getEntriesByName("shader-cpu-time")[0];
|
|
1388
|
+
k && ie.recordCpuTime(k.duration), performance.clearMarks("shader-cpu-start"), performance.clearMarks("shader-cpu-end"), performance.clearMeasures("shader-cpu-time");
|
|
1382
1389
|
} catch {
|
|
1383
1390
|
}
|
|
1384
1391
|
const g = performance.now() - s;
|
|
@@ -1387,15 +1394,15 @@ function cs() {
|
|
|
1387
1394
|
} catch (f) {
|
|
1388
1395
|
console.error("Render frame error:", f);
|
|
1389
1396
|
}
|
|
1390
|
-
},
|
|
1391
|
-
const s = Math.max(0, h.nodes.size - 1), t =
|
|
1397
|
+
}, Bn = () => {
|
|
1398
|
+
const s = Math.max(0, h.nodes.size - 1), t = Pe;
|
|
1392
1399
|
ie.updateNodeCounts(s, t);
|
|
1393
|
-
},
|
|
1394
|
-
|
|
1400
|
+
}, Pn = () => {
|
|
1401
|
+
Bn();
|
|
1395
1402
|
const s = n?.info;
|
|
1396
1403
|
return ie.getStats(s);
|
|
1397
1404
|
}, je = () => {
|
|
1398
|
-
if (R || !ae || !
|
|
1405
|
+
if (R || !ae || !N) return;
|
|
1399
1406
|
ie.setRendering(!0);
|
|
1400
1407
|
const s = () => {
|
|
1401
1408
|
R = requestAnimationFrame(s), re().catch(console.warn);
|
|
@@ -1412,49 +1419,49 @@ function cs() {
|
|
|
1412
1419
|
} else
|
|
1413
1420
|
t = s.clientX, o = s.clientY;
|
|
1414
1421
|
const l = e.getBoundingClientRect(), f = (t - l.left) / l.width, b = (o - l.top) / l.height;
|
|
1415
|
-
|
|
1416
|
-
},
|
|
1422
|
+
De = f, ze = b;
|
|
1423
|
+
}, _n = (s) => {
|
|
1417
1424
|
!B || !e || cn(s);
|
|
1418
|
-
},
|
|
1425
|
+
}, Vn = (s) => {
|
|
1419
1426
|
!B || !e || cn(s);
|
|
1420
|
-
},
|
|
1427
|
+
}, Ln = () => {
|
|
1421
1428
|
B && (ue = !1, re().catch(console.warn));
|
|
1422
|
-
},
|
|
1429
|
+
}, qn = () => {
|
|
1423
1430
|
B && (ue = !1, re().catch(console.warn));
|
|
1424
1431
|
}, fn = () => {
|
|
1425
1432
|
ue = !0, re().catch(console.warn);
|
|
1426
1433
|
}, mn = () => {
|
|
1427
1434
|
ue = !0, re().catch(console.warn);
|
|
1428
|
-
},
|
|
1435
|
+
}, Gn = () => {
|
|
1429
1436
|
if (oe.length === 0) return;
|
|
1430
1437
|
const s = [...oe];
|
|
1431
1438
|
oe = [];
|
|
1432
1439
|
for (const { id: t, fragmentNodeFunc: o, parentId: l, metadata: f, uniforms: b, componentDefinition: g } of s) o && ln(t, o, l, f, b, g);
|
|
1433
|
-
},
|
|
1440
|
+
}, Nn = async ({ canvas: s, enablePerformanceTracking: t = !1 }) => {
|
|
1434
1441
|
if (B || ne) return;
|
|
1435
|
-
de = t, ne = !0,
|
|
1436
|
-
const o =
|
|
1442
|
+
de = t, ne = !0, I = new AbortController();
|
|
1443
|
+
const o = I;
|
|
1437
1444
|
try {
|
|
1438
|
-
if (e = s, r = new
|
|
1439
|
-
onMouseMove:
|
|
1440
|
-
onTouchMove:
|
|
1441
|
-
onMouseUp:
|
|
1442
|
-
onTouchEnd:
|
|
1443
|
-
}), s.addEventListener("mousedown", fn), s.addEventListener("touchstart", mn),
|
|
1445
|
+
if (e = s, r = new Jn(), r.background = null, a = new Yn(-1, 1, 1, -1, 0.1, 10), a.position.z = 1, a.lookAt(0, 0, 0), Ee = Xt.register({
|
|
1446
|
+
onMouseMove: _n,
|
|
1447
|
+
onTouchMove: Vn,
|
|
1448
|
+
onMouseUp: Ln,
|
|
1449
|
+
onTouchEnd: qn
|
|
1450
|
+
}), s.addEventListener("mousedown", fn), s.addEventListener("touchstart", mn), Te = () => {
|
|
1444
1451
|
un();
|
|
1445
|
-
}, window.addEventListener("beforeunload",
|
|
1452
|
+
}, window.addEventListener("beforeunload", Te), o.signal.aborted) return;
|
|
1446
1453
|
try {
|
|
1447
|
-
const
|
|
1454
|
+
const $ = {
|
|
1448
1455
|
canvas: s,
|
|
1449
1456
|
antialias: !0,
|
|
1450
1457
|
alpha: !0,
|
|
1451
1458
|
depth: !1,
|
|
1452
1459
|
powerPreference: "high-performance"
|
|
1453
1460
|
};
|
|
1454
|
-
if (de && (
|
|
1455
|
-
} catch (
|
|
1461
|
+
if (de && ($.forceWebGL = !1, $.requiredFeatures = ["timestamp-query"]), n = new Je($), await n.init(), o.signal.aborted) return;
|
|
1462
|
+
} catch ($) {
|
|
1456
1463
|
if (o.signal.aborted) return;
|
|
1457
|
-
console.warn("[Shaders] WebGPU initialization failed, falling back to WebGL:",
|
|
1464
|
+
console.warn("[Shaders] WebGPU initialization failed, falling back to WebGL:", $);
|
|
1458
1465
|
try {
|
|
1459
1466
|
if (n = new st({
|
|
1460
1467
|
canvas: s,
|
|
@@ -1463,45 +1470,45 @@ function cs() {
|
|
|
1463
1470
|
depth: !1,
|
|
1464
1471
|
powerPreference: "high-performance"
|
|
1465
1472
|
}), o.signal.aborted) return;
|
|
1466
|
-
} catch (
|
|
1473
|
+
} catch (w) {
|
|
1467
1474
|
if (o.signal.aborted) return;
|
|
1468
|
-
console.error("[Shaders] Both WebGPU and WebGL initialization failed:",
|
|
1475
|
+
console.error("[Shaders] Both WebGPU and WebGL initialization failed:", w);
|
|
1469
1476
|
return;
|
|
1470
1477
|
}
|
|
1471
1478
|
}
|
|
1472
1479
|
if (o.signal.aborted) return;
|
|
1473
|
-
n.setPixelRatio(Math.min(window.devicePixelRatio, 2)), n.outputColorSpace =
|
|
1480
|
+
n.setPixelRatio(Math.min(window.devicePixelRatio, 2)), n.outputColorSpace = In, p = new dn({ transparent: !0 }), p.fragmentNode = x(0, 0, 0, 0), m = new ar(new Kn(2, 2), p), r.add(m);
|
|
1474
1481
|
const l = s.parentElement;
|
|
1475
1482
|
if (!l) {
|
|
1476
1483
|
console.warn("[Shaders] Canvas has no parent element for resize observation");
|
|
1477
1484
|
return;
|
|
1478
1485
|
}
|
|
1479
|
-
|
|
1486
|
+
U = new ResizeObserver(xn), U.observe(l), V = new IntersectionObserver(Mn, { threshold: 0 }), V.observe(s);
|
|
1480
1487
|
const f = s.getBoundingClientRect();
|
|
1481
|
-
|
|
1482
|
-
const { width: b, height: g } = s.getBoundingClientRect(),
|
|
1483
|
-
|
|
1488
|
+
N = f.width > 0 && f.height > 0 && f.top < window.innerHeight && f.bottom > 0 && f.left < window.innerWidth && f.right > 0, te = N && f.width > 0 && f.height > 0, ae = !0;
|
|
1489
|
+
const { width: b, height: g } = s.getBoundingClientRect(), k = Math.round(b), M = Math.round(g);
|
|
1490
|
+
k > 0 && M > 0 ? (Xe(k, M), Y = !0, await re()) : Y = !1, ae && N && je(), o.signal.aborted || (B = !0, Ge = !0, Gn());
|
|
1484
1491
|
} catch (l) {
|
|
1485
1492
|
console.error("[Shaders] Initialization error:", l);
|
|
1486
1493
|
} finally {
|
|
1487
|
-
ne = !1,
|
|
1494
|
+
ne = !1, I === o && (I = null);
|
|
1488
1495
|
}
|
|
1489
|
-
},
|
|
1490
|
-
!Yt() ||
|
|
1496
|
+
}, Xn = () => {
|
|
1497
|
+
!Yt() || Tn || (console.warn("Shaders is running in development mode. Please purchase a license at https://shaders.com to use it in production."), Tn = !0);
|
|
1491
1498
|
}, un = () => {
|
|
1492
|
-
if (
|
|
1499
|
+
if (I && I.abort(), U && (U.disconnect(), U = null), V && (V.disconnect(), V = null), Ee && (Ee(), Ee = null), e && (e.removeEventListener("mousedown", fn), e.removeEventListener("touchstart", mn)), Te && (window.removeEventListener("beforeunload", Te), Te = null), Qe(), rn(), ke.forEach((s) => {
|
|
1493
1500
|
try {
|
|
1494
1501
|
s?.renderTarget?.dispose && s.renderTarget.dispose();
|
|
1495
1502
|
} catch {
|
|
1496
1503
|
}
|
|
1497
|
-
}),
|
|
1504
|
+
}), ke.clear(), h.nodes.clear(), h.rootId = null, h.idToNodeId.clear(), d.clear(), oe = [], Ge = !1, Oe = [], ge !== null && (cancelAnimationFrame(ge), ge = null), Be = [], be !== null && (cancelAnimationFrame(be), be = null), we = null, _e = !1, m) {
|
|
1498
1505
|
r && r.remove(m);
|
|
1499
1506
|
try {
|
|
1500
1507
|
m.geometry && typeof m.geometry.dispose == "function" && m.geometry.dispose();
|
|
1501
1508
|
} catch {
|
|
1502
1509
|
}
|
|
1503
1510
|
try {
|
|
1504
|
-
m.material instanceof
|
|
1511
|
+
m.material instanceof Qn && typeof m.material.dispose == "function" && m.material.dispose();
|
|
1505
1512
|
} catch {
|
|
1506
1513
|
}
|
|
1507
1514
|
}
|
|
@@ -1509,25 +1516,25 @@ function cs() {
|
|
|
1509
1516
|
n.dispose();
|
|
1510
1517
|
} catch {
|
|
1511
1518
|
}
|
|
1512
|
-
e = null, n = null, a = null, r = null, m = null, p = null, B = !1, ne = !1,
|
|
1519
|
+
e = null, n = null, a = null, r = null, m = null, p = null, B = !1, ne = !1, Y = !1, I = null, F = 0, E = 0, N = !1, ae = !0, De = 0.5, ze = 0.5, ue = !1;
|
|
1513
1520
|
};
|
|
1514
1521
|
return {
|
|
1515
|
-
initialize:
|
|
1522
|
+
initialize: Nn,
|
|
1516
1523
|
cleanup: un,
|
|
1517
1524
|
registerNode: ln,
|
|
1518
1525
|
removeNode: We,
|
|
1519
|
-
updateUniformValue:
|
|
1520
|
-
updateNodeMetadata:
|
|
1521
|
-
showLicenseWarning:
|
|
1526
|
+
updateUniformValue: zn,
|
|
1527
|
+
updateNodeMetadata: Fn,
|
|
1528
|
+
showLicenseWarning: Xn,
|
|
1522
1529
|
isInitialized: () => B,
|
|
1523
1530
|
startAnimation: je,
|
|
1524
1531
|
stopAnimation: Qe,
|
|
1525
|
-
getPerformanceStats:
|
|
1532
|
+
getPerformanceStats: Pn,
|
|
1526
1533
|
getNodeRegistry: () => ({ nodes: new Map(h.nodes) }),
|
|
1527
1534
|
getRendererType: () => n ? n instanceof Je ? "webgpu" : "webgl" : null
|
|
1528
1535
|
};
|
|
1529
1536
|
}
|
|
1530
|
-
|
|
1537
|
+
Sn();
|
|
1531
1538
|
function fs(e) {
|
|
1532
1539
|
const n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), r = {
|
|
1533
1540
|
processingOrder: [],
|
|
@@ -1553,8 +1560,8 @@ function It(e, n) {
|
|
|
1553
1560
|
return;
|
|
1554
1561
|
}
|
|
1555
1562
|
m.add(d), R.push(d);
|
|
1556
|
-
const
|
|
1557
|
-
for (const V of
|
|
1563
|
+
const U = e.get(d) || [];
|
|
1564
|
+
for (const V of U) p(V, [...R]);
|
|
1558
1565
|
m.delete(d), r.add(d), a.push(d);
|
|
1559
1566
|
}
|
|
1560
1567
|
for (const d of e.keys()) r.has(d) || p(d);
|
|
@@ -1562,23 +1569,23 @@ function It(e, n) {
|
|
|
1562
1569
|
for (const d of h) !r.has(d) && !e.has(d) && a.push(d);
|
|
1563
1570
|
return a.reverse();
|
|
1564
1571
|
}
|
|
1565
|
-
|
|
1572
|
+
z();
|
|
1566
1573
|
var { vec2: Ht, fract: Wt, sin: jt, dot: Qt } = pe;
|
|
1567
1574
|
const Jt = (e) => Wt(jt(Qt(e, Ht(12.12345, 78.12345))).mul(40000.12345)), ms = (e = 0.03) => (n) => Jt(n).mul(e).mul(0.10012345);
|
|
1568
|
-
|
|
1575
|
+
z();
|
|
1569
1576
|
var { vec2: Kt } = pe;
|
|
1570
1577
|
const us = (e = Kt(0), n = 0.02, a = 1, r = 1) => {
|
|
1571
|
-
const { vec2: m, sin: p, cos: h, time: d } = pe, R = r * 1.618033988749895,
|
|
1572
|
-
return e.add(
|
|
1578
|
+
const { vec2: m, sin: p, cos: h, time: d } = pe, R = r * 1.618033988749895, U = r * 2.718281828459045, V = (Math.sin(r) + 2) * 5, B = (Math.cos(r) + 2) * 5, ne = m(p(e.x.mul(a).mul(V).add(d.mul(0.1)).add(R)), h(e.y.mul(a).mul(V).add(d.mul(0.1)).add(U))), Y = m(p(e.y.mul(a).mul(B).add(d.mul(0.05)).add(U)), h(e.x.mul(a).mul(B).add(d.mul(0.05)).add(R))), I = ne.add(Y).mul(n);
|
|
1579
|
+
return e.add(I);
|
|
1573
1580
|
};
|
|
1574
|
-
|
|
1581
|
+
z();
|
|
1575
1582
|
const ds = (e, n, a = 0.6, r = 0.3, m = 1) => {
|
|
1576
|
-
const { max: p, smoothstep: h, vec4: d } = pe, R = p(p(e.r, e.g), e.b),
|
|
1577
|
-
return d(e.rgb.add(n.rgb.mul(
|
|
1583
|
+
const { max: p, smoothstep: h, vec4: d } = pe, R = p(p(e.r, e.g), e.b), U = h(a, a + r, R).mul(m).mul(1);
|
|
1584
|
+
return d(e.rgb.add(n.rgb.mul(U)), e.a);
|
|
1578
1585
|
};
|
|
1579
|
-
|
|
1586
|
+
z();
|
|
1580
1587
|
const hs = (e = {}) => {
|
|
1581
|
-
const { inset: n = 0.4, softness: a = 0.5, offsetX: r = 0, offsetY: m = 0 } = e, { float: p, smoothstep: h, uv: d } = pe, R = d(),
|
|
1588
|
+
const { inset: n = 0.4, softness: a = 0.5, offsetX: r = 0, offsetY: m = 0 } = e, { float: p, smoothstep: h, uv: d } = pe, R = d(), U = R.x.sub(0.5).sub(p(r)).mul(2), V = R.y.sub(0.5).add(p(m)).mul(2), B = U.mul(U).add(V.mul(V)).sqrt();
|
|
1582
1589
|
return p(1).sub(h(p(1).sub(p(n)), p(1).sub(p(n)).add(p(a)), B.mul(p(1).add(p(a)))));
|
|
1583
1590
|
};
|
|
1584
1591
|
var Zt = () => {
|
|
@@ -1608,8 +1615,8 @@ var Zt = () => {
|
|
|
1608
1615
|
Grayscale: Mr,
|
|
1609
1616
|
Grid: Ar,
|
|
1610
1617
|
GridDistortion: $r,
|
|
1611
|
-
Group:
|
|
1612
|
-
Halftone:
|
|
1618
|
+
Group: Dr,
|
|
1619
|
+
Halftone: zr,
|
|
1613
1620
|
HueShift: Fr,
|
|
1614
1621
|
ImageTexture: Er,
|
|
1615
1622
|
Invert: Or,
|
|
@@ -1653,18 +1660,18 @@ var Zt = () => {
|
|
|
1653
1660
|
};
|
|
1654
1661
|
}), e;
|
|
1655
1662
|
};
|
|
1656
|
-
const
|
|
1663
|
+
const Le = Zt();
|
|
1657
1664
|
function ps() {
|
|
1658
|
-
return Object.values(
|
|
1665
|
+
return Object.values(Le);
|
|
1659
1666
|
}
|
|
1660
1667
|
function gs(e) {
|
|
1661
|
-
return
|
|
1668
|
+
return Le[e];
|
|
1662
1669
|
}
|
|
1663
1670
|
function bs(e) {
|
|
1664
|
-
return Object.values(
|
|
1671
|
+
return Object.values(Le).filter((n) => n.category === e);
|
|
1665
1672
|
}
|
|
1666
1673
|
function vs() {
|
|
1667
|
-
const e = new Set(Object.values(
|
|
1674
|
+
const e = new Set(Object.values(Le).map((n) => n.category));
|
|
1668
1675
|
return Array.from(e).sort();
|
|
1669
1676
|
}
|
|
1670
1677
|
export {
|
|
@@ -1679,7 +1686,7 @@ export {
|
|
|
1679
1686
|
ds as glow,
|
|
1680
1687
|
ms as grain,
|
|
1681
1688
|
fs as resolveMaskDependencies,
|
|
1682
|
-
|
|
1689
|
+
Le as shaderRegistry,
|
|
1683
1690
|
cs as shaderRenderer,
|
|
1684
1691
|
Nt as updateUniformValue
|
|
1685
1692
|
};
|