matrix-rain-webgpu 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +82 -0
- package/dist/gpu/atlas/bindings.d.ts +9 -0
- package/dist/gpu/atlas/build-sdf-atlas.d.ts +6 -0
- package/dist/gpu/atlas/glyph-set.d.ts +3 -0
- package/dist/gpu/feature-detect.d.ts +1 -0
- package/dist/gpu/material/hash.d.ts +3 -0
- package/dist/gpu/material/palette.d.ts +6 -0
- package/dist/gpu/pipelines/blit.d.ts +11 -0
- package/dist/gpu/pipelines/bloom.d.ts +19 -0
- package/dist/gpu/pipelines/compute-step.d.ts +6 -0
- package/dist/gpu/pipelines/crt.d.ts +4 -0
- package/dist/gpu/pipelines/render-glyphs.d.ts +5 -0
- package/dist/gpu/render-graph.d.ts +31 -0
- package/dist/gpu/schemas/column.d.ts +8 -0
- package/dist/gpu/schemas/uniforms.d.ts +14 -0
- package/dist/hooks/use-matrix-rain-renderer.d.ts +21 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3231 -0
- package/dist/matrix-rain.d.ts +7 -0
- package/dist/types.d.ts +95 -0
- package/package.json +78 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3231 @@
|
|
|
1
|
+
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
+
import { useConfigureContext as i, useFrame as a, useRoot as o, useRootWithStatus as s } from "@typegpu/react";
|
|
3
|
+
import { common as c, d as l, std as u, tgpu as d } from "typegpu";
|
|
4
|
+
import { randf as f } from "@typegpu/noise";
|
|
5
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
6
|
+
//#region src/gpu/atlas/glyph-set.ts
|
|
7
|
+
var m = "ハミヒーウシナモニサワツオリアホテマケメエカキムユラセネスタヌヘ012345789Z:.=*+-<>".split(""), h = m.length, g = 8, _ = .75, v = 32e3, y = [
|
|
8
|
+
{
|
|
9
|
+
dx: -1,
|
|
10
|
+
dy: -1
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
dx: 0,
|
|
14
|
+
dy: -1
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
dx: 1,
|
|
18
|
+
dy: -1
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
dx: -1,
|
|
22
|
+
dy: 0
|
|
23
|
+
}
|
|
24
|
+
], b = [
|
|
25
|
+
{
|
|
26
|
+
dx: 1,
|
|
27
|
+
dy: 1
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
dx: 0,
|
|
31
|
+
dy: 1
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
dx: -1,
|
|
35
|
+
dy: 1
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
dx: 1,
|
|
39
|
+
dy: 0
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
async function x() {
|
|
43
|
+
let e = m.length, t = new Uint8Array(e * 64 * 64), n = new OffscreenCanvas(64, 64).getContext("2d");
|
|
44
|
+
if (!n) throw Error("OffscreenCanvas 2D context unavailable");
|
|
45
|
+
n.fillStyle = "white", n.textAlign = "center", n.textBaseline = "middle", n.font = `${Math.floor(64 * _)}px monospace`;
|
|
46
|
+
for (let r = 0; r < e; r++) n.clearRect(0, 0, 64, 64), n.fillText(m[r], 64 / 2, 64 / 2), T(C(S(n.getImageData(0, 0, 64, 64)), 64), t, r * 64 * 64);
|
|
47
|
+
return {
|
|
48
|
+
data: t,
|
|
49
|
+
layerCount: e,
|
|
50
|
+
layerSize: 64
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function S(e) {
|
|
54
|
+
let t = e.data, n = new Uint8Array(t.length / 4);
|
|
55
|
+
for (let e = 0; e < n.length; e++) n[e] = +(t[e * 4 + 3] >= 128);
|
|
56
|
+
return n;
|
|
57
|
+
}
|
|
58
|
+
function C(e, t) {
|
|
59
|
+
let n = w(e, t, 1), r = w(e, t, 0), i = new Float32Array(e.length);
|
|
60
|
+
for (let t = 0; t < i.length; t++) i[t] = e[t] ? r[t] : -n[t];
|
|
61
|
+
return i;
|
|
62
|
+
}
|
|
63
|
+
function w(e, t, n) {
|
|
64
|
+
let r = e.length, i = new Int16Array(r), a = new Int16Array(r);
|
|
65
|
+
for (let t = 0; t < r; t++) e[t] === n ? (i[t] = 0, a[t] = 0) : (i[t] = v, a[t] = v);
|
|
66
|
+
let o = (e, n) => n * t + e;
|
|
67
|
+
function s(e, t, n, r) {
|
|
68
|
+
let o = i[t] - n, s = a[t] - r;
|
|
69
|
+
o * o + s * s < i[e] * i[e] + a[e] * a[e] && (i[e] = o, a[e] = s);
|
|
70
|
+
}
|
|
71
|
+
function c(e, n, r) {
|
|
72
|
+
let i = o(e, n);
|
|
73
|
+
for (let { dx: a, dy: c } of r) {
|
|
74
|
+
let r = e + a, l = n + c;
|
|
75
|
+
r < 0 || l < 0 || r >= t || l >= t || s(i, o(r, l), -a, -c);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
for (let e = 0; e < t; e++) for (let n = 0; n < t; n++) c(n, e, y);
|
|
79
|
+
for (let e = t - 1; e >= 0; e--) for (let n = t - 1; n >= 0; n--) c(n, e, b);
|
|
80
|
+
let l = new Float32Array(r);
|
|
81
|
+
for (let e = 0; e < r; e++) l[e] = Math.sqrt(i[e] * i[e] + a[e] * a[e]);
|
|
82
|
+
return l;
|
|
83
|
+
}
|
|
84
|
+
function T(e, t, n) {
|
|
85
|
+
for (let r = 0; r < e.length; r++) {
|
|
86
|
+
let i = (e[r] + g) / (2 * g), a = Math.max(0, Math.min(255, Math.round(i * 255)));
|
|
87
|
+
t[n + r] = a;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/gpu/schemas/column.ts
|
|
92
|
+
var E = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(l.struct({
|
|
93
|
+
headY: l.f32,
|
|
94
|
+
speed: l.f32,
|
|
95
|
+
depth: l.f32,
|
|
96
|
+
tailLength: l.f32,
|
|
97
|
+
seed: l.u32
|
|
98
|
+
}), "Column"), D = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(l.struct({
|
|
99
|
+
time: l.f32,
|
|
100
|
+
stepProgress: l.f32,
|
|
101
|
+
resolution: l.vec2f,
|
|
102
|
+
cellSize: l.f32,
|
|
103
|
+
density: l.f32,
|
|
104
|
+
depthDim: l.f32,
|
|
105
|
+
bloomThreshold: l.f32,
|
|
106
|
+
bloomIntensity: l.f32,
|
|
107
|
+
headEmission: l.f32,
|
|
108
|
+
scanlineStrength: l.f32,
|
|
109
|
+
aberration: l.f32
|
|
110
|
+
}), "Uniforms"), O = 4294967295;
|
|
111
|
+
function ee(e, t, n) {
|
|
112
|
+
let r = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(d.computeFn({
|
|
113
|
+
workgroupSize: [64],
|
|
114
|
+
in: { gid: l.builtin.globalInvocationId }
|
|
115
|
+
})(/*#__PURE__*/ ((e) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set(e.f = (({ gid: e }) => {
|
|
116
|
+
"use gpu";
|
|
117
|
+
let r = l.u32(u.floor(__tsover_div(n.$.resolution.x, n.$.cellSize)));
|
|
118
|
+
if (e.x >= r) return;
|
|
119
|
+
let i = t.$[e.x];
|
|
120
|
+
f.seed2(l.vec2f(__tsover_div(l.f32(i.seed), O), n.$.time));
|
|
121
|
+
let a = __tsover_add(i.headY, i.speed), o = i.seed;
|
|
122
|
+
__tsover_mul(a, n.$.cellSize) > n.$.resolution.y && f.sample() > n.$.density && (a = l.f32(0), o = l.u32(__tsover_mul(f.sample(), O))), t.$[e.x] = E({
|
|
123
|
+
headY: a,
|
|
124
|
+
speed: i.speed,
|
|
125
|
+
depth: i.depth,
|
|
126
|
+
tailLength: i.tailLength,
|
|
127
|
+
seed: o
|
|
128
|
+
});
|
|
129
|
+
}), {
|
|
130
|
+
v: 1,
|
|
131
|
+
name: void 0,
|
|
132
|
+
ast: {
|
|
133
|
+
params: [{
|
|
134
|
+
type: "d",
|
|
135
|
+
props: [{
|
|
136
|
+
name: "gid",
|
|
137
|
+
alias: "gid"
|
|
138
|
+
}]
|
|
139
|
+
}],
|
|
140
|
+
body: [0, [
|
|
141
|
+
[
|
|
142
|
+
13,
|
|
143
|
+
"columnCount",
|
|
144
|
+
[
|
|
145
|
+
6,
|
|
146
|
+
[
|
|
147
|
+
7,
|
|
148
|
+
"d",
|
|
149
|
+
"u32"
|
|
150
|
+
],
|
|
151
|
+
[[
|
|
152
|
+
6,
|
|
153
|
+
[
|
|
154
|
+
7,
|
|
155
|
+
"std",
|
|
156
|
+
"floor"
|
|
157
|
+
],
|
|
158
|
+
[[
|
|
159
|
+
1,
|
|
160
|
+
[
|
|
161
|
+
7,
|
|
162
|
+
[
|
|
163
|
+
7,
|
|
164
|
+
[
|
|
165
|
+
7,
|
|
166
|
+
"uniforms",
|
|
167
|
+
"$"
|
|
168
|
+
],
|
|
169
|
+
"resolution"
|
|
170
|
+
],
|
|
171
|
+
"x"
|
|
172
|
+
],
|
|
173
|
+
"/",
|
|
174
|
+
[
|
|
175
|
+
7,
|
|
176
|
+
[
|
|
177
|
+
7,
|
|
178
|
+
"uniforms",
|
|
179
|
+
"$"
|
|
180
|
+
],
|
|
181
|
+
"cellSize"
|
|
182
|
+
]
|
|
183
|
+
]]
|
|
184
|
+
]]
|
|
185
|
+
]
|
|
186
|
+
],
|
|
187
|
+
[
|
|
188
|
+
11,
|
|
189
|
+
[
|
|
190
|
+
1,
|
|
191
|
+
[
|
|
192
|
+
7,
|
|
193
|
+
"gid",
|
|
194
|
+
"x"
|
|
195
|
+
],
|
|
196
|
+
">=",
|
|
197
|
+
"columnCount"
|
|
198
|
+
],
|
|
199
|
+
[0, [[10]]]
|
|
200
|
+
],
|
|
201
|
+
[
|
|
202
|
+
13,
|
|
203
|
+
"column",
|
|
204
|
+
[
|
|
205
|
+
8,
|
|
206
|
+
[
|
|
207
|
+
7,
|
|
208
|
+
"columns",
|
|
209
|
+
"$"
|
|
210
|
+
],
|
|
211
|
+
[
|
|
212
|
+
7,
|
|
213
|
+
"gid",
|
|
214
|
+
"x"
|
|
215
|
+
]
|
|
216
|
+
]
|
|
217
|
+
],
|
|
218
|
+
[
|
|
219
|
+
6,
|
|
220
|
+
[
|
|
221
|
+
7,
|
|
222
|
+
"randf",
|
|
223
|
+
"seed2"
|
|
224
|
+
],
|
|
225
|
+
[[
|
|
226
|
+
6,
|
|
227
|
+
[
|
|
228
|
+
7,
|
|
229
|
+
"d",
|
|
230
|
+
"vec2f"
|
|
231
|
+
],
|
|
232
|
+
[[
|
|
233
|
+
1,
|
|
234
|
+
[
|
|
235
|
+
6,
|
|
236
|
+
[
|
|
237
|
+
7,
|
|
238
|
+
"d",
|
|
239
|
+
"f32"
|
|
240
|
+
],
|
|
241
|
+
[[
|
|
242
|
+
7,
|
|
243
|
+
"column",
|
|
244
|
+
"seed"
|
|
245
|
+
]]
|
|
246
|
+
],
|
|
247
|
+
"/",
|
|
248
|
+
"U32_MAX_F"
|
|
249
|
+
], [
|
|
250
|
+
7,
|
|
251
|
+
[
|
|
252
|
+
7,
|
|
253
|
+
"uniforms",
|
|
254
|
+
"$"
|
|
255
|
+
],
|
|
256
|
+
"time"
|
|
257
|
+
]]
|
|
258
|
+
]]
|
|
259
|
+
],
|
|
260
|
+
[
|
|
261
|
+
12,
|
|
262
|
+
"nextHeadY",
|
|
263
|
+
[
|
|
264
|
+
1,
|
|
265
|
+
[
|
|
266
|
+
7,
|
|
267
|
+
"column",
|
|
268
|
+
"headY"
|
|
269
|
+
],
|
|
270
|
+
"+",
|
|
271
|
+
[
|
|
272
|
+
7,
|
|
273
|
+
"column",
|
|
274
|
+
"speed"
|
|
275
|
+
]
|
|
276
|
+
]
|
|
277
|
+
],
|
|
278
|
+
[
|
|
279
|
+
12,
|
|
280
|
+
"nextSeed",
|
|
281
|
+
[
|
|
282
|
+
7,
|
|
283
|
+
"column",
|
|
284
|
+
"seed"
|
|
285
|
+
]
|
|
286
|
+
],
|
|
287
|
+
[
|
|
288
|
+
13,
|
|
289
|
+
"offscreen",
|
|
290
|
+
[
|
|
291
|
+
1,
|
|
292
|
+
[
|
|
293
|
+
1,
|
|
294
|
+
"nextHeadY",
|
|
295
|
+
"*",
|
|
296
|
+
[
|
|
297
|
+
7,
|
|
298
|
+
[
|
|
299
|
+
7,
|
|
300
|
+
"uniforms",
|
|
301
|
+
"$"
|
|
302
|
+
],
|
|
303
|
+
"cellSize"
|
|
304
|
+
]
|
|
305
|
+
],
|
|
306
|
+
">",
|
|
307
|
+
[
|
|
308
|
+
7,
|
|
309
|
+
[
|
|
310
|
+
7,
|
|
311
|
+
[
|
|
312
|
+
7,
|
|
313
|
+
"uniforms",
|
|
314
|
+
"$"
|
|
315
|
+
],
|
|
316
|
+
"resolution"
|
|
317
|
+
],
|
|
318
|
+
"y"
|
|
319
|
+
]
|
|
320
|
+
]
|
|
321
|
+
],
|
|
322
|
+
[
|
|
323
|
+
11,
|
|
324
|
+
[
|
|
325
|
+
3,
|
|
326
|
+
"offscreen",
|
|
327
|
+
"&&",
|
|
328
|
+
[
|
|
329
|
+
1,
|
|
330
|
+
[
|
|
331
|
+
6,
|
|
332
|
+
[
|
|
333
|
+
7,
|
|
334
|
+
"randf",
|
|
335
|
+
"sample"
|
|
336
|
+
],
|
|
337
|
+
[]
|
|
338
|
+
],
|
|
339
|
+
">",
|
|
340
|
+
[
|
|
341
|
+
7,
|
|
342
|
+
[
|
|
343
|
+
7,
|
|
344
|
+
"uniforms",
|
|
345
|
+
"$"
|
|
346
|
+
],
|
|
347
|
+
"density"
|
|
348
|
+
]
|
|
349
|
+
]
|
|
350
|
+
],
|
|
351
|
+
[0, [[
|
|
352
|
+
2,
|
|
353
|
+
"nextHeadY",
|
|
354
|
+
"=",
|
|
355
|
+
[
|
|
356
|
+
6,
|
|
357
|
+
[
|
|
358
|
+
7,
|
|
359
|
+
"d",
|
|
360
|
+
"f32"
|
|
361
|
+
],
|
|
362
|
+
[[5, "0"]]
|
|
363
|
+
]
|
|
364
|
+
], [
|
|
365
|
+
2,
|
|
366
|
+
"nextSeed",
|
|
367
|
+
"=",
|
|
368
|
+
[
|
|
369
|
+
6,
|
|
370
|
+
[
|
|
371
|
+
7,
|
|
372
|
+
"d",
|
|
373
|
+
"u32"
|
|
374
|
+
],
|
|
375
|
+
[[
|
|
376
|
+
1,
|
|
377
|
+
[
|
|
378
|
+
6,
|
|
379
|
+
[
|
|
380
|
+
7,
|
|
381
|
+
"randf",
|
|
382
|
+
"sample"
|
|
383
|
+
],
|
|
384
|
+
[]
|
|
385
|
+
],
|
|
386
|
+
"*",
|
|
387
|
+
"U32_MAX_F"
|
|
388
|
+
]]
|
|
389
|
+
]
|
|
390
|
+
]]]
|
|
391
|
+
],
|
|
392
|
+
[
|
|
393
|
+
2,
|
|
394
|
+
[
|
|
395
|
+
8,
|
|
396
|
+
[
|
|
397
|
+
7,
|
|
398
|
+
"columns",
|
|
399
|
+
"$"
|
|
400
|
+
],
|
|
401
|
+
[
|
|
402
|
+
7,
|
|
403
|
+
"gid",
|
|
404
|
+
"x"
|
|
405
|
+
]
|
|
406
|
+
],
|
|
407
|
+
"=",
|
|
408
|
+
[
|
|
409
|
+
6,
|
|
410
|
+
"Column",
|
|
411
|
+
[[104, {
|
|
412
|
+
headY: "nextHeadY",
|
|
413
|
+
speed: [
|
|
414
|
+
7,
|
|
415
|
+
"column",
|
|
416
|
+
"speed"
|
|
417
|
+
],
|
|
418
|
+
depth: [
|
|
419
|
+
7,
|
|
420
|
+
"column",
|
|
421
|
+
"depth"
|
|
422
|
+
],
|
|
423
|
+
tailLength: [
|
|
424
|
+
7,
|
|
425
|
+
"column",
|
|
426
|
+
"tailLength"
|
|
427
|
+
],
|
|
428
|
+
seed: "nextSeed"
|
|
429
|
+
}]]
|
|
430
|
+
]
|
|
431
|
+
]
|
|
432
|
+
]],
|
|
433
|
+
externalNames: [
|
|
434
|
+
"d",
|
|
435
|
+
"std",
|
|
436
|
+
"uniforms",
|
|
437
|
+
"columns",
|
|
438
|
+
"randf",
|
|
439
|
+
"U32_MAX_F",
|
|
440
|
+
"Column"
|
|
441
|
+
]
|
|
442
|
+
},
|
|
443
|
+
externals: () => ({
|
|
444
|
+
d: l,
|
|
445
|
+
std: u,
|
|
446
|
+
uniforms: n,
|
|
447
|
+
columns: t,
|
|
448
|
+
randf: f,
|
|
449
|
+
U32_MAX_F: O,
|
|
450
|
+
Column: E
|
|
451
|
+
})
|
|
452
|
+
}) && e.f)({})), "computeMain");
|
|
453
|
+
return e.createComputePipeline({ compute: r });
|
|
454
|
+
}
|
|
455
|
+
//#endregion
|
|
456
|
+
//#region src/gpu/atlas/bindings.ts
|
|
457
|
+
var k = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(d.bindGroupLayout({
|
|
458
|
+
atlas: { texture: l.texture2dArray(l.f32) },
|
|
459
|
+
sampler: { sampler: "filtering" }
|
|
460
|
+
}), "atlasBindings"), A = 4294967295, j = .01, M = 1.5, N = .6, P = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(d.fn([l.u32, l.u32], l.u32)(/*#__PURE__*/ ((e) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set(e.f = ((e, t) => {
|
|
461
|
+
"use gpu";
|
|
462
|
+
return f.seed2(l.vec2f(__tsover_div(l.f32(e), A), __tsover_mul(l.f32(t), j))), l.u32(__tsover_mul(f.sample(), l.f32(h)));
|
|
463
|
+
}), {
|
|
464
|
+
v: 1,
|
|
465
|
+
name: void 0,
|
|
466
|
+
ast: {
|
|
467
|
+
params: [{
|
|
468
|
+
type: "i",
|
|
469
|
+
name: "seed"
|
|
470
|
+
}, {
|
|
471
|
+
type: "i",
|
|
472
|
+
name: "slotY"
|
|
473
|
+
}],
|
|
474
|
+
body: [0, [[
|
|
475
|
+
6,
|
|
476
|
+
[
|
|
477
|
+
7,
|
|
478
|
+
"randf",
|
|
479
|
+
"seed2"
|
|
480
|
+
],
|
|
481
|
+
[[
|
|
482
|
+
6,
|
|
483
|
+
[
|
|
484
|
+
7,
|
|
485
|
+
"d",
|
|
486
|
+
"vec2f"
|
|
487
|
+
],
|
|
488
|
+
[[
|
|
489
|
+
1,
|
|
490
|
+
[
|
|
491
|
+
6,
|
|
492
|
+
[
|
|
493
|
+
7,
|
|
494
|
+
"d",
|
|
495
|
+
"f32"
|
|
496
|
+
],
|
|
497
|
+
["seed"]
|
|
498
|
+
],
|
|
499
|
+
"/",
|
|
500
|
+
"U32_MAX_F"
|
|
501
|
+
], [
|
|
502
|
+
1,
|
|
503
|
+
[
|
|
504
|
+
6,
|
|
505
|
+
[
|
|
506
|
+
7,
|
|
507
|
+
"d",
|
|
508
|
+
"f32"
|
|
509
|
+
],
|
|
510
|
+
["slotY"]
|
|
511
|
+
],
|
|
512
|
+
"*",
|
|
513
|
+
"SLOT_Y_SCALE"
|
|
514
|
+
]]
|
|
515
|
+
]]
|
|
516
|
+
], [10, [
|
|
517
|
+
6,
|
|
518
|
+
[
|
|
519
|
+
7,
|
|
520
|
+
"d",
|
|
521
|
+
"u32"
|
|
522
|
+
],
|
|
523
|
+
[[
|
|
524
|
+
1,
|
|
525
|
+
[
|
|
526
|
+
6,
|
|
527
|
+
[
|
|
528
|
+
7,
|
|
529
|
+
"randf",
|
|
530
|
+
"sample"
|
|
531
|
+
],
|
|
532
|
+
[]
|
|
533
|
+
],
|
|
534
|
+
"*",
|
|
535
|
+
[
|
|
536
|
+
6,
|
|
537
|
+
[
|
|
538
|
+
7,
|
|
539
|
+
"d",
|
|
540
|
+
"f32"
|
|
541
|
+
],
|
|
542
|
+
["GLYPH_COUNT"]
|
|
543
|
+
]
|
|
544
|
+
]]
|
|
545
|
+
]]]],
|
|
546
|
+
externalNames: [
|
|
547
|
+
"randf",
|
|
548
|
+
"d",
|
|
549
|
+
"U32_MAX_F",
|
|
550
|
+
"SLOT_Y_SCALE",
|
|
551
|
+
"GLYPH_COUNT"
|
|
552
|
+
]
|
|
553
|
+
},
|
|
554
|
+
externals: () => ({
|
|
555
|
+
randf: f,
|
|
556
|
+
d: l,
|
|
557
|
+
U32_MAX_F: A,
|
|
558
|
+
SLOT_Y_SCALE: j,
|
|
559
|
+
GLYPH_COUNT: h
|
|
560
|
+
})
|
|
561
|
+
}) && e.f)({})), "glyphIndex"), F = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(d.fn([l.u32, l.u32], l.f32)(/*#__PURE__*/ ((e) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set(e.f = ((e, t) => {
|
|
562
|
+
"use gpu";
|
|
563
|
+
return f.seed2(l.vec2f(__tsover_div(l.f32(e), A), __tsover_add(__tsover_mul(l.f32(t), j), M))), __tsover_mul(__tsover_mul(__tsover_sub(f.sample(), .5), 2), N);
|
|
564
|
+
}), {
|
|
565
|
+
v: 1,
|
|
566
|
+
name: void 0,
|
|
567
|
+
ast: {
|
|
568
|
+
params: [{
|
|
569
|
+
type: "i",
|
|
570
|
+
name: "seed"
|
|
571
|
+
}, {
|
|
572
|
+
type: "i",
|
|
573
|
+
name: "slotY"
|
|
574
|
+
}],
|
|
575
|
+
body: [0, [[
|
|
576
|
+
6,
|
|
577
|
+
[
|
|
578
|
+
7,
|
|
579
|
+
"randf",
|
|
580
|
+
"seed2"
|
|
581
|
+
],
|
|
582
|
+
[[
|
|
583
|
+
6,
|
|
584
|
+
[
|
|
585
|
+
7,
|
|
586
|
+
"d",
|
|
587
|
+
"vec2f"
|
|
588
|
+
],
|
|
589
|
+
[[
|
|
590
|
+
1,
|
|
591
|
+
[
|
|
592
|
+
6,
|
|
593
|
+
[
|
|
594
|
+
7,
|
|
595
|
+
"d",
|
|
596
|
+
"f32"
|
|
597
|
+
],
|
|
598
|
+
["seed"]
|
|
599
|
+
],
|
|
600
|
+
"/",
|
|
601
|
+
"U32_MAX_F"
|
|
602
|
+
], [
|
|
603
|
+
1,
|
|
604
|
+
[
|
|
605
|
+
1,
|
|
606
|
+
[
|
|
607
|
+
6,
|
|
608
|
+
[
|
|
609
|
+
7,
|
|
610
|
+
"d",
|
|
611
|
+
"f32"
|
|
612
|
+
],
|
|
613
|
+
["slotY"]
|
|
614
|
+
],
|
|
615
|
+
"*",
|
|
616
|
+
"SLOT_Y_SCALE"
|
|
617
|
+
],
|
|
618
|
+
"+",
|
|
619
|
+
"BRIGHTNESS_SALT"
|
|
620
|
+
]]
|
|
621
|
+
]]
|
|
622
|
+
], [10, [
|
|
623
|
+
1,
|
|
624
|
+
[
|
|
625
|
+
1,
|
|
626
|
+
[
|
|
627
|
+
1,
|
|
628
|
+
[
|
|
629
|
+
6,
|
|
630
|
+
[
|
|
631
|
+
7,
|
|
632
|
+
"randf",
|
|
633
|
+
"sample"
|
|
634
|
+
],
|
|
635
|
+
[]
|
|
636
|
+
],
|
|
637
|
+
"-",
|
|
638
|
+
[5, "0.5"]
|
|
639
|
+
],
|
|
640
|
+
"*",
|
|
641
|
+
[5, "2"]
|
|
642
|
+
],
|
|
643
|
+
"*",
|
|
644
|
+
"JITTER_RANGE"
|
|
645
|
+
]]]],
|
|
646
|
+
externalNames: [
|
|
647
|
+
"randf",
|
|
648
|
+
"d",
|
|
649
|
+
"U32_MAX_F",
|
|
650
|
+
"SLOT_Y_SCALE",
|
|
651
|
+
"BRIGHTNESS_SALT",
|
|
652
|
+
"JITTER_RANGE"
|
|
653
|
+
]
|
|
654
|
+
},
|
|
655
|
+
externals: () => ({
|
|
656
|
+
randf: f,
|
|
657
|
+
d: l,
|
|
658
|
+
U32_MAX_F: A,
|
|
659
|
+
SLOT_Y_SCALE: j,
|
|
660
|
+
BRIGHTNESS_SALT: M,
|
|
661
|
+
JITTER_RANGE: N
|
|
662
|
+
})
|
|
663
|
+
}) && e.f)({})), "brightnessJitter"), I = {
|
|
664
|
+
background: [
|
|
665
|
+
0,
|
|
666
|
+
5 / 255,
|
|
667
|
+
0,
|
|
668
|
+
1
|
|
669
|
+
],
|
|
670
|
+
head: [
|
|
671
|
+
180 / 255,
|
|
672
|
+
255 / 255,
|
|
673
|
+
180 / 255,
|
|
674
|
+
1
|
|
675
|
+
],
|
|
676
|
+
trail: [
|
|
677
|
+
0,
|
|
678
|
+
255 / 255,
|
|
679
|
+
65 / 255,
|
|
680
|
+
1
|
|
681
|
+
],
|
|
682
|
+
fade: [
|
|
683
|
+
0,
|
|
684
|
+
61 / 255,
|
|
685
|
+
16 / 255,
|
|
686
|
+
1
|
|
687
|
+
]
|
|
688
|
+
}, L = 1.5, R = 2.5;
|
|
689
|
+
function z(e, t, n, r) {
|
|
690
|
+
let i = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(d.fragmentFn({
|
|
691
|
+
in: { uv: l.vec2f },
|
|
692
|
+
out: l.vec4f
|
|
693
|
+
})(/*#__PURE__*/ ((e) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set(e.f = (({ uv: e }) => {
|
|
694
|
+
"use gpu";
|
|
695
|
+
let r = n.$.resolution, i = n.$.cellSize, a = l.u32(u.floor(__tsover_div(r.x, i))), o = __tsover_mul(e, r), s = u.min(l.u32(u.floor(__tsover_div(o.x, i))), __tsover_sub(a, 1)), c = l.u32(u.floor(__tsover_div(o.y, i))), d = l.vec2f(u.fract(__tsover_div(o.x, i)), u.fract(__tsover_div(o.y, i))), f = t.$[s], p = l.i32(u.floor(f.headY)), m = __tsover_sub(p, l.i32(c)), h = l.i32(f.tailLength), g = m >= 0 && m <= h, _ = P(f.seed, c), v = u.textureSample(k.$.atlas, k.$.sampler, d, l.i32(_)), y = u.mix(R, 1, f.depth), b = __tsover_mul(__tsover_mul(u.fwidth(d.x), .5), y), x = u.smoothstep(__tsover_sub(.5, b), __tsover_add(.5, b), v.x), S = __tsover_div(l.f32(m), f.tailLength), C = u.pow(u.clamp(__tsover_sub(1, S), 0, 1), L), w = u.mix(__tsover_sub(1, n.$.depthDim), 1, f.depth), T = u.select(F(f.seed, c), l.f32(0), m === 0), E = u.clamp(__tsover_mul(__tsover_mul(C, w), __tsover_add(1, T)), 0, 1), D = l.vec3f(I.head[0], I.head[1], I.head[2]), O = l.vec3f(I.trail[0], I.trail[1], I.trail[2]), ee = l.vec3f(I.fade[0], I.fade[1], I.fade[2]), A = l.vec3f(I.background[0], I.background[1], I.background[2]), j = u.mix(O, ee, u.clamp(S, 0, 1)), M = u.select(j, D, m === 0), N = u.mix(1, n.$.headEmission, C), z = __tsover_mul(__tsover_mul(M, E), N), B = u.mix(A, z, x), V = u.select(A, B, g);
|
|
696
|
+
return l.vec4f(V, 1);
|
|
697
|
+
}), {
|
|
698
|
+
v: 1,
|
|
699
|
+
name: void 0,
|
|
700
|
+
ast: {
|
|
701
|
+
params: [{
|
|
702
|
+
type: "d",
|
|
703
|
+
props: [{
|
|
704
|
+
name: "uv",
|
|
705
|
+
alias: "uv"
|
|
706
|
+
}]
|
|
707
|
+
}],
|
|
708
|
+
body: [0, [
|
|
709
|
+
[
|
|
710
|
+
13,
|
|
711
|
+
"resolution",
|
|
712
|
+
[
|
|
713
|
+
7,
|
|
714
|
+
[
|
|
715
|
+
7,
|
|
716
|
+
"uniforms",
|
|
717
|
+
"$"
|
|
718
|
+
],
|
|
719
|
+
"resolution"
|
|
720
|
+
]
|
|
721
|
+
],
|
|
722
|
+
[
|
|
723
|
+
13,
|
|
724
|
+
"cellSize",
|
|
725
|
+
[
|
|
726
|
+
7,
|
|
727
|
+
[
|
|
728
|
+
7,
|
|
729
|
+
"uniforms",
|
|
730
|
+
"$"
|
|
731
|
+
],
|
|
732
|
+
"cellSize"
|
|
733
|
+
]
|
|
734
|
+
],
|
|
735
|
+
[
|
|
736
|
+
13,
|
|
737
|
+
"columnCount",
|
|
738
|
+
[
|
|
739
|
+
6,
|
|
740
|
+
[
|
|
741
|
+
7,
|
|
742
|
+
"d",
|
|
743
|
+
"u32"
|
|
744
|
+
],
|
|
745
|
+
[[
|
|
746
|
+
6,
|
|
747
|
+
[
|
|
748
|
+
7,
|
|
749
|
+
"std",
|
|
750
|
+
"floor"
|
|
751
|
+
],
|
|
752
|
+
[[
|
|
753
|
+
1,
|
|
754
|
+
[
|
|
755
|
+
7,
|
|
756
|
+
"resolution",
|
|
757
|
+
"x"
|
|
758
|
+
],
|
|
759
|
+
"/",
|
|
760
|
+
"cellSize"
|
|
761
|
+
]]
|
|
762
|
+
]]
|
|
763
|
+
]
|
|
764
|
+
],
|
|
765
|
+
[
|
|
766
|
+
13,
|
|
767
|
+
"pixelPos",
|
|
768
|
+
[
|
|
769
|
+
1,
|
|
770
|
+
"uv",
|
|
771
|
+
"*",
|
|
772
|
+
"resolution"
|
|
773
|
+
]
|
|
774
|
+
],
|
|
775
|
+
[
|
|
776
|
+
13,
|
|
777
|
+
"col",
|
|
778
|
+
[
|
|
779
|
+
6,
|
|
780
|
+
[
|
|
781
|
+
7,
|
|
782
|
+
"std",
|
|
783
|
+
"min"
|
|
784
|
+
],
|
|
785
|
+
[[
|
|
786
|
+
6,
|
|
787
|
+
[
|
|
788
|
+
7,
|
|
789
|
+
"d",
|
|
790
|
+
"u32"
|
|
791
|
+
],
|
|
792
|
+
[[
|
|
793
|
+
6,
|
|
794
|
+
[
|
|
795
|
+
7,
|
|
796
|
+
"std",
|
|
797
|
+
"floor"
|
|
798
|
+
],
|
|
799
|
+
[[
|
|
800
|
+
1,
|
|
801
|
+
[
|
|
802
|
+
7,
|
|
803
|
+
"pixelPos",
|
|
804
|
+
"x"
|
|
805
|
+
],
|
|
806
|
+
"/",
|
|
807
|
+
"cellSize"
|
|
808
|
+
]]
|
|
809
|
+
]]
|
|
810
|
+
], [
|
|
811
|
+
1,
|
|
812
|
+
"columnCount",
|
|
813
|
+
"-",
|
|
814
|
+
[5, "1"]
|
|
815
|
+
]]
|
|
816
|
+
]
|
|
817
|
+
],
|
|
818
|
+
[
|
|
819
|
+
13,
|
|
820
|
+
"row",
|
|
821
|
+
[
|
|
822
|
+
6,
|
|
823
|
+
[
|
|
824
|
+
7,
|
|
825
|
+
"d",
|
|
826
|
+
"u32"
|
|
827
|
+
],
|
|
828
|
+
[[
|
|
829
|
+
6,
|
|
830
|
+
[
|
|
831
|
+
7,
|
|
832
|
+
"std",
|
|
833
|
+
"floor"
|
|
834
|
+
],
|
|
835
|
+
[[
|
|
836
|
+
1,
|
|
837
|
+
[
|
|
838
|
+
7,
|
|
839
|
+
"pixelPos",
|
|
840
|
+
"y"
|
|
841
|
+
],
|
|
842
|
+
"/",
|
|
843
|
+
"cellSize"
|
|
844
|
+
]]
|
|
845
|
+
]]
|
|
846
|
+
]
|
|
847
|
+
],
|
|
848
|
+
[
|
|
849
|
+
13,
|
|
850
|
+
"localUv",
|
|
851
|
+
[
|
|
852
|
+
6,
|
|
853
|
+
[
|
|
854
|
+
7,
|
|
855
|
+
"d",
|
|
856
|
+
"vec2f"
|
|
857
|
+
],
|
|
858
|
+
[[
|
|
859
|
+
6,
|
|
860
|
+
[
|
|
861
|
+
7,
|
|
862
|
+
"std",
|
|
863
|
+
"fract"
|
|
864
|
+
],
|
|
865
|
+
[[
|
|
866
|
+
1,
|
|
867
|
+
[
|
|
868
|
+
7,
|
|
869
|
+
"pixelPos",
|
|
870
|
+
"x"
|
|
871
|
+
],
|
|
872
|
+
"/",
|
|
873
|
+
"cellSize"
|
|
874
|
+
]]
|
|
875
|
+
], [
|
|
876
|
+
6,
|
|
877
|
+
[
|
|
878
|
+
7,
|
|
879
|
+
"std",
|
|
880
|
+
"fract"
|
|
881
|
+
],
|
|
882
|
+
[[
|
|
883
|
+
1,
|
|
884
|
+
[
|
|
885
|
+
7,
|
|
886
|
+
"pixelPos",
|
|
887
|
+
"y"
|
|
888
|
+
],
|
|
889
|
+
"/",
|
|
890
|
+
"cellSize"
|
|
891
|
+
]]
|
|
892
|
+
]]
|
|
893
|
+
]
|
|
894
|
+
],
|
|
895
|
+
[
|
|
896
|
+
13,
|
|
897
|
+
"column",
|
|
898
|
+
[
|
|
899
|
+
8,
|
|
900
|
+
[
|
|
901
|
+
7,
|
|
902
|
+
"columns",
|
|
903
|
+
"$"
|
|
904
|
+
],
|
|
905
|
+
"col"
|
|
906
|
+
]
|
|
907
|
+
],
|
|
908
|
+
[
|
|
909
|
+
13,
|
|
910
|
+
"headRow",
|
|
911
|
+
[
|
|
912
|
+
6,
|
|
913
|
+
[
|
|
914
|
+
7,
|
|
915
|
+
"d",
|
|
916
|
+
"i32"
|
|
917
|
+
],
|
|
918
|
+
[[
|
|
919
|
+
6,
|
|
920
|
+
[
|
|
921
|
+
7,
|
|
922
|
+
"std",
|
|
923
|
+
"floor"
|
|
924
|
+
],
|
|
925
|
+
[[
|
|
926
|
+
7,
|
|
927
|
+
"column",
|
|
928
|
+
"headY"
|
|
929
|
+
]]
|
|
930
|
+
]]
|
|
931
|
+
]
|
|
932
|
+
],
|
|
933
|
+
[
|
|
934
|
+
13,
|
|
935
|
+
"k",
|
|
936
|
+
[
|
|
937
|
+
1,
|
|
938
|
+
"headRow",
|
|
939
|
+
"-",
|
|
940
|
+
[
|
|
941
|
+
6,
|
|
942
|
+
[
|
|
943
|
+
7,
|
|
944
|
+
"d",
|
|
945
|
+
"i32"
|
|
946
|
+
],
|
|
947
|
+
["row"]
|
|
948
|
+
]
|
|
949
|
+
]
|
|
950
|
+
],
|
|
951
|
+
[
|
|
952
|
+
13,
|
|
953
|
+
"tailLengthI",
|
|
954
|
+
[
|
|
955
|
+
6,
|
|
956
|
+
[
|
|
957
|
+
7,
|
|
958
|
+
"d",
|
|
959
|
+
"i32"
|
|
960
|
+
],
|
|
961
|
+
[[
|
|
962
|
+
7,
|
|
963
|
+
"column",
|
|
964
|
+
"tailLength"
|
|
965
|
+
]]
|
|
966
|
+
]
|
|
967
|
+
],
|
|
968
|
+
[
|
|
969
|
+
13,
|
|
970
|
+
"inTail",
|
|
971
|
+
[
|
|
972
|
+
3,
|
|
973
|
+
[
|
|
974
|
+
1,
|
|
975
|
+
"k",
|
|
976
|
+
">=",
|
|
977
|
+
[5, "0"]
|
|
978
|
+
],
|
|
979
|
+
"&&",
|
|
980
|
+
[
|
|
981
|
+
1,
|
|
982
|
+
"k",
|
|
983
|
+
"<=",
|
|
984
|
+
"tailLengthI"
|
|
985
|
+
]
|
|
986
|
+
]
|
|
987
|
+
],
|
|
988
|
+
[
|
|
989
|
+
13,
|
|
990
|
+
"layer",
|
|
991
|
+
[
|
|
992
|
+
6,
|
|
993
|
+
"glyphIndex",
|
|
994
|
+
[[
|
|
995
|
+
7,
|
|
996
|
+
"column",
|
|
997
|
+
"seed"
|
|
998
|
+
], "row"]
|
|
999
|
+
]
|
|
1000
|
+
],
|
|
1001
|
+
[
|
|
1002
|
+
13,
|
|
1003
|
+
"sample",
|
|
1004
|
+
[
|
|
1005
|
+
6,
|
|
1006
|
+
[
|
|
1007
|
+
7,
|
|
1008
|
+
"std",
|
|
1009
|
+
"textureSample"
|
|
1010
|
+
],
|
|
1011
|
+
[
|
|
1012
|
+
[
|
|
1013
|
+
7,
|
|
1014
|
+
[
|
|
1015
|
+
7,
|
|
1016
|
+
"atlasBindings",
|
|
1017
|
+
"$"
|
|
1018
|
+
],
|
|
1019
|
+
"atlas"
|
|
1020
|
+
],
|
|
1021
|
+
[
|
|
1022
|
+
7,
|
|
1023
|
+
[
|
|
1024
|
+
7,
|
|
1025
|
+
"atlasBindings",
|
|
1026
|
+
"$"
|
|
1027
|
+
],
|
|
1028
|
+
"sampler"
|
|
1029
|
+
],
|
|
1030
|
+
"localUv",
|
|
1031
|
+
[
|
|
1032
|
+
6,
|
|
1033
|
+
[
|
|
1034
|
+
7,
|
|
1035
|
+
"d",
|
|
1036
|
+
"i32"
|
|
1037
|
+
],
|
|
1038
|
+
["layer"]
|
|
1039
|
+
]
|
|
1040
|
+
]
|
|
1041
|
+
]
|
|
1042
|
+
],
|
|
1043
|
+
[
|
|
1044
|
+
13,
|
|
1045
|
+
"softness",
|
|
1046
|
+
[
|
|
1047
|
+
6,
|
|
1048
|
+
[
|
|
1049
|
+
7,
|
|
1050
|
+
"std",
|
|
1051
|
+
"mix"
|
|
1052
|
+
],
|
|
1053
|
+
[
|
|
1054
|
+
"FAR_SOFTNESS",
|
|
1055
|
+
[5, "1"],
|
|
1056
|
+
[
|
|
1057
|
+
7,
|
|
1058
|
+
"column",
|
|
1059
|
+
"depth"
|
|
1060
|
+
]
|
|
1061
|
+
]
|
|
1062
|
+
]
|
|
1063
|
+
],
|
|
1064
|
+
[
|
|
1065
|
+
13,
|
|
1066
|
+
"edgeHalfBand",
|
|
1067
|
+
[
|
|
1068
|
+
1,
|
|
1069
|
+
[
|
|
1070
|
+
1,
|
|
1071
|
+
[
|
|
1072
|
+
6,
|
|
1073
|
+
[
|
|
1074
|
+
7,
|
|
1075
|
+
"std",
|
|
1076
|
+
"fwidth"
|
|
1077
|
+
],
|
|
1078
|
+
[[
|
|
1079
|
+
7,
|
|
1080
|
+
"localUv",
|
|
1081
|
+
"x"
|
|
1082
|
+
]]
|
|
1083
|
+
],
|
|
1084
|
+
"*",
|
|
1085
|
+
[5, "0.5"]
|
|
1086
|
+
],
|
|
1087
|
+
"*",
|
|
1088
|
+
"softness"
|
|
1089
|
+
]
|
|
1090
|
+
],
|
|
1091
|
+
[
|
|
1092
|
+
13,
|
|
1093
|
+
"coverage",
|
|
1094
|
+
[
|
|
1095
|
+
6,
|
|
1096
|
+
[
|
|
1097
|
+
7,
|
|
1098
|
+
"std",
|
|
1099
|
+
"smoothstep"
|
|
1100
|
+
],
|
|
1101
|
+
[
|
|
1102
|
+
[
|
|
1103
|
+
1,
|
|
1104
|
+
[5, "0.5"],
|
|
1105
|
+
"-",
|
|
1106
|
+
"edgeHalfBand"
|
|
1107
|
+
],
|
|
1108
|
+
[
|
|
1109
|
+
1,
|
|
1110
|
+
[5, "0.5"],
|
|
1111
|
+
"+",
|
|
1112
|
+
"edgeHalfBand"
|
|
1113
|
+
],
|
|
1114
|
+
[
|
|
1115
|
+
7,
|
|
1116
|
+
"sample",
|
|
1117
|
+
"x"
|
|
1118
|
+
]
|
|
1119
|
+
]
|
|
1120
|
+
]
|
|
1121
|
+
],
|
|
1122
|
+
[
|
|
1123
|
+
13,
|
|
1124
|
+
"tailProgress",
|
|
1125
|
+
[
|
|
1126
|
+
1,
|
|
1127
|
+
[
|
|
1128
|
+
6,
|
|
1129
|
+
[
|
|
1130
|
+
7,
|
|
1131
|
+
"d",
|
|
1132
|
+
"f32"
|
|
1133
|
+
],
|
|
1134
|
+
["k"]
|
|
1135
|
+
],
|
|
1136
|
+
"/",
|
|
1137
|
+
[
|
|
1138
|
+
7,
|
|
1139
|
+
"column",
|
|
1140
|
+
"tailLength"
|
|
1141
|
+
]
|
|
1142
|
+
]
|
|
1143
|
+
],
|
|
1144
|
+
[
|
|
1145
|
+
13,
|
|
1146
|
+
"tailFalloff",
|
|
1147
|
+
[
|
|
1148
|
+
6,
|
|
1149
|
+
[
|
|
1150
|
+
7,
|
|
1151
|
+
"std",
|
|
1152
|
+
"pow"
|
|
1153
|
+
],
|
|
1154
|
+
[[
|
|
1155
|
+
6,
|
|
1156
|
+
[
|
|
1157
|
+
7,
|
|
1158
|
+
"std",
|
|
1159
|
+
"clamp"
|
|
1160
|
+
],
|
|
1161
|
+
[
|
|
1162
|
+
[
|
|
1163
|
+
1,
|
|
1164
|
+
[5, "1"],
|
|
1165
|
+
"-",
|
|
1166
|
+
"tailProgress"
|
|
1167
|
+
],
|
|
1168
|
+
[5, "0"],
|
|
1169
|
+
[5, "1"]
|
|
1170
|
+
]
|
|
1171
|
+
], "FALLOFF_POWER"]
|
|
1172
|
+
]
|
|
1173
|
+
],
|
|
1174
|
+
[
|
|
1175
|
+
13,
|
|
1176
|
+
"depthDimming",
|
|
1177
|
+
[
|
|
1178
|
+
6,
|
|
1179
|
+
[
|
|
1180
|
+
7,
|
|
1181
|
+
"std",
|
|
1182
|
+
"mix"
|
|
1183
|
+
],
|
|
1184
|
+
[
|
|
1185
|
+
[
|
|
1186
|
+
1,
|
|
1187
|
+
[5, "1"],
|
|
1188
|
+
"-",
|
|
1189
|
+
[
|
|
1190
|
+
7,
|
|
1191
|
+
[
|
|
1192
|
+
7,
|
|
1193
|
+
"uniforms",
|
|
1194
|
+
"$"
|
|
1195
|
+
],
|
|
1196
|
+
"depthDim"
|
|
1197
|
+
]
|
|
1198
|
+
],
|
|
1199
|
+
[5, "1"],
|
|
1200
|
+
[
|
|
1201
|
+
7,
|
|
1202
|
+
"column",
|
|
1203
|
+
"depth"
|
|
1204
|
+
]
|
|
1205
|
+
]
|
|
1206
|
+
]
|
|
1207
|
+
],
|
|
1208
|
+
[
|
|
1209
|
+
13,
|
|
1210
|
+
"trailJitter",
|
|
1211
|
+
[
|
|
1212
|
+
6,
|
|
1213
|
+
[
|
|
1214
|
+
7,
|
|
1215
|
+
"std",
|
|
1216
|
+
"select"
|
|
1217
|
+
],
|
|
1218
|
+
[
|
|
1219
|
+
[
|
|
1220
|
+
6,
|
|
1221
|
+
"brightnessJitter",
|
|
1222
|
+
[[
|
|
1223
|
+
7,
|
|
1224
|
+
"column",
|
|
1225
|
+
"seed"
|
|
1226
|
+
], "row"]
|
|
1227
|
+
],
|
|
1228
|
+
[
|
|
1229
|
+
6,
|
|
1230
|
+
[
|
|
1231
|
+
7,
|
|
1232
|
+
"d",
|
|
1233
|
+
"f32"
|
|
1234
|
+
],
|
|
1235
|
+
[[5, "0"]]
|
|
1236
|
+
],
|
|
1237
|
+
[
|
|
1238
|
+
1,
|
|
1239
|
+
"k",
|
|
1240
|
+
"===",
|
|
1241
|
+
[5, "0"]
|
|
1242
|
+
]
|
|
1243
|
+
]
|
|
1244
|
+
]
|
|
1245
|
+
],
|
|
1246
|
+
[
|
|
1247
|
+
13,
|
|
1248
|
+
"brightness",
|
|
1249
|
+
[
|
|
1250
|
+
6,
|
|
1251
|
+
[
|
|
1252
|
+
7,
|
|
1253
|
+
"std",
|
|
1254
|
+
"clamp"
|
|
1255
|
+
],
|
|
1256
|
+
[
|
|
1257
|
+
[
|
|
1258
|
+
1,
|
|
1259
|
+
[
|
|
1260
|
+
1,
|
|
1261
|
+
"tailFalloff",
|
|
1262
|
+
"*",
|
|
1263
|
+
"depthDimming"
|
|
1264
|
+
],
|
|
1265
|
+
"*",
|
|
1266
|
+
[
|
|
1267
|
+
1,
|
|
1268
|
+
[5, "1"],
|
|
1269
|
+
"+",
|
|
1270
|
+
"trailJitter"
|
|
1271
|
+
]
|
|
1272
|
+
],
|
|
1273
|
+
[5, "0"],
|
|
1274
|
+
[5, "1"]
|
|
1275
|
+
]
|
|
1276
|
+
]
|
|
1277
|
+
],
|
|
1278
|
+
[
|
|
1279
|
+
13,
|
|
1280
|
+
"head",
|
|
1281
|
+
[
|
|
1282
|
+
6,
|
|
1283
|
+
[
|
|
1284
|
+
7,
|
|
1285
|
+
"d",
|
|
1286
|
+
"vec3f"
|
|
1287
|
+
],
|
|
1288
|
+
[
|
|
1289
|
+
[
|
|
1290
|
+
8,
|
|
1291
|
+
[
|
|
1292
|
+
7,
|
|
1293
|
+
"PALETTE",
|
|
1294
|
+
"head"
|
|
1295
|
+
],
|
|
1296
|
+
[5, "0"]
|
|
1297
|
+
],
|
|
1298
|
+
[
|
|
1299
|
+
8,
|
|
1300
|
+
[
|
|
1301
|
+
7,
|
|
1302
|
+
"PALETTE",
|
|
1303
|
+
"head"
|
|
1304
|
+
],
|
|
1305
|
+
[5, "1"]
|
|
1306
|
+
],
|
|
1307
|
+
[
|
|
1308
|
+
8,
|
|
1309
|
+
[
|
|
1310
|
+
7,
|
|
1311
|
+
"PALETTE",
|
|
1312
|
+
"head"
|
|
1313
|
+
],
|
|
1314
|
+
[5, "2"]
|
|
1315
|
+
]
|
|
1316
|
+
]
|
|
1317
|
+
]
|
|
1318
|
+
],
|
|
1319
|
+
[
|
|
1320
|
+
13,
|
|
1321
|
+
"trail",
|
|
1322
|
+
[
|
|
1323
|
+
6,
|
|
1324
|
+
[
|
|
1325
|
+
7,
|
|
1326
|
+
"d",
|
|
1327
|
+
"vec3f"
|
|
1328
|
+
],
|
|
1329
|
+
[
|
|
1330
|
+
[
|
|
1331
|
+
8,
|
|
1332
|
+
[
|
|
1333
|
+
7,
|
|
1334
|
+
"PALETTE",
|
|
1335
|
+
"trail"
|
|
1336
|
+
],
|
|
1337
|
+
[5, "0"]
|
|
1338
|
+
],
|
|
1339
|
+
[
|
|
1340
|
+
8,
|
|
1341
|
+
[
|
|
1342
|
+
7,
|
|
1343
|
+
"PALETTE",
|
|
1344
|
+
"trail"
|
|
1345
|
+
],
|
|
1346
|
+
[5, "1"]
|
|
1347
|
+
],
|
|
1348
|
+
[
|
|
1349
|
+
8,
|
|
1350
|
+
[
|
|
1351
|
+
7,
|
|
1352
|
+
"PALETTE",
|
|
1353
|
+
"trail"
|
|
1354
|
+
],
|
|
1355
|
+
[5, "2"]
|
|
1356
|
+
]
|
|
1357
|
+
]
|
|
1358
|
+
]
|
|
1359
|
+
],
|
|
1360
|
+
[
|
|
1361
|
+
13,
|
|
1362
|
+
"fade",
|
|
1363
|
+
[
|
|
1364
|
+
6,
|
|
1365
|
+
[
|
|
1366
|
+
7,
|
|
1367
|
+
"d",
|
|
1368
|
+
"vec3f"
|
|
1369
|
+
],
|
|
1370
|
+
[
|
|
1371
|
+
[
|
|
1372
|
+
8,
|
|
1373
|
+
[
|
|
1374
|
+
7,
|
|
1375
|
+
"PALETTE",
|
|
1376
|
+
"fade"
|
|
1377
|
+
],
|
|
1378
|
+
[5, "0"]
|
|
1379
|
+
],
|
|
1380
|
+
[
|
|
1381
|
+
8,
|
|
1382
|
+
[
|
|
1383
|
+
7,
|
|
1384
|
+
"PALETTE",
|
|
1385
|
+
"fade"
|
|
1386
|
+
],
|
|
1387
|
+
[5, "1"]
|
|
1388
|
+
],
|
|
1389
|
+
[
|
|
1390
|
+
8,
|
|
1391
|
+
[
|
|
1392
|
+
7,
|
|
1393
|
+
"PALETTE",
|
|
1394
|
+
"fade"
|
|
1395
|
+
],
|
|
1396
|
+
[5, "2"]
|
|
1397
|
+
]
|
|
1398
|
+
]
|
|
1399
|
+
]
|
|
1400
|
+
],
|
|
1401
|
+
[
|
|
1402
|
+
13,
|
|
1403
|
+
"bg",
|
|
1404
|
+
[
|
|
1405
|
+
6,
|
|
1406
|
+
[
|
|
1407
|
+
7,
|
|
1408
|
+
"d",
|
|
1409
|
+
"vec3f"
|
|
1410
|
+
],
|
|
1411
|
+
[
|
|
1412
|
+
[
|
|
1413
|
+
8,
|
|
1414
|
+
[
|
|
1415
|
+
7,
|
|
1416
|
+
"PALETTE",
|
|
1417
|
+
"background"
|
|
1418
|
+
],
|
|
1419
|
+
[5, "0"]
|
|
1420
|
+
],
|
|
1421
|
+
[
|
|
1422
|
+
8,
|
|
1423
|
+
[
|
|
1424
|
+
7,
|
|
1425
|
+
"PALETTE",
|
|
1426
|
+
"background"
|
|
1427
|
+
],
|
|
1428
|
+
[5, "1"]
|
|
1429
|
+
],
|
|
1430
|
+
[
|
|
1431
|
+
8,
|
|
1432
|
+
[
|
|
1433
|
+
7,
|
|
1434
|
+
"PALETTE",
|
|
1435
|
+
"background"
|
|
1436
|
+
],
|
|
1437
|
+
[5, "2"]
|
|
1438
|
+
]
|
|
1439
|
+
]
|
|
1440
|
+
]
|
|
1441
|
+
],
|
|
1442
|
+
[
|
|
1443
|
+
13,
|
|
1444
|
+
"trailColor",
|
|
1445
|
+
[
|
|
1446
|
+
6,
|
|
1447
|
+
[
|
|
1448
|
+
7,
|
|
1449
|
+
"std",
|
|
1450
|
+
"mix"
|
|
1451
|
+
],
|
|
1452
|
+
[
|
|
1453
|
+
"trail",
|
|
1454
|
+
"fade",
|
|
1455
|
+
[
|
|
1456
|
+
6,
|
|
1457
|
+
[
|
|
1458
|
+
7,
|
|
1459
|
+
"std",
|
|
1460
|
+
"clamp"
|
|
1461
|
+
],
|
|
1462
|
+
[
|
|
1463
|
+
"tailProgress",
|
|
1464
|
+
[5, "0"],
|
|
1465
|
+
[5, "1"]
|
|
1466
|
+
]
|
|
1467
|
+
]
|
|
1468
|
+
]
|
|
1469
|
+
]
|
|
1470
|
+
],
|
|
1471
|
+
[
|
|
1472
|
+
13,
|
|
1473
|
+
"baseColor",
|
|
1474
|
+
[
|
|
1475
|
+
6,
|
|
1476
|
+
[
|
|
1477
|
+
7,
|
|
1478
|
+
"std",
|
|
1479
|
+
"select"
|
|
1480
|
+
],
|
|
1481
|
+
[
|
|
1482
|
+
"trailColor",
|
|
1483
|
+
"head",
|
|
1484
|
+
[
|
|
1485
|
+
1,
|
|
1486
|
+
"k",
|
|
1487
|
+
"===",
|
|
1488
|
+
[5, "0"]
|
|
1489
|
+
]
|
|
1490
|
+
]
|
|
1491
|
+
]
|
|
1492
|
+
],
|
|
1493
|
+
[
|
|
1494
|
+
13,
|
|
1495
|
+
"emission",
|
|
1496
|
+
[
|
|
1497
|
+
6,
|
|
1498
|
+
[
|
|
1499
|
+
7,
|
|
1500
|
+
"std",
|
|
1501
|
+
"mix"
|
|
1502
|
+
],
|
|
1503
|
+
[
|
|
1504
|
+
[5, "1"],
|
|
1505
|
+
[
|
|
1506
|
+
7,
|
|
1507
|
+
[
|
|
1508
|
+
7,
|
|
1509
|
+
"uniforms",
|
|
1510
|
+
"$"
|
|
1511
|
+
],
|
|
1512
|
+
"headEmission"
|
|
1513
|
+
],
|
|
1514
|
+
"tailFalloff"
|
|
1515
|
+
]
|
|
1516
|
+
]
|
|
1517
|
+
],
|
|
1518
|
+
[
|
|
1519
|
+
13,
|
|
1520
|
+
"glyphColor",
|
|
1521
|
+
[
|
|
1522
|
+
1,
|
|
1523
|
+
[
|
|
1524
|
+
1,
|
|
1525
|
+
"baseColor",
|
|
1526
|
+
"*",
|
|
1527
|
+
"brightness"
|
|
1528
|
+
],
|
|
1529
|
+
"*",
|
|
1530
|
+
"emission"
|
|
1531
|
+
]
|
|
1532
|
+
],
|
|
1533
|
+
[
|
|
1534
|
+
13,
|
|
1535
|
+
"finalRgb",
|
|
1536
|
+
[
|
|
1537
|
+
6,
|
|
1538
|
+
[
|
|
1539
|
+
7,
|
|
1540
|
+
"std",
|
|
1541
|
+
"mix"
|
|
1542
|
+
],
|
|
1543
|
+
[
|
|
1544
|
+
"bg",
|
|
1545
|
+
"glyphColor",
|
|
1546
|
+
"coverage"
|
|
1547
|
+
]
|
|
1548
|
+
]
|
|
1549
|
+
],
|
|
1550
|
+
[
|
|
1551
|
+
13,
|
|
1552
|
+
"color",
|
|
1553
|
+
[
|
|
1554
|
+
6,
|
|
1555
|
+
[
|
|
1556
|
+
7,
|
|
1557
|
+
"std",
|
|
1558
|
+
"select"
|
|
1559
|
+
],
|
|
1560
|
+
[
|
|
1561
|
+
"bg",
|
|
1562
|
+
"finalRgb",
|
|
1563
|
+
"inTail"
|
|
1564
|
+
]
|
|
1565
|
+
]
|
|
1566
|
+
],
|
|
1567
|
+
[10, [
|
|
1568
|
+
6,
|
|
1569
|
+
[
|
|
1570
|
+
7,
|
|
1571
|
+
"d",
|
|
1572
|
+
"vec4f"
|
|
1573
|
+
],
|
|
1574
|
+
["color", [5, "1"]]
|
|
1575
|
+
]]
|
|
1576
|
+
]],
|
|
1577
|
+
externalNames: [
|
|
1578
|
+
"uniforms",
|
|
1579
|
+
"d",
|
|
1580
|
+
"std",
|
|
1581
|
+
"columns",
|
|
1582
|
+
"glyphIndex",
|
|
1583
|
+
"atlasBindings",
|
|
1584
|
+
"FAR_SOFTNESS",
|
|
1585
|
+
"FALLOFF_POWER",
|
|
1586
|
+
"brightnessJitter",
|
|
1587
|
+
"PALETTE"
|
|
1588
|
+
]
|
|
1589
|
+
},
|
|
1590
|
+
externals: () => ({
|
|
1591
|
+
uniforms: n,
|
|
1592
|
+
d: l,
|
|
1593
|
+
std: u,
|
|
1594
|
+
columns: t,
|
|
1595
|
+
glyphIndex: P,
|
|
1596
|
+
atlasBindings: k,
|
|
1597
|
+
FAR_SOFTNESS: R,
|
|
1598
|
+
FALLOFF_POWER: L,
|
|
1599
|
+
brightnessJitter: F,
|
|
1600
|
+
PALETTE: I
|
|
1601
|
+
})
|
|
1602
|
+
}) && e.f)({})), "fragMain");
|
|
1603
|
+
return e.createRenderPipeline({
|
|
1604
|
+
vertex: c.fullScreenTriangle,
|
|
1605
|
+
fragment: i,
|
|
1606
|
+
targets: { format: r }
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
//#endregion
|
|
1610
|
+
//#region src/gpu/pipelines/blit.ts
|
|
1611
|
+
var B = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(d.bindGroupLayout({
|
|
1612
|
+
source: { texture: l.texture2d(l.f32) },
|
|
1613
|
+
sampler: { sampler: "filtering" }
|
|
1614
|
+
}), "blitBindings");
|
|
1615
|
+
function V(e) {
|
|
1616
|
+
let t = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(d.fragmentFn({
|
|
1617
|
+
in: { uv: l.vec2f },
|
|
1618
|
+
out: l.vec4f
|
|
1619
|
+
})(/*#__PURE__*/ ((e) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set(e.f = (({ uv: e }) => {
|
|
1620
|
+
"use gpu";
|
|
1621
|
+
return u.textureSample(B.$.source, B.$.sampler, e);
|
|
1622
|
+
}), {
|
|
1623
|
+
v: 1,
|
|
1624
|
+
name: void 0,
|
|
1625
|
+
ast: {
|
|
1626
|
+
params: [{
|
|
1627
|
+
type: "d",
|
|
1628
|
+
props: [{
|
|
1629
|
+
name: "uv",
|
|
1630
|
+
alias: "uv"
|
|
1631
|
+
}]
|
|
1632
|
+
}],
|
|
1633
|
+
body: [0, [[10, [
|
|
1634
|
+
6,
|
|
1635
|
+
[
|
|
1636
|
+
7,
|
|
1637
|
+
"std",
|
|
1638
|
+
"textureSample"
|
|
1639
|
+
],
|
|
1640
|
+
[
|
|
1641
|
+
[
|
|
1642
|
+
7,
|
|
1643
|
+
[
|
|
1644
|
+
7,
|
|
1645
|
+
"blitBindings",
|
|
1646
|
+
"$"
|
|
1647
|
+
],
|
|
1648
|
+
"source"
|
|
1649
|
+
],
|
|
1650
|
+
[
|
|
1651
|
+
7,
|
|
1652
|
+
[
|
|
1653
|
+
7,
|
|
1654
|
+
"blitBindings",
|
|
1655
|
+
"$"
|
|
1656
|
+
],
|
|
1657
|
+
"sampler"
|
|
1658
|
+
],
|
|
1659
|
+
"uv"
|
|
1660
|
+
]
|
|
1661
|
+
]]]],
|
|
1662
|
+
externalNames: ["std", "blitBindings"]
|
|
1663
|
+
},
|
|
1664
|
+
externals: () => ({
|
|
1665
|
+
std: u,
|
|
1666
|
+
blitBindings: B
|
|
1667
|
+
})
|
|
1668
|
+
}) && e.f)({})), "fragMain");
|
|
1669
|
+
return e.createRenderPipeline({
|
|
1670
|
+
vertex: c.fullScreenTriangle,
|
|
1671
|
+
fragment: t
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
//#endregion
|
|
1675
|
+
//#region src/gpu/pipelines/crt.ts
|
|
1676
|
+
var H = 4;
|
|
1677
|
+
function te(e, t) {
|
|
1678
|
+
let n = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(d.fragmentFn({
|
|
1679
|
+
in: { uv: l.vec2f },
|
|
1680
|
+
out: l.vec4f
|
|
1681
|
+
})(/*#__PURE__*/ ((e) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set(e.f = (({ uv: e }) => {
|
|
1682
|
+
"use gpu";
|
|
1683
|
+
let n = l.vec2f(__tsover_div(t.$.aberration, t.$.resolution.x), 0), r = u.textureSample(B.$.source, B.$.sampler, __tsover_add(e, n)).x, i = u.textureSample(B.$.source, B.$.sampler, e).y, a = u.textureSample(B.$.source, B.$.sampler, __tsover_sub(e, n)).z, o = u.saturate(l.vec3f(r, i, a)), s = __tsover_mul(t.$.resolution.y, __tsover_div(__tsover_mul(2, Math.PI), H)), c = __tsover_sub(1, __tsover_mul(t.$.scanlineStrength, __tsover_add(.5, __tsover_mul(.5, u.sin(__tsover_mul(e.y, s))))));
|
|
1684
|
+
return o = __tsover_mul(o, c), l.vec4f(o, 1);
|
|
1685
|
+
}), {
|
|
1686
|
+
v: 1,
|
|
1687
|
+
name: void 0,
|
|
1688
|
+
ast: {
|
|
1689
|
+
params: [{
|
|
1690
|
+
type: "d",
|
|
1691
|
+
props: [{
|
|
1692
|
+
name: "uv",
|
|
1693
|
+
alias: "uv"
|
|
1694
|
+
}]
|
|
1695
|
+
}],
|
|
1696
|
+
body: [0, [
|
|
1697
|
+
[
|
|
1698
|
+
13,
|
|
1699
|
+
"offset",
|
|
1700
|
+
[
|
|
1701
|
+
6,
|
|
1702
|
+
[
|
|
1703
|
+
7,
|
|
1704
|
+
"d",
|
|
1705
|
+
"vec2f"
|
|
1706
|
+
],
|
|
1707
|
+
[[
|
|
1708
|
+
1,
|
|
1709
|
+
[
|
|
1710
|
+
7,
|
|
1711
|
+
[
|
|
1712
|
+
7,
|
|
1713
|
+
"uniforms",
|
|
1714
|
+
"$"
|
|
1715
|
+
],
|
|
1716
|
+
"aberration"
|
|
1717
|
+
],
|
|
1718
|
+
"/",
|
|
1719
|
+
[
|
|
1720
|
+
7,
|
|
1721
|
+
[
|
|
1722
|
+
7,
|
|
1723
|
+
[
|
|
1724
|
+
7,
|
|
1725
|
+
"uniforms",
|
|
1726
|
+
"$"
|
|
1727
|
+
],
|
|
1728
|
+
"resolution"
|
|
1729
|
+
],
|
|
1730
|
+
"x"
|
|
1731
|
+
]
|
|
1732
|
+
], [5, "0"]]
|
|
1733
|
+
]
|
|
1734
|
+
],
|
|
1735
|
+
[
|
|
1736
|
+
13,
|
|
1737
|
+
"r",
|
|
1738
|
+
[
|
|
1739
|
+
7,
|
|
1740
|
+
[
|
|
1741
|
+
6,
|
|
1742
|
+
[
|
|
1743
|
+
7,
|
|
1744
|
+
"std",
|
|
1745
|
+
"textureSample"
|
|
1746
|
+
],
|
|
1747
|
+
[
|
|
1748
|
+
[
|
|
1749
|
+
7,
|
|
1750
|
+
[
|
|
1751
|
+
7,
|
|
1752
|
+
"blitBindings",
|
|
1753
|
+
"$"
|
|
1754
|
+
],
|
|
1755
|
+
"source"
|
|
1756
|
+
],
|
|
1757
|
+
[
|
|
1758
|
+
7,
|
|
1759
|
+
[
|
|
1760
|
+
7,
|
|
1761
|
+
"blitBindings",
|
|
1762
|
+
"$"
|
|
1763
|
+
],
|
|
1764
|
+
"sampler"
|
|
1765
|
+
],
|
|
1766
|
+
[
|
|
1767
|
+
1,
|
|
1768
|
+
"uv",
|
|
1769
|
+
"+",
|
|
1770
|
+
"offset"
|
|
1771
|
+
]
|
|
1772
|
+
]
|
|
1773
|
+
],
|
|
1774
|
+
"x"
|
|
1775
|
+
]
|
|
1776
|
+
],
|
|
1777
|
+
[
|
|
1778
|
+
13,
|
|
1779
|
+
"g",
|
|
1780
|
+
[
|
|
1781
|
+
7,
|
|
1782
|
+
[
|
|
1783
|
+
6,
|
|
1784
|
+
[
|
|
1785
|
+
7,
|
|
1786
|
+
"std",
|
|
1787
|
+
"textureSample"
|
|
1788
|
+
],
|
|
1789
|
+
[
|
|
1790
|
+
[
|
|
1791
|
+
7,
|
|
1792
|
+
[
|
|
1793
|
+
7,
|
|
1794
|
+
"blitBindings",
|
|
1795
|
+
"$"
|
|
1796
|
+
],
|
|
1797
|
+
"source"
|
|
1798
|
+
],
|
|
1799
|
+
[
|
|
1800
|
+
7,
|
|
1801
|
+
[
|
|
1802
|
+
7,
|
|
1803
|
+
"blitBindings",
|
|
1804
|
+
"$"
|
|
1805
|
+
],
|
|
1806
|
+
"sampler"
|
|
1807
|
+
],
|
|
1808
|
+
"uv"
|
|
1809
|
+
]
|
|
1810
|
+
],
|
|
1811
|
+
"y"
|
|
1812
|
+
]
|
|
1813
|
+
],
|
|
1814
|
+
[
|
|
1815
|
+
13,
|
|
1816
|
+
"b",
|
|
1817
|
+
[
|
|
1818
|
+
7,
|
|
1819
|
+
[
|
|
1820
|
+
6,
|
|
1821
|
+
[
|
|
1822
|
+
7,
|
|
1823
|
+
"std",
|
|
1824
|
+
"textureSample"
|
|
1825
|
+
],
|
|
1826
|
+
[
|
|
1827
|
+
[
|
|
1828
|
+
7,
|
|
1829
|
+
[
|
|
1830
|
+
7,
|
|
1831
|
+
"blitBindings",
|
|
1832
|
+
"$"
|
|
1833
|
+
],
|
|
1834
|
+
"source"
|
|
1835
|
+
],
|
|
1836
|
+
[
|
|
1837
|
+
7,
|
|
1838
|
+
[
|
|
1839
|
+
7,
|
|
1840
|
+
"blitBindings",
|
|
1841
|
+
"$"
|
|
1842
|
+
],
|
|
1843
|
+
"sampler"
|
|
1844
|
+
],
|
|
1845
|
+
[
|
|
1846
|
+
1,
|
|
1847
|
+
"uv",
|
|
1848
|
+
"-",
|
|
1849
|
+
"offset"
|
|
1850
|
+
]
|
|
1851
|
+
]
|
|
1852
|
+
],
|
|
1853
|
+
"z"
|
|
1854
|
+
]
|
|
1855
|
+
],
|
|
1856
|
+
[
|
|
1857
|
+
12,
|
|
1858
|
+
"color",
|
|
1859
|
+
[
|
|
1860
|
+
6,
|
|
1861
|
+
[
|
|
1862
|
+
7,
|
|
1863
|
+
"std",
|
|
1864
|
+
"saturate"
|
|
1865
|
+
],
|
|
1866
|
+
[[
|
|
1867
|
+
6,
|
|
1868
|
+
[
|
|
1869
|
+
7,
|
|
1870
|
+
"d",
|
|
1871
|
+
"vec3f"
|
|
1872
|
+
],
|
|
1873
|
+
[
|
|
1874
|
+
"r",
|
|
1875
|
+
"g",
|
|
1876
|
+
"b"
|
|
1877
|
+
]
|
|
1878
|
+
]]
|
|
1879
|
+
]
|
|
1880
|
+
],
|
|
1881
|
+
[
|
|
1882
|
+
13,
|
|
1883
|
+
"scanFreq",
|
|
1884
|
+
[
|
|
1885
|
+
1,
|
|
1886
|
+
[
|
|
1887
|
+
7,
|
|
1888
|
+
[
|
|
1889
|
+
7,
|
|
1890
|
+
[
|
|
1891
|
+
7,
|
|
1892
|
+
"uniforms",
|
|
1893
|
+
"$"
|
|
1894
|
+
],
|
|
1895
|
+
"resolution"
|
|
1896
|
+
],
|
|
1897
|
+
"y"
|
|
1898
|
+
],
|
|
1899
|
+
"*",
|
|
1900
|
+
[
|
|
1901
|
+
1,
|
|
1902
|
+
[
|
|
1903
|
+
1,
|
|
1904
|
+
[5, "2"],
|
|
1905
|
+
"*",
|
|
1906
|
+
[
|
|
1907
|
+
7,
|
|
1908
|
+
"Math",
|
|
1909
|
+
"PI"
|
|
1910
|
+
]
|
|
1911
|
+
],
|
|
1912
|
+
"/",
|
|
1913
|
+
"SCANLINE_PERIOD_PX"
|
|
1914
|
+
]
|
|
1915
|
+
]
|
|
1916
|
+
],
|
|
1917
|
+
[
|
|
1918
|
+
13,
|
|
1919
|
+
"scan",
|
|
1920
|
+
[
|
|
1921
|
+
1,
|
|
1922
|
+
[5, "1"],
|
|
1923
|
+
"-",
|
|
1924
|
+
[
|
|
1925
|
+
1,
|
|
1926
|
+
[
|
|
1927
|
+
7,
|
|
1928
|
+
[
|
|
1929
|
+
7,
|
|
1930
|
+
"uniforms",
|
|
1931
|
+
"$"
|
|
1932
|
+
],
|
|
1933
|
+
"scanlineStrength"
|
|
1934
|
+
],
|
|
1935
|
+
"*",
|
|
1936
|
+
[
|
|
1937
|
+
1,
|
|
1938
|
+
[5, "0.5"],
|
|
1939
|
+
"+",
|
|
1940
|
+
[
|
|
1941
|
+
1,
|
|
1942
|
+
[5, "0.5"],
|
|
1943
|
+
"*",
|
|
1944
|
+
[
|
|
1945
|
+
6,
|
|
1946
|
+
[
|
|
1947
|
+
7,
|
|
1948
|
+
"std",
|
|
1949
|
+
"sin"
|
|
1950
|
+
],
|
|
1951
|
+
[[
|
|
1952
|
+
1,
|
|
1953
|
+
[
|
|
1954
|
+
7,
|
|
1955
|
+
"uv",
|
|
1956
|
+
"y"
|
|
1957
|
+
],
|
|
1958
|
+
"*",
|
|
1959
|
+
"scanFreq"
|
|
1960
|
+
]]
|
|
1961
|
+
]
|
|
1962
|
+
]
|
|
1963
|
+
]
|
|
1964
|
+
]
|
|
1965
|
+
]
|
|
1966
|
+
],
|
|
1967
|
+
[
|
|
1968
|
+
2,
|
|
1969
|
+
"color",
|
|
1970
|
+
"=",
|
|
1971
|
+
[
|
|
1972
|
+
1,
|
|
1973
|
+
"color",
|
|
1974
|
+
"*",
|
|
1975
|
+
"scan"
|
|
1976
|
+
]
|
|
1977
|
+
],
|
|
1978
|
+
[10, [
|
|
1979
|
+
6,
|
|
1980
|
+
[
|
|
1981
|
+
7,
|
|
1982
|
+
"d",
|
|
1983
|
+
"vec4f"
|
|
1984
|
+
],
|
|
1985
|
+
["color", [5, "1"]]
|
|
1986
|
+
]]
|
|
1987
|
+
]],
|
|
1988
|
+
externalNames: [
|
|
1989
|
+
"d",
|
|
1990
|
+
"uniforms",
|
|
1991
|
+
"std",
|
|
1992
|
+
"blitBindings",
|
|
1993
|
+
"Math",
|
|
1994
|
+
"SCANLINE_PERIOD_PX"
|
|
1995
|
+
]
|
|
1996
|
+
},
|
|
1997
|
+
externals: () => ({
|
|
1998
|
+
d: l,
|
|
1999
|
+
uniforms: t,
|
|
2000
|
+
std: u,
|
|
2001
|
+
blitBindings: B,
|
|
2002
|
+
Math,
|
|
2003
|
+
SCANLINE_PERIOD_PX: H
|
|
2004
|
+
})
|
|
2005
|
+
}) && e.f)({})), "fragMain");
|
|
2006
|
+
return e.createRenderPipeline({
|
|
2007
|
+
vertex: c.fullScreenTriangle,
|
|
2008
|
+
fragment: n
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
//#endregion
|
|
2012
|
+
//#region src/gpu/pipelines/bloom.ts
|
|
2013
|
+
function ne(e, t, n) {
|
|
2014
|
+
let r = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(d.fragmentFn({
|
|
2015
|
+
in: { uv: l.vec2f },
|
|
2016
|
+
out: l.vec4f
|
|
2017
|
+
})(/*#__PURE__*/ ((e) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set(e.f = (({ uv: e }) => {
|
|
2018
|
+
"use gpu";
|
|
2019
|
+
let n = u.textureSample(B.$.source, B.$.sampler, e), r = t.$.bloomThreshold, i = u.max(__tsover_sub(n.rgb, l.vec3f(r)), l.vec3f(0));
|
|
2020
|
+
return l.vec4f(i, 1);
|
|
2021
|
+
}), {
|
|
2022
|
+
v: 1,
|
|
2023
|
+
name: void 0,
|
|
2024
|
+
ast: {
|
|
2025
|
+
params: [{
|
|
2026
|
+
type: "d",
|
|
2027
|
+
props: [{
|
|
2028
|
+
name: "uv",
|
|
2029
|
+
alias: "uv"
|
|
2030
|
+
}]
|
|
2031
|
+
}],
|
|
2032
|
+
body: [0, [
|
|
2033
|
+
[
|
|
2034
|
+
13,
|
|
2035
|
+
"src",
|
|
2036
|
+
[
|
|
2037
|
+
6,
|
|
2038
|
+
[
|
|
2039
|
+
7,
|
|
2040
|
+
"std",
|
|
2041
|
+
"textureSample"
|
|
2042
|
+
],
|
|
2043
|
+
[
|
|
2044
|
+
[
|
|
2045
|
+
7,
|
|
2046
|
+
[
|
|
2047
|
+
7,
|
|
2048
|
+
"blitBindings",
|
|
2049
|
+
"$"
|
|
2050
|
+
],
|
|
2051
|
+
"source"
|
|
2052
|
+
],
|
|
2053
|
+
[
|
|
2054
|
+
7,
|
|
2055
|
+
[
|
|
2056
|
+
7,
|
|
2057
|
+
"blitBindings",
|
|
2058
|
+
"$"
|
|
2059
|
+
],
|
|
2060
|
+
"sampler"
|
|
2061
|
+
],
|
|
2062
|
+
"uv"
|
|
2063
|
+
]
|
|
2064
|
+
]
|
|
2065
|
+
],
|
|
2066
|
+
[
|
|
2067
|
+
13,
|
|
2068
|
+
"threshold",
|
|
2069
|
+
[
|
|
2070
|
+
7,
|
|
2071
|
+
[
|
|
2072
|
+
7,
|
|
2073
|
+
"uniforms",
|
|
2074
|
+
"$"
|
|
2075
|
+
],
|
|
2076
|
+
"bloomThreshold"
|
|
2077
|
+
]
|
|
2078
|
+
],
|
|
2079
|
+
[
|
|
2080
|
+
13,
|
|
2081
|
+
"bright",
|
|
2082
|
+
[
|
|
2083
|
+
6,
|
|
2084
|
+
[
|
|
2085
|
+
7,
|
|
2086
|
+
"std",
|
|
2087
|
+
"max"
|
|
2088
|
+
],
|
|
2089
|
+
[[
|
|
2090
|
+
1,
|
|
2091
|
+
[
|
|
2092
|
+
7,
|
|
2093
|
+
"src",
|
|
2094
|
+
"rgb"
|
|
2095
|
+
],
|
|
2096
|
+
"-",
|
|
2097
|
+
[
|
|
2098
|
+
6,
|
|
2099
|
+
[
|
|
2100
|
+
7,
|
|
2101
|
+
"d",
|
|
2102
|
+
"vec3f"
|
|
2103
|
+
],
|
|
2104
|
+
["threshold"]
|
|
2105
|
+
]
|
|
2106
|
+
], [
|
|
2107
|
+
6,
|
|
2108
|
+
[
|
|
2109
|
+
7,
|
|
2110
|
+
"d",
|
|
2111
|
+
"vec3f"
|
|
2112
|
+
],
|
|
2113
|
+
[[5, "0"]]
|
|
2114
|
+
]]
|
|
2115
|
+
]
|
|
2116
|
+
],
|
|
2117
|
+
[10, [
|
|
2118
|
+
6,
|
|
2119
|
+
[
|
|
2120
|
+
7,
|
|
2121
|
+
"d",
|
|
2122
|
+
"vec4f"
|
|
2123
|
+
],
|
|
2124
|
+
["bright", [5, "1"]]
|
|
2125
|
+
]]
|
|
2126
|
+
]],
|
|
2127
|
+
externalNames: [
|
|
2128
|
+
"std",
|
|
2129
|
+
"blitBindings",
|
|
2130
|
+
"uniforms",
|
|
2131
|
+
"d"
|
|
2132
|
+
]
|
|
2133
|
+
},
|
|
2134
|
+
externals: () => ({
|
|
2135
|
+
std: u,
|
|
2136
|
+
blitBindings: B,
|
|
2137
|
+
uniforms: t,
|
|
2138
|
+
d: l
|
|
2139
|
+
})
|
|
2140
|
+
}) && e.f)({})), "fragMain");
|
|
2141
|
+
return e.createRenderPipeline({
|
|
2142
|
+
vertex: c.fullScreenTriangle,
|
|
2143
|
+
fragment: r,
|
|
2144
|
+
targets: { format: n }
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
var U = 1.8;
|
|
2148
|
+
function W(e, t) {
|
|
2149
|
+
let n = [];
|
|
2150
|
+
for (let r = 0; r <= t; r++) n.push(Math.exp(-(r * r) / (2 * e * e)));
|
|
2151
|
+
let r = n[0] + 2 * n.slice(1).reduce((e, t) => e + t, 0);
|
|
2152
|
+
return n.map((e) => e / r);
|
|
2153
|
+
}
|
|
2154
|
+
function G(e, t, n, r) {
|
|
2155
|
+
let [i, a, o, s, f] = W(U, 4), p = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(d.fragmentFn({
|
|
2156
|
+
in: { uv: l.vec2f },
|
|
2157
|
+
out: l.vec4f
|
|
2158
|
+
})(/*#__PURE__*/ ((e) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set(e.f = (({ uv: e }) => {
|
|
2159
|
+
"use gpu";
|
|
2160
|
+
let n = __tsover_div(l.vec2f(2, 2), t.$.resolution), c = __tsover_mul(l.vec2f(r[0], r[1]), n), d = u.textureSample(B.$.source, B.$.sampler, e).rgb, p = u.textureSample(B.$.source, B.$.sampler, __tsover_add(e, c)).rgb, m = u.textureSample(B.$.source, B.$.sampler, __tsover_sub(e, c)).rgb, h = u.textureSample(B.$.source, B.$.sampler, __tsover_add(e, __tsover_mul(c, 2))).rgb, g = u.textureSample(B.$.source, B.$.sampler, __tsover_sub(e, __tsover_mul(c, 2))).rgb, _ = u.textureSample(B.$.source, B.$.sampler, __tsover_add(e, __tsover_mul(c, 3))).rgb, v = u.textureSample(B.$.source, B.$.sampler, __tsover_sub(e, __tsover_mul(c, 3))).rgb, y = u.textureSample(B.$.source, B.$.sampler, __tsover_add(e, __tsover_mul(c, 4))).rgb, b = u.textureSample(B.$.source, B.$.sampler, __tsover_sub(e, __tsover_mul(c, 4))).rgb, x = __tsover_add(__tsover_add(__tsover_add(__tsover_add(__tsover_mul(d, i), __tsover_mul(__tsover_add(p, m), a)), __tsover_mul(__tsover_add(h, g), o)), __tsover_mul(__tsover_add(_, v), s)), __tsover_mul(__tsover_add(y, b), f));
|
|
2161
|
+
return l.vec4f(x, 1);
|
|
2162
|
+
}), {
|
|
2163
|
+
v: 1,
|
|
2164
|
+
name: void 0,
|
|
2165
|
+
ast: {
|
|
2166
|
+
params: [{
|
|
2167
|
+
type: "d",
|
|
2168
|
+
props: [{
|
|
2169
|
+
name: "uv",
|
|
2170
|
+
alias: "uv"
|
|
2171
|
+
}]
|
|
2172
|
+
}],
|
|
2173
|
+
body: [0, [
|
|
2174
|
+
[
|
|
2175
|
+
13,
|
|
2176
|
+
"texelDimension",
|
|
2177
|
+
[
|
|
2178
|
+
1,
|
|
2179
|
+
[
|
|
2180
|
+
6,
|
|
2181
|
+
[
|
|
2182
|
+
7,
|
|
2183
|
+
"d",
|
|
2184
|
+
"vec2f"
|
|
2185
|
+
],
|
|
2186
|
+
[[5, "2"], [5, "2"]]
|
|
2187
|
+
],
|
|
2188
|
+
"/",
|
|
2189
|
+
[
|
|
2190
|
+
7,
|
|
2191
|
+
[
|
|
2192
|
+
7,
|
|
2193
|
+
"uniforms",
|
|
2194
|
+
"$"
|
|
2195
|
+
],
|
|
2196
|
+
"resolution"
|
|
2197
|
+
]
|
|
2198
|
+
]
|
|
2199
|
+
],
|
|
2200
|
+
[
|
|
2201
|
+
13,
|
|
2202
|
+
"step",
|
|
2203
|
+
[
|
|
2204
|
+
1,
|
|
2205
|
+
[
|
|
2206
|
+
6,
|
|
2207
|
+
[
|
|
2208
|
+
7,
|
|
2209
|
+
"d",
|
|
2210
|
+
"vec2f"
|
|
2211
|
+
],
|
|
2212
|
+
[[
|
|
2213
|
+
8,
|
|
2214
|
+
"direction",
|
|
2215
|
+
[5, "0"]
|
|
2216
|
+
], [
|
|
2217
|
+
8,
|
|
2218
|
+
"direction",
|
|
2219
|
+
[5, "1"]
|
|
2220
|
+
]]
|
|
2221
|
+
],
|
|
2222
|
+
"*",
|
|
2223
|
+
"texelDimension"
|
|
2224
|
+
]
|
|
2225
|
+
],
|
|
2226
|
+
[
|
|
2227
|
+
13,
|
|
2228
|
+
"c",
|
|
2229
|
+
[
|
|
2230
|
+
7,
|
|
2231
|
+
[
|
|
2232
|
+
6,
|
|
2233
|
+
[
|
|
2234
|
+
7,
|
|
2235
|
+
"std",
|
|
2236
|
+
"textureSample"
|
|
2237
|
+
],
|
|
2238
|
+
[
|
|
2239
|
+
[
|
|
2240
|
+
7,
|
|
2241
|
+
[
|
|
2242
|
+
7,
|
|
2243
|
+
"blitBindings",
|
|
2244
|
+
"$"
|
|
2245
|
+
],
|
|
2246
|
+
"source"
|
|
2247
|
+
],
|
|
2248
|
+
[
|
|
2249
|
+
7,
|
|
2250
|
+
[
|
|
2251
|
+
7,
|
|
2252
|
+
"blitBindings",
|
|
2253
|
+
"$"
|
|
2254
|
+
],
|
|
2255
|
+
"sampler"
|
|
2256
|
+
],
|
|
2257
|
+
"uv"
|
|
2258
|
+
]
|
|
2259
|
+
],
|
|
2260
|
+
"rgb"
|
|
2261
|
+
]
|
|
2262
|
+
],
|
|
2263
|
+
[
|
|
2264
|
+
13,
|
|
2265
|
+
"p1",
|
|
2266
|
+
[
|
|
2267
|
+
7,
|
|
2268
|
+
[
|
|
2269
|
+
6,
|
|
2270
|
+
[
|
|
2271
|
+
7,
|
|
2272
|
+
"std",
|
|
2273
|
+
"textureSample"
|
|
2274
|
+
],
|
|
2275
|
+
[
|
|
2276
|
+
[
|
|
2277
|
+
7,
|
|
2278
|
+
[
|
|
2279
|
+
7,
|
|
2280
|
+
"blitBindings",
|
|
2281
|
+
"$"
|
|
2282
|
+
],
|
|
2283
|
+
"source"
|
|
2284
|
+
],
|
|
2285
|
+
[
|
|
2286
|
+
7,
|
|
2287
|
+
[
|
|
2288
|
+
7,
|
|
2289
|
+
"blitBindings",
|
|
2290
|
+
"$"
|
|
2291
|
+
],
|
|
2292
|
+
"sampler"
|
|
2293
|
+
],
|
|
2294
|
+
[
|
|
2295
|
+
1,
|
|
2296
|
+
"uv",
|
|
2297
|
+
"+",
|
|
2298
|
+
"step"
|
|
2299
|
+
]
|
|
2300
|
+
]
|
|
2301
|
+
],
|
|
2302
|
+
"rgb"
|
|
2303
|
+
]
|
|
2304
|
+
],
|
|
2305
|
+
[
|
|
2306
|
+
13,
|
|
2307
|
+
"n1",
|
|
2308
|
+
[
|
|
2309
|
+
7,
|
|
2310
|
+
[
|
|
2311
|
+
6,
|
|
2312
|
+
[
|
|
2313
|
+
7,
|
|
2314
|
+
"std",
|
|
2315
|
+
"textureSample"
|
|
2316
|
+
],
|
|
2317
|
+
[
|
|
2318
|
+
[
|
|
2319
|
+
7,
|
|
2320
|
+
[
|
|
2321
|
+
7,
|
|
2322
|
+
"blitBindings",
|
|
2323
|
+
"$"
|
|
2324
|
+
],
|
|
2325
|
+
"source"
|
|
2326
|
+
],
|
|
2327
|
+
[
|
|
2328
|
+
7,
|
|
2329
|
+
[
|
|
2330
|
+
7,
|
|
2331
|
+
"blitBindings",
|
|
2332
|
+
"$"
|
|
2333
|
+
],
|
|
2334
|
+
"sampler"
|
|
2335
|
+
],
|
|
2336
|
+
[
|
|
2337
|
+
1,
|
|
2338
|
+
"uv",
|
|
2339
|
+
"-",
|
|
2340
|
+
"step"
|
|
2341
|
+
]
|
|
2342
|
+
]
|
|
2343
|
+
],
|
|
2344
|
+
"rgb"
|
|
2345
|
+
]
|
|
2346
|
+
],
|
|
2347
|
+
[
|
|
2348
|
+
13,
|
|
2349
|
+
"p2",
|
|
2350
|
+
[
|
|
2351
|
+
7,
|
|
2352
|
+
[
|
|
2353
|
+
6,
|
|
2354
|
+
[
|
|
2355
|
+
7,
|
|
2356
|
+
"std",
|
|
2357
|
+
"textureSample"
|
|
2358
|
+
],
|
|
2359
|
+
[
|
|
2360
|
+
[
|
|
2361
|
+
7,
|
|
2362
|
+
[
|
|
2363
|
+
7,
|
|
2364
|
+
"blitBindings",
|
|
2365
|
+
"$"
|
|
2366
|
+
],
|
|
2367
|
+
"source"
|
|
2368
|
+
],
|
|
2369
|
+
[
|
|
2370
|
+
7,
|
|
2371
|
+
[
|
|
2372
|
+
7,
|
|
2373
|
+
"blitBindings",
|
|
2374
|
+
"$"
|
|
2375
|
+
],
|
|
2376
|
+
"sampler"
|
|
2377
|
+
],
|
|
2378
|
+
[
|
|
2379
|
+
1,
|
|
2380
|
+
"uv",
|
|
2381
|
+
"+",
|
|
2382
|
+
[
|
|
2383
|
+
1,
|
|
2384
|
+
"step",
|
|
2385
|
+
"*",
|
|
2386
|
+
[5, "2"]
|
|
2387
|
+
]
|
|
2388
|
+
]
|
|
2389
|
+
]
|
|
2390
|
+
],
|
|
2391
|
+
"rgb"
|
|
2392
|
+
]
|
|
2393
|
+
],
|
|
2394
|
+
[
|
|
2395
|
+
13,
|
|
2396
|
+
"n2",
|
|
2397
|
+
[
|
|
2398
|
+
7,
|
|
2399
|
+
[
|
|
2400
|
+
6,
|
|
2401
|
+
[
|
|
2402
|
+
7,
|
|
2403
|
+
"std",
|
|
2404
|
+
"textureSample"
|
|
2405
|
+
],
|
|
2406
|
+
[
|
|
2407
|
+
[
|
|
2408
|
+
7,
|
|
2409
|
+
[
|
|
2410
|
+
7,
|
|
2411
|
+
"blitBindings",
|
|
2412
|
+
"$"
|
|
2413
|
+
],
|
|
2414
|
+
"source"
|
|
2415
|
+
],
|
|
2416
|
+
[
|
|
2417
|
+
7,
|
|
2418
|
+
[
|
|
2419
|
+
7,
|
|
2420
|
+
"blitBindings",
|
|
2421
|
+
"$"
|
|
2422
|
+
],
|
|
2423
|
+
"sampler"
|
|
2424
|
+
],
|
|
2425
|
+
[
|
|
2426
|
+
1,
|
|
2427
|
+
"uv",
|
|
2428
|
+
"-",
|
|
2429
|
+
[
|
|
2430
|
+
1,
|
|
2431
|
+
"step",
|
|
2432
|
+
"*",
|
|
2433
|
+
[5, "2"]
|
|
2434
|
+
]
|
|
2435
|
+
]
|
|
2436
|
+
]
|
|
2437
|
+
],
|
|
2438
|
+
"rgb"
|
|
2439
|
+
]
|
|
2440
|
+
],
|
|
2441
|
+
[
|
|
2442
|
+
13,
|
|
2443
|
+
"p3",
|
|
2444
|
+
[
|
|
2445
|
+
7,
|
|
2446
|
+
[
|
|
2447
|
+
6,
|
|
2448
|
+
[
|
|
2449
|
+
7,
|
|
2450
|
+
"std",
|
|
2451
|
+
"textureSample"
|
|
2452
|
+
],
|
|
2453
|
+
[
|
|
2454
|
+
[
|
|
2455
|
+
7,
|
|
2456
|
+
[
|
|
2457
|
+
7,
|
|
2458
|
+
"blitBindings",
|
|
2459
|
+
"$"
|
|
2460
|
+
],
|
|
2461
|
+
"source"
|
|
2462
|
+
],
|
|
2463
|
+
[
|
|
2464
|
+
7,
|
|
2465
|
+
[
|
|
2466
|
+
7,
|
|
2467
|
+
"blitBindings",
|
|
2468
|
+
"$"
|
|
2469
|
+
],
|
|
2470
|
+
"sampler"
|
|
2471
|
+
],
|
|
2472
|
+
[
|
|
2473
|
+
1,
|
|
2474
|
+
"uv",
|
|
2475
|
+
"+",
|
|
2476
|
+
[
|
|
2477
|
+
1,
|
|
2478
|
+
"step",
|
|
2479
|
+
"*",
|
|
2480
|
+
[5, "3"]
|
|
2481
|
+
]
|
|
2482
|
+
]
|
|
2483
|
+
]
|
|
2484
|
+
],
|
|
2485
|
+
"rgb"
|
|
2486
|
+
]
|
|
2487
|
+
],
|
|
2488
|
+
[
|
|
2489
|
+
13,
|
|
2490
|
+
"n3",
|
|
2491
|
+
[
|
|
2492
|
+
7,
|
|
2493
|
+
[
|
|
2494
|
+
6,
|
|
2495
|
+
[
|
|
2496
|
+
7,
|
|
2497
|
+
"std",
|
|
2498
|
+
"textureSample"
|
|
2499
|
+
],
|
|
2500
|
+
[
|
|
2501
|
+
[
|
|
2502
|
+
7,
|
|
2503
|
+
[
|
|
2504
|
+
7,
|
|
2505
|
+
"blitBindings",
|
|
2506
|
+
"$"
|
|
2507
|
+
],
|
|
2508
|
+
"source"
|
|
2509
|
+
],
|
|
2510
|
+
[
|
|
2511
|
+
7,
|
|
2512
|
+
[
|
|
2513
|
+
7,
|
|
2514
|
+
"blitBindings",
|
|
2515
|
+
"$"
|
|
2516
|
+
],
|
|
2517
|
+
"sampler"
|
|
2518
|
+
],
|
|
2519
|
+
[
|
|
2520
|
+
1,
|
|
2521
|
+
"uv",
|
|
2522
|
+
"-",
|
|
2523
|
+
[
|
|
2524
|
+
1,
|
|
2525
|
+
"step",
|
|
2526
|
+
"*",
|
|
2527
|
+
[5, "3"]
|
|
2528
|
+
]
|
|
2529
|
+
]
|
|
2530
|
+
]
|
|
2531
|
+
],
|
|
2532
|
+
"rgb"
|
|
2533
|
+
]
|
|
2534
|
+
],
|
|
2535
|
+
[
|
|
2536
|
+
13,
|
|
2537
|
+
"p4",
|
|
2538
|
+
[
|
|
2539
|
+
7,
|
|
2540
|
+
[
|
|
2541
|
+
6,
|
|
2542
|
+
[
|
|
2543
|
+
7,
|
|
2544
|
+
"std",
|
|
2545
|
+
"textureSample"
|
|
2546
|
+
],
|
|
2547
|
+
[
|
|
2548
|
+
[
|
|
2549
|
+
7,
|
|
2550
|
+
[
|
|
2551
|
+
7,
|
|
2552
|
+
"blitBindings",
|
|
2553
|
+
"$"
|
|
2554
|
+
],
|
|
2555
|
+
"source"
|
|
2556
|
+
],
|
|
2557
|
+
[
|
|
2558
|
+
7,
|
|
2559
|
+
[
|
|
2560
|
+
7,
|
|
2561
|
+
"blitBindings",
|
|
2562
|
+
"$"
|
|
2563
|
+
],
|
|
2564
|
+
"sampler"
|
|
2565
|
+
],
|
|
2566
|
+
[
|
|
2567
|
+
1,
|
|
2568
|
+
"uv",
|
|
2569
|
+
"+",
|
|
2570
|
+
[
|
|
2571
|
+
1,
|
|
2572
|
+
"step",
|
|
2573
|
+
"*",
|
|
2574
|
+
[5, "4"]
|
|
2575
|
+
]
|
|
2576
|
+
]
|
|
2577
|
+
]
|
|
2578
|
+
],
|
|
2579
|
+
"rgb"
|
|
2580
|
+
]
|
|
2581
|
+
],
|
|
2582
|
+
[
|
|
2583
|
+
13,
|
|
2584
|
+
"n4",
|
|
2585
|
+
[
|
|
2586
|
+
7,
|
|
2587
|
+
[
|
|
2588
|
+
6,
|
|
2589
|
+
[
|
|
2590
|
+
7,
|
|
2591
|
+
"std",
|
|
2592
|
+
"textureSample"
|
|
2593
|
+
],
|
|
2594
|
+
[
|
|
2595
|
+
[
|
|
2596
|
+
7,
|
|
2597
|
+
[
|
|
2598
|
+
7,
|
|
2599
|
+
"blitBindings",
|
|
2600
|
+
"$"
|
|
2601
|
+
],
|
|
2602
|
+
"source"
|
|
2603
|
+
],
|
|
2604
|
+
[
|
|
2605
|
+
7,
|
|
2606
|
+
[
|
|
2607
|
+
7,
|
|
2608
|
+
"blitBindings",
|
|
2609
|
+
"$"
|
|
2610
|
+
],
|
|
2611
|
+
"sampler"
|
|
2612
|
+
],
|
|
2613
|
+
[
|
|
2614
|
+
1,
|
|
2615
|
+
"uv",
|
|
2616
|
+
"-",
|
|
2617
|
+
[
|
|
2618
|
+
1,
|
|
2619
|
+
"step",
|
|
2620
|
+
"*",
|
|
2621
|
+
[5, "4"]
|
|
2622
|
+
]
|
|
2623
|
+
]
|
|
2624
|
+
]
|
|
2625
|
+
],
|
|
2626
|
+
"rgb"
|
|
2627
|
+
]
|
|
2628
|
+
],
|
|
2629
|
+
[
|
|
2630
|
+
13,
|
|
2631
|
+
"blurred",
|
|
2632
|
+
[
|
|
2633
|
+
1,
|
|
2634
|
+
[
|
|
2635
|
+
1,
|
|
2636
|
+
[
|
|
2637
|
+
1,
|
|
2638
|
+
[
|
|
2639
|
+
1,
|
|
2640
|
+
[
|
|
2641
|
+
1,
|
|
2642
|
+
"c",
|
|
2643
|
+
"*",
|
|
2644
|
+
"w0"
|
|
2645
|
+
],
|
|
2646
|
+
"+",
|
|
2647
|
+
[
|
|
2648
|
+
1,
|
|
2649
|
+
[
|
|
2650
|
+
1,
|
|
2651
|
+
"p1",
|
|
2652
|
+
"+",
|
|
2653
|
+
"n1"
|
|
2654
|
+
],
|
|
2655
|
+
"*",
|
|
2656
|
+
"w1"
|
|
2657
|
+
]
|
|
2658
|
+
],
|
|
2659
|
+
"+",
|
|
2660
|
+
[
|
|
2661
|
+
1,
|
|
2662
|
+
[
|
|
2663
|
+
1,
|
|
2664
|
+
"p2",
|
|
2665
|
+
"+",
|
|
2666
|
+
"n2"
|
|
2667
|
+
],
|
|
2668
|
+
"*",
|
|
2669
|
+
"w2"
|
|
2670
|
+
]
|
|
2671
|
+
],
|
|
2672
|
+
"+",
|
|
2673
|
+
[
|
|
2674
|
+
1,
|
|
2675
|
+
[
|
|
2676
|
+
1,
|
|
2677
|
+
"p3",
|
|
2678
|
+
"+",
|
|
2679
|
+
"n3"
|
|
2680
|
+
],
|
|
2681
|
+
"*",
|
|
2682
|
+
"w3"
|
|
2683
|
+
]
|
|
2684
|
+
],
|
|
2685
|
+
"+",
|
|
2686
|
+
[
|
|
2687
|
+
1,
|
|
2688
|
+
[
|
|
2689
|
+
1,
|
|
2690
|
+
"p4",
|
|
2691
|
+
"+",
|
|
2692
|
+
"n4"
|
|
2693
|
+
],
|
|
2694
|
+
"*",
|
|
2695
|
+
"w4"
|
|
2696
|
+
]
|
|
2697
|
+
]
|
|
2698
|
+
],
|
|
2699
|
+
[10, [
|
|
2700
|
+
6,
|
|
2701
|
+
[
|
|
2702
|
+
7,
|
|
2703
|
+
"d",
|
|
2704
|
+
"vec4f"
|
|
2705
|
+
],
|
|
2706
|
+
["blurred", [5, "1"]]
|
|
2707
|
+
]]
|
|
2708
|
+
]],
|
|
2709
|
+
externalNames: [
|
|
2710
|
+
"d",
|
|
2711
|
+
"uniforms",
|
|
2712
|
+
"direction",
|
|
2713
|
+
"std",
|
|
2714
|
+
"blitBindings",
|
|
2715
|
+
"w0",
|
|
2716
|
+
"w1",
|
|
2717
|
+
"w2",
|
|
2718
|
+
"w3",
|
|
2719
|
+
"w4"
|
|
2720
|
+
]
|
|
2721
|
+
},
|
|
2722
|
+
externals: () => ({
|
|
2723
|
+
d: l,
|
|
2724
|
+
uniforms: t,
|
|
2725
|
+
direction: r,
|
|
2726
|
+
std: u,
|
|
2727
|
+
blitBindings: B,
|
|
2728
|
+
w0: i,
|
|
2729
|
+
w1: a,
|
|
2730
|
+
w2: o,
|
|
2731
|
+
w3: s,
|
|
2732
|
+
w4: f
|
|
2733
|
+
})
|
|
2734
|
+
}) && e.f)({})), "fragMain");
|
|
2735
|
+
return e.createRenderPipeline({
|
|
2736
|
+
vertex: c.fullScreenTriangle,
|
|
2737
|
+
fragment: p,
|
|
2738
|
+
targets: { format: n }
|
|
2739
|
+
});
|
|
2740
|
+
}
|
|
2741
|
+
var K = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(d.bindGroupLayout({
|
|
2742
|
+
scene: { texture: l.texture2d(l.f32) },
|
|
2743
|
+
bloom: { texture: l.texture2d(l.f32) },
|
|
2744
|
+
sampler: { sampler: "filtering" }
|
|
2745
|
+
}), "combineBindings");
|
|
2746
|
+
function re(e, t, n) {
|
|
2747
|
+
let r = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(d.fragmentFn({
|
|
2748
|
+
in: { uv: l.vec2f },
|
|
2749
|
+
out: l.vec4f
|
|
2750
|
+
})(/*#__PURE__*/ ((e) => (globalThis.__TYPEGPU_META__ ??= /* @__PURE__ */ new WeakMap()).set(e.f = (({ uv: e }) => {
|
|
2751
|
+
"use gpu";
|
|
2752
|
+
let n = u.textureSample(K.$.scene, K.$.sampler, e), r = u.textureSample(K.$.bloom, K.$.sampler, e), i = __tsover_add(n.rgb, __tsover_mul(r.rgb, t.$.bloomIntensity));
|
|
2753
|
+
return l.vec4f(i, 1);
|
|
2754
|
+
}), {
|
|
2755
|
+
v: 1,
|
|
2756
|
+
name: void 0,
|
|
2757
|
+
ast: {
|
|
2758
|
+
params: [{
|
|
2759
|
+
type: "d",
|
|
2760
|
+
props: [{
|
|
2761
|
+
name: "uv",
|
|
2762
|
+
alias: "uv"
|
|
2763
|
+
}]
|
|
2764
|
+
}],
|
|
2765
|
+
body: [0, [
|
|
2766
|
+
[
|
|
2767
|
+
13,
|
|
2768
|
+
"scene",
|
|
2769
|
+
[
|
|
2770
|
+
6,
|
|
2771
|
+
[
|
|
2772
|
+
7,
|
|
2773
|
+
"std",
|
|
2774
|
+
"textureSample"
|
|
2775
|
+
],
|
|
2776
|
+
[
|
|
2777
|
+
[
|
|
2778
|
+
7,
|
|
2779
|
+
[
|
|
2780
|
+
7,
|
|
2781
|
+
"combineBindings",
|
|
2782
|
+
"$"
|
|
2783
|
+
],
|
|
2784
|
+
"scene"
|
|
2785
|
+
],
|
|
2786
|
+
[
|
|
2787
|
+
7,
|
|
2788
|
+
[
|
|
2789
|
+
7,
|
|
2790
|
+
"combineBindings",
|
|
2791
|
+
"$"
|
|
2792
|
+
],
|
|
2793
|
+
"sampler"
|
|
2794
|
+
],
|
|
2795
|
+
"uv"
|
|
2796
|
+
]
|
|
2797
|
+
]
|
|
2798
|
+
],
|
|
2799
|
+
[
|
|
2800
|
+
13,
|
|
2801
|
+
"bloom",
|
|
2802
|
+
[
|
|
2803
|
+
6,
|
|
2804
|
+
[
|
|
2805
|
+
7,
|
|
2806
|
+
"std",
|
|
2807
|
+
"textureSample"
|
|
2808
|
+
],
|
|
2809
|
+
[
|
|
2810
|
+
[
|
|
2811
|
+
7,
|
|
2812
|
+
[
|
|
2813
|
+
7,
|
|
2814
|
+
"combineBindings",
|
|
2815
|
+
"$"
|
|
2816
|
+
],
|
|
2817
|
+
"bloom"
|
|
2818
|
+
],
|
|
2819
|
+
[
|
|
2820
|
+
7,
|
|
2821
|
+
[
|
|
2822
|
+
7,
|
|
2823
|
+
"combineBindings",
|
|
2824
|
+
"$"
|
|
2825
|
+
],
|
|
2826
|
+
"sampler"
|
|
2827
|
+
],
|
|
2828
|
+
"uv"
|
|
2829
|
+
]
|
|
2830
|
+
]
|
|
2831
|
+
],
|
|
2832
|
+
[
|
|
2833
|
+
13,
|
|
2834
|
+
"combined",
|
|
2835
|
+
[
|
|
2836
|
+
1,
|
|
2837
|
+
[
|
|
2838
|
+
7,
|
|
2839
|
+
"scene",
|
|
2840
|
+
"rgb"
|
|
2841
|
+
],
|
|
2842
|
+
"+",
|
|
2843
|
+
[
|
|
2844
|
+
1,
|
|
2845
|
+
[
|
|
2846
|
+
7,
|
|
2847
|
+
"bloom",
|
|
2848
|
+
"rgb"
|
|
2849
|
+
],
|
|
2850
|
+
"*",
|
|
2851
|
+
[
|
|
2852
|
+
7,
|
|
2853
|
+
[
|
|
2854
|
+
7,
|
|
2855
|
+
"uniforms",
|
|
2856
|
+
"$"
|
|
2857
|
+
],
|
|
2858
|
+
"bloomIntensity"
|
|
2859
|
+
]
|
|
2860
|
+
]
|
|
2861
|
+
]
|
|
2862
|
+
],
|
|
2863
|
+
[10, [
|
|
2864
|
+
6,
|
|
2865
|
+
[
|
|
2866
|
+
7,
|
|
2867
|
+
"d",
|
|
2868
|
+
"vec4f"
|
|
2869
|
+
],
|
|
2870
|
+
["combined", [5, "1"]]
|
|
2871
|
+
]]
|
|
2872
|
+
]],
|
|
2873
|
+
externalNames: [
|
|
2874
|
+
"std",
|
|
2875
|
+
"combineBindings",
|
|
2876
|
+
"uniforms",
|
|
2877
|
+
"d"
|
|
2878
|
+
]
|
|
2879
|
+
},
|
|
2880
|
+
externals: () => ({
|
|
2881
|
+
std: u,
|
|
2882
|
+
combineBindings: K,
|
|
2883
|
+
uniforms: t,
|
|
2884
|
+
d: l
|
|
2885
|
+
})
|
|
2886
|
+
}) && e.f)({})), "fragMain");
|
|
2887
|
+
return e.createRenderPipeline({
|
|
2888
|
+
vertex: c.fullScreenTriangle,
|
|
2889
|
+
fragment: r,
|
|
2890
|
+
targets: { format: n }
|
|
2891
|
+
});
|
|
2892
|
+
}
|
|
2893
|
+
//#endregion
|
|
2894
|
+
//#region src/gpu/render-graph.ts
|
|
2895
|
+
var q = "rgba16float";
|
|
2896
|
+
function J(e, t, n, r, i) {
|
|
2897
|
+
let a = Math.max(1, Math.floor(t / n)), [o, s] = r, [c, l] = i;
|
|
2898
|
+
return Array.from({ length: e }, () => {
|
|
2899
|
+
let e = s - o, t = e > 0 ? o + e * Math.random() : o, n = e > 0 ? (t - o) / e : 1, r = c + (l - c) * Math.random();
|
|
2900
|
+
return {
|
|
2901
|
+
headY: Math.random() * 2 * a - a,
|
|
2902
|
+
speed: t,
|
|
2903
|
+
depth: n,
|
|
2904
|
+
tailLength: r,
|
|
2905
|
+
seed: Math.floor(Math.random() * 4294967295)
|
|
2906
|
+
};
|
|
2907
|
+
});
|
|
2908
|
+
}
|
|
2909
|
+
function Y(e) {
|
|
2910
|
+
let { root: t, ctx: n, atlas: r, cellSize: i } = e, a = e.density, o = e.stepRate, s = e.tailRange, c = e.bloom, u = e.crt, d = e.parallax, f = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(t.createUniform(D, {
|
|
2911
|
+
time: 0,
|
|
2912
|
+
stepProgress: 0,
|
|
2913
|
+
resolution: l.vec2f(0, 0),
|
|
2914
|
+
cellSize: i,
|
|
2915
|
+
density: a,
|
|
2916
|
+
depthDim: d.depthDim,
|
|
2917
|
+
bloomThreshold: c.threshold,
|
|
2918
|
+
bloomIntensity: c.intensity,
|
|
2919
|
+
headEmission: c.enabled ? c.emission : 1,
|
|
2920
|
+
scanlineStrength: u.scanlineStrength,
|
|
2921
|
+
aberration: u.aberration
|
|
2922
|
+
}), "uniforms"), p = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(t.createTexture({
|
|
2923
|
+
size: [
|
|
2924
|
+
r.layerSize,
|
|
2925
|
+
r.layerSize,
|
|
2926
|
+
r.layerCount
|
|
2927
|
+
],
|
|
2928
|
+
format: "r8unorm"
|
|
2929
|
+
}).$usage("sampled"), "atlasTexture"), m = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(t.createSampler({
|
|
2930
|
+
magFilter: "linear",
|
|
2931
|
+
minFilter: "linear",
|
|
2932
|
+
addressModeU: "clamp-to-edge",
|
|
2933
|
+
addressModeV: "clamp-to-edge"
|
|
2934
|
+
}), "atlasSampler"), h = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(t.createSampler({
|
|
2935
|
+
magFilter: "linear",
|
|
2936
|
+
minFilter: "linear",
|
|
2937
|
+
addressModeU: "clamp-to-edge",
|
|
2938
|
+
addressModeV: "clamp-to-edge"
|
|
2939
|
+
}), "blitSampler");
|
|
2940
|
+
t.device.queue.writeTexture({ texture: t.unwrap(p) }, r.data, {
|
|
2941
|
+
bytesPerRow: r.layerSize,
|
|
2942
|
+
rowsPerImage: r.layerSize
|
|
2943
|
+
}, [
|
|
2944
|
+
r.layerSize,
|
|
2945
|
+
r.layerSize,
|
|
2946
|
+
r.layerCount
|
|
2947
|
+
]);
|
|
2948
|
+
let g = t.createBindGroup(k, {
|
|
2949
|
+
atlas: /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(p.createView(l.texture2dArray(l.f32)), "atlas"),
|
|
2950
|
+
sampler: m
|
|
2951
|
+
}), _ = V(t), v = ne(t, f, q), y = G(t, f, q, [1, 0]), b = G(t, f, q, [0, 1]), x = re(t, f, q), S = te(t, f), C = null, w = null, T = null, O = 0, A = 0, j = 0;
|
|
2952
|
+
function M(e, n) {
|
|
2953
|
+
let r = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(t.createTexture({
|
|
2954
|
+
size: [e, n],
|
|
2955
|
+
format: q
|
|
2956
|
+
}).$usage("sampled", "render"), "texture");
|
|
2957
|
+
return {
|
|
2958
|
+
texture: r,
|
|
2959
|
+
bindGroup: t.createBindGroup(B, {
|
|
2960
|
+
source: /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(r.createView(l.texture2d(l.f32)), "source"),
|
|
2961
|
+
sampler: h
|
|
2962
|
+
})
|
|
2963
|
+
};
|
|
2964
|
+
}
|
|
2965
|
+
function N(e, n) {
|
|
2966
|
+
return t.createBindGroup(K, {
|
|
2967
|
+
scene: /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(e.texture.createView(l.texture2d(l.f32)), "scene"),
|
|
2968
|
+
bloom: /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(n.texture.createView(l.texture2d(l.f32)), "bloom"),
|
|
2969
|
+
sampler: h
|
|
2970
|
+
});
|
|
2971
|
+
}
|
|
2972
|
+
let P = null, F = null, I = null, L = null, R = null, H = null, U = 0, W = 0;
|
|
2973
|
+
function Y(e, n) {
|
|
2974
|
+
A = n;
|
|
2975
|
+
let r = Math.max(1, Math.floor(e / i));
|
|
2976
|
+
if (r !== O && (C?.buffer.destroy(), O = r, C = /*#__PURE__*/ (globalThis.__TYPEGPU_AUTONAME__ ?? ((e) => e))(t.createMutable(l.arrayOf(E, O)), "columns"), C.write(J(O, n, i, d.speedRange, s)), w = ee(t, C, f), T = z(t, C, f, q)), e !== U || n !== W) {
|
|
2977
|
+
U = e, W = n;
|
|
2978
|
+
let t = Math.max(1, Math.floor(e / 2)), r = Math.max(1, Math.floor(n / 2));
|
|
2979
|
+
P?.texture.destroy(), P = M(e, n), F?.texture.destroy(), F = M(t, r), I?.texture.destroy(), I = M(t, r), L?.texture.destroy(), L = M(t, r), R?.texture.destroy(), R = M(e, n), H = N(P, L);
|
|
2980
|
+
}
|
|
2981
|
+
f.patch({ resolution: l.vec2f(e, n) });
|
|
2982
|
+
}
|
|
2983
|
+
function X() {
|
|
2984
|
+
C && C.write(J(O, A, i, d.speedRange, s));
|
|
2985
|
+
}
|
|
2986
|
+
function Z(e, t) {
|
|
2987
|
+
j += e;
|
|
2988
|
+
let n = 1 / o;
|
|
2989
|
+
f.patch({
|
|
2990
|
+
time: t,
|
|
2991
|
+
density: a,
|
|
2992
|
+
depthDim: d.depthDim,
|
|
2993
|
+
bloomThreshold: c.threshold,
|
|
2994
|
+
bloomIntensity: c.intensity,
|
|
2995
|
+
headEmission: c.enabled ? c.emission : 1,
|
|
2996
|
+
scanlineStrength: u.scanlineStrength,
|
|
2997
|
+
aberration: u.aberration
|
|
2998
|
+
});
|
|
2999
|
+
let r = Math.ceil(O / 64);
|
|
3000
|
+
for (; j >= n;) j -= n, w && r > 0 && w.dispatchWorkgroups(r);
|
|
3001
|
+
f.patch({ stepProgress: j / n });
|
|
3002
|
+
}
|
|
3003
|
+
function Q() {
|
|
3004
|
+
let e = Math.ceil(O / 64);
|
|
3005
|
+
if (!w || e <= 0 || A <= 0) return;
|
|
3006
|
+
let t = A / i, n = Math.max((d.speedRange[0] + d.speedRange[1]) / 2, 1e-4), r = Math.max(1, Math.ceil(t / n)), a = 1 / o;
|
|
3007
|
+
for (let t = 0; t < r; t++) f.patch({ time: (t + 1) * a }), w.dispatchWorkgroups(e);
|
|
3008
|
+
f.patch({ stepProgress: 0 });
|
|
3009
|
+
}
|
|
3010
|
+
function ie() {
|
|
3011
|
+
if (!T || !P) return;
|
|
3012
|
+
T.with(g).withColorAttachment({ view: P.texture }).draw(3);
|
|
3013
|
+
let e = P;
|
|
3014
|
+
c.enabled && F && I && L && H && R && (v.with(P.bindGroup).withColorAttachment({ view: F.texture }).draw(3), y.with(F.bindGroup).withColorAttachment({ view: I.texture }).draw(3), b.with(I.bindGroup).withColorAttachment({ view: L.texture }).draw(3), x.with(H).withColorAttachment({ view: R.texture }).draw(3), e = R), (u.enabled ? S : _).with(e.bindGroup).withColorAttachment({ view: n }).draw(3);
|
|
3015
|
+
}
|
|
3016
|
+
function ae(e) {
|
|
3017
|
+
a = e;
|
|
3018
|
+
}
|
|
3019
|
+
function oe(e) {
|
|
3020
|
+
o = e;
|
|
3021
|
+
}
|
|
3022
|
+
function se(e) {
|
|
3023
|
+
s = e;
|
|
3024
|
+
}
|
|
3025
|
+
function ce(e) {
|
|
3026
|
+
c = e;
|
|
3027
|
+
}
|
|
3028
|
+
function le(e) {
|
|
3029
|
+
u = e;
|
|
3030
|
+
}
|
|
3031
|
+
function $(e) {
|
|
3032
|
+
d = e;
|
|
3033
|
+
}
|
|
3034
|
+
function ue() {
|
|
3035
|
+
f.buffer.destroy(), C?.buffer.destroy(), C = null, w = null, T = null, P?.texture.destroy(), P = null, F?.texture.destroy(), F = null, I?.texture.destroy(), I = null, L?.texture.destroy(), L = null, R?.texture.destroy(), R = null;
|
|
3036
|
+
}
|
|
3037
|
+
function de() {
|
|
3038
|
+
return O;
|
|
3039
|
+
}
|
|
3040
|
+
return {
|
|
3041
|
+
resize: Y,
|
|
3042
|
+
step: Z,
|
|
3043
|
+
settle: Q,
|
|
3044
|
+
render: ie,
|
|
3045
|
+
setDensity: ae,
|
|
3046
|
+
setStepRate: oe,
|
|
3047
|
+
setTailRange: se,
|
|
3048
|
+
setBloom: ce,
|
|
3049
|
+
setCrt: le,
|
|
3050
|
+
setParallax: $,
|
|
3051
|
+
regenerate: X,
|
|
3052
|
+
getColumnCount: de,
|
|
3053
|
+
dispose: ue
|
|
3054
|
+
};
|
|
3055
|
+
}
|
|
3056
|
+
//#endregion
|
|
3057
|
+
//#region src/hooks/use-matrix-rain-renderer.ts
|
|
3058
|
+
function X(i) {
|
|
3059
|
+
let a = o(), s = n(null), c = n(i);
|
|
3060
|
+
c.current = i;
|
|
3061
|
+
let [l, u] = r(0), d = n(0), f = n(null), p = n(!1);
|
|
3062
|
+
t(() => {
|
|
3063
|
+
let e = !1;
|
|
3064
|
+
return x().then((t) => {
|
|
3065
|
+
e || (f.current = t);
|
|
3066
|
+
}), () => {
|
|
3067
|
+
e = !0;
|
|
3068
|
+
};
|
|
3069
|
+
}, []), t(() => () => {
|
|
3070
|
+
s.current?.dispose(), s.current = null, d.current = 0, u(0);
|
|
3071
|
+
}, [i.cellSize]);
|
|
3072
|
+
let [m, h] = i.parallax.speedRange, [g, _] = i.tailRange;
|
|
3073
|
+
t(() => {
|
|
3074
|
+
let e = s.current;
|
|
3075
|
+
e && (e.setParallax(i.parallax), e.setTailRange(i.tailRange), e.regenerate());
|
|
3076
|
+
}, [
|
|
3077
|
+
m,
|
|
3078
|
+
h,
|
|
3079
|
+
g,
|
|
3080
|
+
_
|
|
3081
|
+
]);
|
|
3082
|
+
function v(e, t) {
|
|
3083
|
+
if (!p.current) try {
|
|
3084
|
+
y(e, t);
|
|
3085
|
+
} catch (e) {
|
|
3086
|
+
p.current = !0, s.current?.dispose(), s.current = null;
|
|
3087
|
+
let t = e instanceof Error ? e : Error(String(e)), n = c.current.onError;
|
|
3088
|
+
n ? n(t) : console.error("[matrix-rain] renderer stopped after error:", t);
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3091
|
+
function y(e, t) {
|
|
3092
|
+
let n = c.current.ctxRef.current, r = f.current;
|
|
3093
|
+
if (!n || !r) return;
|
|
3094
|
+
let i = n.canvas, o = i.width === 300 && i.height === 150, l = "clientWidth" in i && (i.clientWidth !== 300 || i.clientHeight !== 150);
|
|
3095
|
+
if (o && l) return;
|
|
3096
|
+
if (!s.current) {
|
|
3097
|
+
let e = Y({
|
|
3098
|
+
root: a,
|
|
3099
|
+
ctx: n,
|
|
3100
|
+
atlas: r,
|
|
3101
|
+
cellSize: c.current.cellSize,
|
|
3102
|
+
density: c.current.density,
|
|
3103
|
+
stepRate: c.current.stepRate,
|
|
3104
|
+
tailRange: c.current.tailRange,
|
|
3105
|
+
bloom: c.current.bloom,
|
|
3106
|
+
crt: c.current.crt,
|
|
3107
|
+
parallax: c.current.parallax
|
|
3108
|
+
});
|
|
3109
|
+
e.resize(n.canvas.width, n.canvas.height), e.settle(), s.current = e;
|
|
3110
|
+
}
|
|
3111
|
+
let p = s.current;
|
|
3112
|
+
p.resize(i.width, i.height), p.setDensity(c.current.density), p.setStepRate(c.current.stepRate), p.setParallax(c.current.parallax), p.setBloom(c.current.bloom), p.setCrt(c.current.crt), c.current.paused || p.step(e, t), p.render();
|
|
3113
|
+
let m = p.getColumnCount();
|
|
3114
|
+
m !== d.current && (d.current = m, u(m));
|
|
3115
|
+
}
|
|
3116
|
+
return {
|
|
3117
|
+
tick: v,
|
|
3118
|
+
regenerate: e(() => {
|
|
3119
|
+
s.current?.regenerate();
|
|
3120
|
+
}, []),
|
|
3121
|
+
columnCount: l
|
|
3122
|
+
};
|
|
3123
|
+
}
|
|
3124
|
+
//#endregion
|
|
3125
|
+
//#region src/matrix-rain.tsx
|
|
3126
|
+
var Z = {
|
|
3127
|
+
rain: {
|
|
3128
|
+
fontSize: 20,
|
|
3129
|
+
density: .95,
|
|
3130
|
+
stepRate: 10,
|
|
3131
|
+
tailRange: [8, 35]
|
|
3132
|
+
},
|
|
3133
|
+
parallax: {
|
|
3134
|
+
speedRange: [.4, 1.5],
|
|
3135
|
+
depthDim: .3
|
|
3136
|
+
},
|
|
3137
|
+
bloom: {
|
|
3138
|
+
intensity: 1.5,
|
|
3139
|
+
threshold: .8,
|
|
3140
|
+
emission: 1.1
|
|
3141
|
+
},
|
|
3142
|
+
crt: {
|
|
3143
|
+
scanlineStrength: .3,
|
|
3144
|
+
aberration: 1
|
|
3145
|
+
}
|
|
3146
|
+
}, Q = typeof window > "u" ? 1 : window.devicePixelRatio || 1, [ie, ae, oe] = I.background, se = {
|
|
3147
|
+
position: "absolute",
|
|
3148
|
+
inset: 0,
|
|
3149
|
+
width: "100%",
|
|
3150
|
+
height: "100%",
|
|
3151
|
+
display: "block",
|
|
3152
|
+
pointerEvents: "none",
|
|
3153
|
+
backgroundColor: `rgb(${Math.round(ie * 255)}, ${Math.round(ae * 255)}, ${Math.round(oe * 255)})`
|
|
3154
|
+
};
|
|
3155
|
+
function ce(e) {
|
|
3156
|
+
return {
|
|
3157
|
+
fontSize: e?.fontSize ?? Z.rain.fontSize,
|
|
3158
|
+
density: e?.density ?? Z.rain.density,
|
|
3159
|
+
stepRate: e?.stepRate ?? Z.rain.stepRate,
|
|
3160
|
+
tailRange: e?.tailRange ?? Z.rain.tailRange
|
|
3161
|
+
};
|
|
3162
|
+
}
|
|
3163
|
+
function le(e) {
|
|
3164
|
+
return {
|
|
3165
|
+
enabled: e !== !1,
|
|
3166
|
+
intensity: (e || void 0)?.intensity ?? Z.bloom.intensity,
|
|
3167
|
+
threshold: (e || void 0)?.threshold ?? Z.bloom.threshold,
|
|
3168
|
+
emission: (e || void 0)?.emission ?? Z.bloom.emission
|
|
3169
|
+
};
|
|
3170
|
+
}
|
|
3171
|
+
function $(e) {
|
|
3172
|
+
return {
|
|
3173
|
+
enabled: e !== !1,
|
|
3174
|
+
scanlineStrength: (e || void 0)?.scanlineStrength ?? Z.crt.scanlineStrength,
|
|
3175
|
+
aberration: (e || void 0)?.aberration ?? Z.crt.aberration
|
|
3176
|
+
};
|
|
3177
|
+
}
|
|
3178
|
+
function ue(e) {
|
|
3179
|
+
return e === !1 ? {
|
|
3180
|
+
speedRange: [1, 1],
|
|
3181
|
+
depthDim: 0
|
|
3182
|
+
} : {
|
|
3183
|
+
speedRange: e?.speedRange ?? Z.parallax.speedRange,
|
|
3184
|
+
depthDim: e?.depthDim ?? Z.parallax.depthDim
|
|
3185
|
+
};
|
|
3186
|
+
}
|
|
3187
|
+
function de(e) {
|
|
3188
|
+
let n = s(), r = n.status, i = r === "rejected" ? n.error : void 0, a = e.onError;
|
|
3189
|
+
return t(() => {
|
|
3190
|
+
if (r !== "rejected") return;
|
|
3191
|
+
let e = i instanceof Error ? i : Error(String(i));
|
|
3192
|
+
a ? a(e) : console.warn("[matrix-rain] WebGPU unavailable; rendering nothing.", e);
|
|
3193
|
+
}, [
|
|
3194
|
+
r,
|
|
3195
|
+
i,
|
|
3196
|
+
a
|
|
3197
|
+
]), t(() => {
|
|
3198
|
+
n.status === "resolved" && n.value.device.lost.then((e) => {
|
|
3199
|
+
console.warn("[matrix-rain] GPUDevice lost:", e.reason, e.message);
|
|
3200
|
+
});
|
|
3201
|
+
}, [n]), r === "resolved" ? /* @__PURE__ */ p(fe, { ...e }) : null;
|
|
3202
|
+
}
|
|
3203
|
+
function fe(e) {
|
|
3204
|
+
let { ref: t, ctxRef: n } = i({
|
|
3205
|
+
autoResize: !0,
|
|
3206
|
+
alphaMode: "premultiplied"
|
|
3207
|
+
}), r = ce(e.rain), o = X({
|
|
3208
|
+
ctxRef: n,
|
|
3209
|
+
cellSize: r.fontSize * Q,
|
|
3210
|
+
density: r.density,
|
|
3211
|
+
stepRate: r.stepRate,
|
|
3212
|
+
tailRange: r.tailRange,
|
|
3213
|
+
bloom: le(e.bloom),
|
|
3214
|
+
crt: $(e.crt),
|
|
3215
|
+
parallax: ue(e.parallax),
|
|
3216
|
+
paused: e.paused ?? !1,
|
|
3217
|
+
onError: e.onError
|
|
3218
|
+
});
|
|
3219
|
+
return a(({ deltaSeconds: e, elapsedSeconds: t }) => {
|
|
3220
|
+
o.tick(e, t);
|
|
3221
|
+
}), /* @__PURE__ */ p("canvas", {
|
|
3222
|
+
ref: t,
|
|
3223
|
+
className: e.className,
|
|
3224
|
+
style: se
|
|
3225
|
+
});
|
|
3226
|
+
}
|
|
3227
|
+
//#endregion
|
|
3228
|
+
//#region src/gpu/feature-detect.ts
|
|
3229
|
+
var pe = () => typeof navigator < "u" && "gpu" in navigator;
|
|
3230
|
+
//#endregion
|
|
3231
|
+
export { de as MatrixRainWebGPU, pe as isWebGPUSupported };
|