@threenative/core 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { Object3D } from 'three';
2
- import { I as IRendererLike } from './renderer-C6hqZpoG.js';
1
+ import { Object3D, Camera } from 'three';
2
+ import { I as IRendererLike } from './renderer-CfsS2hxi.js';
3
3
 
4
4
  /**
5
5
  * The lifecycle contract for a game-owned GPU simulation.
@@ -17,8 +17,15 @@ interface IComputeDriven {
17
17
  * existing behavior of consumers whose simulation is intentionally tied to presentation.
18
18
  */
19
19
  readonly processCadence?: "fixed" | "render";
20
- /** Dispatched once per fixed step, in scene-add order unless render cadence is declared. */
21
- process(renderer: IRendererLike): void;
20
+ /**
21
+ * Dispatched once per fixed step, in scene-add order unless render cadence is declared.
22
+ *
23
+ * `camera` is the frame's render camera, handed over at render cadence so a consumer that culls by
24
+ * the view — a streamed world narrowing its instanced windows to what the frustum covers — can do
25
+ * it from the driver that runs every frame rather than from a draw three will not submit. An
26
+ * implementation that does not need it simply declares one parameter.
27
+ */
28
+ process(renderer: IRendererLike, camera?: Camera): void;
22
29
  detach(): void;
23
30
  readonly released: boolean;
24
31
  }
@@ -34,8 +41,11 @@ declare class ComputeDrivenRegistry {
34
41
  get warmupNodes(): readonly unknown[];
35
42
  /** Dispatch fixed-step objects once; detached scene children are released before dispatch. */
36
43
  process(renderer: IRendererLike): void;
37
- /** Dispatch render-cadence objects once; detached scene children are released before dispatch. */
38
- processRender(renderer: IRendererLike): void;
44
+ /**
45
+ * Dispatch render-cadence objects once with the frame's render camera; detached scene children are
46
+ * released before dispatch.
47
+ */
48
+ processRender(renderer: IRendererLike, camera?: Camera): void;
39
49
  /** Release every registered object, continuing after a failure so no resource is stranded. */
40
50
  clear(): void;
41
51
  }
package/dist/hot.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { a as audioRuntimeSnapshot } from './audio-BFiGneTL.js';
2
- import { I as IGame } from './game-XGrTzapq.js';
1
+ import { a as audioRuntimeSnapshot } from './audio-7i3Xl0l3.js';
2
+ import { I as IGame } from './game-CljaDv4D.js';
3
3
  import 'three';
4
- import './assets-kyoF7JlJ.js';
5
- import './renderer-C6hqZpoG.js';
4
+ import './assets-CqvE429w.js';
5
+ import './renderer-CfsS2hxi.js';
6
6
  import 'three/webgpu';
7
- import './canvas-layer-BLVijiUJ.js';
7
+ import './canvas-layer-DDmC_VVF.js';
8
8
  import 'zustand/vanilla';
9
9
 
10
10
  interface IHotDiagnostics {
package/dist/hot.js CHANGED
@@ -1,21 +1,38 @@
1
1
  import 'three';
2
2
 
3
3
  // src/audio.ts
4
- var buses = /* @__PURE__ */ new Set();
4
+ var AUDIO_STATE = /* @__PURE__ */ Symbol.for("threenative.audio.runtime");
5
+ function audioState() {
6
+ const host = globalThis;
7
+ const existing = host[AUDIO_STATE];
8
+ if (existing !== void 0) return existing;
9
+ const created = { buses: /* @__PURE__ */ new Set(), cueCounts: /* @__PURE__ */ new Map(), cueLog: [] };
10
+ host[AUDIO_STATE] = created;
11
+ return created;
12
+ }
5
13
  function audioRuntimeSnapshot() {
6
14
  let queued = 0;
7
15
  let voices = 0;
8
16
  let pooled = 0;
9
17
  let paused = 0;
10
18
  const unsupported = /* @__PURE__ */ new Set();
11
- for (const bus of buses) {
19
+ const state = audioState();
20
+ for (const bus of state.buses) {
12
21
  queued += bus.queued;
13
22
  voices += bus.voices;
14
23
  pooled += bus.pooled;
15
24
  paused += bus.pausedVoices;
16
25
  for (const option of bus.unsupported) unsupported.add(option);
17
26
  }
18
- return { paused, pooled, queued, unsupported: [...unsupported].sort(), voices };
27
+ return {
28
+ cues: Object.fromEntries(state.cueCounts),
29
+ paused,
30
+ pooled,
31
+ queued,
32
+ recentCues: state.cueLog.map((entry) => ({ ...entry })),
33
+ unsupported: [...unsupported].sort(),
34
+ voices
35
+ };
19
36
  }
20
37
 
21
38
  // src/hot.ts