@vgai/engine 0.5.5 → 0.5.7

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 (446) hide show
  1. package/dist/adapter/adapter-surface.d.ts +30 -0
  2. package/dist/adapter/adapter-surface.d.ts.map +1 -0
  3. package/dist/adapter/adapter-surface.js +18 -0
  4. package/dist/adapter/authoring.d.ts +597 -0
  5. package/dist/adapter/authoring.d.ts.map +1 -0
  6. package/dist/adapter/authoring.js +22 -0
  7. package/dist/adapter/colyseus-networking-adapter.d.ts +77 -0
  8. package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -0
  9. package/dist/adapter/colyseus-networking-adapter.js +76 -0
  10. package/dist/adapter/first-party-systems.d.ts +23 -0
  11. package/dist/adapter/first-party-systems.d.ts.map +1 -0
  12. package/dist/adapter/first-party-systems.js +196 -0
  13. package/dist/adapter/host-context.d.ts +194 -0
  14. package/dist/adapter/host-context.d.ts.map +1 -0
  15. package/dist/adapter/host-context.js +80 -0
  16. package/dist/adapter/index.d.ts +33 -0
  17. package/dist/adapter/index.d.ts.map +1 -0
  18. package/dist/adapter/index.js +25 -0
  19. package/dist/adapter/ingest/game-contract.d.ts +53 -0
  20. package/dist/adapter/ingest/game-contract.d.ts.map +1 -0
  21. package/dist/adapter/ingest/game-contract.js +30 -0
  22. package/dist/adapter/ingest/scene-capture.d.ts +121 -0
  23. package/dist/adapter/ingest/scene-capture.d.ts.map +1 -0
  24. package/dist/adapter/ingest/scene-capture.js +270 -0
  25. package/dist/adapter/ingest/structural-ids.d.ts +64 -0
  26. package/dist/adapter/ingest/structural-ids.d.ts.map +1 -0
  27. package/dist/adapter/ingest/structural-ids.js +110 -0
  28. package/dist/adapter/ingest/upstream-pin.d.ts +44 -0
  29. package/dist/adapter/ingest/upstream-pin.d.ts.map +1 -0
  30. package/dist/adapter/ingest/upstream-pin.js +47 -0
  31. package/dist/adapter/loop-gate-report.d.ts +34 -0
  32. package/dist/adapter/loop-gate-report.d.ts.map +1 -0
  33. package/dist/adapter/loop-gate-report.js +37 -0
  34. package/dist/adapter/rapier-physics-adapter.d.ts +69 -0
  35. package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -0
  36. package/dist/adapter/rapier-physics-adapter.js +135 -0
  37. package/dist/adapter/root-adapter.d.ts +195 -0
  38. package/dist/adapter/root-adapter.d.ts.map +1 -0
  39. package/dist/adapter/root-adapter.js +25 -0
  40. package/dist/adapter/setup-three-root-adapter.d.ts +87 -0
  41. package/dist/adapter/setup-three-root-adapter.d.ts.map +1 -0
  42. package/dist/adapter/setup-three-root-adapter.js +791 -0
  43. package/dist/adapter/system-adapter.d.ts +453 -0
  44. package/dist/adapter/system-adapter.d.ts.map +1 -0
  45. package/dist/adapter/system-adapter.js +13 -0
  46. package/dist/adapter/transform.d.ts +18 -0
  47. package/dist/adapter/transform.d.ts.map +1 -0
  48. package/dist/adapter/transform.js +1 -0
  49. package/dist/ai/navigation.d.ts +78 -0
  50. package/dist/ai/navigation.d.ts.map +1 -0
  51. package/dist/ai/navigation.js +152 -0
  52. package/dist/animation/anim-graph-types.d.ts +25 -0
  53. package/dist/animation/anim-graph-types.d.ts.map +1 -0
  54. package/dist/animation/anim-graph-types.js +1 -0
  55. package/dist/animation/animation-clock.d.ts +213 -0
  56. package/dist/animation/animation-clock.d.ts.map +1 -0
  57. package/dist/animation/animation-clock.js +301 -0
  58. package/dist/animation/blend-node.d.ts +22 -0
  59. package/dist/animation/blend-node.d.ts.map +1 -0
  60. package/dist/animation/blend-node.js +97 -0
  61. package/dist/animation/camera-ownership.d.ts +249 -0
  62. package/dist/animation/camera-ownership.d.ts.map +1 -0
  63. package/dist/animation/camera-ownership.js +169 -0
  64. package/dist/animation/cinematic-cues.d.ts +200 -0
  65. package/dist/animation/cinematic-cues.d.ts.map +1 -0
  66. package/dist/animation/cinematic-cues.js +213 -0
  67. package/dist/animation/clip-map.d.ts +12 -0
  68. package/dist/animation/clip-map.d.ts.map +1 -0
  69. package/dist/animation/clip-map.js +31 -0
  70. package/dist/animation/cubic-spline-interpolant.d.ts +54 -0
  71. package/dist/animation/cubic-spline-interpolant.d.ts.map +1 -0
  72. package/dist/animation/cubic-spline-interpolant.js +111 -0
  73. package/dist/animation/theatre-clock-binding.d.ts +89 -0
  74. package/dist/animation/theatre-clock-binding.d.ts.map +1 -0
  75. package/dist/animation/theatre-clock-binding.js +29 -0
  76. package/dist/animation/theatre-director.d.ts +277 -0
  77. package/dist/animation/theatre-director.d.ts.map +1 -0
  78. package/dist/animation/theatre-director.js +248 -0
  79. package/dist/animation/theatre-object-binding.d.ts +305 -0
  80. package/dist/animation/theatre-object-binding.d.ts.map +1 -0
  81. package/dist/animation/theatre-object-binding.js +351 -0
  82. package/dist/animation/xstate-animation-binding.d.ts +119 -0
  83. package/dist/animation/xstate-animation-binding.d.ts.map +1 -0
  84. package/dist/animation/xstate-animation-binding.js +349 -0
  85. package/dist/animation/xstate-animation-meta.d.ts +266 -0
  86. package/dist/animation/xstate-animation-meta.d.ts.map +1 -0
  87. package/dist/animation/xstate-animation-meta.js +252 -0
  88. package/dist/asset-formats/camera.d.ts +15 -0
  89. package/dist/asset-formats/camera.d.ts.map +1 -0
  90. package/dist/asset-formats/camera.js +15 -0
  91. package/dist/asset-formats/collider.d.ts +21 -0
  92. package/dist/asset-formats/collider.d.ts.map +1 -0
  93. package/dist/asset-formats/collider.js +53 -0
  94. package/dist/asset-formats/index.d.ts +46 -0
  95. package/dist/asset-formats/index.d.ts.map +1 -0
  96. package/dist/asset-formats/index.js +36 -0
  97. package/dist/asset-formats/instances.d.ts +17 -0
  98. package/dist/asset-formats/instances.d.ts.map +1 -0
  99. package/dist/asset-formats/instances.js +31 -0
  100. package/dist/asset-formats/light.d.ts +21 -0
  101. package/dist/asset-formats/light.d.ts.map +1 -0
  102. package/dist/asset-formats/light.js +35 -0
  103. package/dist/asset-formats/material.d.ts +129 -0
  104. package/dist/asset-formats/material.d.ts.map +1 -0
  105. package/dist/asset-formats/material.js +88 -0
  106. package/dist/asset-formats/mesh.d.ts +22 -0
  107. package/dist/asset-formats/mesh.d.ts.map +1 -0
  108. package/dist/asset-formats/mesh.js +64 -0
  109. package/dist/asset-formats/parse.d.ts +20 -0
  110. package/dist/asset-formats/parse.d.ts.map +1 -0
  111. package/dist/asset-formats/parse.js +34 -0
  112. package/dist/asset-formats/particles.d.ts +1390 -0
  113. package/dist/asset-formats/particles.d.ts.map +1 -0
  114. package/dist/asset-formats/particles.js +319 -0
  115. package/dist/asset-formats/render-env.d.ts +387 -0
  116. package/dist/asset-formats/render-env.d.ts.map +1 -0
  117. package/dist/asset-formats/render-env.js +300 -0
  118. package/dist/asset-formats/tuples.d.ts +12 -0
  119. package/dist/asset-formats/tuples.d.ts.map +1 -0
  120. package/dist/asset-formats/tuples.js +14 -0
  121. package/dist/asset-loaders.d.ts +97 -0
  122. package/dist/asset-loaders.d.ts.map +1 -0
  123. package/dist/asset-loaders.js +209 -0
  124. package/dist/asset-parse-error.d.ts +24 -0
  125. package/dist/asset-parse-error.d.ts.map +1 -0
  126. package/dist/asset-parse-error.js +29 -0
  127. package/dist/asset-registry.d.ts +38 -0
  128. package/dist/asset-registry.d.ts.map +1 -0
  129. package/dist/asset-registry.js +66 -0
  130. package/dist/assets.d.ts +26 -0
  131. package/dist/assets.d.ts.map +1 -0
  132. package/dist/assets.js +55 -0
  133. package/dist/audio/wav-encode.d.ts +38 -0
  134. package/dist/audio/wav-encode.d.ts.map +1 -0
  135. package/dist/audio/wav-encode.js +97 -0
  136. package/dist/canvas-react/engine-bridge.d.ts +45 -0
  137. package/dist/canvas-react/engine-bridge.d.ts.map +1 -0
  138. package/dist/canvas-react/engine-bridge.js +45 -0
  139. package/dist/canvas-react/index.d.ts +42 -0
  140. package/dist/canvas-react/index.d.ts.map +1 -0
  141. package/dist/canvas-react/index.js +41 -0
  142. package/dist/canvas-react/pixi-primitive.d.ts +85 -0
  143. package/dist/canvas-react/pixi-primitive.d.ts.map +1 -0
  144. package/dist/canvas-react/pixi-primitive.js +181 -0
  145. package/dist/canvas-react/pixi-react-adapter.d.ts +71 -0
  146. package/dist/canvas-react/pixi-react-adapter.d.ts.map +1 -0
  147. package/dist/canvas-react/pixi-react-adapter.js +229 -0
  148. package/dist/canvas-react/pixi-react-root-factory.d.ts +56 -0
  149. package/dist/canvas-react/pixi-react-root-factory.d.ts.map +1 -0
  150. package/dist/canvas-react/pixi-react-root-factory.js +73 -0
  151. package/dist/canvas-react/world-context.d.ts +88 -0
  152. package/dist/canvas-react/world-context.d.ts.map +1 -0
  153. package/dist/canvas-react/world-context.js +212 -0
  154. package/dist/config.d.ts +9 -0
  155. package/dist/config.d.ts.map +1 -0
  156. package/dist/config.js +8 -0
  157. package/dist/core/frame-pacing.d.ts +90 -0
  158. package/dist/core/frame-pacing.d.ts.map +1 -0
  159. package/dist/core/frame-pacing.js +89 -0
  160. package/dist/core/game-loop.d.ts +62 -0
  161. package/dist/core/game-loop.d.ts.map +1 -0
  162. package/dist/core/game-loop.js +189 -0
  163. package/dist/core/seeded-random.d.ts +69 -0
  164. package/dist/core/seeded-random.d.ts.map +1 -0
  165. package/dist/core/seeded-random.js +121 -0
  166. package/dist/core/sim-clock.d.ts +199 -0
  167. package/dist/core/sim-clock.d.ts.map +1 -0
  168. package/dist/core/sim-clock.js +291 -0
  169. package/dist/core/system-runner.d.ts +96 -0
  170. package/dist/core/system-runner.d.ts.map +1 -0
  171. package/dist/core/system-runner.js +253 -0
  172. package/dist/core/types.d.ts +111 -0
  173. package/dist/core/types.d.ts.map +1 -0
  174. package/dist/core/types.js +25 -0
  175. package/dist/data/data-asset.d.ts +101 -0
  176. package/dist/data/data-asset.d.ts.map +1 -0
  177. package/dist/data/data-asset.js +122 -0
  178. package/dist/data/data-check-core.d.ts +109 -0
  179. package/dist/data/data-check-core.d.ts.map +1 -0
  180. package/dist/data/data-check-core.js +177 -0
  181. package/dist/data/data-ref.d.ts +79 -0
  182. package/dist/data/data-ref.d.ts.map +1 -0
  183. package/dist/data/data-ref.js +130 -0
  184. package/dist/data/vite-plugin-data.d.ts +79 -0
  185. package/dist/data/vite-plugin-data.d.ts.map +1 -0
  186. package/dist/data/vite-plugin-data.js +217 -0
  187. package/dist/defaults.d.ts +233 -0
  188. package/dist/defaults.d.ts.map +1 -0
  189. package/dist/defaults.js +137 -0
  190. package/dist/dev/chrome-trace.d.ts +45 -0
  191. package/dist/dev/chrome-trace.d.ts.map +1 -0
  192. package/dist/dev/chrome-trace.js +114 -0
  193. package/dist/dev/console-bridge.d.ts +22 -0
  194. package/dist/dev/console-bridge.d.ts.map +1 -0
  195. package/dist/dev/console-bridge.js +71 -0
  196. package/dist/dev/debug-draw.d.ts +24 -0
  197. package/dist/dev/debug-draw.d.ts.map +1 -0
  198. package/dist/dev/debug-draw.js +73 -0
  199. package/dist/dev/instruments.d.ts +133 -0
  200. package/dist/dev/instruments.d.ts.map +1 -0
  201. package/dist/dev/instruments.js +231 -0
  202. package/dist/dev/logger.d.ts +30 -0
  203. package/dist/dev/logger.d.ts.map +1 -0
  204. package/dist/dev/logger.js +90 -0
  205. package/dist/dev/performance-profiler.d.ts +111 -0
  206. package/dist/dev/performance-profiler.d.ts.map +1 -0
  207. package/dist/dev/performance-profiler.js +215 -0
  208. package/dist/dev/render-debug-adapter.d.ts +57 -0
  209. package/dist/dev/render-debug-adapter.d.ts.map +1 -0
  210. package/dist/dev/render-debug-adapter.js +141 -0
  211. package/dist/dev/render-memory.d.ts +53 -0
  212. package/dist/dev/render-memory.d.ts.map +1 -0
  213. package/dist/dev/render-memory.js +190 -0
  214. package/dist/dev/webgl-frame-capture.d.ts +134 -0
  215. package/dist/dev/webgl-frame-capture.d.ts.map +1 -0
  216. package/dist/dev/webgl-frame-capture.js +270 -0
  217. package/dist/dev/webgl-gpu-timer.d.ts +8 -0
  218. package/dist/dev/webgl-gpu-timer.d.ts.map +1 -0
  219. package/dist/dev/webgl-gpu-timer.js +52 -0
  220. package/dist/ecs/scene-index.d.ts +179 -0
  221. package/dist/ecs/scene-index.d.ts.map +1 -0
  222. package/dist/ecs/scene-index.js +331 -0
  223. package/dist/ecs/scene-query.d.ts +6 -0
  224. package/dist/ecs/scene-query.d.ts.map +1 -0
  225. package/dist/ecs/scene-query.js +40 -0
  226. package/dist/ecs/user-data.d.ts +193 -0
  227. package/dist/ecs/user-data.d.ts.map +1 -0
  228. package/dist/ecs/user-data.js +145 -0
  229. package/dist/index.d.ts +35 -0
  230. package/dist/index.d.ts.map +1 -0
  231. package/dist/index.js +29 -0
  232. package/dist/input/input-manager.d.ts +944 -0
  233. package/dist/input/input-manager.d.ts.map +1 -0
  234. package/dist/input/input-manager.js +2209 -0
  235. package/dist/input/input-types.d.ts +174 -0
  236. package/dist/input/input-types.d.ts.map +1 -0
  237. package/dist/input/input-types.js +1 -0
  238. package/dist/input/prompt-labels.d.ts +21 -0
  239. package/dist/input/prompt-labels.d.ts.map +1 -0
  240. package/dist/input/prompt-labels.js +121 -0
  241. package/dist/input/rebind-controller.d.ts +59 -0
  242. package/dist/input/rebind-controller.d.ts.map +1 -0
  243. package/dist/input/rebind-controller.js +85 -0
  244. package/dist/input/schema.d.ts +16 -0
  245. package/dist/input/schema.d.ts.map +1 -0
  246. package/dist/input/schema.js +228 -0
  247. package/dist/loader.d.ts +76 -0
  248. package/dist/loader.d.ts.map +1 -0
  249. package/dist/loader.js +114 -0
  250. package/dist/manifest/editor-port.d.ts +53 -0
  251. package/dist/manifest/editor-port.d.ts.map +1 -0
  252. package/dist/manifest/editor-port.js +67 -0
  253. package/dist/manifest/filename.d.ts +14 -0
  254. package/dist/manifest/filename.d.ts.map +1 -0
  255. package/dist/manifest/filename.js +43 -0
  256. package/dist/manifest/index.d.ts +6 -0
  257. package/dist/manifest/index.d.ts.map +1 -0
  258. package/dist/manifest/index.js +9 -0
  259. package/dist/manifest/load-file.d.ts +7 -0
  260. package/dist/manifest/load-file.d.ts.map +1 -0
  261. package/dist/manifest/load-file.js +23 -0
  262. package/dist/manifest/load.d.ts +161 -0
  263. package/dist/manifest/load.d.ts.map +1 -0
  264. package/dist/manifest/load.js +269 -0
  265. package/dist/manifest/locate.d.ts +24 -0
  266. package/dist/manifest/locate.d.ts.map +1 -0
  267. package/dist/manifest/locate.js +48 -0
  268. package/dist/manifest/schema.d.ts +293 -0
  269. package/dist/manifest/schema.d.ts.map +1 -0
  270. package/dist/manifest/schema.js +633 -0
  271. package/dist/physics/collider-dimensions.d.ts +63 -0
  272. package/dist/physics/collider-dimensions.d.ts.map +1 -0
  273. package/dist/physics/collider-dimensions.js +98 -0
  274. package/dist/physics/collision-system.d.ts +41 -0
  275. package/dist/physics/collision-system.d.ts.map +1 -0
  276. package/dist/physics/collision-system.js +64 -0
  277. package/dist/physics/physics-registry.d.ts +45 -0
  278. package/dist/physics/physics-registry.d.ts.map +1 -0
  279. package/dist/physics/physics-registry.js +65 -0
  280. package/dist/physics/transform-writer.d.ts +16 -0
  281. package/dist/physics/transform-writer.d.ts.map +1 -0
  282. package/dist/physics/transform-writer.js +38 -0
  283. package/dist/pixi/authoring.d.ts +93 -0
  284. package/dist/pixi/authoring.d.ts.map +1 -0
  285. package/dist/pixi/authoring.js +207 -0
  286. package/dist/pixi/index.d.ts +16 -0
  287. package/dist/pixi/index.d.ts.map +1 -0
  288. package/dist/pixi/index.js +15 -0
  289. package/dist/pixi/ingest-iframe.d.ts +82 -0
  290. package/dist/pixi/ingest-iframe.d.ts.map +1 -0
  291. package/dist/pixi/ingest-iframe.js +166 -0
  292. package/dist/pixi/ingest.d.ts +97 -0
  293. package/dist/pixi/ingest.d.ts.map +1 -0
  294. package/dist/pixi/ingest.js +40 -0
  295. package/dist/pixi/physics-registry.d.ts +24 -0
  296. package/dist/pixi/physics-registry.d.ts.map +1 -0
  297. package/dist/pixi/physics-registry.js +38 -0
  298. package/dist/pixi/scene-capture.d.ts +43 -0
  299. package/dist/pixi/scene-capture.d.ts.map +1 -0
  300. package/dist/pixi/scene-capture.js +92 -0
  301. package/dist/pixi/system-adapters.d.ts +16 -0
  302. package/dist/pixi/system-adapters.d.ts.map +1 -0
  303. package/dist/pixi/system-adapters.js +37 -0
  304. package/dist/react/unmanaged-root-detector.d.ts +18 -0
  305. package/dist/react/unmanaged-root-detector.d.ts.map +1 -0
  306. package/dist/react/unmanaged-root-detector.js +70 -0
  307. package/dist/react/use-data.d.ts +60 -0
  308. package/dist/react/use-data.d.ts.map +1 -0
  309. package/dist/react/use-data.js +101 -0
  310. package/dist/react/use-selection.d.ts +54 -0
  311. package/dist/react/use-selection.d.ts.map +1 -0
  312. package/dist/react/use-selection.js +71 -0
  313. package/dist/react/world-state.d.ts +154 -0
  314. package/dist/react/world-state.d.ts.map +1 -0
  315. package/dist/react/world-state.js +220 -0
  316. package/dist/render/auto-batcher.d.ts +34 -0
  317. package/dist/render/auto-batcher.d.ts.map +1 -0
  318. package/dist/render/auto-batcher.js +140 -0
  319. package/dist/render/instance-mesh.d.ts +5 -0
  320. package/dist/render/instance-mesh.d.ts.map +1 -0
  321. package/dist/render/instance-mesh.js +19 -0
  322. package/dist/render/light-camera-factory.d.ts +24 -0
  323. package/dist/render/light-camera-factory.d.ts.map +1 -0
  324. package/dist/render/light-camera-factory.js +71 -0
  325. package/dist/render/lod.d.ts +13 -0
  326. package/dist/render/lod.d.ts.map +1 -0
  327. package/dist/render/lod.js +16 -0
  328. package/dist/render/material-factory.d.ts +15 -0
  329. package/dist/render/material-factory.d.ts.map +1 -0
  330. package/dist/render/material-factory.js +186 -0
  331. package/dist/render/mesh-shadow.d.ts +11 -0
  332. package/dist/render/mesh-shadow.d.ts.map +1 -0
  333. package/dist/render/mesh-shadow.js +19 -0
  334. package/dist/render/particles-factory.d.ts +99 -0
  335. package/dist/render/particles-factory.d.ts.map +1 -0
  336. package/dist/render/particles-factory.js +361 -0
  337. package/dist/render/render-batch-system.d.ts +33 -0
  338. package/dist/render/render-batch-system.d.ts.map +1 -0
  339. package/dist/render/render-batch-system.js +223 -0
  340. package/dist/render/render-features.d.ts +47 -0
  341. package/dist/render/render-features.d.ts.map +1 -0
  342. package/dist/render/render-features.js +105 -0
  343. package/dist/render/render-settings.d.ts +35 -0
  344. package/dist/render/render-settings.d.ts.map +1 -0
  345. package/dist/render/render-settings.js +51 -0
  346. package/dist/render/spark-renderer-lifecycle.d.ts +18 -0
  347. package/dist/render/spark-renderer-lifecycle.d.ts.map +1 -0
  348. package/dist/render/spark-renderer-lifecycle.js +57 -0
  349. package/dist/render/viewport-shading.d.ts +17 -0
  350. package/dist/render/viewport-shading.d.ts.map +1 -0
  351. package/dist/render/viewport-shading.js +87 -0
  352. package/dist/runtime/create-runtime.d.ts +259 -0
  353. package/dist/runtime/create-runtime.d.ts.map +1 -0
  354. package/dist/runtime/create-runtime.js +666 -0
  355. package/dist/runtime/debug-bridge.d.ts +288 -0
  356. package/dist/runtime/debug-bridge.d.ts.map +1 -0
  357. package/dist/runtime/debug-bridge.js +277 -0
  358. package/dist/runtime/debug-registry.d.ts +287 -0
  359. package/dist/runtime/debug-registry.d.ts.map +1 -0
  360. package/dist/runtime/debug-registry.js +528 -0
  361. package/dist/runtime/dev-layers.d.ts +34 -0
  362. package/dist/runtime/dev-layers.d.ts.map +1 -0
  363. package/dist/runtime/dev-layers.js +40 -0
  364. package/dist/runtime/frame-selector-cache.d.ts +41 -0
  365. package/dist/runtime/frame-selector-cache.d.ts.map +1 -0
  366. package/dist/runtime/frame-selector-cache.js +65 -0
  367. package/dist/runtime/game.d.ts +576 -0
  368. package/dist/runtime/game.d.ts.map +1 -0
  369. package/dist/runtime/game.js +1003 -0
  370. package/dist/runtime/gameplay-rng-trap.d.ts +47 -0
  371. package/dist/runtime/gameplay-rng-trap.d.ts.map +1 -0
  372. package/dist/runtime/gameplay-rng-trap.js +95 -0
  373. package/dist/runtime/input-router.d.ts +78 -0
  374. package/dist/runtime/input-router.d.ts.map +1 -0
  375. package/dist/runtime/input-router.js +171 -0
  376. package/dist/runtime/mount-game.d.ts +126 -0
  377. package/dist/runtime/mount-game.d.ts.map +1 -0
  378. package/dist/runtime/mount-game.js +159 -0
  379. package/dist/runtime/mount-manifest.d.ts +174 -0
  380. package/dist/runtime/mount-manifest.d.ts.map +1 -0
  381. package/dist/runtime/mount-manifest.js +304 -0
  382. package/dist/runtime/presentation.d.ts +85 -0
  383. package/dist/runtime/presentation.d.ts.map +1 -0
  384. package/dist/runtime/presentation.js +92 -0
  385. package/dist/runtime/render-audio-control.d.ts +126 -0
  386. package/dist/runtime/render-audio-control.d.ts.map +1 -0
  387. package/dist/runtime/render-audio-control.js +116 -0
  388. package/dist/runtime/render-control.d.ts +347 -0
  389. package/dist/runtime/render-control.d.ts.map +1 -0
  390. package/dist/runtime/render-control.js +317 -0
  391. package/dist/runtime/render-seed.d.ts +56 -0
  392. package/dist/runtime/render-seed.d.ts.map +1 -0
  393. package/dist/runtime/render-seed.js +73 -0
  394. package/dist/runtime/state-bridge.d.ts +60 -0
  395. package/dist/runtime/state-bridge.d.ts.map +1 -0
  396. package/dist/runtime/state-bridge.js +62 -0
  397. package/dist/runtime/types.d.ts +285 -0
  398. package/dist/runtime/types.d.ts.map +1 -0
  399. package/dist/runtime/types.js +1 -0
  400. package/dist/runtime/unexported-game-trap.d.ts +36 -0
  401. package/dist/runtime/unexported-game-trap.d.ts.map +1 -0
  402. package/dist/runtime/unexported-game-trap.js +80 -0
  403. package/dist/setup/setup-audio.d.ts +20 -0
  404. package/dist/setup/setup-audio.d.ts.map +1 -0
  405. package/dist/setup/setup-audio.js +41 -0
  406. package/dist/setup/setup-particles.d.ts +17 -0
  407. package/dist/setup/setup-particles.d.ts.map +1 -0
  408. package/dist/setup/setup-particles.js +16 -0
  409. package/dist/setup/setup-physics.d.ts +25 -0
  410. package/dist/setup/setup-physics.d.ts.map +1 -0
  411. package/dist/setup/setup-physics.js +51 -0
  412. package/dist/setup/setup-renderer.d.ts +82 -0
  413. package/dist/setup/setup-renderer.d.ts.map +1 -0
  414. package/dist/setup/setup-renderer.js +381 -0
  415. package/dist/world3d-react/engine-bridge.d.ts +47 -0
  416. package/dist/world3d-react/engine-bridge.d.ts.map +1 -0
  417. package/dist/world3d-react/engine-bridge.js +48 -0
  418. package/dist/world3d-react/index.d.ts +47 -0
  419. package/dist/world3d-react/index.d.ts.map +1 -0
  420. package/dist/world3d-react/index.js +46 -0
  421. package/dist/world3d-react/r3f-adapter.d.ts +51 -0
  422. package/dist/world3d-react/r3f-adapter.d.ts.map +1 -0
  423. package/dist/world3d-react/r3f-adapter.js +368 -0
  424. package/dist/world3d-react/r3f-root-factory.d.ts +62 -0
  425. package/dist/world3d-react/r3f-root-factory.d.ts.map +1 -0
  426. package/dist/world3d-react/r3f-root-factory.js +79 -0
  427. package/dist/world3d-react/rapier-physics-bridge.d.ts +76 -0
  428. package/dist/world3d-react/rapier-physics-bridge.d.ts.map +1 -0
  429. package/dist/world3d-react/rapier-physics-bridge.js +120 -0
  430. package/dist/world3d-react/renderer-config.d.ts +58 -0
  431. package/dist/world3d-react/renderer-config.d.ts.map +1 -0
  432. package/dist/world3d-react/renderer-config.js +96 -0
  433. package/dist/world3d-react/world-context.d.ts +123 -0
  434. package/dist/world3d-react/world-context.d.ts.map +1 -0
  435. package/dist/world3d-react/world-context.js +204 -0
  436. package/dist-config/config.js +303 -0
  437. package/dist-config/config.js.map +7 -0
  438. package/package.json +14 -3
  439. package/src/adapter/rapier-physics-adapter.ts +77 -34
  440. package/src/config.ts +8 -0
  441. package/src/core/frame-pacing.ts +26 -0
  442. package/src/core/game-loop.ts +4 -3
  443. package/src/dev/instruments.ts +302 -0
  444. package/src/setup/setup-renderer.ts +2 -0
  445. package/src/world3d-react/index.ts +9 -0
  446. package/src/world3d-react/rapier-physics-bridge.tsx +137 -0
@@ -0,0 +1,228 @@
1
+ // T4.6 — the `.inputmap.json` schema.
2
+ //
3
+ // Was TS-types-only (`input-types.ts`) until T4.6 authored this Zod schema.
4
+ // `InputManager.loadMap` (input-manager.ts) is this schema's runtime reader: it
5
+ // parses via this schema, then copies each action's `bindings` array (and its
6
+ // declared `valueType`, F1) straight into
7
+ // `this.actions`/`this.actionValueTypes`.
8
+ //
9
+ // Every field has a `.describe()` (repo policy — powers
10
+ // `scripts/generate-schema.ts` and the T4.1/T4.6 schema-walk coverage test).
11
+ // No runtime dependency beyond `zod`, matching the `scene/schema/` and
12
+ // `manifest/schema.ts` precedent.
13
+ //
14
+ // T4.1 history (now closed by F2): `mouse_move` and `gamepad_axis_pair` were
15
+ // authored-but-unhandled binding kinds — REJECTED at parse via a `.superRefine`
16
+ // that threw naming the field, mirroring the `scene/schema/ui.ts` dead-field
17
+ // mechanism. F2 (spec §12 "Complete Device Backends") un-rejects both: real
18
+ // `InputManager` readers now exist for them (`collectPointerDeltaContributions`/
19
+ // `collectVector2Contributions` — `mouse_move` feeds pointerDelta/vector2 from
20
+ // the existing mouseDelta accumulator; `gamepad_axis_pair` feeds vector2 from
21
+ // the coupled `xAxis`/`yAxis` gamepad reading). F2 also adds two new LIVE
22
+ // binding kinds, `touch_button`/`touch_stick` (the touch/virtual-control
23
+ // backend — see `InputManager.setTouchButton`/`setTouchStick`).
24
+ //
25
+ // F1 (spec §12 "Define Typed Action Values") adds:
26
+ // - `InputAction.valueType` — an action now DECLARES its value shape
27
+ // (`digital`/`scalar`/`vector2`/`pointerDelta`/`pointerPosition`),
28
+ // defaulted to `digital` so every pre-F1 action stays valid unchanged.
29
+ // - four new, LIVE (not dead-rejected) binding kinds — `test_axis`,
30
+ // `test_vector2`, `test_pointer_delta`, `test_pointer_position` — the
31
+ // "injected test input" backend F2's acceptance criteria names as a
32
+ // peer of keyboard/mouse/gamepad/touch. They read back a caller-injected
33
+ // raw value (InputManager.injectAxis/injectVector2/injectPointerDelta/
34
+ // injectPointerPosition) through the SAME deadzone/normalize/combine path
35
+ // real device bindings use.
36
+ import { z } from 'zod';
37
+ const KeyBindingSchema = z.object({
38
+ type: z.literal('key').describe('Binding kind: a keyboard key (KeyboardEvent.code)'),
39
+ code: z.string().describe('KeyboardEvent.code value, e.g. "KeyW", "Space", "ArrowUp"'),
40
+ });
41
+ const MouseButtonBindingSchema = z.object({
42
+ type: z.literal('mouse_button').describe('Binding kind: a mouse button'),
43
+ button: z.number().describe('MouseEvent.button index (0 = left, 1 = middle, 2 = right)'),
44
+ });
45
+ const MouseMoveBindingSchema = z.object({
46
+ type: z
47
+ .literal('mouse_move')
48
+ .describe('Binding kind: raw mouse movement (F2, spec §12 "Complete Device Backends"). Feeds a ' +
49
+ "'pointerDelta'-valueType action with the raw accumulated mouse delta (no deadzone), and " +
50
+ "can also feed a 'vector2'-valueType action (the same delta, radial-deadzoned + unit-" +
51
+ 'circle-clamped via `deadzone`).'),
52
+ deadzone: z
53
+ .number()
54
+ .optional()
55
+ .describe("Radial deadzone magnitude applied only when this binding feeds a 'vector2'-valueType " +
56
+ "action (default 0 — no deadzone; ignored for 'pointerDelta' reads, which are never " +
57
+ 'deadzoned).'),
58
+ });
59
+ const GamepadButtonBindingSchema = z.object({
60
+ type: z.literal('gamepad_button').describe('Binding kind: a gamepad face/shoulder button'),
61
+ button: z.number().describe('Standard Gamepad API button index'),
62
+ });
63
+ const GamepadAxisBindingSchema = z.object({
64
+ type: z.literal('gamepad_axis').describe('Binding kind: a single thresholded gamepad axis'),
65
+ axis: z.number().describe('Standard Gamepad API axis index'),
66
+ direction: z
67
+ .enum(['positive', 'negative'])
68
+ .describe('Which side of the deadzone counts as "pressed"'),
69
+ deadzone: z.number().optional().describe('Deadzone magnitude (default 0.15 if omitted)'),
70
+ });
71
+ const GamepadAxisPairBindingSchema = z.object({
72
+ type: z
73
+ .literal('gamepad_axis_pair')
74
+ .describe('Binding kind: a coupled (x, y) gamepad axis pair, e.g. a stick used as a 2D vector ' +
75
+ '(look/aim/movement) (F2, spec §12 "Complete Device Backends"). Feeds a ' +
76
+ "'vector2'-valueType action: (xAxis, yAxis) read together, radial-deadzoned + unit-" +
77
+ 'circle-clamped the same way a real analog stick is.'),
78
+ xAxis: z.number().describe('Standard Gamepad API axis index for the X component'),
79
+ yAxis: z.number().describe('Standard Gamepad API axis index for the Y component'),
80
+ deadzone: z.number().optional().describe('Deadzone magnitude (default 0.15 if omitted)'),
81
+ });
82
+ // ---------------------------------------------------------------------------
83
+ // F1 (spec §12) — injected test input bindings. LIVE (real runtime readers in
84
+ // InputManager's getScalar/getVector2/getPointerDelta/getPointerPosition),
85
+ // unlike the two dead stubs above. Foreshadows F2's "injected test input"
86
+ // backend: real device kinds F2 adds later feed the same typed-value
87
+ // aggregation path these exercise today.
88
+ // ---------------------------------------------------------------------------
89
+ const TestAxisBindingSchema = z.object({
90
+ type: z
91
+ .literal('test_axis')
92
+ .describe("Binding kind: an injected synthetic scalar value for a 'scalar'-valueType action " +
93
+ '(InputManager.injectAxis/getScalar) — the "injected test input" backend named in F2, ' +
94
+ "built in F1 as the typed scalar value model's testable source."),
95
+ sourceId: z
96
+ .string()
97
+ .describe('Names the injected test source this binding reads (InputManager.injectAxis).'),
98
+ deadzone: z
99
+ .number()
100
+ .optional()
101
+ .describe('1D deadzone magnitude applied to the injected raw value before combine (default 0 — no ' +
102
+ 'deadzone). Values below it read as 0; values at/above it rescale from 0 (at the ' +
103
+ 'deadzone edge) to ±1 (at |raw| = 1), sign preserved.'),
104
+ });
105
+ const TestVector2BindingSchema = z.object({
106
+ type: z
107
+ .literal('test_vector2')
108
+ .describe("Binding kind: an injected synthetic {x,y} value for a 'vector2'-valueType action " +
109
+ '(InputManager.injectVector2/getVector2) — the "injected test input" backend named in ' +
110
+ "F2, built in F1 as the typed Vector2 value model's testable source."),
111
+ sourceId: z
112
+ .string()
113
+ .describe('Names the injected test source this binding reads (InputManager.injectVector2).'),
114
+ deadzone: z
115
+ .number()
116
+ .optional()
117
+ .describe('Radial deadzone magnitude applied to the injected raw {x,y} before combine (default 0 ' +
118
+ '— no deadzone). Vectors whose magnitude is below it read as {0,0}; at/above it, ' +
119
+ 'direction is preserved and magnitude rescales the same way the scalar deadzone does, ' +
120
+ 'then the result is clamped to the unit circle (magnitude <= 1).'),
121
+ });
122
+ const TestPointerDeltaBindingSchema = z.object({
123
+ type: z
124
+ .literal('test_pointer_delta')
125
+ .describe("Binding kind: an injected synthetic per-frame {x,y} delta for a 'pointerDelta'-" +
126
+ 'valueType action (InputManager.injectPointerDelta/getPointerDelta) — the "injected ' +
127
+ 'test input" backend named in F2. No deadzone (deltas are not deadzoned).'),
128
+ sourceId: z
129
+ .string()
130
+ .describe('Names the injected test source this binding reads (InputManager.injectPointerDelta).'),
131
+ });
132
+ const TestPointerPositionBindingSchema = z.object({
133
+ type: z
134
+ .literal('test_pointer_position')
135
+ .describe("Binding kind: an injected synthetic absolute {x,y} position for a 'pointerPosition'-" +
136
+ 'valueType action (InputManager.injectPointerPosition/getPointerPosition) — the ' +
137
+ '"injected test input" backend named in F2.'),
138
+ sourceId: z
139
+ .string()
140
+ .describe('Names the injected test source this binding reads (InputManager.injectPointerPosition).'),
141
+ });
142
+ // ---------------------------------------------------------------------------
143
+ // F2 (spec §12 "Complete Device Backends") — touch/virtual-control bindings.
144
+ // LIVE (real runtime readers in InputManager's isPressed/isJustPressed/
145
+ // isJustReleased/getDigitalSource and getVector2), driven by
146
+ // InputManager.setTouchButton/setTouchStick — the headless-testable
147
+ // injectable entry points a real on-screen touch-control UI's own
148
+ // touchstart/touchmove/touchend handlers would call (that DOM wiring is a
149
+ // thin adapter at the edge, out of scope here — see input-manager.ts).
150
+ // ---------------------------------------------------------------------------
151
+ const TouchButtonBindingSchema = z.object({
152
+ type: z
153
+ .literal('touch_button')
154
+ .describe("Binding kind: a virtual on-screen button for a 'digital' action " +
155
+ '(InputManager.setTouchButton/isPressed) — edge-tracked (isJustPressed/isJustReleased) ' +
156
+ 'the same way a real mouse/keyboard button is.'),
157
+ sourceId: z
158
+ .string()
159
+ .describe('Names the virtual control zone this binding reads (InputManager.setTouchButton) — a ' +
160
+ 'touch-UI-chosen id, not a real device index.'),
161
+ });
162
+ const TouchStickBindingSchema = z.object({
163
+ type: z
164
+ .literal('touch_stick')
165
+ .describe("Binding kind: a virtual on-screen analog stick for a 'vector2' action " +
166
+ '(InputManager.setTouchStick/getVector2) — radial-deadzoned + unit-circle-clamped the ' +
167
+ 'same way a real gamepad stick is.'),
168
+ sourceId: z
169
+ .string()
170
+ .describe('Names the virtual control zone this binding reads (InputManager.setTouchStick) — a ' +
171
+ 'touch-UI-chosen id, not a real device index.'),
172
+ deadzone: z
173
+ .number()
174
+ .optional()
175
+ .describe('Radial deadzone magnitude applied to the raw {x,y} before combine (default 0 — no ' +
176
+ 'deadzone).'),
177
+ });
178
+ /** A single input binding. Every kind listed here is LIVE — F2 (spec §12) closed the last two
179
+ * dead stubs (`mouse_move`/`gamepad_axis_pair`) by giving both real `InputManager` readers. */
180
+ export const InputBindingSchema = z.discriminatedUnion('type', [
181
+ KeyBindingSchema,
182
+ MouseButtonBindingSchema,
183
+ MouseMoveBindingSchema,
184
+ GamepadButtonBindingSchema,
185
+ GamepadAxisBindingSchema,
186
+ GamepadAxisPairBindingSchema,
187
+ TestAxisBindingSchema,
188
+ TestVector2BindingSchema,
189
+ TestPointerDeltaBindingSchema,
190
+ TestPointerPositionBindingSchema,
191
+ TouchButtonBindingSchema,
192
+ TouchStickBindingSchema,
193
+ ]);
194
+ /** An action has a name (the record key) and one or more bindings. */
195
+ export const InputActionSchema = z.object({
196
+ valueType: z
197
+ .enum(['digital', 'scalar', 'vector2', 'pointerDelta', 'pointerPosition'])
198
+ .default('digital')
199
+ .describe("This action's declared value shape (F1, spec §12). 'digital' (boolean, with " +
200
+ 'pressed/justPressed/justReleased edges) is the default when omitted, matching every ' +
201
+ "action authored before F1. 'scalar' is a single deadzone-rescaled float axis. " +
202
+ "'vector2' is a radial-deadzoned, unit-circle-normalized {x,y}. 'pointerDelta' is a " +
203
+ "per-frame {x,y} movement delta, summed across sources. 'pointerPosition' is an " +
204
+ 'absolute {x,y}, last-write-wins across sources. InputManager enforces this at read ' +
205
+ 'time: reading an action through the wrong typed getter (e.g. getScalar on a ' +
206
+ "'digital' action) throws."),
207
+ bindings: z
208
+ .array(InputBindingSchema)
209
+ .describe('Bindings that all trigger/feed this action. Digital actions combine via OR (any one ' +
210
+ 'binding satisfied is enough). Scalar actions combine via max-magnitude across ' +
211
+ 'contributing bindings (ties keep the first-listed binding). Vector2 actions combine ' +
212
+ 'by summing contributing {x,y} values then clamping to the unit circle. PointerDelta ' +
213
+ 'actions sum contributing deltas. PointerPosition actions use the most-recently-' +
214
+ 'written contributing source (last-write-wins).'),
215
+ });
216
+ /**
217
+ * The `.inputmap.json` file format (`InputManager.loadMap`).
218
+ *
219
+ * `version` is RESERVED (no range-check reader exists yet for this format —
220
+ * same convention `2d.version`/`Scene2DSchema` used before T2.3 gave the 3D
221
+ * scene version axis a real reader; see `schema-consumption-map.ts`).
222
+ */
223
+ export const InputMapFileSchema = z.object({
224
+ version: z.number().describe('Input map file format version (RESERVED — no range check yet)'),
225
+ actions: z
226
+ .record(z.string(), InputActionSchema)
227
+ .describe('Named actions, each with a list of bindings (InputManager.loadMap)'),
228
+ });
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Shared asset loading infrastructure.
3
+ *
4
+ * Provides a single LoadingManager (for Three.js loaders) and resolveUrl()
5
+ * (for raw fetch calls) so that all engine asset requests go through one
6
+ * configurable URL prefix. Call setAssetPrefix() once at runtime startup.
7
+ *
8
+ * Three.js loaders constructed with `loadingManager` automatically rewrite
9
+ * URLs via setURLModifier(). For raw fetch() calls, wrap the URL with
10
+ * resolveUrl() to apply the same prefix.
11
+ */
12
+ import * as THREE from 'three';
13
+ import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js';
14
+ import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
15
+ import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js';
16
+ /** Shared Three.js LoadingManager — all engine loaders should use this. */
17
+ export declare const loadingManager: THREE.LoadingManager;
18
+ /** Pre-configured TextureLoader using the shared manager. */
19
+ export declare const textureLoader: THREE.TextureLoader;
20
+ /**
21
+ * Shared DRACOLoader for decoding DRACO-compressed GLTF/GLB meshes.
22
+ *
23
+ * The decoder wasm/js is vendored under
24
+ * packages/editor/template/public/jsm/libs/draco/gltf/ and served at the
25
+ * absolute runtime path '/jsm/libs/draco/gltf/' (DRACOLoader appends
26
+ * draco_wasm_wrapper.js / draco_decoder.wasm to this path). This is an
27
+ * absolute path, so it deliberately does NOT go through the asset prefix —
28
+ * the decoder is engine infrastructure, not a scene asset.
29
+ */
30
+ export declare const dracoLoader: DRACOLoader;
31
+ /**
32
+ * Shared KTX2Loader for decoding KHR_texture_basisu (KTX2/Basis) textures.
33
+ *
34
+ * Vendored and served EXACTLY like the DRACO decoder above — the Basis
35
+ * transcoder js/wasm live in repo-root `public/jsm/libs/basis/` (the editor)
36
+ * and `packages/editor/template/public/jsm/libs/basis/` (a scaffolded game's
37
+ * own build), pinned in `vendor/upstream-assets.lock.json`, and KTX2Loader
38
+ * appends `basis_transcoder.js` / `.wasm` to this absolute path.
39
+ *
40
+ * Without this wiring, the Asset Budget's "Compress textures · KTX2" output
41
+ * is a GLB nothing in the engine can load — which is why the op and this
42
+ * loader landed together.
43
+ */
44
+ export declare const ktx2Loader: KTX2Loader;
45
+ /**
46
+ * Teach the shared KTX2Loader which compressed formats THIS GPU accepts.
47
+ *
48
+ * KTX2Loader refuses to transcode until it has seen a renderer, and the
49
+ * answer is a property of the page's GPU rather than of any one renderer —
50
+ * so the FIRST renderer to exist supplies it and every later one is a no-op.
51
+ * Called by the engine's own renderer setup (`setup/setup-renderer.ts`) and
52
+ * by the editor's viewport, which between them cover every surface that
53
+ * parses a GLB.
54
+ *
55
+ * This sits on the MOUNT path, so it must never throw for a renderer it
56
+ * cannot question. `detectSupport` reads `renderer.extensions.has/get` (or
57
+ * `renderer.hasFeature` on a WebGPU renderer) — surface a headless stand-in
58
+ * (the test harnesses' fake renderers, any non-WebGL host) does not have.
59
+ * Such a renderer is skipped WITHOUT latching, so the first renderer that
60
+ * can actually answer still configures the loader for the whole page.
61
+ */
62
+ export declare function detectKtx2Support(renderer: THREE.WebGLRenderer): void;
63
+ /** Pre-configured GLTFLoader using the shared manager, with DRACO decoding wired in. */
64
+ export declare const gltfLoader: GLTFLoader;
65
+ /**
66
+ * Set the URL prefix prepended to relative asset paths.
67
+ * Called once by createGameRuntime(). Defaults to '/'.
68
+ */
69
+ export declare function setAssetPrefix(prefix: string): void;
70
+ /**
71
+ * Resolve a relative asset URL using the current prefix.
72
+ * Use this for raw fetch() calls — Three.js loaders using
73
+ * `loadingManager` handle this automatically.
74
+ */
75
+ export declare function resolveUrl(url: string): string;
76
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAgBhE,2EAA2E;AAC3E,eAAO,MAAM,cAAc,sBAA6B,CAAC;AAGzD,6DAA6D;AAC7D,eAAO,MAAM,aAAa,qBAA0C,CAAC;AAErE;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,aAAkC,CAAC;AAG3D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,YAAiC,CAAC;AAKzD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,KAAK,CAAC,aAAa,GAAG,IAAI,CAkBrE;AAED,wFAAwF;AACxF,eAAO,MAAM,UAAU,YAAiC,CAAC;AAUzD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C"}
package/dist/loader.js ADDED
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Shared asset loading infrastructure.
3
+ *
4
+ * Provides a single LoadingManager (for Three.js loaders) and resolveUrl()
5
+ * (for raw fetch calls) so that all engine asset requests go through one
6
+ * configurable URL prefix. Call setAssetPrefix() once at runtime startup.
7
+ *
8
+ * Three.js loaders constructed with `loadingManager` automatically rewrite
9
+ * URLs via setURLModifier(). For raw fetch() calls, wrap the URL with
10
+ * resolveUrl() to apply the same prefix.
11
+ */
12
+ import * as THREE from 'three';
13
+ import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js';
14
+ import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js';
15
+ import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
16
+ import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js';
17
+ let _prefix = '/';
18
+ function rewriteUrl(url) {
19
+ if (url.startsWith('/') ||
20
+ url.startsWith('http') ||
21
+ url.startsWith('data:') ||
22
+ url.startsWith('blob:')) {
23
+ return url;
24
+ }
25
+ return _prefix + url;
26
+ }
27
+ /** Shared Three.js LoadingManager — all engine loaders should use this. */
28
+ export const loadingManager = new THREE.LoadingManager();
29
+ loadingManager.setURLModifier(rewriteUrl);
30
+ /** Pre-configured TextureLoader using the shared manager. */
31
+ export const textureLoader = new THREE.TextureLoader(loadingManager);
32
+ /**
33
+ * Shared DRACOLoader for decoding DRACO-compressed GLTF/GLB meshes.
34
+ *
35
+ * The decoder wasm/js is vendored under
36
+ * packages/editor/template/public/jsm/libs/draco/gltf/ and served at the
37
+ * absolute runtime path '/jsm/libs/draco/gltf/' (DRACOLoader appends
38
+ * draco_wasm_wrapper.js / draco_decoder.wasm to this path). This is an
39
+ * absolute path, so it deliberately does NOT go through the asset prefix —
40
+ * the decoder is engine infrastructure, not a scene asset.
41
+ */
42
+ export const dracoLoader = new DRACOLoader(loadingManager);
43
+ dracoLoader.setDecoderPath('/jsm/libs/draco/gltf/');
44
+ /**
45
+ * Shared KTX2Loader for decoding KHR_texture_basisu (KTX2/Basis) textures.
46
+ *
47
+ * Vendored and served EXACTLY like the DRACO decoder above — the Basis
48
+ * transcoder js/wasm live in repo-root `public/jsm/libs/basis/` (the editor)
49
+ * and `packages/editor/template/public/jsm/libs/basis/` (a scaffolded game's
50
+ * own build), pinned in `vendor/upstream-assets.lock.json`, and KTX2Loader
51
+ * appends `basis_transcoder.js` / `.wasm` to this absolute path.
52
+ *
53
+ * Without this wiring, the Asset Budget's "Compress textures · KTX2" output
54
+ * is a GLB nothing in the engine can load — which is why the op and this
55
+ * loader landed together.
56
+ */
57
+ export const ktx2Loader = new KTX2Loader(loadingManager);
58
+ ktx2Loader.setTranscoderPath('/jsm/libs/basis/');
59
+ let ktx2SupportDetected = false;
60
+ /**
61
+ * Teach the shared KTX2Loader which compressed formats THIS GPU accepts.
62
+ *
63
+ * KTX2Loader refuses to transcode until it has seen a renderer, and the
64
+ * answer is a property of the page's GPU rather than of any one renderer —
65
+ * so the FIRST renderer to exist supplies it and every later one is a no-op.
66
+ * Called by the engine's own renderer setup (`setup/setup-renderer.ts`) and
67
+ * by the editor's viewport, which between them cover every surface that
68
+ * parses a GLB.
69
+ *
70
+ * This sits on the MOUNT path, so it must never throw for a renderer it
71
+ * cannot question. `detectSupport` reads `renderer.extensions.has/get` (or
72
+ * `renderer.hasFeature` on a WebGPU renderer) — surface a headless stand-in
73
+ * (the test harnesses' fake renderers, any non-WebGL host) does not have.
74
+ * Such a renderer is skipped WITHOUT latching, so the first renderer that
75
+ * can actually answer still configures the loader for the whole page.
76
+ */
77
+ export function detectKtx2Support(renderer) {
78
+ if (ktx2SupportDetected)
79
+ return;
80
+ const probe = renderer;
81
+ const canAnswer = probe != null &&
82
+ (probe.isWebGPURenderer === true
83
+ ? typeof probe.hasFeature === 'function'
84
+ : typeof probe.extensions?.has === 'function' && typeof probe.extensions?.get === 'function');
85
+ if (!canAnswer)
86
+ return;
87
+ ktx2Loader.detectSupport(renderer);
88
+ ktx2SupportDetected = true;
89
+ }
90
+ /** Pre-configured GLTFLoader using the shared manager, with DRACO decoding wired in. */
91
+ export const gltfLoader = new GLTFLoader(loadingManager);
92
+ gltfLoader.setDRACOLoader(dracoLoader);
93
+ gltfLoader.setKTX2Loader(ktx2Loader);
94
+ // EXT_meshopt_compression decoding (three's own bundled decoder — inline
95
+ // wasm, no fetch). Without this, a meshopt-compressed GLB — including the
96
+ // output of the editor's Asset Budget "Compress · meshopt" action (W4a M3) —
97
+ // throws at load time in every runtime and the editor viewport. Symmetric
98
+ // with the DRACO wiring above (CB2): the ONE shared loader owns codec setup.
99
+ gltfLoader.setMeshoptDecoder(MeshoptDecoder);
100
+ /**
101
+ * Set the URL prefix prepended to relative asset paths.
102
+ * Called once by createGameRuntime(). Defaults to '/'.
103
+ */
104
+ export function setAssetPrefix(prefix) {
105
+ _prefix = prefix.endsWith('/') ? prefix : prefix ? `${prefix}/` : '/';
106
+ }
107
+ /**
108
+ * Resolve a relative asset URL using the current prefix.
109
+ * Use this for raw fetch() calls — Three.js loaders using
110
+ * `loadingManager` handle this automatically.
111
+ */
112
+ export function resolveUrl(url) {
113
+ return rewriteUrl(url);
114
+ }
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The editor's built-in port fallback, and the paired HMR-socket derivation.
3
+ *
4
+ * ONE owner for the number, because it is spelled in a launcher (`vgai edit`),
5
+ * three servers (dev / prod / packaged), and a client default — a duplicated
6
+ * literal across those drifts silently.
7
+ *
8
+ * **Why not Vite's 5173.** It used to be exactly that, and 5173 is the default
9
+ * of every Vite app on the machine. On a box running any other Vite dev server
10
+ * the engine-repo editor and that app fight over one port, and — worse —
11
+ * `http://…:5173` can resolve to a FOREIGN application. Measured 2026-08-07:
12
+ * an unrelated process on 5173 was what the editor's tab self-heal opened.
13
+ *
14
+ * **The band.** 20000-20199 is vgai's own reserved band: fixed, hand-picked
15
+ * ports that must never be minted for a worktree session. Machine-local
16
+ * allocations start at 20200, so one can never land on this default by chance.
17
+ * 20173 keeps Vite's memorable `173` tail while sitting in a range nothing
18
+ * else claims.
19
+ */
20
+ export declare const DEFAULT_EDITOR_PORT = 20173;
21
+ /**
22
+ * The Vite HMR websocket port paired with an editor port.
23
+ *
24
+ * Editor ports in 20000-29999 map into the parallel 30000-39999 band, so two
25
+ * worktree sessions cannot collide merely because their editor ports differ
26
+ * by 100. Anything outside that band keeps the simple +100 offset.
27
+ *
28
+ * `DEFAULT_EDITOR_PORT` derives 30173 through the first arm — no special case,
29
+ * which is the point: the old expression carried a hardcoded `5173 -> 24678`
30
+ * exception precisely because the default sat outside the band it designed.
31
+ */
32
+ export declare function editorHmrPort(editorPort: number): number;
33
+ /**
34
+ * The ONE composer for an editor origin — every URL vgai PRINTS, OPENS,
35
+ * SELF-HEALS with, records in `.vgai/session.json`, or dials.
36
+ *
37
+ * **It never says `localhost`.** A bare-`localhost` URL is a different address
38
+ * from the one the server is listening on: on a dual-stack box `localhost`
39
+ * resolves `::1` first while the editor binds `127.0.0.1`, so the URL reaches
40
+ * whatever else happens to hold that port on IPv6. Measured 2026-08-07 — the
41
+ * tab bijection's self-heal opened an UNRELATED application in the owner's
42
+ * browser because it composed its reopen URL from `localhost` instead of the
43
+ * host the server had actually bound.
44
+ *
45
+ * `bindHost` is the host the server bound (`resolveBindHost`); callers that
46
+ * only know a port — the CLI and SDK clients dialing a local session — omit it
47
+ * and get the IPv4 loopback literal. A wildcard bind (`0.0.0.0` / `::`, which
48
+ * is what WSL gets) is not an address a browser can visit, so it degrades to
49
+ * that same literal: reachable from the same box, and reachable from Windows
50
+ * through WSL2's loopback forwarding.
51
+ */
52
+ export declare function editorOrigin(port: number, bindHost?: string): string;
53
+ //# sourceMappingURL=editor-port.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor-port.d.ts","sourceRoot":"","sources":["../../src/manifest/editor-port.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,QAAS,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAExD;AAWD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAIpE"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * The editor's built-in port fallback, and the paired HMR-socket derivation.
3
+ *
4
+ * ONE owner for the number, because it is spelled in a launcher (`vgai edit`),
5
+ * three servers (dev / prod / packaged), and a client default — a duplicated
6
+ * literal across those drifts silently.
7
+ *
8
+ * **Why not Vite's 5173.** It used to be exactly that, and 5173 is the default
9
+ * of every Vite app on the machine. On a box running any other Vite dev server
10
+ * the engine-repo editor and that app fight over one port, and — worse —
11
+ * `http://…:5173` can resolve to a FOREIGN application. Measured 2026-08-07:
12
+ * an unrelated process on 5173 was what the editor's tab self-heal opened.
13
+ *
14
+ * **The band.** 20000-20199 is vgai's own reserved band: fixed, hand-picked
15
+ * ports that must never be minted for a worktree session. Machine-local
16
+ * allocations start at 20200, so one can never land on this default by chance.
17
+ * 20173 keeps Vite's memorable `173` tail while sitting in a range nothing
18
+ * else claims.
19
+ */
20
+ export const DEFAULT_EDITOR_PORT = 20_173;
21
+ /**
22
+ * The Vite HMR websocket port paired with an editor port.
23
+ *
24
+ * Editor ports in 20000-29999 map into the parallel 30000-39999 band, so two
25
+ * worktree sessions cannot collide merely because their editor ports differ
26
+ * by 100. Anything outside that band keeps the simple +100 offset.
27
+ *
28
+ * `DEFAULT_EDITOR_PORT` derives 30173 through the first arm — no special case,
29
+ * which is the point: the old expression carried a hardcoded `5173 -> 24678`
30
+ * exception precisely because the default sat outside the band it designed.
31
+ */
32
+ export function editorHmrPort(editorPort) {
33
+ return editorPort >= 20_000 && editorPort < 30_100 ? editorPort + 10_000 : editorPort + 100;
34
+ }
35
+ /**
36
+ * Wrap a bare IPv6 literal in brackets so it is legal inside a URL authority.
37
+ * `127.0.0.1`, a hostname, and an already-bracketed literal pass through.
38
+ */
39
+ function urlAuthorityHost(host) {
40
+ if (host.startsWith('['))
41
+ return host;
42
+ return host.includes(':') ? `[${host}]` : host;
43
+ }
44
+ /**
45
+ * The ONE composer for an editor origin — every URL vgai PRINTS, OPENS,
46
+ * SELF-HEALS with, records in `.vgai/session.json`, or dials.
47
+ *
48
+ * **It never says `localhost`.** A bare-`localhost` URL is a different address
49
+ * from the one the server is listening on: on a dual-stack box `localhost`
50
+ * resolves `::1` first while the editor binds `127.0.0.1`, so the URL reaches
51
+ * whatever else happens to hold that port on IPv6. Measured 2026-08-07 — the
52
+ * tab bijection's self-heal opened an UNRELATED application in the owner's
53
+ * browser because it composed its reopen URL from `localhost` instead of the
54
+ * host the server had actually bound.
55
+ *
56
+ * `bindHost` is the host the server bound (`resolveBindHost`); callers that
57
+ * only know a port — the CLI and SDK clients dialing a local session — omit it
58
+ * and get the IPv4 loopback literal. A wildcard bind (`0.0.0.0` / `::`, which
59
+ * is what WSL gets) is not an address a browser can visit, so it degrades to
60
+ * that same literal: reachable from the same box, and reachable from Windows
61
+ * through WSL2's loopback forwarding.
62
+ */
63
+ export function editorOrigin(port, bindHost) {
64
+ const host = (bindHost ?? '').trim();
65
+ const unusable = host === '' || host === '0.0.0.0' || host === '::' || host === '[::]';
66
+ return `http://${unusable ? '127.0.0.1' : urlAuthorityHost(host)}:${port}`;
67
+ }
@@ -0,0 +1,14 @@
1
+ /** The manifest filename. Every reader reads it; every writer writes it. */
2
+ export declare const MANIFEST_FILENAME = "vgai.project.json";
3
+ /** The removed filename. Read by nothing — its only job is the error message. */
4
+ export declare const REMOVED_MANIFEST_FILENAME = "vgai.game.json";
5
+ /** True for the manifest filename (basename comparison). */
6
+ export declare function isManifestFilename(name: string): boolean;
7
+ /**
8
+ * The verbatim rejection an on-disk `vgai.game.json` earns — the one-line fix
9
+ * spelled out, per the removed-format contract. Shared by the Node
10
+ * (`./locate`) and browser (storage-backend) halves so a project author sees
11
+ * the same sentence wherever the stale name is found.
12
+ */
13
+ export declare function removedManifestFilenameMessage(where: string): string;
14
+ //# sourceMappingURL=filename.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filename.d.ts","sourceRoot":"","sources":["../../src/manifest/filename.ts"],"names":[],"mappings":"AAsBA,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,iFAAiF;AACjF,eAAO,MAAM,yBAAyB,mBAAmB,CAAC;AAE1D,4DAA4D;AAC5D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASpE"}
@@ -0,0 +1,43 @@
1
+ // The project manifest's FILENAME. There is exactly ONE.
2
+ //
3
+ // The manifest is `vgai.project.json`. It used to be `vgai.game.json`, and for
4
+ // a while both names were read — WO-9 #62 recorded that dual-read as
5
+ // permanent, on the presumption of an EXTERNAL constituency of projects
6
+ // already on disk. The owner reversed that on 2026-08-02 (the legacy-removal
7
+ // doctrine, `docs/ARCHITECTURE-CORE.md` §Vocabulary): this is pre-release
8
+ // software, no such constituency exists, and a second way to spell the
9
+ // manifest is the defect — two accepted names meant both kept being written,
10
+ // and copies of the "try both" probe grew in five modules that agreed with the
11
+ // real resolver only by coincidence.
12
+ //
13
+ // So the old name is REMOVED, and removed means it REJECTS LOUDLY naming the
14
+ // exact one-line fix — never silently ignored, never redirected. A directory
15
+ // carrying only `vgai.game.json` is an error with a `git mv` in the message,
16
+ // not a project that quietly fails to open.
17
+ //
18
+ // This module is the ONE place either literal is spelled out, and it is
19
+ // dependency-free (no `node:fs`) so browser bundles can import it. The
20
+ // filesystem side lives in `./locate` (`resolveManifestPath`, `hasManifest`,
21
+ // `assertNoRemovedManifestFilename`).
22
+ /** The manifest filename. Every reader reads it; every writer writes it. */
23
+ export const MANIFEST_FILENAME = 'vgai.project.json';
24
+ /** The removed filename. Read by nothing — its only job is the error message. */
25
+ export const REMOVED_MANIFEST_FILENAME = 'vgai.game.json';
26
+ /** True for the manifest filename (basename comparison). */
27
+ export function isManifestFilename(name) {
28
+ return name === MANIFEST_FILENAME;
29
+ }
30
+ /**
31
+ * The verbatim rejection an on-disk `vgai.game.json` earns — the one-line fix
32
+ * spelled out, per the removed-format contract. Shared by the Node
33
+ * (`./locate`) and browser (storage-backend) halves so a project author sees
34
+ * the same sentence wherever the stale name is found.
35
+ */
36
+ export function removedManifestFilenameMessage(where) {
37
+ return (`${where}: found \`${REMOVED_MANIFEST_FILENAME}\` and no \`${MANIFEST_FILENAME}\`. ` +
38
+ `\`${REMOVED_MANIFEST_FILENAME}\` was REMOVED (WO-LR1; the legacy-removal doctrine, ` +
39
+ 'docs/ARCHITECTURE-CORE.md §Vocabulary) — nothing reads it any more, and it is ' +
40
+ 'deliberately NOT read as a fallback, because a second accepted name is the defect.\n' +
41
+ `Fix: rename it — \`git mv ${REMOVED_MANIFEST_FILENAME} ${MANIFEST_FILENAME}\`. ` +
42
+ 'The contents are unchanged; only the filename moved.');
43
+ }
@@ -0,0 +1,6 @@
1
+ export { isManifestFilename, MANIFEST_FILENAME, REMOVED_MANIFEST_FILENAME, removedManifestFilenameMessage, } from './filename';
2
+ export type { ResolvedAdapter, ResolvedAdapterRoot, ResolvedGameManifest } from './load';
3
+ export { CAPABILITY_CEILINGS, DEFAULT_SERVER_MODULE, loadGameManifest } from './load';
4
+ export type { AdapterRoot, GameManifest, IngestStrategy, RootAdapter, Tier, } from './schema';
5
+ export { AdapterRootSchema, GameManifestSchema, IngestStrategySchema, RootAdapterSchema, TierSchema, } from './schema';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACtF,YAAY,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,WAAW,EACX,IAAI,GACL,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,UAAU,GACX,MAAM,UAAU,CAAC"}
@@ -0,0 +1,9 @@
1
+ // Game manifest (vgai.project.json) — schema + loader (T3.1 slice
2
+ // 1)..
3
+ export { isManifestFilename, MANIFEST_FILENAME, REMOVED_MANIFEST_FILENAME, removedManifestFilenameMessage, } from './filename';
4
+ export { CAPABILITY_CEILINGS, DEFAULT_SERVER_MODULE, loadGameManifest } from './load';
5
+ export { AdapterRootSchema, GameManifestSchema, IngestStrategySchema, RootAdapterSchema, TierSchema, } from './schema';
6
+ // `loadGameManifestFile` (Node-only, reads `path` via `node:fs`) is
7
+ // deliberately NOT re-exported here — this barrel must stay import-safe for
8
+ // browser bundles. Import it directly from `@engine/manifest/load-file` in
9
+ // Node-only contexts (CLI, tests).
@@ -0,0 +1,7 @@
1
+ import { type ResolvedGameManifest } from './load';
2
+ export { hasManifest, manifestWritePath, resolveManifestPath } from './locate';
3
+ /** Read + JSON.parse `path`, then resolve it via `loadGameManifest`. Node-only. */
4
+ export declare function loadGameManifestFile(path: string): ResolvedGameManifest;
5
+ /** {@link loadGameManifestFile} against `dir`'s `vgai.project.json`. */
6
+ export declare function loadGameManifestDir(dir: string): ResolvedGameManifest;
7
+ //# sourceMappingURL=load-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-file.d.ts","sourceRoot":"","sources":["../../src/manifest/load-file.ts"],"names":[],"mappings":"AASA,OAAO,EAAoB,KAAK,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAMrE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/E,mFAAmF;AACnF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,CAGvE;AAED,wEAAwE;AACxE,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAErE"}