@threenative/core 0.3.12 → 0.3.15

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 (165) hide show
  1. package/README.md +1 -1
  2. package/capabilities.json +1047 -44
  3. package/dist/{assets-YUbXa3-Y.d.ts → assets-CfMKnOsK.d.ts} +78 -1
  4. package/dist/{canvas-layer-CWuFRT7G.d.ts → canvas-layer-G7ttVy7y.d.ts} +1 -1
  5. package/dist/{chunk-7UUT3TY5.js → chunk-2GPHICV6.js} +1 -1
  6. package/dist/{chunk-GMHATRPW.js → chunk-GEMQJBY4.js} +1650 -383
  7. package/dist/{chunk-VAZM36TV.js → chunk-H4J6IAJE.js} +17 -10
  8. package/dist/{chunk-5O73CDMR.js → chunk-QAMSM3Z5.js} +415 -27
  9. package/dist/{chunk-2Z44XSI2.js → chunk-QAQHYOWY.js} +3 -7
  10. package/dist/{chunk-DBELTTTM.js → chunk-U4YHUKKL.js} +1 -1
  11. package/dist/{chunk-OKXUCASC.js → chunk-VBBYWGAT.js} +3 -4
  12. package/dist/chunk-VP43GIWW.js +18 -0
  13. package/dist/{chunk-N5LRP4BR.js → chunk-VQRPEOKY.js} +66 -3
  14. package/dist/{chunk-6KLNISRJ.js → chunk-XDTZ4QMO.js} +11 -4
  15. package/dist/default-tone-mapping-GgKPTiBP.d.ts +4 -0
  16. package/dist/{game-D7pAzZUY.d.ts → game-k8K3hZai.d.ts} +72 -8
  17. package/dist/hot.d.ts +5 -4
  18. package/dist/hot.js +5 -8
  19. package/dist/index.d.ts +871 -1018
  20. package/dist/index.js +4786 -1631
  21. package/dist/{model-lod-B6BMqS1r.d.ts → model-lod-DPTzeCcD.d.ts} +4 -2
  22. package/dist/playtest.d.ts +5 -4
  23. package/dist/playtest.js +6 -5
  24. package/dist/quality-BADStsTn.d.ts +868 -0
  25. package/dist/react.d.ts +3 -2
  26. package/dist/render-environment.d.ts +170 -0
  27. package/dist/render-environment.js +352 -0
  28. package/dist/{renderer-DvFVoAgj.d.ts → renderer-BtOSseYf.d.ts} +29 -31
  29. package/dist/spells/index.js +1 -1
  30. package/dist/ui-layer.js +3 -2
  31. package/dist/worker.js +12 -5
  32. package/dist/world.d.ts +280 -16
  33. package/dist/world.js +1529 -642
  34. package/mcp/animation-server.mjs +1 -1
  35. package/mcp/engine-server.mjs +135 -11
  36. package/mcp/servers.mjs +4 -4
  37. package/package.json +10 -6
  38. package/scripts/ensure-mcp.mjs +6 -1
  39. package/src/animation-batch.ts +193 -0
  40. package/src/animation-layers.ts +7 -3
  41. package/src/animation.ts +209 -29
  42. package/src/asset-cache.ts +3 -3
  43. package/src/asset-memo.ts +202 -0
  44. package/src/assets.ts +436 -131
  45. package/src/auto-batch.ts +190 -44
  46. package/src/clustered-batch.ts +146 -3
  47. package/src/clustered-mesh.ts +548 -20
  48. package/src/compute-driven.ts +1 -1
  49. package/src/config.ts +8 -0
  50. package/src/debug.ts +119 -22
  51. package/src/dev-global.ts +54 -0
  52. package/src/displaced-surface.ts +428 -0
  53. package/src/engine-hooks.ts +37 -0
  54. package/src/frame-budget.ts +35 -3
  55. package/src/game-boot-phase.ts +269 -0
  56. package/src/game-dev-tools.ts +7 -14
  57. package/src/game-frame-loop.ts +45 -82
  58. package/src/game-startup.ts +145 -70
  59. package/src/game-ui.ts +84 -0
  60. package/src/game.ts +168 -552
  61. package/src/gamepad-mappings.ts +269 -0
  62. package/src/generated/console-markers.ts +14 -0
  63. package/src/geometry-capture.ts +28 -4
  64. package/src/gpu-readings.ts +98 -0
  65. package/src/gpu-scene-bvh.ts +149 -36
  66. package/src/grass-field.ts +628 -0
  67. package/src/hot.ts +4 -7
  68. package/src/index.ts +227 -8
  69. package/src/input.ts +237 -25
  70. package/src/instanced-batch-lod.ts +3 -8
  71. package/src/interpolation.ts +171 -40
  72. package/src/look/ao-admission.ts +4 -3
  73. package/src/look/auto-exposure.ts +5 -16
  74. package/src/look/default-tone-mapping.ts +41 -5
  75. package/src/look/local-exposure.ts +2 -7
  76. package/src/look/quad-pass.ts +21 -0
  77. package/src/look/quality.ts +4 -0
  78. package/src/look/unreal-bloom.ts +4 -13
  79. package/src/look/world-environment.ts +58 -115
  80. package/src/merge-parts.ts +20 -24
  81. package/src/model-lod.ts +97 -14
  82. package/src/particle-significance.ts +12 -0
  83. package/src/particles.ts +19 -10
  84. package/src/platform.ts +23 -4
  85. package/src/profiling/FrameStages.ts +5 -6
  86. package/src/profiling/Spans.ts +3 -17
  87. package/src/profiling/debug-telemetry.ts +2 -6
  88. package/src/profiling/render-list-validate.ts +6 -15
  89. package/src/projection-marker.ts +2 -1
  90. package/src/quiet-markers.ts +3 -10
  91. package/src/render/cpu-bvh.ts +100 -0
  92. package/src/render/depth-pyramid.ts +6 -14
  93. package/src/render/environment/environmentContribution.ts +202 -0
  94. package/src/render/environment/environmentRadiance.ts +44 -0
  95. package/src/render/environment/environmentSampleCache.ts +56 -0
  96. package/src/render/environment/environmentSampling.ts +201 -0
  97. package/src/render/environment/environmentSnapshot.ts +71 -0
  98. package/src/render/environment/gate.ts +57 -0
  99. package/src/render/material-key.ts +21 -1
  100. package/src/render/mesh-pool.ts +3 -19
  101. package/src/render/probe-trace.ts +872 -0
  102. package/src/render/probe-volume.ts +780 -34
  103. package/src/render/radiance-cache.ts +17 -0
  104. package/src/render/screen-probe-gather.ts +303 -0
  105. package/src/render/short-range-ao.ts +274 -0
  106. package/src/render/virtual-shadow-partial.ts +13 -0
  107. package/src/render/virtual-shadow.ts +18 -16
  108. package/src/render/world-impostor-surface.ts +207 -9
  109. package/src/render/world-impostor.ts +5 -2
  110. package/src/render-camera-cull.ts +105 -4
  111. package/src/render-environment.ts +41 -0
  112. package/src/renderer-config.ts +36 -0
  113. package/src/renderer-facts.ts +37 -0
  114. package/src/renderer.ts +78 -32
  115. package/src/resolution-scaler.ts +3 -2
  116. package/src/scatter-field.ts +496 -0
  117. package/src/scene-entry-inspectors.ts +61 -0
  118. package/src/snow-field.ts +1 -0
  119. package/src/startup-offscreen-bytes.ts +84 -0
  120. package/src/state.ts +16 -3
  121. package/src/static-transform.ts +100 -25
  122. package/src/streamed-textures.ts +112 -0
  123. package/src/streaming.ts +68 -4
  124. package/src/texture-streaming.ts +331 -0
  125. package/src/tile-ring.ts +294 -0
  126. package/src/version.ts +1 -1
  127. package/src/warmup.ts +15 -2
  128. package/src/worker.ts +12 -2
  129. package/src/world-bundle-safety.ts +55 -10
  130. package/src/world-cell-batches.ts +166 -200
  131. package/src/world-cell-chunks.ts +3 -7
  132. package/src/world-cell-data.ts +7 -0
  133. package/src/world-cell-impostors.ts +20 -8
  134. package/src/world-cell-models.ts +36 -8
  135. package/src/world-cell-options.ts +2 -14
  136. package/src/world-cell-placements.ts +194 -90
  137. package/src/world-cell-prewarm.ts +39 -4
  138. package/src/world-cell-records.ts +401 -0
  139. package/src/world-cell-render-bundles.ts +2 -2
  140. package/src/world-cell-render-gpu-dress.ts +17 -19
  141. package/src/world-cell-render-main-cull.ts +73 -17
  142. package/src/world-cell-render-util.ts +18 -5
  143. package/src/world-cell-render.ts +13 -5
  144. package/src/world-cell-residency.ts +15 -6
  145. package/src/world-cell-stale.ts +238 -0
  146. package/src/world-cells.ts +23 -6
  147. package/src/world-gpu-flags.ts +18 -50
  148. package/src/world-gpu-reference.ts +22 -8
  149. package/src/world-gpu-scene.ts +44 -24
  150. package/src/world-gpu-shadow.ts +21 -8
  151. package/src/world-gpu-types.ts +41 -13
  152. package/src/world-load-limiter.ts +5 -0
  153. package/src/world-model-sections.ts +80 -0
  154. package/src/world-river-ribbon.ts +273 -0
  155. package/src/world-root-frame.ts +39 -0
  156. package/src/world-shore-field.ts +91 -0
  157. package/src/world-static-pose.ts +163 -0
  158. package/src/world-surface-sampler.ts +48 -0
  159. package/src/world-terrain-splat.ts +10 -18
  160. package/src/world-tile-budget.ts +4 -11
  161. package/src/world-tiles.ts +79 -12
  162. package/src/world-validate.ts +6 -14
  163. package/src/world-warm.ts +51 -0
  164. package/src/world-water-bodies.ts +113 -3
  165. package/src/world.ts +13 -0
@@ -1,15 +1,11 @@
1
+ import { readLaunchFlag } from './chunk-VQRPEOKY.js';
2
+
1
3
  // src/quiet-markers.ts
2
4
  var LOG_FLAG = "TN_LOG";
3
5
  var BROWSER_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:", "file:"]);
4
6
  var restore;
5
- var isOn = (value) => value === true || typeof value === "string" && value !== "" && value !== "0" && value !== "false";
6
7
  function markerLogRequested() {
7
- const host = globalThis;
8
- if (isOn(host.process?.env?.[LOG_FLAG])) return true;
9
- const query = globalThis.location?.search;
10
- if (typeof query === "string" && /[?&]tnLog=(?!0(?:&|$))(?!false(?:&|$))[^&]/u.test(query))
11
- return true;
12
- return isOn(globalThis.__THREENATIVE_LOG__);
8
+ return readLaunchFlag({ environment: LOG_FLAG, global: "__THREENATIVE_LOG__", query: "tnLog" });
13
9
  }
14
10
  function installQuietMarkers() {
15
11
  const protocol = globalThis.location?.protocol;
@@ -1,4 +1,4 @@
1
- import { hostGestureTarget, hostWindow } from './chunk-6KLNISRJ.js';
1
+ import { hostGestureTarget, hostWindow } from './chunk-XDTZ4QMO.js';
2
2
  import { AudioListener, Object3D, Audio, PositionalAudio, AudioContext } from 'three';
3
3
 
4
4
  var AUDIO_STATE = /* @__PURE__ */ Symbol.for("threenative.audio.runtime");
@@ -1,7 +1,9 @@
1
- import { debugRequested, countDebug, isContentScaled } from './chunk-N5LRP4BR.js';
1
+ import { debugRequested, countDebug, isContentScaled } from './chunk-VQRPEOKY.js';
2
2
  import { mrt, velocity, output, context } from 'three/tsl';
3
3
  import { BatchedMesh, DataTexture } from 'three';
4
4
 
5
+ // src/version.ts
6
+ var CORE_VERSION = "0.3.15";
5
7
  var THREE_NATIVE_BATCHED_VELOCITY_PATCH = "threeNativeBatchedVelocityPatch";
6
8
  function isBatchedMeshVelocityPatched() {
7
9
  return Reflect.get(BatchedMesh, THREE_NATIVE_BATCHED_VELOCITY_PATCH) === true;
@@ -333,9 +335,6 @@ function copyInto(target, source) {
333
335
  return target;
334
336
  }
335
337
 
336
- // src/version.ts
337
- var CORE_VERSION = "0.3.12";
338
-
339
338
  // src/pipeline-census.ts
340
339
  var PIPELINE_CENSUS_VERSION = 1;
341
340
  var PIPELINE_CENSUS_CAPABILITY = "runtime.pipelineCensus";
@@ -0,0 +1,18 @@
1
+ // src/dev-global.ts
2
+ var DEV_GLOBAL_KEY = "__THREENATIVE__";
3
+ function devGlobal(scope) {
4
+ const value = scope?.[DEV_GLOBAL_KEY];
5
+ return typeof value === "object" && value !== null ? value : void 0;
6
+ }
7
+ function publishDevGlobal(name, value, scope) {
8
+ const host = scope;
9
+ if (host === void 0) return;
10
+ const current = devGlobal(scope);
11
+ if (current !== void 0) {
12
+ current[name] = value;
13
+ return;
14
+ }
15
+ host[DEV_GLOBAL_KEY] = { [name]: value };
16
+ }
17
+
18
+ export { DEV_GLOBAL_KEY, devGlobal, publishDevGlobal };
@@ -1,3 +1,67 @@
1
+ import { devGlobal, publishDevGlobal } from './chunk-VP43GIWW.js';
2
+
3
+ // src/debug.ts
4
+ function envName(name) {
5
+ return `TN_DEBUG_${name.replace(/([a-z0-9])([A-Z])/gu, "$1_$2").toUpperCase()}`;
6
+ }
7
+ function readLaunchSeams(spec, search) {
8
+ const values = [];
9
+ if (spec.environment.length > 0) {
10
+ const env = envValue(spec.environment);
11
+ if (env !== void 0 && env !== "") values.push(env);
12
+ }
13
+ const query = search ?? globalThis.location?.search;
14
+ if (typeof query === "string") {
15
+ const fromQuery = new URLSearchParams(query).get(spec.query);
16
+ if (fromQuery !== null) values.push(fromQuery);
17
+ }
18
+ if (spec.global !== void 0) {
19
+ const fromGlobal = globalThis[spec.global];
20
+ if (typeof fromGlobal === "string") values.push(fromGlobal);
21
+ else if (typeof fromGlobal === "number") values.push(String(fromGlobal));
22
+ else if (typeof fromGlobal === "boolean") values.push(fromGlobal ? "true" : "false");
23
+ }
24
+ return values;
25
+ }
26
+ function isOff(value) {
27
+ return value === "0" || value === "false";
28
+ }
29
+ function readLaunchFlag(spec, askedFor = "on", search) {
30
+ const values = readLaunchSeams(spec, search);
31
+ return askedFor === "off" ? values.some((value) => isOff(value)) : values.some((value) => !isOff(value));
32
+ }
33
+ function readLaunchValue(spec) {
34
+ return readLaunchSeams(spec)[0];
35
+ }
36
+ function readLaunchValues(spec) {
37
+ return readLaunchSeams(spec);
38
+ }
39
+ function envValue(name) {
40
+ const scope = globalThis;
41
+ if (typeof scope !== "object" || scope === null || !("process" in scope)) return void 0;
42
+ const hostProcess = scope.process;
43
+ if (typeof hostProcess !== "object" || hostProcess === null || !("env" in hostProcess))
44
+ return void 0;
45
+ const env = hostProcess.env;
46
+ if (typeof env !== "object" || env === null) return void 0;
47
+ const value = env[name];
48
+ return typeof value === "string" ? value : void 0;
49
+ }
50
+ function debugFlag(name) {
51
+ return readLaunchFlag({ environment: envName(name), query: name });
52
+ }
53
+ function debugValue(name) {
54
+ return readLaunchValue({ environment: envName(name), query: name });
55
+ }
56
+ function exposeDebug(name, value) {
57
+ const isDev = import.meta.env?.DEV === true;
58
+ if (!isDev) return;
59
+ const tools = devGlobal(globalThis) ?? {};
60
+ const debug = tools.debug ?? {};
61
+ debug[name] = value;
62
+ publishDevGlobal("debug", debug, globalThis);
63
+ }
64
+
1
65
  // src/profiling/debug-telemetry.ts
2
66
  var CONTENT_SCALED_LIMIT = 10;
3
67
  function isContentScaled(name) {
@@ -5,8 +69,7 @@ function isContentScaled(name) {
5
69
  }
6
70
  var DEBUG_GLOBAL = "__THREENATIVE_DEBUG__";
7
71
  function debugRequested() {
8
- const host = globalThis;
9
- return host.process?.env?.TN_DEBUG === "1" || globalThis[DEBUG_GLOBAL] === true || /[?&]tnDebug=1(?:&|$)/u.test(globalThis.location?.search ?? "");
72
+ return readLaunchFlag({ environment: "TN_DEBUG", global: DEBUG_GLOBAL, query: "tnDebug" });
10
73
  }
11
74
  function countDebug(name, value, area, caller, unit = "count") {
12
75
  if (!Number.isFinite(value) || value < 0)
@@ -217,4 +280,4 @@ function debugHotCalls(window) {
217
280
  return calls.length === 0 ? void 0 : `TN_HOT_CALL:${JSON.stringify({ window: window.window, intervalMs: interval, calls })}`;
218
281
  }
219
282
 
220
- export { countDebug, debugHotCalls, debugRequested, formatDebugReport, isContentScaled, measureDebug, observeDebugGc };
283
+ export { countDebug, debugFlag, debugHotCalls, debugRequested, debugValue, exposeDebug, formatDebugReport, isContentScaled, measureDebug, observeDebugGc, readLaunchFlag, readLaunchValue, readLaunchValues };
@@ -1,6 +1,7 @@
1
1
  // src/platform.ts
2
2
  var DESKTOP_OS = /* @__PURE__ */ new Set(["linux", "macos", "windows"]);
3
3
  var MOBILE_OS = /* @__PURE__ */ new Set(["android", "ios"]);
4
+ var CONSOLE_OS = /* @__PURE__ */ new Set(["ps4"]);
4
5
  function isRecord(value) {
5
6
  return typeof value === "object" && value !== null && !Array.isArray(value);
6
7
  }
@@ -19,16 +20,16 @@ function nativePlatform(source) {
19
20
  const formFactor = descriptor.formFactor;
20
21
  const maxTouchPoints = descriptor.maxTouchPoints;
21
22
  if (runtime !== "native") invalidNativePlatform("runtime must be native");
22
- if (os !== "android" && os !== "ios" && os !== "linux" && os !== "macos" && os !== "windows" && os !== "unknown") {
23
+ if (os !== "android" && os !== "ios" && os !== "linux" && os !== "macos" && os !== "windows" && os !== "ps4" && os !== "unknown") {
23
24
  invalidNativePlatform("os is unknown");
24
25
  }
25
- if (formFactor !== "mobile" && formFactor !== "desktop" && formFactor !== "unknown") {
26
+ if (formFactor !== "mobile" && formFactor !== "desktop" && formFactor !== "console" && formFactor !== "unknown") {
26
27
  invalidNativePlatform("formFactor is unknown");
27
28
  }
28
29
  if (!Number.isInteger(maxTouchPoints) || maxTouchPoints < 0) {
29
30
  invalidNativePlatform("maxTouchPoints must be a non-negative integer");
30
31
  }
31
- const expectedFormFactor = MOBILE_OS.has(os) ? "mobile" : DESKTOP_OS.has(os) ? "desktop" : "unknown";
32
+ const expectedFormFactor = MOBILE_OS.has(os) ? "mobile" : DESKTOP_OS.has(os) ? "desktop" : CONSOLE_OS.has(os) ? "console" : "unknown";
32
33
  if (formFactor !== expectedFormFactor) {
33
34
  invalidNativePlatform("os and formFactor disagree");
34
35
  }
@@ -134,6 +135,12 @@ function isNative() {
134
135
  function isMobile() {
135
136
  return getPlatform().formFactor === "mobile";
136
137
  }
138
+ function isConsole() {
139
+ return getPlatform().formFactor === "console";
140
+ }
141
+ function isPs4() {
142
+ return getPlatform().os === "ps4";
143
+ }
137
144
  function isTouchscreenAvailable() {
138
145
  return getPlatform().maxTouchPoints > 0;
139
146
  }
@@ -150,4 +157,4 @@ function hostResizeObserver() {
150
157
  return typeof ResizeObserver === "undefined" ? void 0 : ResizeObserver;
151
158
  }
152
159
 
153
- export { getPlatform, hostDocument, hostGestureTarget, hostResizeObserver, hostWindow, isMobile, isNative, isTouchscreenAvailable, isWeb };
160
+ export { getPlatform, hostDocument, hostGestureTarget, hostResizeObserver, hostWindow, isConsole, isMobile, isNative, isPs4, isTouchscreenAvailable, isWeb };
@@ -0,0 +1,4 @@
1
+ /** `filmic` is a fresh Unreal 5.8.3 project's curve and the default; the rest are the named overrides. */
2
+ type RendererToneMapping = "filmic" | "aces" | "agx" | "neutral" | "none";
3
+
4
+ export type { RendererToneMapping as R };
@@ -1,7 +1,7 @@
1
- import { I as IAssetLoader, a as IAssetLoaderOptions } from './assets-YUbXa3-Y.js';
2
- import { F as FramePassKind, c as IRenderPassSample, d as IFramePhaseSample, e as IPipelineCensus, I as IRendererLike, f as IRendererOptions, a as IFrameBudgetWindow, g as IFrameBudgetOptions } from './renderer-DvFVoAgj.js';
1
+ import { I as IAssetLoader, a as IAssetLoaderOptions } from './assets-CfMKnOsK.js';
2
+ import { F as FramePassKind, c as IRenderPassSample, d as IFramePhaseSample, e as IRendererOptions, f as IPipelineCensus, I as IRendererLike, a as IFrameBudgetWindow, g as IFrameBudgetOptions } from './renderer-BtOSseYf.js';
3
3
  import { Vector2, Vector3, Object3D, Camera, Intersection, Scene as Scene$1 } from 'three';
4
- import { V as Viewport, C as CanvasLayer, I as IViewportOptions } from './canvas-layer-CWuFRT7G.js';
4
+ import { V as Viewport, C as CanvasLayer, I as IViewportOptions } from './canvas-layer-G7ttVy7y.js';
5
5
  import { StoreApi } from 'zustand/vanilla';
6
6
 
7
7
  type EntitySnapshot = Record<string, Record<string, unknown> & {
@@ -349,6 +349,14 @@ interface IThreeNativeConfig {
349
349
  readonly orientation?: ThreeNativeOrientation;
350
350
  readonly fullscreen?: boolean;
351
351
  readonly keepScreenOn?: boolean;
352
+ /**
353
+ * CPU priority of a shipped native game (PRD-859). `"game"`, the default, raises the game, render
354
+ * and present threads above other programs and lowers the game's own background work (shader
355
+ * compiles, workers, the HUD processes), through the route each OS allows without admin rights.
356
+ * `"normal"` keeps the OS default. The player reports what the OS applied on its
357
+ * `TN_PROCESS_PRIORITY` line. The browser owns scheduling, so a web build ignores it.
358
+ */
359
+ readonly priority?: "game" | "normal";
352
360
  /**
353
361
  * Maximum native presentation rate in frames per second. Left out, it follows the display's own
354
362
  * refresh rate capped at 120 on desktop and web, and stays 60 on mobile where the ceiling is
@@ -838,8 +846,24 @@ interface IInputGamepad {
838
846
  readonly buttons: readonly {
839
847
  readonly pressed: boolean;
840
848
  }[];
849
+ /** The browser's device name, which carries the vendor:product an unmapped pad is looked up by. */
850
+ readonly id?: string;
851
+ /**
852
+ * `"standard"` when the pad already uses the W3C standard layout, and `""` when the browser does
853
+ * not know the device. A source with no `mapping` at all is standard by construction: the owned
854
+ * native host builds standard pads, and so does a fixture.
855
+ */
856
+ readonly mapping?: string;
841
857
  }
842
858
  type InputPlatformSource = () => readonly (IInputGamepad | null)[];
859
+ interface IInputMapOptions {
860
+ /**
861
+ * Radial dead zone for both sticks, `0`..`1`. Default `0.2`, the stock Enhanced Input dead zone
862
+ * (`UInputModifierDeadZone`, `LowerThreshold = 0.2`, `EDeadZoneType::Radial`). A stick inside it
863
+ * reads zero, one outside it is rescaled so full tilt is still `1`. `0` publishes raw axes.
864
+ */
865
+ readonly gamepadDeadZone?: number;
866
+ }
843
867
  interface IRawInputPointer {
844
868
  readonly id: number;
845
869
  buttons: number;
@@ -880,7 +904,13 @@ declare function captureMouse(target: EventTarget): Promise<void> | undefined;
880
904
  declare class InputMap {
881
905
  #private;
882
906
  readonly raw: IRawInputState;
883
- constructor(bindings?: InputBindings, target?: EventTarget, pointerTarget?: EventTarget, source?: InputPlatformSource, contextMenu?: ContextMenuPolicy);
907
+ /**
908
+ * Radial dead zone for both sticks; `0` publishes the raw axes. Read on every tick, so a game may
909
+ * change it while running, and a value that is not a finite number from 0 through 1 reads as raw
910
+ * axes. `defineGame({ gamepadDeadZone })` sets the starting value and refuses one it cannot honour.
911
+ */
912
+ gamepadDeadZone: number;
913
+ constructor(bindings?: InputBindings, target?: EventTarget, pointerTarget?: EventTarget, source?: InputPlatformSource, contextMenu?: ContextMenuPolicy, options?: IInputMapOptions);
884
914
  /**
885
915
  * Returns a 2D action vector where +y is up. On a conventional XZ ground plane whose
886
916
  * forward direction is -z, map `vector.y` to `-z`. This differs from Godot's
@@ -897,7 +927,11 @@ declare class InputMap {
897
927
  * a third pointer is ignored and a changing pair starts a new gesture without a jump.
898
928
  */
899
929
  axis(name: string): number;
900
- /** Request pointer capture explicitly from a named game gesture. Relative bindings request it on canvas click by default. */
930
+ /**
931
+ * Request pointer capture explicitly from a named game gesture. Relative bindings request it on
932
+ * canvas click by default. A refused lock — an unfocused window, an untrusted gesture — leaves
933
+ * `raw.pointer.captured` false and warns once as `TN_POINTER_LOCK_REFUSED:`, never a rejection.
934
+ */
901
935
  captureMouse(): void;
902
936
  /** Release pointer capture. A browser refusal remains an unhandled rejection. */
903
937
  releaseMouse(): void;
@@ -938,6 +972,18 @@ interface IRandom {
938
972
  }
939
973
  declare function createRandom(seed?: number): IRandom;
940
974
 
975
+ type RendererConfig = NonNullable<IThreeNativeConfig["renderer"]>;
976
+ /**
977
+ * What `defineGame({ renderer })` accepts: the project's portable renderer config (`threenative.config.ts`
978
+ * `renderer`, including its `android` block and `"auto"` scale) beside the live renderer options.
979
+ *
980
+ * One key for both. `defineGame` once took the portable config as `render` and the live options as
981
+ * `renderer`, so a game wrote `render: config.renderer` beside a second `renderer:` and the
982
+ * antialias and scale resolvers each fell back from one to the other. The scale is the one field
983
+ * the two disagreed on, and the portable form (a number or `"auto"`) is the superset.
984
+ */
985
+ type GameRendererConfig = Omit<IRendererOptions, "resolutionScale" | "scaleSource"> & RendererConfig;
986
+
941
987
  interface IRaycastOptions {
942
988
  /** Screen point in canvas pixels. Mutually exclusive with `origin` and `direction`. */
943
989
  readonly screen?: Vector2;
@@ -1695,6 +1741,12 @@ interface IGameConfig<TState extends Record<string, unknown> = Record<string, un
1695
1741
  * the browser menu over its canvas.
1696
1742
  */
1697
1743
  readonly contextMenu?: ContextMenuPolicy;
1744
+ /**
1745
+ * Radial dead zone for both controller sticks, `0`..`1`. Default `0.2`, the stock Enhanced Input
1746
+ * value, so a worn stick resting at `0.08` reads zero instead of walking the character. A stick
1747
+ * past the zone is rescaled so full tilt is still `1`. Pass `0` to read raw axes.
1748
+ */
1749
+ readonly gamepadDeadZone?: number;
1698
1750
  /**
1699
1751
  * Per-frame cost attribution, on by default. Every `reportEvery` presented frames the game
1700
1752
  * prints one `TN_FRAME_BUDGET` line naming where the frame went — present wait, simulation,
@@ -1756,8 +1808,20 @@ interface IGameConfig<TState extends Record<string, unknown> = Record<string, un
1756
1808
  * 60 fps default rather than a scaler with no target.
1757
1809
  */
1758
1810
  readonly display?: NonNullable<IThreeNativeConfig["display"]>;
1759
- readonly render?: NonNullable<IThreeNativeConfig["renderer"]>;
1760
- readonly renderer?: IRendererOptions;
1811
+ /**
1812
+ * The project's renderer settings: `config.renderer` from `threenative.config.ts` beside the live
1813
+ * renderer options, as one key.
1814
+ *
1815
+ * `render` once carried the portable half, so a game wrote `render: config.renderer` beside a
1816
+ * second `renderer:` and the antialias and scale resolvers each fell back from one to the other.
1817
+ * The keys are one now; `render` is adopted onto this one and reported as renamed.
1818
+ */
1819
+ readonly renderer?: GameRendererConfig;
1820
+ /**
1821
+ * @deprecated The retired name for {@link renderer}, adopted onto it and reported. Move the object
1822
+ * to `renderer` with no other change.
1823
+ */
1824
+ readonly render?: GameRendererConfig;
1761
1825
  readonly seed?: number;
1762
1826
  readonly scenes: Record<string, SceneConstructor<TState, TPhysics>>;
1763
1827
  /**
@@ -1840,4 +1904,4 @@ interface IGame<TState extends Record<string, unknown> = Record<string, unknown>
1840
1904
  }
1841
1905
  declare function defineGame<TState extends Record<string, unknown>, TPhysics = undefined>(config: IGameConfig<TState, TPhysics>): IGame<TState, TPhysics>;
1842
1906
 
1843
- export { type IWarmUpRenderer as $, type AfterPhysicsCallback as A, type IRandom as B, type ContextMenuPolicy as C, type IRawInputPointer as D, type IRawInputPointerEdge as E, type IRawInputState as F, GEOMETRY_ASSET_KEY as G, type IRaycastOptions as H, type IGame as I, type IScenePickerOptions as J, type IThreeNativeAudioConfig as K, type IThreeNativeAudioLoop as L, type IThreeNativeAudioOverride as M, type IThreeNativeAudioSpectrum as N, type IThreeNativeBootSplash as O, type IThreeNativeConfig as P, type IThreeNativeIconVariants as Q, type IThreeNativeLodConfig as R, type IThreeNativeLodGenerationConfig as S, type IThreeNativeLodOverride as T, type IThreeNativeLodRuntimeConfig as U, type IThreeNativeTexturesConfig as V, type ITweenOptions as W, type IWarmUpCacheOptions as X, type IWarmUpObservation as Y, type IWarmUpOptions as Z, type IWarmUpProgress as _, type IGamePluginHooks as a, type IWarmUpReport as a0, type InputBindings as a1, InputMap as a2, type InputPlatformSource as a3, type PointerEvent3DListener as a4, type PointerEvent3DType as a5, PointerEvents3D as a6, Scene as a7, type SceneFrame as a8, ScenePicker as a9, type ScheduleHandle as aa, Scheduler as ab, type ThreeNativeBackgroundMode as ac, type ThreeNativeLodMinTrianglesScope as ad, type ThreeNativeLodPreset as ae, type ThreeNativeOrientation as af, type ThreeNativeUiRenderer as ag, type WarmUpCacheStatus as ah, type WarmUpObservationStatus as ai, afterPhysics as aj, captureMouse as ak, createRandom as al, defineGame as am, warmUpScene as an, type IGamePluginRuntime as b, GEOMETRY_CAPTURE_DEFAULT_LIMIT as c, GEOMETRY_CAPTURE_MAX_LIMIT as d, GEOMETRY_CAPTURE_SORTS as e, GEOMETRY_CAPTURE_TIMEOUT_MS as f, GEOMETRY_CAPTURE_WALK_CAP as g, type GeometryCaptureSort as h, type ICtx as i, type IGameObservationContribution as j, type IGameObservationSampleRequest as k, type IGamePlatformSource as l, type IGeometryCaptureAsset as m, type IGeometryCaptureMesh as n, type IGeometryCapturePass as o, type IGeometryCaptureReport as p, type IGeometryCaptureRequest as q, type IGeometryCaptureRow as r, type IInputAction as s, type IInputGamepad as t, type IPointerDragHandle as u, type IPointerEvent3D as v, type IPointerEvents3D as w, type IPointerEvents3DOptions as x, type IPointerEvents3DPicker as y, type IPointerState as z };
1907
+ export { type IWarmUpOptions as $, type AfterPhysicsCallback as A, type IPointerState as B, type ContextMenuPolicy as C, type IRandom as D, type EntitySnapshot as E, type IRawInputPointer as F, GEOMETRY_ASSET_KEY as G, type IRawInputPointerEdge as H, type IGame as I, type IRawInputState as J, type IRaycastOptions as K, type IScenePickerOptions as L, type IThreeNativeAudioConfig as M, type IThreeNativeAudioLoop as N, type IThreeNativeAudioOverride as O, type IThreeNativeAudioSpectrum as P, type IThreeNativeBootSplash as Q, type IThreeNativeConfig as R, type IThreeNativeIconVariants as S, type IThreeNativeLodConfig as T, type IThreeNativeLodGenerationConfig as U, type IThreeNativeLodOverride as V, type IThreeNativeLodRuntimeConfig as W, type IThreeNativeTexturesConfig as X, type ITweenOptions as Y, type IWarmUpCacheOptions as Z, type IWarmUpObservation as _, type IGamePluginHooks as a, type IWarmUpProgress as a0, type IWarmUpRenderer as a1, type IWarmUpReport as a2, type InputBindings as a3, InputMap as a4, type InputPlatformSource as a5, type PointerEvent3DListener as a6, type PointerEvent3DType as a7, PointerEvents3D as a8, Scene as a9, type SceneFrame as aa, ScenePicker as ab, type ScheduleHandle as ac, Scheduler as ad, type ThreeNativeBackgroundMode as ae, type ThreeNativeLodMinTrianglesScope as af, type ThreeNativeLodPreset as ag, type ThreeNativeOrientation as ah, type ThreeNativeUiRenderer as ai, type WarmUpCacheStatus as aj, type WarmUpObservationStatus as ak, afterPhysics as al, captureMouse as am, createRandom as an, defineGame as ao, warmUpScene as ap, type IGeometryCaptureRequest as b, type IGeometryCaptureReport as c, type IGamePluginRuntime as d, GEOMETRY_CAPTURE_DEFAULT_LIMIT as e, GEOMETRY_CAPTURE_MAX_LIMIT as f, GEOMETRY_CAPTURE_SORTS as g, GEOMETRY_CAPTURE_TIMEOUT_MS as h, GEOMETRY_CAPTURE_WALK_CAP as i, type GeometryCaptureSort as j, type ICtx as k, type IGameObservationContribution as l, type IGameObservationSampleRequest as m, type IGamePlatformSource as n, type IGeometryCaptureAsset as o, type IGeometryCaptureMesh as p, type IGeometryCapturePass as q, type IGeometryCaptureRow as r, type IInputAction as s, type IInputGamepad as t, type IInputMapOptions as u, type IPointerDragHandle as v, type IPointerEvent3D as w, type IPointerEvents3D as x, type IPointerEvents3DOptions as y, type IPointerEvents3DPicker as z };
package/dist/hot.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { a as audioRuntimeSnapshot } from './audio-DIJE5HTr.js';
2
- import { I as IGame } from './game-D7pAzZUY.js';
2
+ import { I as IGame } from './game-k8K3hZai.js';
3
3
  import 'three';
4
- import './assets-YUbXa3-Y.js';
5
- import './renderer-DvFVoAgj.js';
4
+ import './assets-CfMKnOsK.js';
5
+ import './renderer-BtOSseYf.js';
6
6
  import 'three/webgpu';
7
- import './canvas-layer-CWuFRT7G.js';
7
+ import './default-tone-mapping-GgKPTiBP.js';
8
+ import './canvas-layer-G7ttVy7y.js';
8
9
  import 'zustand/vanilla';
9
10
 
10
11
  interface IHotDiagnostics {
package/dist/hot.js CHANGED
@@ -1,5 +1,6 @@
1
- import { audioRuntimeSnapshot } from './chunk-DBELTTTM.js';
2
- import { hostWindow, hostDocument } from './chunk-6KLNISRJ.js';
1
+ import { audioRuntimeSnapshot } from './chunk-U4YHUKKL.js';
2
+ import { hostWindow, hostDocument } from './chunk-XDTZ4QMO.js';
3
+ import { publishDevGlobal, devGlobal } from './chunk-VP43GIWW.js';
3
4
 
4
5
  // src/hot.ts
5
6
  var isDev = import.meta.env?.DEV === true;
@@ -22,12 +23,8 @@ function acceptHotUpdate(game, hot) {
22
23
  }
23
24
  const page = hostWindow();
24
25
  if (isDev && page !== void 0) {
25
- const host = page;
26
- host.__THREENATIVE__ = {
27
- ...host.__THREENATIVE__,
28
- hot: () => diagnostics(game, reloads),
29
- snapshot: host.__THREENATIVE__?.snapshot ?? (() => ({}))
30
- };
26
+ publishDevGlobal("hot", () => diagnostics(game, reloads), page);
27
+ if (devGlobal(page)?.snapshot === void 0) publishDevGlobal("snapshot", () => ({}), page);
31
28
  }
32
29
  let disposed = false;
33
30
  hot.dispose((data) => {