ugly-game 0.15.24 → 0.15.25

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.
@@ -1,2 +1,20 @@
1
1
  import type { RawMesh } from './geometry';
2
- export declare function buildLodLadder(m: RawMesh, ratios: number[]): Promise<RawMesh[]>;
2
+ /**
3
+ * One rung, plus HOW WRONG IT IS — the number a render-size LOD selector runs on.
4
+ *
5
+ * `error` is the rung's geometric deviation from the source in the mesh's own units. meshopt returns
6
+ * it relative to the mesh extent, so it is multiplied by `getScale` here and never leaves this module
7
+ * in relative form: a caller comparing a relative error against a world-space budget would be right
8
+ * only for a mesh that happens to be one unit across.
9
+ *
10
+ * It was being DISCARDED. `simplify` has always returned `[indices, error]` and every caller
11
+ * destructured the first element alone, which left every consumer with no way to ask the only
12
+ * question that matters at draw time — "is this rung good enough from here?" — and forced them to
13
+ * guess from triangle counts or hardcoded distance bands instead.
14
+ */
15
+ export interface LodRung extends RawMesh {
16
+ /** Absolute geometric deviation from the source, in the mesh's own units. Exactly 0 for the
17
+ * source rung, and non-decreasing as the ladder coarsens. */
18
+ error: number;
19
+ }
20
+ export declare function buildLodLadder(m: RawMesh, ratios: number[]): Promise<LodRung[]>;
@@ -4,15 +4,22 @@
4
4
  import { MeshoptSimplifier } from 'meshoptimizer';
5
5
  export async function buildLodLadder(m, ratios) {
6
6
  await MeshoptSimplifier.ready;
7
+ // Extent of the SOURCE mesh, taken once: every rung reuses the source's position array, so a
8
+ // per-rung scale would be the same number computed n times.
9
+ const scale = MeshoptSimplifier.getScale(m.positions, 3);
7
10
  const out = [];
8
11
  for (const r of ratios) {
9
12
  if (r >= 1) {
10
- out.push({ positions: m.positions, indices: m.indices });
13
+ out.push({ positions: m.positions, indices: m.indices, error: 0 });
11
14
  continue;
12
15
  }
13
16
  const targetCount = Math.max(3, Math.floor((m.indices.length * r) / 3) * 3);
14
- const [simplified] = MeshoptSimplifier.simplify(m.indices, m.positions, 3, targetCount, 0.05, ['LockBorder']);
15
- out.push({ positions: m.positions, indices: Uint32Array.from(simplified) });
17
+ const [simplified, relError] = MeshoptSimplifier.simplify(m.indices, m.positions, 3, targetCount, 0.05, ['LockBorder']);
18
+ out.push({
19
+ positions: m.positions,
20
+ indices: Uint32Array.from(simplified),
21
+ error: relError * scale,
22
+ });
16
23
  }
17
24
  return out;
18
25
  }
@@ -0,0 +1,56 @@
1
+ import type { LodLevel } from './ugm';
2
+ /**
3
+ * Pixels per unit of (size / distance) — the one camera number this file needs.
4
+ *
5
+ * Both halves of the perspective are in here: `viewportHeightPx` carries the resolution and
6
+ * `fovY` the zoom, so a selector fed this value tracks a window resize and a scope-in without
7
+ * knowing that either happened.
8
+ */
9
+ export declare function focalPixels(fovY: number, viewportHeightPx: number): number;
10
+ /**
11
+ * How many pixels a rung's geometric error covers from `distance` away.
12
+ *
13
+ * `worldScale` is the instance's own scale — metres per model unit — because the table is cooked in
14
+ * model units. Two copies of one species at 1x and 3x are genuinely different LOD problems and this
15
+ * is where they separate.
16
+ */
17
+ export declare function projectedErrorPx(error: number, worldScale: number, distance: number, focalPx: number): number;
18
+ /**
19
+ * RENDER SIZE: how tall the whole model stands on screen, in pixels, from `distance` away.
20
+ *
21
+ * Not what selection runs on — error is — but it is the number a human can judge, so it is what
22
+ * telemetry and lab readouts should show. "This broadleaf is 14 px tall and drawing 6,000 triangles"
23
+ * is a legible bug report; "its projected error is 0.4 px" is not.
24
+ *
25
+ * `radius` is the container's `bounds[0]`, so this is the bounding-sphere diameter and reads a
26
+ * little generous for a tall thin plant. That is the right direction to be wrong in for a readout.
27
+ */
28
+ export declare function projectedSizePx(radius: number, worldScale: number, distance: number, focalPx: number): number;
29
+ export interface LodPick {
30
+ /** Instance scale, in metres per model unit. */
31
+ worldScale: number;
32
+ /** Metres from the camera to the instance. */
33
+ distance: number;
34
+ /** From `focalPixels`. */
35
+ focalPx: number;
36
+ /** The quality knob: geometric deviation, in pixels, you are willing not to notice. ~1 px is
37
+ * conservative; raising it is the cheapest quality-for-speed trade in the renderer. */
38
+ tolerancePx: number;
39
+ }
40
+ /**
41
+ * The COARSEST rung whose error stays inside the pixel budget — or the finest, if none does.
42
+ *
43
+ * `levels` must be ascending by `detailLevel`, which is what `readLodChunk` returns. Nothing is
44
+ * sorted or allocated here on purpose: this runs once per decor instance per rebuild, thousands of
45
+ * times, and a sort per call would cost more than the draw it is saving.
46
+ *
47
+ * ⚠️ CORRECT ON A BROKEN LADDER, and two shipped containers need it to be. `flora.fungal.lumen` was
48
+ * cooked with three identical coarse rungs; scanning coarse-to-fine for the first rung that FITS
49
+ * picks the cheapest of those three rather than assuming error falls monotonically and bisecting
50
+ * into the wrong one. A defective cook should cost triangles, not correctness.
51
+ *
52
+ * ⚠️ AND DEGENERATE INPUT RESOLVES TO THE FINEST RUNG. A zero viewport during layout, a
53
+ * not-yet-known scale, a camera exactly on top of a plant: every one of those is a moment where
54
+ * guessing coarse would show a visible pop for no measurable saving.
55
+ */
56
+ export declare function pickDetailLevel(levels: readonly LodLevel[], p: LodPick): number;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Pixels per unit of (size / distance) — the one camera number this file needs.
3
+ *
4
+ * Both halves of the perspective are in here: `viewportHeightPx` carries the resolution and
5
+ * `fovY` the zoom, so a selector fed this value tracks a window resize and a scope-in without
6
+ * knowing that either happened.
7
+ */
8
+ export function focalPixels(fovY, viewportHeightPx) {
9
+ const t = Math.tan(fovY / 2);
10
+ return t > 0 ? viewportHeightPx / 2 / t : 0;
11
+ }
12
+ /**
13
+ * How many pixels a rung's geometric error covers from `distance` away.
14
+ *
15
+ * `worldScale` is the instance's own scale — metres per model unit — because the table is cooked in
16
+ * model units. Two copies of one species at 1x and 3x are genuinely different LOD problems and this
17
+ * is where they separate.
18
+ */
19
+ export function projectedErrorPx(error, worldScale, distance, focalPx) {
20
+ return distance > 0 ? (error * worldScale * focalPx) / distance : Infinity;
21
+ }
22
+ /**
23
+ * RENDER SIZE: how tall the whole model stands on screen, in pixels, from `distance` away.
24
+ *
25
+ * Not what selection runs on — error is — but it is the number a human can judge, so it is what
26
+ * telemetry and lab readouts should show. "This broadleaf is 14 px tall and drawing 6,000 triangles"
27
+ * is a legible bug report; "its projected error is 0.4 px" is not.
28
+ *
29
+ * `radius` is the container's `bounds[0]`, so this is the bounding-sphere diameter and reads a
30
+ * little generous for a tall thin plant. That is the right direction to be wrong in for a readout.
31
+ */
32
+ export function projectedSizePx(radius, worldScale, distance, focalPx) {
33
+ return distance > 0
34
+ ? (2 * radius * worldScale * focalPx) / distance
35
+ : Infinity;
36
+ }
37
+ /**
38
+ * The COARSEST rung whose error stays inside the pixel budget — or the finest, if none does.
39
+ *
40
+ * `levels` must be ascending by `detailLevel`, which is what `readLodChunk` returns. Nothing is
41
+ * sorted or allocated here on purpose: this runs once per decor instance per rebuild, thousands of
42
+ * times, and a sort per call would cost more than the draw it is saving.
43
+ *
44
+ * ⚠️ CORRECT ON A BROKEN LADDER, and two shipped containers need it to be. `flora.fungal.lumen` was
45
+ * cooked with three identical coarse rungs; scanning coarse-to-fine for the first rung that FITS
46
+ * picks the cheapest of those three rather than assuming error falls monotonically and bisecting
47
+ * into the wrong one. A defective cook should cost triangles, not correctness.
48
+ *
49
+ * ⚠️ AND DEGENERATE INPUT RESOLVES TO THE FINEST RUNG. A zero viewport during layout, a
50
+ * not-yet-known scale, a camera exactly on top of a plant: every one of those is a moment where
51
+ * guessing coarse would show a visible pop for no measurable saving.
52
+ */
53
+ export function pickDetailLevel(levels, p) {
54
+ const n = levels.length;
55
+ if (n === 0)
56
+ return 0;
57
+ const finest = levels[n - 1].detailLevel;
58
+ if (!(p.tolerancePx > 0) ||
59
+ !(p.distance > 0) ||
60
+ !(p.focalPx > 0) ||
61
+ !(p.worldScale > 0))
62
+ return finest;
63
+ for (let i = 0; i < n; i++) {
64
+ const l = levels[i];
65
+ if (projectedErrorPx(l.error, p.worldScale, p.distance, p.focalPx) <=
66
+ p.tolerancePx)
67
+ return l.detailLevel;
68
+ }
69
+ return finest;
70
+ }
@@ -1,15 +1,33 @@
1
- export declare enum ChunkKind {
2
- VTX = 1,
3
- IDX = 2,
4
- CLUSTER = 3,
5
- MIP = 4,
6
- MAT = 5,
7
- SKEL = 6,
8
- ANIM = 7,
9
- MORPH = 8,
10
- UV = 9,
11
- KTX2 = 10
12
- }
1
+ /**
2
+ * A const object rather than a TS `enum`, and the reason is that the package's own test runner could
3
+ * not read this file otherwise.
4
+ *
5
+ * `node --experimental-strip-types` — which runs every test in `game/src` — refuses an `enum`: it is
6
+ * the one TypeScript construct that emits runtime code, so strip-only mode cannot erase it. That is
7
+ * why there has never been a container test in this package despite `.ugm` being the format
8
+ * everything else is cooked into. The shape below is erasable, so the format is now testable where it
9
+ * lives.
10
+ *
11
+ * Source-compatible for readers: `ChunkKind.VTX` still resolves, and `ChunkKind` still names the
12
+ * type. The one behaviour that changes is that a bare `number` no longer assigns to it without a
13
+ * cast, which is a numeric-enum looseness rather than something worth keeping.
14
+ */
15
+ export declare const ChunkKind: {
16
+ readonly VTX: 1;
17
+ readonly IDX: 2;
18
+ readonly CLUSTER: 3;
19
+ readonly MIP: 4;
20
+ readonly MAT: 5;
21
+ readonly SKEL: 6;
22
+ readonly ANIM: 7;
23
+ readonly MORPH: 8;
24
+ readonly UV: 9;
25
+ readonly KTX2: 10;
26
+ /** The LOD SELECTION TABLE — see packLodChunk. One per container, `base: true`, so a coarse
27
+ * prefix can already answer "which rung should I draw from here?". */
28
+ readonly LOD: 11;
29
+ };
30
+ export type ChunkKind = (typeof ChunkKind)[keyof typeof ChunkKind];
13
31
  export interface ChunkIn {
14
32
  kind: ChunkKind;
15
33
  detailLevel: number;
@@ -57,3 +75,41 @@ export interface UgmHeader {
57
75
  export declare function readHeader(buf: Uint8Array): UgmHeader;
58
76
  export declare function readToc(buf: Uint8Array, h: UgmHeader): TocEntry[];
59
77
  export declare function readChunk(buf: Uint8Array, e: TocEntry): Uint8Array;
78
+ export declare const LOD_MAGIC = 1145849685;
79
+ export declare const LOD_CHUNK_VERSION = 1;
80
+ export interface LodLevel {
81
+ /** The `detailLevel` this row describes — matches the VTX/IDX chunks of the same rung. */
82
+ detailLevel: number;
83
+ /**
84
+ * Geometric deviation of this rung from the source, in MODEL units.
85
+ *
86
+ * Model units, not metres, and the distinction is the whole contract: the cooks normalise their
87
+ * meshes (the life kit to unit height) and the world scales each instance as it places it, so an
88
+ * instance's world error is this number times ITS OWN scale. Baking metres in here would make the
89
+ * table wrong for every instance not drawn at 1x.
90
+ *
91
+ * 0 for the source rung, and non-decreasing as the ladder coarsens.
92
+ */
93
+ error: number;
94
+ }
95
+ /** Serialise a LOD selection table. Sorted by detailLevel so a reader can bisect it. */
96
+ export declare function packLodChunk(levels: LodLevel[]): Uint8Array;
97
+ /**
98
+ * Parse a LOD selection table, or return null when these bytes are not one.
99
+ *
100
+ * NULL RATHER THAN THROW, for the two cases that are normal rather than exceptional: a container
101
+ * cooked before the table existed has no LOD chunk at all, and a container being STREAMED advertises
102
+ * its whole TOC from byte 64 while the payload is still arriving — so a caller can hold a TOC entry
103
+ * whose bytes have not landed. Both mean "select some other way for now", not "this file is broken".
104
+ * A future version is treated the same way, so a new cook cannot crash an old client.
105
+ */
106
+ export declare function readLodChunk(bytes: Uint8Array): LodLevel[] | null;
107
+ /**
108
+ * One model's LOD table, or null if it carries none / has not streamed that far yet.
109
+ *
110
+ * ⚠️ KEYED BY `targetId`, because a container is not always one model. `nature.ugm` packs ten, each
111
+ * with its own ladder under its own targetId, so a per-CONTAINER lookup would hand all ten the first
112
+ * model's errors — a bush selecting rungs by a tree's simplification error. Single-model containers
113
+ * cook everything at targetId 0 and get the default.
114
+ */
115
+ export declare function lodTableOf(buf: Uint8Array, toc: TocEntry[], targetId?: number): LodLevel[] | null;
@@ -2,19 +2,35 @@
2
2
  // Layout (little-endian): [64B header][TOC: chunkCount × 24B][chunk bytes …].
3
3
  // Chunks are sorted base-first then ascending detailLevel, so a leading byte range
4
4
  // (0 .. basePayloadLen) is a complete coarse-renderable asset.
5
- export var ChunkKind;
6
- (function (ChunkKind) {
7
- ChunkKind[ChunkKind["VTX"] = 1] = "VTX";
8
- ChunkKind[ChunkKind["IDX"] = 2] = "IDX";
9
- ChunkKind[ChunkKind["CLUSTER"] = 3] = "CLUSTER";
10
- ChunkKind[ChunkKind["MIP"] = 4] = "MIP";
11
- ChunkKind[ChunkKind["MAT"] = 5] = "MAT";
12
- ChunkKind[ChunkKind["SKEL"] = 6] = "SKEL";
13
- ChunkKind[ChunkKind["ANIM"] = 7] = "ANIM";
14
- ChunkKind[ChunkKind["MORPH"] = 8] = "MORPH";
15
- ChunkKind[ChunkKind["UV"] = 9] = "UV";
16
- ChunkKind[ChunkKind["KTX2"] = 10] = "KTX2";
17
- })(ChunkKind || (ChunkKind = {}));
5
+ /**
6
+ * A const object rather than a TS `enum`, and the reason is that the package's own test runner could
7
+ * not read this file otherwise.
8
+ *
9
+ * `node --experimental-strip-types` — which runs every test in `game/src` — refuses an `enum`: it is
10
+ * the one TypeScript construct that emits runtime code, so strip-only mode cannot erase it. That is
11
+ * why there has never been a container test in this package despite `.ugm` being the format
12
+ * everything else is cooked into. The shape below is erasable, so the format is now testable where it
13
+ * lives.
14
+ *
15
+ * Source-compatible for readers: `ChunkKind.VTX` still resolves, and `ChunkKind` still names the
16
+ * type. The one behaviour that changes is that a bare `number` no longer assigns to it without a
17
+ * cast, which is a numeric-enum looseness rather than something worth keeping.
18
+ */
19
+ export const ChunkKind = {
20
+ VTX: 1,
21
+ IDX: 2,
22
+ CLUSTER: 3,
23
+ MIP: 4,
24
+ MAT: 5,
25
+ SKEL: 6,
26
+ ANIM: 7,
27
+ MORPH: 8,
28
+ UV: 9,
29
+ KTX2: 10,
30
+ /** The LOD SELECTION TABLE — see packLodChunk. One per container, `base: true`, so a coarse
31
+ * prefix can already answer "which rung should I draw from here?". */
32
+ LOD: 11,
33
+ };
18
34
  export const MAGIC = 0x324d4755; // "UGM2" little-endian
19
35
  export const HEADER_BYTES = 64;
20
36
  export const TOC_ENTRY_BYTES = 24; // kind1 detail1 targetId2 offset4 length4 hash4 depMask4 pad4
@@ -108,6 +124,9 @@ export function readToc(buf, h) {
108
124
  for (let i = 0; i < h.chunkCount; i++) {
109
125
  const t = h.tocOffset + i * TOC_ENTRY_BYTES;
110
126
  out.push({
127
+ // Cast: the byte on disk is whatever was written, including a kind this build has never heard
128
+ // of. Validating here would mean rejecting forward-compatible containers, and every consumer
129
+ // already filters by the kinds it wants — an unknown one is simply never matched.
111
130
  kind: dv.getUint8(t),
112
131
  detailLevel: dv.getUint8(t + 1),
113
132
  targetId: dv.getUint16(t + 2, true),
@@ -122,3 +141,98 @@ export function readToc(buf, h) {
122
141
  export function readChunk(buf, e) {
123
142
  return buf.subarray(e.offset, e.offset + e.length);
124
143
  }
144
+ // ─────────────────────────────────────────────────────────────────────────────
145
+ // THE LOD SELECTION TABLE (ChunkKind.LOD)
146
+ //
147
+ // A container has always described WHAT its rungs are — one VTX/IDX pair per detailLevel — and never
148
+ // how far away each one stops being good enough. Every consumer therefore invented its own answer:
149
+ // a distance band, a triangle-count guess, or the terrain chunk's stride. Those disagree with each
150
+ // other, none of them knows the field of view or the resolution, and none of them survives a mesh
151
+ // being re-cooked coarser.
152
+ //
153
+ // What the cook knows and the renderer does not is the GEOMETRIC ERROR: how far a rung's surface
154
+ // deviates from the source, in model units. That single number turns LOD selection into arithmetic —
155
+ // project the error through the camera and compare it against a pixel budget — and it is the one
156
+ // quantity that cannot be recovered at runtime, because the source mesh is not shipped.
157
+ //
158
+ // ⚠️ A CHUNK RATHER THAN THE 20 FREE HEADER BYTES. The header would hold four f32 errors today and
159
+ // nothing beyond five rungs, and `detailLevel` is a u8: a format whose extension budget runs out at
160
+ // the sixth rung is not one worth spending a version number on. A chunk also versions itself, is
161
+ // content-hashed and deduplicated like every other chunk, and — the part that made the decision —
162
+ // is INVISIBLE to readers that do not know about it, because every consumer filters the TOC by kind.
163
+ // Old readers see one extra chunk they ignore; new readers see an old file as "no table" and fall
164
+ // back. Neither direction needs a format-version bump, so this ships without re-cooking the world.
165
+ //
166
+ // Layout (little-endian):
167
+ // [u32 magic][u16 version][u8 levelCount][u8 flags] then levelCount x [u8 detailLevel][3B pad][f32 error]
168
+ //
169
+ // Pairs, not a bare f32 array indexed by position: `detailLevel` is free to be sparse — a container
170
+ // that ships rungs 0 and 3 and nothing between is legal — and a positional array would silently
171
+ // misattribute every error in that case.
172
+ // ─────────────────────────────────────────────────────────────────────────────
173
+ export const LOD_MAGIC = 0x444c4755; // "UGLD" little-endian
174
+ export const LOD_CHUNK_VERSION = 1;
175
+ const LOD_HEAD_BYTES = 8;
176
+ const LOD_LEVEL_BYTES = 8;
177
+ /** Serialise a LOD selection table. Sorted by detailLevel so a reader can bisect it. */
178
+ export function packLodChunk(levels) {
179
+ const sorted = [...levels].sort((a, b) => a.detailLevel - b.detailLevel);
180
+ if (sorted.length > 255)
181
+ throw new Error('.ugm LOD: levelCount exceeds the u8 field');
182
+ const out = new Uint8Array(LOD_HEAD_BYTES + sorted.length * LOD_LEVEL_BYTES);
183
+ const dv = new DataView(out.buffer);
184
+ dv.setUint32(0, LOD_MAGIC, true);
185
+ dv.setUint16(4, LOD_CHUNK_VERSION, true);
186
+ dv.setUint8(6, sorted.length);
187
+ dv.setUint8(7, 0); // flags reserved
188
+ for (let i = 0; i < sorted.length; i++) {
189
+ const o = LOD_HEAD_BYTES + i * LOD_LEVEL_BYTES;
190
+ dv.setUint8(o, sorted[i].detailLevel);
191
+ dv.setFloat32(o + 4, sorted[i].error, true);
192
+ }
193
+ return out;
194
+ }
195
+ /**
196
+ * Parse a LOD selection table, or return null when these bytes are not one.
197
+ *
198
+ * NULL RATHER THAN THROW, for the two cases that are normal rather than exceptional: a container
199
+ * cooked before the table existed has no LOD chunk at all, and a container being STREAMED advertises
200
+ * its whole TOC from byte 64 while the payload is still arriving — so a caller can hold a TOC entry
201
+ * whose bytes have not landed. Both mean "select some other way for now", not "this file is broken".
202
+ * A future version is treated the same way, so a new cook cannot crash an old client.
203
+ */
204
+ export function readLodChunk(bytes) {
205
+ if (bytes.byteLength < LOD_HEAD_BYTES)
206
+ return null;
207
+ const dv = dvOf(bytes);
208
+ if (dv.getUint32(0, true) !== LOD_MAGIC)
209
+ return null;
210
+ if (dv.getUint16(4, true) !== LOD_CHUNK_VERSION)
211
+ return null;
212
+ const count = dv.getUint8(6);
213
+ if (bytes.byteLength < LOD_HEAD_BYTES + count * LOD_LEVEL_BYTES)
214
+ return null;
215
+ const out = [];
216
+ for (let i = 0; i < count; i++) {
217
+ const o = LOD_HEAD_BYTES + i * LOD_LEVEL_BYTES;
218
+ out.push({
219
+ detailLevel: dv.getUint8(o),
220
+ error: dv.getFloat32(o + 4, true),
221
+ });
222
+ }
223
+ return out;
224
+ }
225
+ /**
226
+ * One model's LOD table, or null if it carries none / has not streamed that far yet.
227
+ *
228
+ * ⚠️ KEYED BY `targetId`, because a container is not always one model. `nature.ugm` packs ten, each
229
+ * with its own ladder under its own targetId, so a per-CONTAINER lookup would hand all ten the first
230
+ * model's errors — a bush selecting rungs by a tree's simplification error. Single-model containers
231
+ * cook everything at targetId 0 and get the default.
232
+ */
233
+ export function lodTableOf(buf, toc, targetId = 0) {
234
+ const e = toc.find((t) => t.kind === ChunkKind.LOD && t.targetId === targetId);
235
+ if (!e || e.offset + e.length > buf.length)
236
+ return null;
237
+ return readLodChunk(readChunk(buf, e));
238
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugly-game",
3
- "version": "0.15.24",
3
+ "version": "0.15.25",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -15,6 +15,20 @@
15
15
  "files": [
16
16
  "dist"
17
17
  ],
18
+ "scripts": {
19
+ "preinstall": "npx only-allow pnpm",
20
+ "build": "tsc -p tsconfig.json && mkdir -p dist/assets/basis && cp src/assets/basis/basis_transcoder.js src/assets/basis/basis_transcoder.bin dist/assets/basis/",
21
+ "lint": "ugly-app lint",
22
+ "lint:fix": "ugly-app lint --fix",
23
+ "lint:wgsl": "node --experimental-strip-types tools/wgslGuard.mts && node --experimental-strip-types tools/wgslLint.mts",
24
+ "test": "node --experimental-strip-types --import ./tools/tsResolve.mjs --test src/*.test.mts",
25
+ "test:flight": "node --experimental-strip-types --import ./tools/tsResolve.mjs --test src/flight*.test.mts",
26
+ "test:flight-browser": "playwright test -c playwright.flight.config.ts",
27
+ "test:flight-perf": "playwright test -c playwright.flight.config.ts --grep 'CPU and retained-memory'",
28
+ "test:types": "tsc -p tsconfig.test.json",
29
+ "pretty": "prettier --write .",
30
+ "prepublishOnly": "pnpm run pretty && ugly-app lint && tsc -p tsconfig.json && pnpm run lint:wgsl && mkdir -p dist/assets/basis && cp src/assets/basis/basis_transcoder.js src/assets/basis/basis_transcoder.bin dist/assets/basis/"
31
+ },
18
32
  "dependencies": {
19
33
  "meshoptimizer": "^1.2.0"
20
34
  },
@@ -30,18 +44,5 @@
30
44
  "typescript": "^5.6.0",
31
45
  "ugly-app": "^0.1.841",
32
46
  "wesl": "0.7.28"
33
- },
34
- "scripts": {
35
- "preinstall": "npx only-allow pnpm",
36
- "build": "tsc -p tsconfig.json && mkdir -p dist/assets/basis && cp src/assets/basis/basis_transcoder.js src/assets/basis/basis_transcoder.bin dist/assets/basis/",
37
- "lint": "ugly-app lint",
38
- "lint:fix": "ugly-app lint --fix",
39
- "lint:wgsl": "node --experimental-strip-types tools/wgslGuard.mts && node --experimental-strip-types tools/wgslLint.mts",
40
- "test": "node --experimental-strip-types --import ./tools/tsResolve.mjs --test src/*.test.mts",
41
- "test:flight": "node --experimental-strip-types --import ./tools/tsResolve.mjs --test src/flight*.test.mts",
42
- "test:flight-browser": "playwright test -c playwright.flight.config.ts",
43
- "test:flight-perf": "playwright test -c playwright.flight.config.ts --grep 'CPU and retained-memory'",
44
- "test:types": "tsc -p tsconfig.test.json",
45
- "pretty": "prettier --write ."
46
47
  }
47
- }
48
+ }