ugly-game 0.15.44 → 0.15.46
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/anim/animEval.js +5 -1
- package/dist/assets/gpuSkin.js +35 -12
- package/dist/flightTestFixture.d.mts +2 -0
- package/dist/flightTestFixture.mjs +57 -0
- package/dist/gpuShadow.d.ts +1133 -0
- package/dist/gpuShadow.js +4463 -0
- package/package.json +1 -1
package/dist/anim/animEval.js
CHANGED
|
@@ -75,7 +75,11 @@ function sampleSlot(rig, slot) {
|
|
|
75
75
|
const d = slot.clip.duration;
|
|
76
76
|
// ⚠️ `loop === false` CLAMPS. A clip whose last pose differs from its first
|
|
77
77
|
// snaps at every wrap — see `LayerSlot.loop`.
|
|
78
|
-
const t = d > 0
|
|
78
|
+
const t = d > 0
|
|
79
|
+
? slot.loop === false
|
|
80
|
+
? Math.max(0, Math.min(slot.time, d))
|
|
81
|
+
: ((slot.time % d) + d) % d
|
|
82
|
+
: 0;
|
|
79
83
|
// ⚠️ NOT `sampleClipToLocals` — that returns composed Mat4s, and rotations
|
|
80
84
|
// cannot be blended once composed. `sampleClipToTRS` is its TRS-level twin,
|
|
81
85
|
// proven byte-equivalent by animSample.test.ts.
|
package/dist/assets/gpuSkin.js
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
/// <reference types="@webgpu/types" preserve="true" />
|
|
2
|
+
/**
|
|
3
|
+
* Every GPUBuffer owned by one packed creature, stated exhaustively.
|
|
4
|
+
*
|
|
5
|
+
* `setCreatures` replaces the complete packed list. Keeping teardown as a typed
|
|
6
|
+
* record means adding a buffer to `Packed` without adding it here is a compile
|
|
7
|
+
* error instead of a per-frame leak that only appears under a clothed actor.
|
|
8
|
+
*/
|
|
9
|
+
const PACKED_BUFFER_KEYS = {
|
|
10
|
+
restB: true,
|
|
11
|
+
restNB: true,
|
|
12
|
+
jointsB: true,
|
|
13
|
+
weightsB: true,
|
|
14
|
+
defB: true,
|
|
15
|
+
defNB: true,
|
|
16
|
+
colB: true,
|
|
17
|
+
uvB: true,
|
|
18
|
+
uv2B: true,
|
|
19
|
+
idxB: true,
|
|
20
|
+
uBuf: true,
|
|
21
|
+
palB: true,
|
|
22
|
+
pB: true,
|
|
23
|
+
instModelB: true,
|
|
24
|
+
instParamB: true,
|
|
25
|
+
};
|
|
26
|
+
function destroyPackedBuffers(packed) {
|
|
27
|
+
for (const key of Object.keys(PACKED_BUFFER_KEYS))
|
|
28
|
+
packed[key]?.destroy();
|
|
29
|
+
}
|
|
2
30
|
export const MAX_CASCADES = 4; // must match gpuShadow's
|
|
3
31
|
const SKIN = /* wgsl */ `
|
|
4
32
|
@group(0) @binding(0) var<storage,read> rest: array<vec4f>;
|
|
@@ -423,18 +451,8 @@ export class GpuSkinRenderer {
|
|
|
423
451
|
}
|
|
424
452
|
setCreatures(list) {
|
|
425
453
|
const dev = this.device, U = GPUBufferUsage;
|
|
426
|
-
for (const p of this.packed)
|
|
427
|
-
p
|
|
428
|
-
p.defNB.destroy();
|
|
429
|
-
p.colB.destroy();
|
|
430
|
-
p.uvB.destroy();
|
|
431
|
-
p.uv2B?.destroy();
|
|
432
|
-
p.idxB.destroy();
|
|
433
|
-
p.uBuf.destroy();
|
|
434
|
-
p.palB.destroy();
|
|
435
|
-
p.instModelB?.destroy();
|
|
436
|
-
p.instParamB?.destroy();
|
|
437
|
-
}
|
|
454
|
+
for (const p of this.packed)
|
|
455
|
+
destroyPackedBuffers(p);
|
|
438
456
|
this.packed = list.map((c) => {
|
|
439
457
|
const n = c.rest.length / 3;
|
|
440
458
|
const rest = new Float32Array(n * 4), restN = new Float32Array(n * 4), joints = new Uint32Array(n * 4), weights = new Float32Array(n * 4);
|
|
@@ -578,6 +596,10 @@ export class GpuSkinRenderer {
|
|
|
578
596
|
instBG,
|
|
579
597
|
instModelB,
|
|
580
598
|
instParamB,
|
|
599
|
+
restB,
|
|
600
|
+
restNB,
|
|
601
|
+
jointsB,
|
|
602
|
+
weightsB,
|
|
581
603
|
defB,
|
|
582
604
|
defNB,
|
|
583
605
|
colB,
|
|
@@ -590,6 +612,7 @@ export class GpuSkinRenderer {
|
|
|
590
612
|
uBuf,
|
|
591
613
|
uBG,
|
|
592
614
|
palB,
|
|
615
|
+
pB,
|
|
593
616
|
n,
|
|
594
617
|
model: c.model,
|
|
595
618
|
mix: c.mix ?? 0,
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { FLIGHT_CHANNELS } from './flightTypes';
|
|
2
|
+
const emptyCounts = () => Object.fromEntries(FLIGHT_CHANNELS.map((channel) => [channel, 0]));
|
|
3
|
+
export function fixtureCapture() {
|
|
4
|
+
const channels = Object.fromEntries(FLIGHT_CHANNELS.map((channel) => [channel, []]));
|
|
5
|
+
channels.inputs = [
|
|
6
|
+
{ sequence: 2, monotonicMs: 2, tick: 0, kind: 0, flags: 0, payload: new Uint8Array([7]) },
|
|
7
|
+
];
|
|
8
|
+
channels.lifecycle = [
|
|
9
|
+
{ sequence: 1, monotonicMs: 1, tick: null, kind: 2, flags: 0, payload: new Uint8Array([8]) },
|
|
10
|
+
];
|
|
11
|
+
return {
|
|
12
|
+
header: {
|
|
13
|
+
recorderSchema: 1,
|
|
14
|
+
gameSchema: 2,
|
|
15
|
+
checkpointSchema: 3,
|
|
16
|
+
inputSchema: 4,
|
|
17
|
+
app: 'test',
|
|
18
|
+
buildId: 'build',
|
|
19
|
+
sessionId: 'session',
|
|
20
|
+
startedAtMs: 1,
|
|
21
|
+
capturedAtMs: 2,
|
|
22
|
+
capturedAtMonotonicMs: 2,
|
|
23
|
+
capturedAtTick: 0,
|
|
24
|
+
tickRate: 60,
|
|
25
|
+
environment: { runtime: 'node' },
|
|
26
|
+
reason: ['manual'],
|
|
27
|
+
},
|
|
28
|
+
anchor: {
|
|
29
|
+
requestId: 1,
|
|
30
|
+
tick: 0,
|
|
31
|
+
monotonicMs: 0,
|
|
32
|
+
schema: 3,
|
|
33
|
+
checkpoint: new Uint8Array([1, 2, 3]),
|
|
34
|
+
rng: new Uint32Array([4, 5]),
|
|
35
|
+
encodedBytes: 3,
|
|
36
|
+
transferBytes: 3,
|
|
37
|
+
},
|
|
38
|
+
channels,
|
|
39
|
+
truncation: {
|
|
40
|
+
dropped: emptyCounts(),
|
|
41
|
+
droppedBytes: emptyCounts(),
|
|
42
|
+
rejectedOversize: emptyCounts(),
|
|
43
|
+
},
|
|
44
|
+
replay: { status: 'unverified' },
|
|
45
|
+
selfTelemetry: {
|
|
46
|
+
calls: 1,
|
|
47
|
+
averageMs: 0.01,
|
|
48
|
+
p95Ms: 0.02,
|
|
49
|
+
p99Ms: 0.02,
|
|
50
|
+
maxMs: 0.02,
|
|
51
|
+
retainedBytes: 100,
|
|
52
|
+
checkpointRequests: 1,
|
|
53
|
+
checkpointFailures: 0,
|
|
54
|
+
checkpointMs: 1,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|