@threenative/core 0.3.11 → 0.3.13

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 (236) hide show
  1. package/README.md +1 -1
  2. package/capabilities.json +1988 -204
  3. package/dist/{assets-YUbXa3-Y.d.ts → assets-CfMKnOsK.d.ts} +78 -1
  4. package/dist/camera-shake-CZKOfGn4.d.ts +46 -0
  5. package/dist/{canvas-layer-vCtanIeB.d.ts → canvas-layer-G7ttVy7y.d.ts} +1 -1
  6. package/dist/chunk-4SRAQFTU.js +133 -0
  7. package/dist/chunk-CFGTPFUH.js +231 -0
  8. package/dist/chunk-DIPIJICH.js +8916 -0
  9. package/dist/chunk-EEABDLUC.js +2237 -0
  10. package/dist/chunk-EFWZWLPY.js +1895 -0
  11. package/dist/chunk-GXY7B3JG.js +46 -0
  12. package/dist/chunk-GYUZJQ7U.js +280 -0
  13. package/dist/chunk-H4J6IAJE.js +504 -0
  14. package/dist/chunk-KIRUKTBQ.js +187 -0
  15. package/dist/chunk-QWJEMUUT.js +94 -0
  16. package/dist/chunk-SV4QVUTQ.js +31 -0
  17. package/dist/chunk-U4YHUKKL.js +615 -0
  18. package/dist/chunk-VP43GIWW.js +18 -0
  19. package/dist/chunk-XDTZ4QMO.js +160 -0
  20. package/dist/default-tone-mapping-GgKPTiBP.d.ts +4 -0
  21. package/dist/{game-DzMcitDO.d.ts → game-k8K3hZai.d.ts} +85 -9
  22. package/dist/hot.d.ts +5 -4
  23. package/dist/hot.js +5 -52
  24. package/dist/index.d.ts +633 -1351
  25. package/dist/index.js +12873 -23068
  26. package/dist/{model-lod-CTpZ6imz.d.ts → model-lod-DPTzeCcD.d.ts} +35 -3
  27. package/dist/playtest.d.ts +5 -4
  28. package/dist/playtest.js +25 -75
  29. package/dist/quality-BYqKGAwo.d.ts +868 -0
  30. package/dist/react-css.js +1 -215
  31. package/dist/react.d.ts +3 -2
  32. package/dist/render-environment.d.ts +170 -0
  33. package/dist/render-environment.js +352 -0
  34. package/dist/{renderer-rZm0hVqq.d.ts → renderer-BtOSseYf.d.ts} +42 -35
  35. package/dist/spells/index.d.ts +643 -0
  36. package/dist/spells/index.js +1558 -0
  37. package/dist/spells/ultra/index.d.ts +1600 -0
  38. package/dist/spells/ultra/index.js +6804 -0
  39. package/dist/terrain-jobs-worker.js +1 -123
  40. package/dist/two-sided-foliage-W523J3UM.js +1 -0
  41. package/dist/ui-layer.js +6 -384
  42. package/dist/worker.js +13 -43
  43. package/dist/world.d.ts +988 -268
  44. package/dist/world.js +17464 -18290
  45. package/mcp/animation-server.mjs +1 -1
  46. package/mcp/animation.mjs +2 -3
  47. package/mcp/engine-server.mjs +245 -52
  48. package/mcp/servers.mjs +10 -3
  49. package/mcp/terrain.mjs +8 -0
  50. package/package.json +19 -7
  51. package/patches/three@0.187.0-prd269-upgrade.patch +2102 -0
  52. package/patches/three@0.187.0.patch +2004 -407
  53. package/src/animation-batch.ts +193 -0
  54. package/src/animation-layers.ts +7 -3
  55. package/src/animation.ts +209 -29
  56. package/src/asset-cache.ts +3 -3
  57. package/src/asset-memo.ts +202 -0
  58. package/src/assets.ts +437 -125
  59. package/src/auto-batch.ts +190 -44
  60. package/src/card-lod.ts +152 -0
  61. package/src/compressed-texture-preparation.ts +1008 -0
  62. package/src/compute-driven.ts +1 -1
  63. package/src/config.ts +8 -0
  64. package/src/debug.ts +103 -22
  65. package/src/dev-global.ts +54 -0
  66. package/src/engine-hooks.ts +37 -0
  67. package/src/frame-budget.ts +50 -23
  68. package/src/game-boot-phase.ts +269 -0
  69. package/src/game-dev-tools.ts +86 -0
  70. package/src/game-frame-loop.ts +958 -0
  71. package/src/game-renderer-metrics.ts +77 -0
  72. package/src/game-startup.ts +1076 -0
  73. package/src/game-ui.ts +84 -0
  74. package/src/game-validate.ts +70 -0
  75. package/src/game.ts +198 -2264
  76. package/src/gamepad-mappings.ts +269 -0
  77. package/src/generated/console-markers.ts +13 -0
  78. package/src/geometry-capture.ts +28 -4
  79. package/src/gpu-readings.ts +98 -0
  80. package/src/gpu-scene-bvh.ts +149 -36
  81. package/src/hot.ts +4 -7
  82. package/src/index.ts +141 -9
  83. package/src/input.ts +237 -25
  84. package/src/instanced-batch-lod.ts +3 -8
  85. package/src/interpolation.ts +171 -40
  86. package/src/launch-diagnostics.ts +22 -12
  87. package/src/look/ao-admission.ts +25 -0
  88. package/src/look/auto-exposure.ts +5 -16
  89. package/src/look/default-tone-mapping.ts +41 -5
  90. package/src/look/filmic-tone-mapping.ts +15 -13
  91. package/src/look/local-exposure.ts +2 -7
  92. package/src/look/look-diagnostics.ts +3 -3
  93. package/src/look/quad-pass.ts +21 -0
  94. package/src/look/quality.ts +14 -5
  95. package/src/look/unreal-bloom.ts +4 -13
  96. package/src/look/world-environment.ts +113 -103
  97. package/src/loop.ts +29 -0
  98. package/src/merge-parts.ts +20 -24
  99. package/src/model-lod.ts +139 -17
  100. package/src/particle-kinds.ts +515 -0
  101. package/src/particle-significance.ts +12 -0
  102. package/src/particles.ts +19 -10
  103. package/src/picking.ts +17 -3
  104. package/src/platform.ts +23 -4
  105. package/src/playtest.ts +27 -1
  106. package/src/profiling/FrameStages.ts +5 -6
  107. package/src/profiling/Spans.ts +3 -17
  108. package/src/profiling/debug-telemetry.ts +2 -6
  109. package/src/profiling/render-list-validate.ts +6 -15
  110. package/src/projection-apply.ts +4 -1
  111. package/src/projection-marker.ts +2 -1
  112. package/src/projection-plan.ts +9 -6
  113. package/src/quiet-markers.ts +3 -10
  114. package/src/render/cpu-bvh.ts +100 -0
  115. package/src/render/depth-pyramid.ts +6 -14
  116. package/src/render/environment/environmentContribution.ts +202 -0
  117. package/src/render/environment/environmentRadiance.ts +44 -0
  118. package/src/render/environment/environmentSampleCache.ts +56 -0
  119. package/src/render/environment/environmentSampling.ts +201 -0
  120. package/src/render/environment/environmentSnapshot.ts +71 -0
  121. package/src/render/environment/gate.ts +57 -0
  122. package/src/render/mesh-pool.ts +4 -20
  123. package/src/render/probe-trace.ts +872 -0
  124. package/src/render/probe-volume.ts +780 -34
  125. package/src/render/radiance-cache.ts +17 -0
  126. package/src/render/resolution-subrect.ts +2 -0
  127. package/src/render/rough-diffuse.ts +46 -12
  128. package/src/render/soft-shadow.ts +27 -12
  129. package/src/render/virtual-shadow-adaptive.ts +55 -0
  130. package/src/render/virtual-shadow-casters.ts +175 -0
  131. package/src/render/virtual-shadow-layers.ts +76 -0
  132. package/src/render/virtual-shadow-level.ts +224 -0
  133. package/src/render/virtual-shadow-markers.ts +193 -0
  134. package/src/render/virtual-shadow-options.ts +370 -0
  135. package/src/render/virtual-shadow-pages.ts +5 -0
  136. package/src/render/virtual-shadow-partial.ts +13 -0
  137. package/src/render/virtual-shadow.ts +231 -1008
  138. package/src/render/world-impostor-surface.ts +402 -40
  139. package/src/render/world-impostor.ts +5 -2
  140. package/src/render-camera-cull.ts +98 -3
  141. package/src/render-environment.ts +41 -0
  142. package/src/render-pass-budget.ts +34 -7
  143. package/src/renderProjection.ts +22 -0
  144. package/src/renderer-config.ts +36 -0
  145. package/src/renderer-facts.ts +37 -0
  146. package/src/renderer.ts +144 -65
  147. package/src/resolution-scaler.ts +3 -2
  148. package/src/scene-entry-inspectors.ts +61 -0
  149. package/src/snow-field.ts +2 -1
  150. package/src/spells/cast-pool.ts +361 -0
  151. package/src/spells/index.ts +177 -0
  152. package/src/spells/mechanisms.ts +295 -0
  153. package/src/spells/reaction-field.ts +415 -0
  154. package/src/spells/spell-lights.ts +139 -0
  155. package/src/spells/spell-world.ts +187 -0
  156. package/src/spells/spell.ts +397 -0
  157. package/src/spells/spells.ts +283 -0
  158. package/src/spells/ultra/engine/camera.ts +184 -0
  159. package/src/spells/ultra/engine/quality.ts +96 -0
  160. package/src/spells/ultra/index.ts +52 -0
  161. package/src/spells/ultra/main.ts +305 -0
  162. package/src/spells/ultra/scene/arenaMaterial.ts +325 -0
  163. package/src/spells/ultra/spells/cast.ts +233 -0
  164. package/src/spells/ultra/spells/fire.ts +1267 -0
  165. package/src/spells/ultra/vfx/FluidVolume.ts +816 -0
  166. package/src/spells/ultra/vfx/FluidVolume.tsl.ts +855 -0
  167. package/src/spells/ultra/vfx/FxTarget.ts +61 -0
  168. package/src/spells/ultra/vfx/GroundField.ts +1399 -0
  169. package/src/spells/ultra/vfx/Particles.ts +1475 -0
  170. package/src/spells/ultra/vfx/Ribbons.ts +645 -0
  171. package/src/spells/ultra/vfx/Shockwaves.ts +286 -0
  172. package/src/spells/ultra/vfx/Volumes.ts +489 -0
  173. package/src/spells/ultra/vfx/common.ts +1195 -0
  174. package/src/spells/ultra/vfx/noise.ts +441 -0
  175. package/src/startup-offscreen-bytes.ts +78 -0
  176. package/src/startup-readiness.ts +128 -34
  177. package/src/static-transform.ts +25 -19
  178. package/src/streamed-textures.ts +112 -0
  179. package/src/streaming.ts +68 -4
  180. package/src/texture-streaming.ts +331 -0
  181. package/src/version.ts +1 -1
  182. package/src/warmup.ts +56 -8
  183. package/src/water-surface.ts +9 -3
  184. package/src/worker.ts +12 -2
  185. package/src/world-bundle-safety.ts +446 -0
  186. package/src/world-cell-batches.ts +1178 -0
  187. package/src/world-cell-chunks.ts +1128 -0
  188. package/src/world-cell-data.ts +995 -0
  189. package/src/world-cell-impostors.ts +1461 -0
  190. package/src/world-cell-lod-bias.ts +151 -0
  191. package/src/world-cell-models.ts +1074 -0
  192. package/src/world-cell-options.ts +177 -0
  193. package/src/world-cell-placements.ts +798 -0
  194. package/src/world-cell-prewarm.ts +592 -0
  195. package/src/world-cell-readiness.ts +357 -0
  196. package/src/world-cell-records.ts +401 -0
  197. package/src/world-cell-render-bundles.ts +459 -0
  198. package/src/world-cell-render-gpu-dress.ts +710 -0
  199. package/src/world-cell-render-main-cull.ts +540 -0
  200. package/src/world-cell-render-shadow-claims.ts +198 -0
  201. package/src/world-cell-render-util.ts +259 -0
  202. package/src/world-cell-render.ts +1501 -0
  203. package/src/world-cell-residency.ts +754 -0
  204. package/src/world-cell-stale.ts +238 -0
  205. package/src/world-cells.ts +1335 -10418
  206. package/src/world-chunk-shadow.ts +308 -0
  207. package/src/world-collar.ts +315 -0
  208. package/src/world-gpu-flags.ts +131 -0
  209. package/src/world-gpu-readback.ts +881 -0
  210. package/src/world-gpu-reference.ts +524 -0
  211. package/src/world-gpu-scene.ts +256 -2286
  212. package/src/world-gpu-shadow.ts +203 -0
  213. package/src/world-gpu-types.ts +409 -0
  214. package/src/world-gpu-validation.ts +518 -0
  215. package/src/world-heightfield.ts +802 -0
  216. package/src/world-load-limiter.ts +111 -0
  217. package/src/world-model-sections.ts +80 -0
  218. package/src/world-noise.ts +241 -0
  219. package/src/world-package.ts +42 -0
  220. package/src/world-region.ts +1 -1
  221. package/src/world-river-ribbon.ts +282 -0
  222. package/src/world-root-frame.ts +39 -0
  223. package/src/world-shore-field.ts +91 -0
  224. package/src/world-static-pose.ts +163 -0
  225. package/src/world-surface-sampler.ts +48 -0
  226. package/src/world-terrain-splat.ts +361 -153
  227. package/src/world-tile-budget.ts +249 -0
  228. package/src/world-tile-geometry.ts +469 -0
  229. package/src/world-tile-lod.ts +408 -0
  230. package/src/world-tile-observation.ts +566 -0
  231. package/src/world-tile-stitch.ts +166 -0
  232. package/src/world-tiles.ts +247 -1755
  233. package/src/world-validate.ts +6 -14
  234. package/src/world-warm.ts +51 -0
  235. package/src/world-water-bodies.ts +359 -0
  236. package/src/world.ts +48 -741
@@ -0,0 +1,160 @@
1
+ // src/platform.ts
2
+ var DESKTOP_OS = /* @__PURE__ */ new Set(["linux", "macos", "windows"]);
3
+ var MOBILE_OS = /* @__PURE__ */ new Set(["android", "ios"]);
4
+ var CONSOLE_OS = /* @__PURE__ */ new Set(["ps4"]);
5
+ function isRecord(value) {
6
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7
+ }
8
+ function freezePlatform(value) {
9
+ return Object.freeze(value);
10
+ }
11
+ function invalidNativePlatform(reason) {
12
+ throw new Error(`TN_NATIVE_PLATFORM_INVALID: ${reason}`);
13
+ }
14
+ function nativePlatform(source) {
15
+ if (!isRecord(source)) invalidNativePlatform("the native marker is not an object");
16
+ const descriptor = source.platform;
17
+ if (!isRecord(descriptor)) invalidNativePlatform("platform descriptor is missing");
18
+ const runtime = descriptor.runtime;
19
+ const os = descriptor.os;
20
+ const formFactor = descriptor.formFactor;
21
+ const maxTouchPoints = descriptor.maxTouchPoints;
22
+ if (runtime !== "native") invalidNativePlatform("runtime must be native");
23
+ if (os !== "android" && os !== "ios" && os !== "linux" && os !== "macos" && os !== "windows" && os !== "ps4" && os !== "unknown") {
24
+ invalidNativePlatform("os is unknown");
25
+ }
26
+ if (formFactor !== "mobile" && formFactor !== "desktop" && formFactor !== "console" && formFactor !== "unknown") {
27
+ invalidNativePlatform("formFactor is unknown");
28
+ }
29
+ if (!Number.isInteger(maxTouchPoints) || maxTouchPoints < 0) {
30
+ invalidNativePlatform("maxTouchPoints must be a non-negative integer");
31
+ }
32
+ const expectedFormFactor = MOBILE_OS.has(os) ? "mobile" : DESKTOP_OS.has(os) ? "desktop" : CONSOLE_OS.has(os) ? "console" : "unknown";
33
+ if (formFactor !== expectedFormFactor) {
34
+ invalidNativePlatform("os and formFactor disagree");
35
+ }
36
+ return freezePlatform({
37
+ formFactor,
38
+ maxTouchPoints,
39
+ os,
40
+ runtime
41
+ });
42
+ }
43
+ function text(value) {
44
+ return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
45
+ }
46
+ function parseOS(value) {
47
+ if (value === void 0) return void 0;
48
+ const normalized = value.toLowerCase();
49
+ if (normalized.includes("android")) return "android";
50
+ if (/(iphone|ipad|ipod|ios)/u.test(normalized)) return "ios";
51
+ if (/(windows|win32|win64|winnt|wince)/u.test(normalized)) return "windows";
52
+ if (/(macintosh|mac os|macos|macintel|macppc|mac68k)/u.test(normalized)) return "macos";
53
+ if (/(linux|x11)/u.test(normalized)) return "linux";
54
+ return void 0;
55
+ }
56
+ function compatibleBrowserOS(left, right, iosUserAgent) {
57
+ if (left === right) return true;
58
+ if (left === "android" && right === "linux" || left === "linux" && right === "android")
59
+ return true;
60
+ if (iosUserAgent && (left === "ios" && right === "macos" || left === "macos" && right === "ios"))
61
+ return true;
62
+ return false;
63
+ }
64
+ function resolveBrowserOS(userAgentDataOS, navigatorOS, userAgentOS, iosUserAgent) {
65
+ let resolved;
66
+ for (const candidate of [userAgentDataOS, navigatorOS, userAgentOS]) {
67
+ if (candidate === void 0) continue;
68
+ if (resolved === void 0) {
69
+ resolved = candidate;
70
+ continue;
71
+ }
72
+ if (!compatibleBrowserOS(resolved, candidate, iosUserAgent)) return "unknown";
73
+ if (resolved === "linux" && candidate === "android" || resolved === "macos" && candidate === "ios") {
74
+ resolved = candidate;
75
+ }
76
+ }
77
+ return resolved ?? "unknown";
78
+ }
79
+ function readTouchPoints(value) {
80
+ return Number.isInteger(value) && value >= 0 ? value : 0;
81
+ }
82
+ function browserPlatform(source) {
83
+ if (!isRecord(source)) {
84
+ return freezePlatform({
85
+ formFactor: "unknown",
86
+ maxTouchPoints: 0,
87
+ os: "unknown",
88
+ runtime: "web"
89
+ });
90
+ }
91
+ const userAgentData = isRecord(source.userAgentData) ? source.userAgentData : void 0;
92
+ const userAgentDataOS = parseOS(text(userAgentData?.platform));
93
+ const navigatorOS = parseOS(text(source.platform));
94
+ const userAgent = text(source.userAgent);
95
+ const userAgentOS = parseOS(userAgent);
96
+ const iosUserAgent = userAgentOS === "ios";
97
+ const os = resolveBrowserOS(userAgentDataOS, navigatorOS, userAgentOS, iosUserAgent);
98
+ let formFactor = "unknown";
99
+ if (typeof userAgentData?.mobile === "boolean") {
100
+ formFactor = userAgentData.mobile ? "mobile" : "desktop";
101
+ } else if (MOBILE_OS.has(os)) {
102
+ formFactor = "mobile";
103
+ } else if (DESKTOP_OS.has(os)) {
104
+ formFactor = "desktop";
105
+ }
106
+ if (os === "unknown") formFactor = "unknown";
107
+ return freezePlatform({
108
+ formFactor,
109
+ maxTouchPoints: readTouchPoints(source.maxTouchPoints),
110
+ os,
111
+ runtime: "web"
112
+ });
113
+ }
114
+ function globalPlatformSource() {
115
+ const globals = globalThis;
116
+ return {
117
+ native: globals.__THREENATIVE_NATIVE__,
118
+ navigator: globals.__tnPageNavigator ?? globals.navigator
119
+ };
120
+ }
121
+ function detectPlatform(source = globalPlatformSource()) {
122
+ return source.native === void 0 ? browserPlatform(source.navigator) : nativePlatform(source.native);
123
+ }
124
+ var platformSnapshot;
125
+ function getPlatform() {
126
+ platformSnapshot ??= detectPlatform();
127
+ return platformSnapshot;
128
+ }
129
+ function isWeb() {
130
+ return getPlatform().runtime === "web";
131
+ }
132
+ function isNative() {
133
+ return getPlatform().runtime === "native";
134
+ }
135
+ function isMobile() {
136
+ return getPlatform().formFactor === "mobile";
137
+ }
138
+ function isConsole() {
139
+ return getPlatform().formFactor === "console";
140
+ }
141
+ function isPs4() {
142
+ return getPlatform().os === "ps4";
143
+ }
144
+ function isTouchscreenAvailable() {
145
+ return getPlatform().maxTouchPoints > 0;
146
+ }
147
+ function hostWindow() {
148
+ return typeof window === "undefined" ? void 0 : window;
149
+ }
150
+ function hostGestureTarget() {
151
+ return hostWindow() ?? globalThis.__tnGamePlatform?.inputTarget;
152
+ }
153
+ function hostDocument() {
154
+ return typeof document === "undefined" ? void 0 : document;
155
+ }
156
+ function hostResizeObserver() {
157
+ return typeof ResizeObserver === "undefined" ? void 0 : ResizeObserver;
158
+ }
159
+
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-rZm0hVqq.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-vCtanIeB.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;
@@ -1598,8 +1644,20 @@ interface IGamePluginRuntime {
1598
1644
  * A run that counts fixed-step ticks must not also accumulate real seconds into the same
1599
1645
  * simulation, and the frames before its first `advance()` are exactly where a boot's seconds
1600
1646
  * used to land. Optional: a runtime without a clock just never freezes one.
1647
+ *
1648
+ * `settleSteps` is the settling pass the world is owed: a zero freeze lets `settleClock` spend it
1649
+ * instead, once the world's scene is live.
1601
1650
  */
1602
- readonly freezeClock?: () => void;
1651
+ readonly freezeClock?: (settleSteps?: number) => void;
1652
+ /**
1653
+ * Spend the settling pass now, from a caller that knows the world's scene is live.
1654
+ *
1655
+ * Present only when the runtime can spend it later than the freeze: a game that boots through a
1656
+ * loading scene otherwise settles the loading scene, and the world's own clock misses those fixed
1657
+ * steps — a playtest pose then depends on how fast the machine booted. Optional, and paired with
1658
+ * `freezeClock(0)`: a runtime without it settles on its first live frame, as before.
1659
+ */
1660
+ readonly settleClock?: (steps?: number) => void;
1603
1661
  /**
1604
1662
  * Draw the current world once without advancing it, for a screenshot taken while the loop is
1605
1663
  * driven by `fixedStep` and presents nothing between ticks. Optional: a runtime without a frozen
@@ -1683,6 +1741,12 @@ interface IGameConfig<TState extends Record<string, unknown> = Record<string, un
1683
1741
  * the browser menu over its canvas.
1684
1742
  */
1685
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;
1686
1750
  /**
1687
1751
  * Per-frame cost attribution, on by default. Every `reportEvery` presented frames the game
1688
1752
  * prints one `TN_FRAME_BUDGET` line naming where the frame went — present wait, simulation,
@@ -1744,8 +1808,20 @@ interface IGameConfig<TState extends Record<string, unknown> = Record<string, un
1744
1808
  * 60 fps default rather than a scaler with no target.
1745
1809
  */
1746
1810
  readonly display?: NonNullable<IThreeNativeConfig["display"]>;
1747
- readonly render?: NonNullable<IThreeNativeConfig["renderer"]>;
1748
- 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;
1749
1825
  readonly seed?: number;
1750
1826
  readonly scenes: Record<string, SceneConstructor<TState, TPhysics>>;
1751
1827
  /**
@@ -1828,4 +1904,4 @@ interface IGame<TState extends Record<string, unknown> = Record<string, unknown>
1828
1904
  }
1829
1905
  declare function defineGame<TState extends Record<string, unknown>, TPhysics = undefined>(config: IGameConfig<TState, TPhysics>): IGame<TState, TPhysics>;
1830
1906
 
1831
- 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-DzMcitDO.js';
2
+ import { I as IGame } from './game-k8K3hZai.js';
3
3
  import 'three';
4
- import './assets-YUbXa3-Y.js';
5
- import './renderer-rZm0hVqq.js';
4
+ import './assets-CfMKnOsK.js';
5
+ import './renderer-BtOSseYf.js';
6
6
  import 'three/webgpu';
7
- import './canvas-layer-vCtanIeB.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,49 +1,6 @@
1
- import 'three';
2
-
3
- // src/audio.ts
4
-
5
- // src/platform.ts
6
- function hostWindow() {
7
- return typeof window === "undefined" ? void 0 : window;
8
- }
9
- function hostDocument() {
10
- return typeof document === "undefined" ? void 0 : document;
11
- }
12
-
13
- // src/audio.ts
14
- var AUDIO_STATE = /* @__PURE__ */ Symbol.for("threenative.audio.runtime");
15
- function audioState() {
16
- const host = globalThis;
17
- const existing = host[AUDIO_STATE];
18
- if (existing !== void 0) return existing;
19
- const created = { buses: /* @__PURE__ */ new Set(), cueCounts: /* @__PURE__ */ new Map(), cueLog: [] };
20
- host[AUDIO_STATE] = created;
21
- return created;
22
- }
23
- function audioRuntimeSnapshot() {
24
- let queued = 0;
25
- let voices = 0;
26
- let pooled = 0;
27
- let paused = 0;
28
- const unsupported = /* @__PURE__ */ new Set();
29
- const state = audioState();
30
- for (const bus of state.buses) {
31
- queued += bus.queued;
32
- voices += bus.voices;
33
- pooled += bus.pooled;
34
- paused += bus.pausedVoices;
35
- for (const option of bus.unsupported) unsupported.add(option);
36
- }
37
- return {
38
- cues: Object.fromEntries(state.cueCounts),
39
- paused,
40
- pooled,
41
- queued,
42
- recentCues: state.cueLog.map((entry) => ({ ...entry })),
43
- unsupported: [...unsupported].sort(),
44
- voices
45
- };
46
- }
1
+ import { audioRuntimeSnapshot } from './chunk-U4YHUKKL.js';
2
+ import { hostWindow, hostDocument } from './chunk-XDTZ4QMO.js';
3
+ import { publishDevGlobal, devGlobal } from './chunk-VP43GIWW.js';
47
4
 
48
5
  // src/hot.ts
49
6
  var isDev = import.meta.env?.DEV === true;
@@ -66,12 +23,8 @@ function acceptHotUpdate(game, hot) {
66
23
  }
67
24
  const page = hostWindow();
68
25
  if (isDev && page !== void 0) {
69
- const host = page;
70
- host.__THREENATIVE__ = {
71
- ...host.__THREENATIVE__,
72
- hot: () => diagnostics(game, reloads),
73
- snapshot: host.__THREENATIVE__?.snapshot ?? (() => ({}))
74
- };
26
+ publishDevGlobal("hot", () => diagnostics(game, reloads), page);
27
+ if (devGlobal(page)?.snapshot === void 0) publishDevGlobal("snapshot", () => ({}), page);
75
28
  }
76
29
  let disposed = false;
77
30
  hot.dispose((data) => {