ugly-game 0.15.43 → 0.15.45

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.
Files changed (44) hide show
  1. package/dist/anim/animEval.js +5 -1
  2. package/dist/assets/gpuCrowd.d.ts +1 -0
  3. package/dist/assets/gpuCrowd.js +1 -0
  4. package/dist/assets/gpuProps.d.ts +1 -0
  5. package/dist/assets/gpuProps.js +1 -0
  6. package/dist/assets/gpuSkin.d.ts +1 -0
  7. package/dist/assets/gpuSkin.js +1 -6
  8. package/dist/assets/ktx2.d.ts +1 -0
  9. package/dist/assets/ktx2.js +1 -0
  10. package/dist/flightTestFixture.d.mts +2 -0
  11. package/dist/flightTestFixture.mjs +57 -0
  12. package/dist/frameProbe.d.ts +1 -0
  13. package/dist/frameProbe.js +1 -6
  14. package/dist/gpuDriven.d.ts +1 -0
  15. package/dist/gpuDriven.js +1 -11
  16. package/dist/gpuGI.d.ts +1 -0
  17. package/dist/gpuGI.js +1 -0
  18. package/dist/gpuGraph.d.ts +2 -1
  19. package/dist/gpuGraph.js +3 -2
  20. package/dist/gpuLit.d.ts +1 -0
  21. package/dist/gpuLit.js +1 -9
  22. package/dist/gpuPost.d.ts +1 -0
  23. package/dist/gpuPost.js +1 -0
  24. package/dist/gpuShadow.d.ts +1133 -0
  25. package/dist/gpuShadow.js +4463 -0
  26. package/dist/gpuShadowMap.d.ts +1 -0
  27. package/dist/gpuShadowMap.js +1 -0
  28. package/dist/gpuSpot.d.ts +3 -2
  29. package/dist/gpuSpot.js +2 -1
  30. package/dist/gpuSsao.d.ts +1 -0
  31. package/dist/gpuSsao.js +1 -0
  32. package/dist/gpuTaa.d.ts +3 -2
  33. package/dist/gpuTaa.js +2 -1
  34. package/dist/gpuTaaResolve.d.ts +1 -0
  35. package/dist/gpuTaaResolve.js +1 -0
  36. package/dist/gpuTerrain.d.ts +2 -1
  37. package/dist/gpuTerrain.js +2 -1
  38. package/dist/gpuTiled.d.ts +1 -0
  39. package/dist/gpuTiled.js +1 -8
  40. package/dist/gpuTimer.d.ts +1 -0
  41. package/dist/gpuTimer.js +1 -29
  42. package/dist/gpuWorld.d.ts +2 -1
  43. package/dist/gpuWorld.js +2 -1
  44. package/package.json +3 -2
@@ -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 ? (slot.loop === false ? Math.min(slot.time, d) : slot.time % 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.
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  export declare const CROWD_MATERIAL_COUNT = 5;
2
3
  export declare const CROWD_RECORD_FLOATS = 24;
3
4
  export declare const CROWD_REC_LAYER = 20;
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  // ─────────────────────────────────────────────────────────────────────────────
2
3
  // GPU CROWD — thousands of individually-shaped, individually-animated characters.
3
4
  //
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  export declare const MAX_CASCADES = 4;
2
3
  /**
3
4
  * Per-world surface + motion parameters.
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  // ─────────────────────────────────────────────────────────────────────────────
2
3
  // GPU PROPS — instanced static-mesh renderer for scattered nature props (PLATFORM). Draws each cooked
3
4
  // model (tree/rock/bush/…) many times at per-instance world transforms, lit + fogged to match the
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  export interface SkinCreature {
2
3
  rest: Float32Array;
3
4
  normals: Float32Array;
@@ -1,9 +1,4 @@
1
- // ─────────────────────────────────────────────────────────────────────────────
2
- // GPU SKIN — a reusable WebGPU renderer for skinned creatures (PLATFORM). A compute pass deforms the
3
- // rest mesh (AND its normals) by each creature's bone palette; the render pass draws them with the SAME
4
- // lighting model as the terrain/prop renderers — sun lambert on smooth per-vertex normals + ambient +
5
- // distance fog — so creatures sit in the scene consistently instead of looking flat/mismatched.
6
- // ─────────────────────────────────────────────────────────────────────────────
1
+ /// <reference types="@webgpu/types" preserve="true" />
7
2
  export const MAX_CASCADES = 4; // must match gpuShadow's
8
3
  const SKIN = /* wgsl */ `
9
4
  @group(0) @binding(0) var<storage,read> rest: array<vec4f>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  export interface TranscodedTexture {
2
3
  texture: GPUTexture;
3
4
  format: GPUTextureFormat;
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  // Runtime Basis Universal transcoder → GPU-compressed WebGPU texture. The runtime half of
2
3
  // design/asset-streaming.md §3/§4: a cooked .ugm carries textures as ETC1S KTX2 (see
3
4
  // demo/cli/assets/texture.ts cookTextureBasis), and at load we transcode them to whatever compressed
@@ -0,0 +1,2 @@
1
+ import type { FlightCapture } from './flightTypes';
2
+ export declare function fixtureCapture(): FlightCapture;
@@ -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
+ }
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  export interface FrameStats {
2
3
  meanLum: number;
3
4
  minLum: number;
@@ -1,9 +1,4 @@
1
- // FULL-FRAME visual-regression harness: render a pinned deterministic scene to an offscreen
2
- // target, READ THE WHOLE FRAMEBUFFER BACK, and reduce it to (a) sanity stats and (b) a small
3
- // perceptual SIGNATURE that can be compared to a committed golden. This is how the eyeballed
4
- // render demos become actual regression tests — a broken render (all-black, blown-out, changed)
5
- // fails automatically instead of needing a human to notice. Pairs with shaderProbe.ts (which
6
- // checks material values); this checks a whole rendered frame.
1
+ /// <reference types="@webgpu/types" preserve="true" />
7
2
  const SIZE = 256, GRID = 8; // 256×256 render (bytesPerRow = 1024, 256-aligned); 8×8 signature
8
3
  export class FrameProbe {
9
4
  device;
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  export interface Instance {
2
3
  x: number;
3
4
  y: number;
package/dist/gpuDriven.js CHANGED
@@ -1,14 +1,4 @@
1
- // ─────────────────────────────────────────────────────────────────────────────
2
- // GPU-DRIVEN render backend (WebGPU) — executes the render IR's DrawPlan on the GPU.
3
- // The whole scene lives in a storage buffer; a COMPUTE shader frustum-culls every
4
- // instance and writes, per pipeline (material), an atomic instanceCount + a compacted
5
- // list of visible instance indices; then ONE indirect draw per pipeline renders all
6
- // its visible instances. CPU draw calls = O(pipelines), independent of instance count.
7
- //
8
- // This is the real backend for the render IR (shared/renderIR.ts is the CPU reference
9
- // oracle it's validated against). Instances are billboarded quads for now — the shape
10
- // is not the point; the draw-call model is. See design/moonshot-open-world.md §5.
11
- // ─────────────────────────────────────────────────────────────────────────────
1
+ /// <reference types="@webgpu/types" preserve="true" />
12
2
  const INSTANCE_F32 = 8; // pos.xyz, scale | material, bounds, pad, pad
13
3
  const ARG_U32 = 4; // drawIndirect: vertexCount, instanceCount, firstVertex, firstInstance
14
4
  const WGSL = /* wgsl */ `
package/dist/gpuGI.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  export interface GIBox {
2
3
  x: number;
3
4
  y: number;
package/dist/gpuGI.js CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  // Render increment 8 — BAKED GLOBAL ILLUMINATION via an irradiance probe grid (DDGI-style).
2
3
  // The last of GAME.md §3.6's named look gaps. Real-time path tracing is out; the tractable form
3
4
  // is to PRECOMPUTE indirect light into a 3D grid of probes, then sample it per-pixel. Each probe
@@ -1,4 +1,5 @@
1
- import { type Graph } from './shaderGraph';
1
+ /// <reference types="@webgpu/types" preserve="true" />
2
+ import { type Graph } from './shaderGraph.js';
2
3
  export interface GraphInstance {
3
4
  x: number;
4
5
  y: number;
package/dist/gpuGraph.js CHANGED
@@ -1,9 +1,10 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  // Renders each shader GRAPH as its own pipeline: compileGraph() emits a `material()` WGSL fn that
2
3
  // is spliced into a shared scene template (cube instances + Cook-Torrance PBR lighting). So the
3
4
  // LIGHTING is engine-owned and identical; only the artist-authored material() differs per graph —
4
5
  // exactly how a production shader-graph pipeline works. No hand-written per-material WGSL.
5
- import { CUBE } from './cube';
6
- import { compileGraph } from './shaderGraph';
6
+ import { CUBE } from './cube.js';
7
+ import { compileGraph } from './shaderGraph.js';
7
8
  function sceneWGSL(materialFn) {
8
9
  return /* wgsl */ `
9
10
  struct Inst { pos: vec4<f32>, scl: vec4<f32> };
package/dist/gpuLit.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  export interface Instance {
2
3
  x: number;
3
4
  y: number;
package/dist/gpuLit.js CHANGED
@@ -1,12 +1,4 @@
1
- // ─────────────────────────────────────────────────────────────────────────────
2
- // GPU-driven LIT renderer — the shading program begins here (GAME.md §3.6). Builds
3
- // on the proven cull backend (compute frustum-cull → per-pipeline indirect draw) and
4
- // adds real lighting: instances render as lit impostor SPHERES (a billboard quad whose
5
- // fragment reconstructs a sphere normal), shaded by a directional sun + a buffer of
6
- // MANY dynamic POINT LIGHTS. This is the many-dynamic-lights look the open-world axis
7
- // needs; a later increment adds tiled/clustered light culling to scale the light count.
8
- // See design/moonshot-open-world.md §5 (phase 4), design/engine-build-plan.md.
9
- // ─────────────────────────────────────────────────────────────────────────────
1
+ /// <reference types="@webgpu/types" preserve="true" />
10
2
  const INSTANCE_F32 = 8, ARG_U32 = 4, LIGHT_F32 = 8, CAM_F32 = 64;
11
3
  const WGSL = /* wgsl */ `
12
4
  struct Inst { pos: vec4<f32>, attr: vec4<f32> };
package/dist/gpuPost.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  export declare class PostChain {
2
3
  private device;
3
4
  private w;
package/dist/gpuPost.js CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="@webgpu/types" preserve="true" />
1
2
  // Stage 2 — a MULTI-STEP GPU POST-PROCESSING CHAIN over the HDR scene, the thing the earlier
2
3
  // "few draw calls, analytic shading" demos conspicuously lacked. Five fullscreen passes:
3
4
  // 1. BRIGHT extract (threshold the HDR → the bloom/flare source, at half res)