@vgai/engine 0.5.0 → 0.5.2

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 (538) hide show
  1. package/package.json +1 -1
  2. package/schemas/engine-capabilities.json +4 -4
  3. package/schemas/vgai-game.schema.json +2 -2
  4. package/src/adapter/authoring.ts +42 -0
  5. package/src/adapter/index.ts +3 -0
  6. package/src/adapter/ingest/overlay-apply.ts +50 -6
  7. package/src/adapter/ingest/scene-capture.ts +51 -2
  8. package/src/adapter/vgai-scene-game-adapter.ts +24 -0
  9. package/src/manifest/schema.ts +7 -3
  10. package/src/runtime/create-runtime.ts +97 -0
  11. package/src/runtime/game.ts +11 -1
  12. package/src/scene/asset-ref-check.ts +1 -1
  13. package/src/scene/scene-loader.ts +2 -2
  14. package/src/scene/user-data.ts +18 -0
  15. package/src/world3d-react/behavior.tsx +19 -11
  16. package/src/world3d-react/r3f-adapter.tsx +8 -0
  17. package/dist/adapter/adapter-surface.d.ts +0 -30
  18. package/dist/adapter/adapter-surface.d.ts.map +0 -1
  19. package/dist/adapter/adapter-surface.js +0 -18
  20. package/dist/adapter/authoring.d.ts +0 -461
  21. package/dist/adapter/authoring.d.ts.map +0 -1
  22. package/dist/adapter/authoring.js +0 -22
  23. package/dist/adapter/colyseus-networking-adapter.d.ts +0 -43
  24. package/dist/adapter/colyseus-networking-adapter.d.ts.map +0 -1
  25. package/dist/adapter/colyseus-networking-adapter.js +0 -38
  26. package/dist/adapter/first-party-systems.d.ts +0 -38
  27. package/dist/adapter/first-party-systems.d.ts.map +0 -1
  28. package/dist/adapter/first-party-systems.js +0 -77
  29. package/dist/adapter/game-adapter.d.ts +0 -133
  30. package/dist/adapter/game-adapter.d.ts.map +0 -1
  31. package/dist/adapter/game-adapter.js +0 -10
  32. package/dist/adapter/host-context.d.ts +0 -71
  33. package/dist/adapter/host-context.d.ts.map +0 -1
  34. package/dist/adapter/host-context.js +0 -16
  35. package/dist/adapter/index.d.ts +0 -22
  36. package/dist/adapter/index.d.ts.map +0 -1
  37. package/dist/adapter/index.js +0 -15
  38. package/dist/adapter/ingest/game-contract.d.ts +0 -53
  39. package/dist/adapter/ingest/game-contract.d.ts.map +0 -1
  40. package/dist/adapter/ingest/game-contract.js +0 -30
  41. package/dist/adapter/ingest/overlay-applier.d.ts +0 -118
  42. package/dist/adapter/ingest/overlay-applier.d.ts.map +0 -1
  43. package/dist/adapter/ingest/overlay-applier.js +0 -132
  44. package/dist/adapter/ingest/overlay-apply.d.ts +0 -60
  45. package/dist/adapter/ingest/overlay-apply.d.ts.map +0 -1
  46. package/dist/adapter/ingest/overlay-apply.js +0 -101
  47. package/dist/adapter/ingest/overlay-file.d.ts +0 -79
  48. package/dist/adapter/ingest/overlay-file.d.ts.map +0 -1
  49. package/dist/adapter/ingest/overlay-file.js +0 -66
  50. package/dist/adapter/ingest/overlay-report.d.ts +0 -113
  51. package/dist/adapter/ingest/overlay-report.d.ts.map +0 -1
  52. package/dist/adapter/ingest/overlay-report.js +0 -103
  53. package/dist/adapter/ingest/scene-capture.d.ts +0 -97
  54. package/dist/adapter/ingest/scene-capture.d.ts.map +0 -1
  55. package/dist/adapter/ingest/scene-capture.js +0 -248
  56. package/dist/adapter/ingest/upstream-pin.d.ts +0 -47
  57. package/dist/adapter/ingest/upstream-pin.d.ts.map +0 -1
  58. package/dist/adapter/ingest/upstream-pin.js +0 -50
  59. package/dist/adapter/loop-gate-report.d.ts +0 -34
  60. package/dist/adapter/loop-gate-report.d.ts.map +0 -1
  61. package/dist/adapter/loop-gate-report.js +0 -37
  62. package/dist/adapter/rapier-physics-adapter.d.ts +0 -12
  63. package/dist/adapter/rapier-physics-adapter.d.ts.map +0 -1
  64. package/dist/adapter/rapier-physics-adapter.js +0 -46
  65. package/dist/adapter/system-adapter.d.ts +0 -206
  66. package/dist/adapter/system-adapter.d.ts.map +0 -1
  67. package/dist/adapter/system-adapter.js +0 -13
  68. package/dist/adapter/transform.d.ts +0 -18
  69. package/dist/adapter/transform.d.ts.map +0 -1
  70. package/dist/adapter/transform.js +0 -1
  71. package/dist/adapter/vgai-scene-game-adapter.d.ts +0 -108
  72. package/dist/adapter/vgai-scene-game-adapter.d.ts.map +0 -1
  73. package/dist/adapter/vgai-scene-game-adapter.js +0 -762
  74. package/dist/ai/navigation.d.ts +0 -64
  75. package/dist/ai/navigation.d.ts.map +0 -1
  76. package/dist/ai/navigation.js +0 -133
  77. package/dist/animation/anim-graph-types.d.ts +0 -25
  78. package/dist/animation/anim-graph-types.d.ts.map +0 -1
  79. package/dist/animation/anim-graph-types.js +0 -1
  80. package/dist/animation/animation-clock.d.ts +0 -213
  81. package/dist/animation/animation-clock.d.ts.map +0 -1
  82. package/dist/animation/animation-clock.js +0 -301
  83. package/dist/animation/blend-node.d.ts +0 -22
  84. package/dist/animation/blend-node.d.ts.map +0 -1
  85. package/dist/animation/blend-node.js +0 -97
  86. package/dist/animation/camera-ownership.d.ts +0 -250
  87. package/dist/animation/camera-ownership.d.ts.map +0 -1
  88. package/dist/animation/camera-ownership.js +0 -169
  89. package/dist/animation/cinematic-cues.d.ts +0 -200
  90. package/dist/animation/cinematic-cues.d.ts.map +0 -1
  91. package/dist/animation/cinematic-cues.js +0 -213
  92. package/dist/animation/clip-map.d.ts +0 -12
  93. package/dist/animation/clip-map.d.ts.map +0 -1
  94. package/dist/animation/clip-map.js +0 -37
  95. package/dist/animation/gsap-registration.d.ts +0 -119
  96. package/dist/animation/gsap-registration.d.ts.map +0 -1
  97. package/dist/animation/gsap-registration.js +0 -92
  98. package/dist/animation/theatre-clock-binding.d.ts +0 -89
  99. package/dist/animation/theatre-clock-binding.d.ts.map +0 -1
  100. package/dist/animation/theatre-clock-binding.js +0 -29
  101. package/dist/animation/theatre-director.d.ts +0 -242
  102. package/dist/animation/theatre-director.d.ts.map +0 -1
  103. package/dist/animation/theatre-director.js +0 -235
  104. package/dist/animation/theatre-object-binding.d.ts +0 -305
  105. package/dist/animation/theatre-object-binding.d.ts.map +0 -1
  106. package/dist/animation/theatre-object-binding.js +0 -351
  107. package/dist/animation/xstate-animation-binding.d.ts +0 -56
  108. package/dist/animation/xstate-animation-binding.d.ts.map +0 -1
  109. package/dist/animation/xstate-animation-binding.js +0 -331
  110. package/dist/animation/xstate-animation-meta.d.ts +0 -266
  111. package/dist/animation/xstate-animation-meta.d.ts.map +0 -1
  112. package/dist/animation/xstate-animation-meta.js +0 -252
  113. package/dist/assets.d.ts +0 -26
  114. package/dist/assets.d.ts.map +0 -1
  115. package/dist/assets.js +0 -55
  116. package/dist/audio/index.d.ts +0 -4
  117. package/dist/audio/index.d.ts.map +0 -1
  118. package/dist/audio/index.js +0 -24
  119. package/dist/audio/tone-clock-binding.d.ts +0 -75
  120. package/dist/audio/tone-clock-binding.d.ts.map +0 -1
  121. package/dist/audio/tone-clock-binding.js +0 -29
  122. package/dist/audio/tone-context.d.ts +0 -114
  123. package/dist/audio/tone-context.d.ts.map +0 -1
  124. package/dist/audio/tone-context.js +0 -39
  125. package/dist/audio/tone-offline-render.d.ts +0 -90
  126. package/dist/audio/tone-offline-render.d.ts.map +0 -1
  127. package/dist/audio/tone-offline-render.js +0 -56
  128. package/dist/audio/wav-encode.d.ts +0 -38
  129. package/dist/audio/wav-encode.d.ts.map +0 -1
  130. package/dist/audio/wav-encode.js +0 -97
  131. package/dist/character/cloth-sim.d.ts +0 -179
  132. package/dist/character/cloth-sim.d.ts.map +0 -1
  133. package/dist/character/cloth-sim.js +0 -334
  134. package/dist/character/spring-chain.d.ts +0 -135
  135. package/dist/character/spring-chain.d.ts.map +0 -1
  136. package/dist/character/spring-chain.js +0 -165
  137. package/dist/core/game-loop.d.ts +0 -42
  138. package/dist/core/game-loop.d.ts.map +0 -1
  139. package/dist/core/game-loop.js +0 -167
  140. package/dist/core/seeded-random.d.ts +0 -69
  141. package/dist/core/seeded-random.d.ts.map +0 -1
  142. package/dist/core/seeded-random.js +0 -121
  143. package/dist/core/system-runner.d.ts +0 -120
  144. package/dist/core/system-runner.d.ts.map +0 -1
  145. package/dist/core/system-runner.js +0 -297
  146. package/dist/core/types.d.ts +0 -92
  147. package/dist/core/types.d.ts.map +0 -1
  148. package/dist/core/types.js +0 -25
  149. package/dist/data/data-asset.d.ts +0 -101
  150. package/dist/data/data-asset.d.ts.map +0 -1
  151. package/dist/data/data-asset.js +0 -122
  152. package/dist/data/data-check-core.d.ts +0 -110
  153. package/dist/data/data-check-core.d.ts.map +0 -1
  154. package/dist/data/data-check-core.js +0 -178
  155. package/dist/data/data-ref.d.ts +0 -79
  156. package/dist/data/data-ref.d.ts.map +0 -1
  157. package/dist/data/data-ref.js +0 -130
  158. package/dist/data/vite-plugin-data.d.ts +0 -79
  159. package/dist/data/vite-plugin-data.d.ts.map +0 -1
  160. package/dist/data/vite-plugin-data.js +0 -217
  161. package/dist/dev/console-bridge.d.ts +0 -22
  162. package/dist/dev/console-bridge.d.ts.map +0 -1
  163. package/dist/dev/console-bridge.js +0 -71
  164. package/dist/dev/debug-draw.d.ts +0 -24
  165. package/dist/dev/debug-draw.d.ts.map +0 -1
  166. package/dist/dev/debug-draw.js +0 -73
  167. package/dist/dev/logger.d.ts +0 -30
  168. package/dist/dev/logger.d.ts.map +0 -1
  169. package/dist/dev/logger.js +0 -90
  170. package/dist/dev/performance-profiler.d.ts +0 -60
  171. package/dist/dev/performance-profiler.d.ts.map +0 -1
  172. package/dist/dev/performance-profiler.js +0 -181
  173. package/dist/dev/webgl-gpu-timer.d.ts +0 -8
  174. package/dist/dev/webgl-gpu-timer.d.ts.map +0 -1
  175. package/dist/dev/webgl-gpu-timer.js +0 -52
  176. package/dist/ecs/component-manager.d.ts +0 -205
  177. package/dist/ecs/component-manager.d.ts.map +0 -1
  178. package/dist/ecs/component-manager.js +0 -706
  179. package/dist/ecs/game-component.d.ts +0 -146
  180. package/dist/ecs/game-component.d.ts.map +0 -1
  181. package/dist/ecs/game-component.js +0 -141
  182. package/dist/ecs/hmr-swap-report.d.ts +0 -53
  183. package/dist/ecs/hmr-swap-report.d.ts.map +0 -1
  184. package/dist/ecs/hmr-swap-report.js +0 -55
  185. package/dist/humanoid/bake.operation.d.ts +0 -119
  186. package/dist/humanoid/bake.operation.d.ts.map +0 -1
  187. package/dist/humanoid/bake.operation.js +0 -228
  188. package/dist/humanoid/body.d.ts +0 -101
  189. package/dist/humanoid/body.d.ts.map +0 -1
  190. package/dist/humanoid/body.js +0 -530
  191. package/dist/humanoid/clips.d.ts +0 -62
  192. package/dist/humanoid/clips.d.ts.map +0 -1
  193. package/dist/humanoid/clips.js +0 -121
  194. package/dist/humanoid/compose.d.ts +0 -75
  195. package/dist/humanoid/compose.d.ts.map +0 -1
  196. package/dist/humanoid/compose.js +0 -176
  197. package/dist/humanoid/generate.d.ts +0 -92
  198. package/dist/humanoid/generate.d.ts.map +0 -1
  199. package/dist/humanoid/generate.js +0 -124
  200. package/dist/humanoid/index.d.ts +0 -24
  201. package/dist/humanoid/index.d.ts.map +0 -1
  202. package/dist/humanoid/index.js +0 -18
  203. package/dist/humanoid/schema.d.ts +0 -35
  204. package/dist/humanoid/schema.d.ts.map +0 -1
  205. package/dist/humanoid/schema.js +0 -87
  206. package/dist/humanoid/skeleton.d.ts +0 -103
  207. package/dist/humanoid/skeleton.d.ts.map +0 -1
  208. package/dist/humanoid/skeleton.js +0 -289
  209. package/dist/index.d.ts +0 -37
  210. package/dist/index.d.ts.map +0 -1
  211. package/dist/index.js +0 -30
  212. package/dist/input/input-manager.d.ts +0 -945
  213. package/dist/input/input-manager.d.ts.map +0 -1
  214. package/dist/input/input-manager.js +0 -2207
  215. package/dist/input/input-types.d.ts +0 -174
  216. package/dist/input/input-types.d.ts.map +0 -1
  217. package/dist/input/input-types.js +0 -1
  218. package/dist/input/prompt-labels.d.ts +0 -21
  219. package/dist/input/prompt-labels.d.ts.map +0 -1
  220. package/dist/input/prompt-labels.js +0 -121
  221. package/dist/input/rebind-controller.d.ts +0 -59
  222. package/dist/input/rebind-controller.d.ts.map +0 -1
  223. package/dist/input/rebind-controller.js +0 -85
  224. package/dist/input/schema.d.ts +0 -16
  225. package/dist/input/schema.d.ts.map +0 -1
  226. package/dist/input/schema.js +0 -228
  227. package/dist/loader.d.ts +0 -43
  228. package/dist/loader.d.ts.map +0 -1
  229. package/dist/loader.js +0 -59
  230. package/dist/manifest/index.d.ts +0 -5
  231. package/dist/manifest/index.d.ts.map +0 -1
  232. package/dist/manifest/index.js +0 -8
  233. package/dist/manifest/load-file.d.ts +0 -4
  234. package/dist/manifest/load-file.d.ts.map +0 -1
  235. package/dist/manifest/load-file.js +0 -14
  236. package/dist/manifest/load.d.ts +0 -144
  237. package/dist/manifest/load.d.ts.map +0 -1
  238. package/dist/manifest/load.js +0 -273
  239. package/dist/manifest/schema.d.ts +0 -230
  240. package/dist/manifest/schema.d.ts.map +0 -1
  241. package/dist/manifest/schema.js +0 -394
  242. package/dist/physics/collision-system.d.ts +0 -41
  243. package/dist/physics/collision-system.d.ts.map +0 -1
  244. package/dist/physics/collision-system.js +0 -64
  245. package/dist/physics/physics-registry.d.ts +0 -45
  246. package/dist/physics/physics-registry.d.ts.map +0 -1
  247. package/dist/physics/physics-registry.js +0 -65
  248. package/dist/physics/transform-writer.d.ts +0 -16
  249. package/dist/physics/transform-writer.d.ts.map +0 -1
  250. package/dist/physics/transform-writer.js +0 -38
  251. package/dist/physics/trigger-dispatch.d.ts +0 -24
  252. package/dist/physics/trigger-dispatch.d.ts.map +0 -1
  253. package/dist/physics/trigger-dispatch.js +0 -80
  254. package/dist/react/game-state.d.ts +0 -156
  255. package/dist/react/game-state.d.ts.map +0 -1
  256. package/dist/react/game-state.js +0 -222
  257. package/dist/react/root-adapter.d.ts +0 -11
  258. package/dist/react/root-adapter.d.ts.map +0 -1
  259. package/dist/react/root-adapter.js +0 -41
  260. package/dist/react/unmanaged-root-detector.d.ts +0 -12
  261. package/dist/react/unmanaged-root-detector.d.ts.map +0 -1
  262. package/dist/react/unmanaged-root-detector.js +0 -45
  263. package/dist/react/use-data.d.ts +0 -60
  264. package/dist/react/use-data.d.ts.map +0 -1
  265. package/dist/react/use-data.js +0 -101
  266. package/dist/react/use-selection.d.ts +0 -75
  267. package/dist/react/use-selection.d.ts.map +0 -1
  268. package/dist/react/use-selection.js +0 -90
  269. package/dist/render/auto-batcher.d.ts +0 -34
  270. package/dist/render/auto-batcher.d.ts.map +0 -1
  271. package/dist/render/auto-batcher.js +0 -140
  272. package/dist/render/render-batch-system.d.ts +0 -33
  273. package/dist/render/render-batch-system.d.ts.map +0 -1
  274. package/dist/render/render-batch-system.js +0 -230
  275. package/dist/render/render-features.d.ts +0 -47
  276. package/dist/render/render-features.d.ts.map +0 -1
  277. package/dist/render/render-features.js +0 -105
  278. package/dist/render/render-settings.d.ts +0 -36
  279. package/dist/render/render-settings.d.ts.map +0 -1
  280. package/dist/render/render-settings.js +0 -51
  281. package/dist/runtime/create-runtime.d.ts +0 -249
  282. package/dist/runtime/create-runtime.d.ts.map +0 -1
  283. package/dist/runtime/create-runtime.js +0 -641
  284. package/dist/runtime/debug-bridge.d.ts +0 -257
  285. package/dist/runtime/debug-bridge.d.ts.map +0 -1
  286. package/dist/runtime/debug-bridge.js +0 -224
  287. package/dist/runtime/debug-registry.d.ts +0 -288
  288. package/dist/runtime/debug-registry.d.ts.map +0 -1
  289. package/dist/runtime/debug-registry.js +0 -513
  290. package/dist/runtime/frame-selector-cache.d.ts +0 -41
  291. package/dist/runtime/frame-selector-cache.d.ts.map +0 -1
  292. package/dist/runtime/frame-selector-cache.js +0 -65
  293. package/dist/runtime/game.d.ts +0 -496
  294. package/dist/runtime/game.d.ts.map +0 -1
  295. package/dist/runtime/game.js +0 -741
  296. package/dist/runtime/gameplay-rng-trap.d.ts +0 -48
  297. package/dist/runtime/gameplay-rng-trap.d.ts.map +0 -1
  298. package/dist/runtime/gameplay-rng-trap.js +0 -96
  299. package/dist/runtime/input-router.d.ts +0 -78
  300. package/dist/runtime/input-router.d.ts.map +0 -1
  301. package/dist/runtime/input-router.js +0 -171
  302. package/dist/runtime/mount-game.d.ts +0 -129
  303. package/dist/runtime/mount-game.d.ts.map +0 -1
  304. package/dist/runtime/mount-game.js +0 -152
  305. package/dist/runtime/mount-manifest.d.ts +0 -173
  306. package/dist/runtime/mount-manifest.d.ts.map +0 -1
  307. package/dist/runtime/mount-manifest.js +0 -297
  308. package/dist/runtime/render-audio-control.d.ts +0 -110
  309. package/dist/runtime/render-audio-control.d.ts.map +0 -1
  310. package/dist/runtime/render-audio-control.js +0 -111
  311. package/dist/runtime/render-control.d.ts +0 -291
  312. package/dist/runtime/render-control.d.ts.map +0 -1
  313. package/dist/runtime/render-control.js +0 -264
  314. package/dist/runtime/render-seed.d.ts +0 -57
  315. package/dist/runtime/render-seed.d.ts.map +0 -1
  316. package/dist/runtime/render-seed.js +0 -74
  317. package/dist/runtime/state-bridge.d.ts +0 -61
  318. package/dist/runtime/state-bridge.d.ts.map +0 -1
  319. package/dist/runtime/state-bridge.js +0 -63
  320. package/dist/runtime/types.d.ts +0 -253
  321. package/dist/runtime/types.d.ts.map +0 -1
  322. package/dist/runtime/types.js +0 -1
  323. package/dist/scene/asset-loaders.d.ts +0 -79
  324. package/dist/scene/asset-loaders.d.ts.map +0 -1
  325. package/dist/scene/asset-loaders.js +0 -141
  326. package/dist/scene/asset-paths.d.ts +0 -11
  327. package/dist/scene/asset-paths.d.ts.map +0 -1
  328. package/dist/scene/asset-paths.js +0 -108
  329. package/dist/scene/asset-ref-check.d.ts +0 -88
  330. package/dist/scene/asset-ref-check.d.ts.map +0 -1
  331. package/dist/scene/asset-ref-check.js +0 -214
  332. package/dist/scene/asset-registry.d.ts +0 -38
  333. package/dist/scene/asset-registry.d.ts.map +0 -1
  334. package/dist/scene/asset-registry.js +0 -66
  335. package/dist/scene/collider-dimensions.d.ts +0 -63
  336. package/dist/scene/collider-dimensions.d.ts.map +0 -1
  337. package/dist/scene/collider-dimensions.js +0 -98
  338. package/dist/scene/component-registry.d.ts +0 -22
  339. package/dist/scene/component-registry.d.ts.map +0 -1
  340. package/dist/scene/component-registry.js +0 -37
  341. package/dist/scene/defaults.d.ts +0 -252
  342. package/dist/scene/defaults.d.ts.map +0 -1
  343. package/dist/scene/defaults.js +0 -151
  344. package/dist/scene/geometries/index.d.ts +0 -8
  345. package/dist/scene/geometries/index.d.ts.map +0 -1
  346. package/dist/scene/geometries/index.js +0 -7
  347. package/dist/scene/geometries/terrain.d.ts +0 -2
  348. package/dist/scene/geometries/terrain.d.ts.map +0 -1
  349. package/dist/scene/geometries/terrain.js +0 -37
  350. package/dist/scene/geometry-registry.d.ts +0 -24
  351. package/dist/scene/geometry-registry.d.ts.map +0 -1
  352. package/dist/scene/geometry-registry.js +0 -20
  353. package/dist/scene/instance-registry.d.ts +0 -36
  354. package/dist/scene/instance-registry.d.ts.map +0 -1
  355. package/dist/scene/instance-registry.js +0 -55
  356. package/dist/scene/instancers/grid.d.ts +0 -2
  357. package/dist/scene/instancers/grid.d.ts.map +0 -1
  358. package/dist/scene/instancers/grid.js +0 -36
  359. package/dist/scene/instancers/index.d.ts +0 -8
  360. package/dist/scene/instancers/index.d.ts.map +0 -1
  361. package/dist/scene/instancers/index.js +0 -7
  362. package/dist/scene/light-camera-factory.d.ts +0 -23
  363. package/dist/scene/light-camera-factory.d.ts.map +0 -1
  364. package/dist/scene/light-camera-factory.js +0 -68
  365. package/dist/scene/material-factory.d.ts +0 -17
  366. package/dist/scene/material-factory.d.ts.map +0 -1
  367. package/dist/scene/material-factory.js +0 -197
  368. package/dist/scene/material-registry.d.ts +0 -40
  369. package/dist/scene/material-registry.d.ts.map +0 -1
  370. package/dist/scene/material-registry.js +0 -44
  371. package/dist/scene/materials/index.d.ts +0 -8
  372. package/dist/scene/materials/index.d.ts.map +0 -1
  373. package/dist/scene/materials/index.js +0 -7
  374. package/dist/scene/materials/water.d.ts +0 -2
  375. package/dist/scene/materials/water.d.ts.map +0 -1
  376. package/dist/scene/materials/water.js +0 -54
  377. package/dist/scene/parse.d.ts +0 -23
  378. package/dist/scene/parse.d.ts.map +0 -1
  379. package/dist/scene/parse.js +0 -179
  380. package/dist/scene/particles-factory.d.ts +0 -33
  381. package/dist/scene/particles-factory.d.ts.map +0 -1
  382. package/dist/scene/particles-factory.js +0 -282
  383. package/dist/scene/scene-apply.d.ts +0 -109
  384. package/dist/scene/scene-apply.d.ts.map +0 -1
  385. package/dist/scene/scene-apply.js +0 -370
  386. package/dist/scene/scene-diff-schema.d.ts +0 -285
  387. package/dist/scene/scene-diff-schema.d.ts.map +0 -1
  388. package/dist/scene/scene-diff-schema.js +0 -92
  389. package/dist/scene/scene-diff-types.d.ts +0 -40
  390. package/dist/scene/scene-diff-types.d.ts.map +0 -1
  391. package/dist/scene/scene-diff-types.js +0 -14
  392. package/dist/scene/scene-loader.d.ts +0 -167
  393. package/dist/scene/scene-loader.d.ts.map +0 -1
  394. package/dist/scene/scene-loader.js +0 -1211
  395. package/dist/scene/scene-query.d.ts +0 -11
  396. package/dist/scene/scene-query.d.ts.map +0 -1
  397. package/dist/scene/scene-query.js +0 -63
  398. package/dist/scene/scene-types.d.ts +0 -10
  399. package/dist/scene/scene-types.d.ts.map +0 -1
  400. package/dist/scene/scene-types.js +0 -8
  401. package/dist/scene/scene-version.d.ts +0 -26
  402. package/dist/scene/scene-version.d.ts.map +0 -1
  403. package/dist/scene/scene-version.js +0 -34
  404. package/dist/scene/schema/animation.d.ts +0 -8
  405. package/dist/scene/schema/animation.d.ts.map +0 -1
  406. package/dist/scene/schema/animation.js +0 -42
  407. package/dist/scene/schema/audio.d.ts +0 -13
  408. package/dist/scene/schema/audio.d.ts.map +0 -1
  409. package/dist/scene/schema/audio.js +0 -22
  410. package/dist/scene/schema/camera.d.ts +0 -28
  411. package/dist/scene/schema/camera.d.ts.map +0 -1
  412. package/dist/scene/schema/camera.js +0 -17
  413. package/dist/scene/schema/collider.d.ts +0 -40
  414. package/dist/scene/schema/collider.d.ts.map +0 -1
  415. package/dist/scene/schema/collider.js +0 -55
  416. package/dist/scene/schema/entity-ref.d.ts +0 -31
  417. package/dist/scene/schema/entity-ref.d.ts.map +0 -1
  418. package/dist/scene/schema/entity-ref.js +0 -61
  419. package/dist/scene/schema/entity.d.ts +0 -1036
  420. package/dist/scene/schema/entity.d.ts.map +0 -1
  421. package/dist/scene/schema/entity.js +0 -153
  422. package/dist/scene/schema/environment.d.ts +0 -425
  423. package/dist/scene/schema/environment.d.ts.map +0 -1
  424. package/dist/scene/schema/environment.js +0 -357
  425. package/dist/scene/schema/index.d.ts +0 -37
  426. package/dist/scene/schema/index.d.ts.map +0 -1
  427. package/dist/scene/schema/index.js +0 -19
  428. package/dist/scene/schema/instances.d.ts +0 -14
  429. package/dist/scene/schema/instances.d.ts.map +0 -1
  430. package/dist/scene/schema/instances.js +0 -28
  431. package/dist/scene/schema/joint.d.ts +0 -23
  432. package/dist/scene/schema/joint.d.ts.map +0 -1
  433. package/dist/scene/schema/joint.js +0 -23
  434. package/dist/scene/schema/light.d.ts +0 -38
  435. package/dist/scene/schema/light.d.ts.map +0 -1
  436. package/dist/scene/schema/light.js +0 -26
  437. package/dist/scene/schema/material.d.ts +0 -199
  438. package/dist/scene/schema/material.d.ts.map +0 -1
  439. package/dist/scene/schema/material.js +0 -103
  440. package/dist/scene/schema/mesh.d.ts +0 -48
  441. package/dist/scene/schema/mesh.d.ts.map +0 -1
  442. package/dist/scene/schema/mesh.js +0 -82
  443. package/dist/scene/schema/particles.d.ts +0 -2178
  444. package/dist/scene/schema/particles.d.ts.map +0 -1
  445. package/dist/scene/schema/particles.js +0 -321
  446. package/dist/scene/schema/physics.d.ts +0 -56
  447. package/dist/scene/schema/physics.d.ts.map +0 -1
  448. package/dist/scene/schema/physics.js +0 -37
  449. package/dist/scene/schema/scene-file.d.ts +0 -303
  450. package/dist/scene/schema/scene-file.d.ts.map +0 -1
  451. package/dist/scene/schema/scene-file.js +0 -256
  452. package/dist/scene/schema/shadow.d.ts +0 -28
  453. package/dist/scene/schema/shadow.d.ts.map +0 -1
  454. package/dist/scene/schema/shadow.js +0 -20
  455. package/dist/scene/schema/spline.d.ts +0 -25
  456. package/dist/scene/schema/spline.d.ts.map +0 -1
  457. package/dist/scene/schema/spline.js +0 -15
  458. package/dist/scene/schema/tuples.d.ts +0 -12
  459. package/dist/scene/schema/tuples.d.ts.map +0 -1
  460. package/dist/scene/schema/tuples.js +0 -14
  461. package/dist/scene/user-data.d.ts +0 -185
  462. package/dist/scene/user-data.d.ts.map +0 -1
  463. package/dist/scene/user-data.js +0 -144
  464. package/dist/setup/setup-audio.d.ts +0 -20
  465. package/dist/setup/setup-audio.d.ts.map +0 -1
  466. package/dist/setup/setup-audio.js +0 -41
  467. package/dist/setup/setup-particles.d.ts +0 -17
  468. package/dist/setup/setup-particles.d.ts.map +0 -1
  469. package/dist/setup/setup-particles.js +0 -16
  470. package/dist/setup/setup-physics.d.ts +0 -25
  471. package/dist/setup/setup-physics.d.ts.map +0 -1
  472. package/dist/setup/setup-physics.js +0 -51
  473. package/dist/setup/setup-renderer.d.ts +0 -69
  474. package/dist/setup/setup-renderer.d.ts.map +0 -1
  475. package/dist/setup/setup-renderer.js +0 -363
  476. package/dist/tools/define-tool.d.ts +0 -130
  477. package/dist/tools/define-tool.d.ts.map +0 -1
  478. package/dist/tools/define-tool.js +0 -96
  479. package/dist/world2d/authoring-2d.d.ts +0 -80
  480. package/dist/world2d/authoring-2d.d.ts.map +0 -1
  481. package/dist/world2d/authoring-2d.js +0 -195
  482. package/dist/world2d/capture-to-scene2d.d.ts +0 -5
  483. package/dist/world2d/capture-to-scene2d.d.ts.map +0 -1
  484. package/dist/world2d/capture-to-scene2d.js +0 -49
  485. package/dist/world2d/collision-2d.d.ts +0 -52
  486. package/dist/world2d/collision-2d.d.ts.map +0 -1
  487. package/dist/world2d/collision-2d.js +0 -70
  488. package/dist/world2d/components-2d.d.ts +0 -47
  489. package/dist/world2d/components-2d.d.ts.map +0 -1
  490. package/dist/world2d/components-2d.js +0 -77
  491. package/dist/world2d/index.d.ts +0 -34
  492. package/dist/world2d/index.d.ts.map +0 -1
  493. package/dist/world2d/index.js +0 -32
  494. package/dist/world2d/ingest-iframe-2d.d.ts +0 -82
  495. package/dist/world2d/ingest-iframe-2d.d.ts.map +0 -1
  496. package/dist/world2d/ingest-iframe-2d.js +0 -166
  497. package/dist/world2d/ingest2d.d.ts +0 -97
  498. package/dist/world2d/ingest2d.d.ts.map +0 -1
  499. package/dist/world2d/ingest2d.js +0 -40
  500. package/dist/world2d/physics2d-registry.d.ts +0 -24
  501. package/dist/world2d/physics2d-registry.d.ts.map +0 -1
  502. package/dist/world2d/physics2d-registry.js +0 -38
  503. package/dist/world2d/pixi-game-adapter.d.ts +0 -107
  504. package/dist/world2d/pixi-game-adapter.d.ts.map +0 -1
  505. package/dist/world2d/pixi-game-adapter.js +0 -210
  506. package/dist/world2d/pixi-surface.d.ts +0 -39
  507. package/dist/world2d/pixi-surface.d.ts.map +0 -1
  508. package/dist/world2d/pixi-surface.js +0 -47
  509. package/dist/world2d/scene-capture-2d.d.ts +0 -43
  510. package/dist/world2d/scene-capture-2d.d.ts.map +0 -1
  511. package/dist/world2d/scene-capture-2d.js +0 -92
  512. package/dist/world2d/scene2d-loader.d.ts +0 -27
  513. package/dist/world2d/scene2d-loader.d.ts.map +0 -1
  514. package/dist/world2d/scene2d-loader.js +0 -275
  515. package/dist/world2d/schema/entity2d.d.ts +0 -102
  516. package/dist/world2d/schema/entity2d.d.ts.map +0 -1
  517. package/dist/world2d/schema/entity2d.js +0 -119
  518. package/dist/world2d/schema/physics2d.d.ts +0 -46
  519. package/dist/world2d/schema/physics2d.d.ts.map +0 -1
  520. package/dist/world2d/schema/physics2d.js +0 -45
  521. package/dist/world2d/schema/sprite.d.ts +0 -42
  522. package/dist/world2d/schema/sprite.d.ts.map +0 -1
  523. package/dist/world2d/schema/sprite.js +0 -63
  524. package/dist/world2d/schema/tilemap.d.ts +0 -15
  525. package/dist/world2d/schema/tilemap.d.ts.map +0 -1
  526. package/dist/world2d/schema/tilemap.js +0 -19
  527. package/dist/world2d/schema/tuples2d.d.ts +0 -20
  528. package/dist/world2d/schema/tuples2d.d.ts.map +0 -1
  529. package/dist/world2d/schema/tuples2d.js +0 -19
  530. package/dist/world2d/system-adapters-2d.d.ts +0 -16
  531. package/dist/world2d/system-adapters-2d.d.ts.map +0 -1
  532. package/dist/world2d/system-adapters-2d.js +0 -37
  533. package/dist/world2d/transform-writer-2d.d.ts +0 -16
  534. package/dist/world2d/transform-writer-2d.d.ts.map +0 -1
  535. package/dist/world2d/transform-writer-2d.js +0 -22
  536. package/dist/world2d/types.d.ts +0 -59
  537. package/dist/world2d/types.d.ts.map +0 -1
  538. package/dist/world2d/types.js +0 -1
@@ -1,252 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * E1 — Zod/TypeScript metadata attached to XState state `meta.animation`
4
- * (spec §11 E1, §5.6, §3.3).
5
- *
6
- * This module defines ONLY animation data: which clip(s) a state plays, how
7
- * they loop/blend/crossfade, and (for locomotion-style states) how a 1D/2D/
8
- * direct blend tree distributes weight across several clips from a live
9
- * parameter. It intentionally contains **no transition vocabulary** — no
10
- * `on`/`target`/`guard`/`always`/`after`/`entry`/`exit`. XState alone owns
11
- * states, transitions, events, and guards (§3.3); this metadata is read-only
12
- * data a binding (`xstate-animation-binding.ts`, E2) consumes to drive a
13
- * `THREE.AnimationMixer` when XState enters/exits a state. Every schema below
14
- * is `.strict()` specifically so that smuggling a transition-shaped key into
15
- * `meta.animation` is a loud Zod "unrecognized key" error, not a silently
16
- * ignored field (E1 AC: "Metadata contains no transition language").
17
- *
18
- * ## Native layered composition
19
- *
20
- * Parallel XState regions may drive independent named layers. Each layer can
21
- * filter a clip to selected bone subtrees, scale its weight, and use normal
22
- * override or Three's native additive blend mode. XState still owns all
23
- * state/transition semantics; these fields only describe how the active
24
- * state's native `AnimationAction`s are composed by the binding.
25
- *
26
- * ## Blend tree shape
27
- *
28
- * Deliberately structurally IDENTICAL to `anim-graph-types.ts`'s
29
- * `BlendTreeDef` (same `type`/`parameter`/`parameterY`/`children[].clip`/
30
- * `.threshold`/`.thresholdY`/`.weight` fields) so the binding can hand a
31
- * parsed `AnimationBlendTree` straight to the existing, already-tested
32
- * `evaluateBlendTree` (`blend-node.ts`) with zero conversion — E2 reuses that
33
- * function verbatim rather than re-implementing 1D/2D/direct blend math.
34
- */
35
- // ---------------------------------------------------------------------------
36
- // Blend tree children
37
- // ---------------------------------------------------------------------------
38
- const AnimationBlendChildSchema = z
39
- .object({
40
- clip: z.string().min(1).describe('Animation clip name this child plays'),
41
- threshold: z.number().describe('1D/2D blend position on the primary parameter axis'),
42
- thresholdY: z
43
- .number()
44
- .optional()
45
- .describe('2D blend position on the secondary parameter axis (2D blend trees only)'),
46
- weight: z
47
- .number()
48
- .min(0)
49
- .optional()
50
- .describe('Explicit weight for "direct" blend trees (ignored by 1D/2D)'),
51
- })
52
- .strict();
53
- const AnimationBlendTree1DSchema = z
54
- .object({
55
- type: z.literal('1D').describe('Interpolates linearly between sorted children by threshold'),
56
- parameter: z.string().min(1).describe('Context/selector value driving the blend'),
57
- children: z
58
- .array(AnimationBlendChildSchema)
59
- .min(2, '1D blend tree needs at least 2 children to interpolate between'),
60
- })
61
- .strict();
62
- const AnimationBlendTree2DSchema = z
63
- .object({
64
- type: z
65
- .literal('2D')
66
- .describe('Inverse-distance-weights children by (parameter, parameterY) position'),
67
- parameter: z.string().min(1).describe('Primary axis context/selector value'),
68
- parameterY: z.string().min(1).describe('Secondary axis context/selector value'),
69
- children: z
70
- .array(AnimationBlendChildSchema.extend({ thresholdY: z.number() }))
71
- .min(1, '2D blend tree needs at least 1 child'),
72
- })
73
- .strict();
74
- const AnimationBlendTreeDirectSchema = z
75
- .object({
76
- type: z.literal('direct').describe('Each child has an explicit weight, normalized to sum to 1'),
77
- // `parameter` is unused by direct blending (evaluateBlendTree never reads
78
- // it for `type: 'direct'`) but kept required+defaulted so the parsed
79
- // value stays structurally assignable to `BlendTreeDef`
80
- // (`anim-graph-types.ts`), which declares `parameter: string` for every
81
- // blend mode — the same convention that type already uses.
82
- parameter: z.string().default(''),
83
- children: z
84
- .array(AnimationBlendChildSchema.extend({ weight: z.number().min(0) }))
85
- .min(1, 'direct blend tree needs at least 1 child'),
86
- })
87
- .strict();
88
- export const AnimationBlendTreeSchema = z.discriminatedUnion('type', [
89
- AnimationBlendTree1DSchema,
90
- AnimationBlendTree2DSchema,
91
- AnimationBlendTreeDirectSchema,
92
- ]);
93
- // ---------------------------------------------------------------------------
94
- // Crossfade / blend-in-out metadata (shared by clip and blend-tree states)
95
- // ---------------------------------------------------------------------------
96
- const AnimationCrossfadeMetaSchema = z
97
- .object({
98
- duration: z
99
- .number()
100
- .min(0)
101
- .default(0)
102
- .describe('Seconds to blend from the previously active clip into this state on entry, applied via ' +
103
- 'native `AnimationAction.crossFadeTo`/`fadeIn` (E2). 0 = instant activation, no fade.'),
104
- warp: z
105
- .boolean()
106
- .default(false)
107
- .describe("Passed through to AnimationAction.crossFadeTo's `warp` param — linearly warps timeScale " +
108
- 'across the two clips during the blend so differing clip lengths line up. Default false.'),
109
- })
110
- .strict()
111
- .describe('Blend-in/out/crossfade timing for entering this state');
112
- const AnimationBoneMaskSchema = z
113
- .object({
114
- include: z
115
- .array(z.string().min(1))
116
- .min(1)
117
- .optional()
118
- .describe('Bone/object names whose complete descendant subtrees are retained'),
119
- exclude: z
120
- .array(z.string().min(1))
121
- .min(1)
122
- .optional()
123
- .describe('Bone/object names whose complete descendant subtrees are removed'),
124
- })
125
- .strict()
126
- .refine((mask) => Boolean(mask.include?.length || mask.exclude?.length), {
127
- message: 'boneMask needs at least one include or exclude bone name',
128
- })
129
- .describe('Filters animation tracks by named Object3D/Bone subtrees');
130
- const AnimationLayerFields = {
131
- layer: z
132
- .string()
133
- .min(1)
134
- .optional()
135
- .describe('Composition layer name; omitted means the single base layer'),
136
- weight: z
137
- .number()
138
- .min(0)
139
- .max(1)
140
- .optional()
141
- .describe('Layer weight multiplier from 0 to 1; defaults to 1'),
142
- blendMode: z
143
- .enum(['override', 'additive'])
144
- .optional()
145
- .describe('Native Three normal/override or additive action blending; defaults to override'),
146
- boneMask: AnimationBoneMaskSchema.optional().describe('Optional include/exclude filter applied to every clip track in this state'),
147
- };
148
- // ---------------------------------------------------------------------------
149
- // Per-state animation metadata: single clip OR blend tree, plus crossfade
150
- // ---------------------------------------------------------------------------
151
- const ClipAnimationMetaSchema = z
152
- .object({
153
- clip: z.string().min(1).describe('Single clip to play while this XState state is active'),
154
- loop: z
155
- .boolean()
156
- .default(true)
157
- .describe('Loop the clip (THREE.LoopRepeat) vs play once (THREE.LoopOnce, clamped on last frame)'),
158
- speed: z
159
- .number()
160
- .positive()
161
- .default(1)
162
- .describe('Playback speed multiplier (AnimationAction.timeScale)'),
163
- crossfade: AnimationCrossfadeMetaSchema.optional(),
164
- ...AnimationLayerFields,
165
- })
166
- .strict();
167
- const BlendTreeAnimationMetaSchema = z
168
- .object({
169
- blendTree: AnimationBlendTreeSchema.describe('Multiple clips blended by a live context/selector-driven parameter'),
170
- crossfade: AnimationCrossfadeMetaSchema.optional(),
171
- ...AnimationLayerFields,
172
- })
173
- .strict();
174
- /**
175
- * The full shape of `state.meta.animation` for one XState state (spec §5.6):
176
- * exactly one of a single clip or a blend tree, plus optional crossfade
177
- * timing. `.strict()` on both branches is what makes authoring a transition
178
- * keyword (`on`, `target`, `guard`, …) inside `meta.animation` a validation
179
- * error instead of a silently-accepted second transition dialect.
180
- */
181
- export const StateAnimationMetaSchema = z.union([
182
- ClipAnimationMetaSchema,
183
- BlendTreeAnimationMetaSchema,
184
- ]);
185
- /** True iff a validated meta declares a single clip rather than a blend tree. */
186
- export function isClipAnimationMeta(meta) {
187
- return 'clip' in meta;
188
- }
189
- /** True iff a validated meta declares a blend tree rather than a single clip. */
190
- export function isBlendTreeAnimationMeta(meta) {
191
- return 'blendTree' in meta;
192
- }
193
- // ---------------------------------------------------------------------------
194
- // Validation entry point
195
- // ---------------------------------------------------------------------------
196
- /** Thrown by `parseStateAnimationMeta` — always names the offending state id. */
197
- export class AnimationMetaValidationError extends Error {
198
- stateId;
199
- issues;
200
- constructor(message, stateId, issues) {
201
- super(message);
202
- this.stateId = stateId;
203
- this.issues = issues;
204
- this.name = 'AnimationMetaValidationError';
205
- }
206
- }
207
- /**
208
- * Validate one state's `meta.animation` value. Called by the E2 binding for
209
- * every state a machine declares (both at bind time, up front, and — for
210
- * belt-and-suspenders — again whenever a state is entered).
211
- *
212
- * @throws {AnimationMetaValidationError} naming the state id and every Zod
213
- * issue (path + message) — e.g. an unrecognized `on`/`target` key, a
214
- * missing `clip`, or a 1D blend tree with only one child.
215
- */
216
- export function parseStateAnimationMeta(stateId, raw) {
217
- const result = StateAnimationMetaSchema.safeParse(raw);
218
- if (!result.success) {
219
- const detail = result.error.issues
220
- .map((issue) => `${issue.path.length ? issue.path.join('.') : '(root)'}: ${issue.message}`)
221
- .join('; ');
222
- throw new AnimationMetaValidationError(`[xstate-animation] invalid meta.animation for state "${stateId}": ${detail}`, stateId, result.error.issues);
223
- }
224
- return result.data;
225
- }
226
- /**
227
- * Walk every state node in a machine (from its root `StateNode`, e.g.
228
- * `actor.logic.root`) and validate every `meta.animation` value found.
229
- * States with no `meta.animation` are skipped (not every XState state needs
230
- * to drive animation). Returns one entry per animated state, in document
231
- * order.
232
- *
233
- * @throws {AnimationMetaValidationError} on the FIRST invalid meta found —
234
- * naming the specific state id, so an agent authoring a machine gets an
235
- * actionable pointer straight to the bad state instead of a generic error.
236
- */
237
- export function collectMachineAnimationMeta(root) {
238
- const out = [];
239
- const visit = (node) => {
240
- if (node.meta && 'animation' in node.meta && node.meta.animation !== undefined) {
241
- out.push({ stateId: node.id, meta: parseStateAnimationMeta(node.id, node.meta.animation) });
242
- }
243
- for (const child of Object.values(node.states ?? {}))
244
- visit(child);
245
- };
246
- visit(root);
247
- return out;
248
- }
249
- /** Every clip name referenced anywhere in a validated meta (1 for clip states, N for blend trees). */
250
- export function clipNamesOf(meta) {
251
- return isClipAnimationMeta(meta) ? [meta.clip] : meta.blendTree.children.map((c) => c.clip);
252
- }
package/dist/assets.d.ts DELETED
@@ -1,26 +0,0 @@
1
- /**
2
- * Shared asset cache — URL-keyed, deduplicating loader for GLTF and JSON.
3
- *
4
- * Inspired by Unity's Resources.Load / Godot's load():
5
- * assets.load<T>(url) — async, returns Promise<T>, deduplicates concurrent loads
6
- * assets.get<T>(url) — sync, returns T, throws if not yet loaded
7
- *
8
- * GLTF files (.glb/.gltf) resolve to GLTFResult.
9
- * JSON files resolve to the parsed object (caller provides type via generic).
10
- *
11
- * Cache lives for the app lifetime — no dispose needed.
12
- */
13
- import type * as THREE from 'three';
14
- /** Result of loading a .glb/.gltf file. */
15
- export interface GLTFResult {
16
- scene: THREE.Group;
17
- animations: THREE.AnimationClip[];
18
- }
19
- export interface AssetCache {
20
- /** Load an asset by URL. Returns a cached promise if already loading/loaded. */
21
- load<T = unknown>(url: string): Promise<T>;
22
- /** Get a previously-loaded asset synchronously. Throws if not yet loaded. */
23
- get<T = unknown>(url: string): T;
24
- }
25
- export declare function createAssetCache(): AssetCache;
26
- //# sourceMappingURL=assets.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAGpC,2CAA2C;AAC3C,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IACnB,UAAU,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,UAAU;IACzB,gFAAgF;IAChF,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAE3C,6EAA6E;IAC7E,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC;CAClC;AAED,wBAAgB,gBAAgB,IAAI,UAAU,CAiD7C"}
package/dist/assets.js DELETED
@@ -1,55 +0,0 @@
1
- /**
2
- * Shared asset cache — URL-keyed, deduplicating loader for GLTF and JSON.
3
- *
4
- * Inspired by Unity's Resources.Load / Godot's load():
5
- * assets.load<T>(url) — async, returns Promise<T>, deduplicates concurrent loads
6
- * assets.get<T>(url) — sync, returns T, throws if not yet loaded
7
- *
8
- * GLTF files (.glb/.gltf) resolve to GLTFResult.
9
- * JSON files resolve to the parsed object (caller provides type via generic).
10
- *
11
- * Cache lives for the app lifetime — no dispose needed.
12
- */
13
- import { gltfLoader, resolveUrl } from './loader';
14
- export function createAssetCache() {
15
- const cache = new Map();
16
- const resolved = new Map();
17
- // Use the shared, DRACO-wired GLTFLoader (A2 / CB2) — no second loader instance.
18
- // This cache keeps the parsed source GLTFResult (load/get semantics for gameplay
19
- // code); it does NOT clone. Callers that need disposal-safe clones use
20
- // scene/asset-loaders `loadGLTF`, which clones + tags `__sharedGeometry`.
21
- function load(url) {
22
- const existing = cache.get(url);
23
- if (existing)
24
- return existing;
25
- let promise;
26
- if (url.endsWith('.glb') || url.endsWith('.gltf')) {
27
- promise = new Promise((resolve, reject) => {
28
- gltfLoader.load(url, (gltf) => resolve({ scene: gltf.scene, animations: gltf.animations }), undefined, reject);
29
- });
30
- }
31
- else if (url.endsWith('.json')) {
32
- promise = fetch(resolveUrl(url)).then((r) => {
33
- if (!r.ok)
34
- throw new Error(`Failed to fetch ${url}: ${r.status}`);
35
- return r.json();
36
- });
37
- }
38
- else {
39
- throw new Error(`AssetCache: unsupported file type for "${url}"`);
40
- }
41
- const tracked = promise.then((value) => {
42
- resolved.set(url, value);
43
- return value;
44
- });
45
- cache.set(url, tracked);
46
- return tracked;
47
- }
48
- function get(url) {
49
- if (!resolved.has(url)) {
50
- throw new Error(`AssetCache: "${url}" not loaded. Call load() first and await it.`);
51
- }
52
- return resolved.get(url);
53
- }
54
- return { load, get };
55
- }
@@ -1,4 +0,0 @@
1
- export { bindClockToTone, type ToneClockBinding, type ToneClockBindingOptions, type ToneTransportLike, } from './tone-clock-binding';
2
- export { bridgeToneToThreeAudio, connectToneBusToMasterGain, resumeSharedAudio, type ToneAudioBridge, } from './tone-context';
3
- export { renderToneOffline, type ToneOfflineComposeFn, type ToneOfflineRenderRequest, type ToneOfflineRenderResult, } from './tone-offline-render';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/audio/index.ts"],"names":[],"mappings":"AAqBA,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,sBAAsB,EACtB,0BAA0B,EAC1B,iBAAiB,EACjB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,uBAAuB,CAAC"}
@@ -1,24 +0,0 @@
1
- // Engine-core audio surface (spec §13 workstream G).
2
- //
3
- // G3 ("Replace or Relocate Procedural Audio Helpers") removed the former
4
- // `musical.ts`/`weapons.ts`/`impacts.ts`/`vehicle.ts`/`ambient.ts`/
5
- // `movement.ts`/`ui-sounds.ts` — raw-`AudioContext`/`Math.random`-driven
6
- // oscillator and noise-buffer SFX generators that were engine-owned but
7
- // non-spatial (they never touched `THREE.PositionalAudio`, so the "spatial
8
- // one-shot helper" exception in the G3 acceptance criteria does not apply to
9
- // them). Each was either relocated verbatim into the example project that
10
- // used it (`examples/{third-person,fps,third-person-arena,rts,vehicle}/src/
11
- // procedural-audio.ts`) or deleted as dead code with no shipped consumer
12
- // (`bassPulse`/`arpeggio`/`gunshot`/`laser`/`bounce`/`crash`/`explosion`/
13
- // `tireSkid`/`wind`/`rain`/`hum`/`nature`/`uiHover`/`uiError`). The canonical
14
- // replacements — a procedural-music example built directly on Tone's own API
15
- // and a spatial-audio example built directly on `THREE.PositionalAudio` — are
16
- // `examples/audio-showcase`.
17
- //
18
- // What remains here is the genuine engine-core audio capability: the G1/G2
19
- // Tone↔Three context bridge and offline render (`wav-encode.ts`, the G4
20
- // PCM->WAV encoder, is consumed by its own module path, not this barrel — see
21
- // `packages/engine/src/runtime/render-audio-control.ts`).
22
- export { bindClockToTone, } from './tone-clock-binding';
23
- export { bridgeToneToThreeAudio, connectToneBusToMasterGain, resumeSharedAudio, } from './tone-context';
24
- export { renderToneOffline, } from './tone-offline-render';
@@ -1,75 +0,0 @@
1
- import type { AnimationClock } from '../animation/animation-clock';
2
- import type { SystemPhaseName } from '../core/types';
3
- /**
4
- * G2 — Integrate Tone with the Canonical Clock, preview/real-time half
5
- * (spec §13 G2, §10 D1). Mirrors `animation/theatre-clock-binding.ts`'s D2
6
- * pattern exactly, on purpose: the canonical `AnimationClock` is the single
7
- * source of truth for "what time is it", and every participating system
8
- * (Theatre's sequence position, a registered GSAP timeline, and — here — a
9
- * Tone transport) is seeked to match it on every clock crossing. Tone must
10
- * never be left to free-run its own real-time clock while participating in
11
- * a cinematic, for the exact same reason Theatre isn't: deterministic
12
- * export, offline scrubbing, and no wall-clock dependency
13
- * (`animation-clock.ts`'s module doc explains why in full).
14
- *
15
- * ## Why setting `transport.seconds` is enough
16
- *
17
- * Setting `Tone.getTransport().seconds` repositions the transport's
18
- * playhead synchronously; it does not itself start real-time ticking (that
19
- * still requires an explicit `transport.start()`, which this binding
20
- * deliberately never calls — see the module doc on `animation-clock.ts` for
21
- * why nothing in this codebase is allowed to drive its own
22
- * `requestAnimationFrame`/wall-clock loop). A clock-seeked Tone transport is
23
- * a pure function of `clock.time`, exactly like a Theatre sequence's
24
- * `position` setter.
25
- *
26
- * ## Structural (not nominal) transport typing
27
- *
28
- * `ToneTransportLike` intentionally types only the ONE property this
29
- * binding touches (`seconds`), the same narrowing discipline
30
- * `runtime/render-control.ts`'s `SeekableClock` uses for the canonical
31
- * clock. `Tone.getTransport()`'s real `TransportClass` satisfies this
32
- * structurally with no adapter — pass it directly at the real call site.
33
- * The narrow type is also what makes this binding's own unit tests real
34
- * (not mocked-away): `packages/engine/test/audio/tone-clock-binding.test.ts`
35
- * exercises the FULL seek/pause/loop/time-scale matrix against a real
36
- * `AnimationClock` and a plain `{ seconds: number }` object — no Tone
37
- * import, no `AudioContext`, and it still proves the exact behavior a real
38
- * `Tone.Transport` will see, because `TransportClass` IS a
39
- * `ToneTransportLike` at the type level.
40
- */
41
- export interface ToneTransportLike {
42
- seconds: number;
43
- }
44
- export interface ToneClockBindingOptions {
45
- /**
46
- * Which `AnimationClock` phase to seek the transport in. Defaults to
47
- * `'animation'` — the same phase `theatre-clock-binding.ts` uses by
48
- * default, so a Theatre sequence and a Tone transport bound to the same
49
- * clock stay in lockstep with each other (`PHASE_ORDER`-then-registration-
50
- * order — see `animation-clock.ts`'s `subscribe` doc comment).
51
- */
52
- phase?: SystemPhaseName;
53
- }
54
- export interface ToneClockBinding {
55
- /** Removes the clock evaluator. No further `transport.seconds` writes
56
- * occur after this — the transport is left at whatever position it was
57
- * last seeked to (matches `TheatreClockBinding.dispose`'s contract). */
58
- dispose(): void;
59
- }
60
- /**
61
- * Subscribe `transport.seconds = clock.time` to every crossing of `clock`
62
- * in the given phase (default `'animation'`). Returns a disposer; call it
63
- * to stop driving the transport (e.g. on `GameCleanup.dispose()`, or before
64
- * rebinding on hot reload — this is what keeps HMR from accumulating
65
- * duplicate listeners).
66
- *
67
- * Only call this for a Tone composition that PARTICIPATES in a cinematic
68
- * (spec G2 AC). Ordinary, non-cinematic game music should drive Tone's own
69
- * real-time transport directly (`transport.start()`, `Tone.Transport.bpm`,
70
- * etc. — see `tone-context.ts`'s "escape hatch" section) and must NEVER be
71
- * bound here, since a bound transport's position is entirely clock-driven
72
- * and `start()`/`stop()` calls on it would fight this binding's writes.
73
- */
74
- export declare function bindClockToTone(clock: AnimationClock, transport: ToneTransportLike, options?: ToneClockBindingOptions): ToneClockBinding;
75
- //# sourceMappingURL=tone-clock-binding.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tone-clock-binding.d.ts","sourceRoot":"","sources":["../../src/audio/tone-clock-binding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,8BAA8B,CAAC;AACzF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;6EAEyE;IACzE,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,iBAAiB,EAC5B,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,CAelB"}
@@ -1,29 +0,0 @@
1
- /**
2
- * Subscribe `transport.seconds = clock.time` to every crossing of `clock`
3
- * in the given phase (default `'animation'`). Returns a disposer; call it
4
- * to stop driving the transport (e.g. on `GameCleanup.dispose()`, or before
5
- * rebinding on hot reload — this is what keeps HMR from accumulating
6
- * duplicate listeners).
7
- *
8
- * Only call this for a Tone composition that PARTICIPATES in a cinematic
9
- * (spec G2 AC). Ordinary, non-cinematic game music should drive Tone's own
10
- * real-time transport directly (`transport.start()`, `Tone.Transport.bpm`,
11
- * etc. — see `tone-context.ts`'s "escape hatch" section) and must NEVER be
12
- * bound here, since a bound transport's position is entirely clock-driven
13
- * and `start()`/`stop()` calls on it would fight this binding's writes.
14
- */
15
- export function bindClockToTone(clock, transport, options = {}) {
16
- const phase = options.phase ?? 'animation';
17
- const handle = clock.subscribe(phase, (crossing) => {
18
- transport.seconds = crossing.currentTime;
19
- });
20
- let disposed = false;
21
- return {
22
- dispose() {
23
- if (disposed)
24
- return;
25
- disposed = true;
26
- handle.dispose();
27
- },
28
- };
29
- }
@@ -1,114 +0,0 @@
1
- import type { ToneAudioNode } from 'tone';
2
- /**
3
- * G1 — Establish Audio Ownership (spec §13 G1, §3.6, §4).
4
- *
5
- * ## The boundary
6
- *
7
- * Two independent, native-vocabulary audio systems coexist in every VGAI
8
- * game, each with a genuinely different job. This module does not wrap
9
- * either one — it only decides who owns which native `AudioContext` and how
10
- * the two graphs meet:
11
- *
12
- * - **Three/Web Audio** (`setup/setup-audio.ts`) remains authoritative for
13
- * SPATIAL audio: `THREE.AudioListener` (attached to the active camera)
14
- * and `THREE.Audio`/`THREE.PositionalAudio` sources. (G3, a later unit,
15
- * has since removed the non-spatial engine-owned one-shot procedural
16
- * helpers this comment used to name here — `audio/impacts.ts`,
17
- * `audio/weapons.ts`, `audio/ambient.ts`, and their siblings — relocating
18
- * each into the example project that used it, or deleting it as dead code;
19
- * see `packages/engine/src/audio/index.ts`'s header comment and
20
- * `examples/audio-showcase` for the canonical native-Tone/native-Three
21
- * replacements. This module's own boundary/bridge is unchanged by that
22
- * unit.)
23
- * - **Tone.js** owns musical transport, tempo, scheduling, synthesis, and
24
- * procedural composition — imported and used with its OWN native API
25
- * (`new Tone.Synth()`, `Tone.getTransport()`, `Tone.Offline(...)`,
26
- * `Tone.getContext()`), never through a VGAI-renamed wrapper (spec §1's
27
- * native-library rule). See `packages/engine/test/audio/tone-context.test.ts`
28
- * for a direct, unwrapped usage example.
29
- *
30
- * ## Why they must share one native `AudioContext`
31
- *
32
- * Both systems ultimately talk to exactly one hardware output. If Tone ran
33
- * its own independently-created `AudioContext` alongside
34
- * `THREE.AudioListener`'s, they would: fight over autoplay-policy resume
35
- * state (two contexts, two `state`s, two places a "click to start audio"
36
- * gesture would need to unlock); produce TWO separate graphs that a single
37
- * mute/volume control cannot coherently silence; and — fatally for G4/I6 —
38
- * make deterministic offline capture impossible to align with the video's
39
- * frame-addressed render range, since there would be no single graph whose
40
- * lifecycle (suspend/resume/close) the render/capture harness can reason
41
- * about.
42
- *
43
- * `bridgeToneToThreeAudio` fixes this: it points Tone's global context
44
- * (`Tone.setContext`) at the SAME native `AudioContext` instance
45
- * `THREE.AudioListener` already created (`setupAudio(camera).listener.context`,
46
- * `setup/setup-audio.ts`). After bridging,
47
- * `Tone.getContext().rawContext === threeListener.context` — there is
48
- * exactly one native context. One `.resume()`/`.suspend()` call (or
49
- * `Tone.start()`, which does both) affects both systems, and routing a Tone
50
- * bus into `setupAudio()`'s `masterGain` (see `connectToneBusToMasterGain`
51
- * below) puts Tone's output under the SAME mute/master-volume control as
52
- * every `THREE.Audio` source.
53
- *
54
- * ## What this module does NOT do
55
- *
56
- * It does not create an `AudioContext` (that remains `setupAudio`'s job —
57
- * call `bridgeToneToThreeAudio` AFTER `setupAudio(camera)`, before
58
- * constructing any Tone node: Tone nodes built against the PREVIOUS global
59
- * context are not retroactively migrated — Tone's own `setContext` contract,
60
- * not a VGAI limitation). It does not wrap any Tone class, and it does not
61
- * touch THREE's audio path at all. G3 (a later unit) is where engine-owned
62
- * procedural helpers get rewritten directly on Tone or relocated to game
63
- * code — this module only owns the context boundary + bridge.
64
- *
65
- * ## Escape hatch — ordinary (non-cinematic) game music
66
- *
67
- * None of the above requires participating in a cinematic. Once bridged,
68
- * ordinary game music can drive Tone's REAL real-time transport exactly as
69
- * Tone's own docs describe — `Tone.getTransport().bpm.value = 128`,
70
- * `Tone.getTransport().start()`, `new Tone.Sequence(...).start(0)`, etc. —
71
- * with no VGAI involvement at all. `tone-clock-binding.ts` (G2) is opt-in,
72
- * only for the case where a Tone composition must stay in lockstep with the
73
- * canonical `AnimationClock` because it participates in a cinematic.
74
- */
75
- /** Result of {@link bridgeToneToThreeAudio} — the shared native context plus
76
- * a re-checkable assertion, so a caller/test doesn't need to re-derive the
77
- * bridging logic to confirm it still holds later. */
78
- export interface ToneAudioBridge {
79
- /** The native `AudioContext` Tone and `THREE.AudioListener` now share. */
80
- readonly context: AudioContext;
81
- /** True iff `Tone.getContext().rawContext` is still exactly `context`
82
- * (identity, not equality — proves ONE shared native context, not two
83
- * compatible-looking ones). */
84
- isBridged(): boolean;
85
- }
86
- /**
87
- * Point Tone's global context at `context` (typically
88
- * `setupAudio(camera).listener.context` from `setup/setup-audio.ts`). Call
89
- * this once per game boot, after `setupAudio(camera)`, before constructing
90
- * any Tone node.
91
- */
92
- export declare function bridgeToneToThreeAudio(context: AudioContext): ToneAudioBridge;
93
- /**
94
- * Route a Tone output node (a bus, `Tone.getDestination()`, or any
95
- * `Tone.Gain` used as a submix) into the SAME `masterGain`
96
- * `setupAudio()` created, so Tone output is silenced/attenuated by the
97
- * identical mute/volume control as every `THREE.Audio`/`THREE.PositionalAudio`
98
- * source. `toneNode` is Tone's own `ToneAudioNode` type (no VGAI wrapper);
99
- * `masterGain` is the plain native `GainNode` `setupAudio()` already
100
- * returns — Tone's `.connect()` natively accepts a raw `AudioNode` as its
101
- * destination, so no adapter node is needed on either side.
102
- */
103
- export declare function connectToneBusToMasterGain(toneNode: ToneAudioNode, masterGain: GainNode): void;
104
- /**
105
- * Resume the shared context after a user gesture. Because
106
- * {@link bridgeToneToThreeAudio} guarantees Tone and THREE share the
107
- * identical native context, calling `Tone.start()` — which both resumes the
108
- * context AND runs Tone's own autoplay-unlock bookkeeping (a silent-buffer
109
- * trick required on some browsers) — is sufficient to unstick BOTH systems;
110
- * a separate `context.resume()` call on the THREE side is redundant once
111
- * bridged, not required.
112
- */
113
- export declare function resumeSharedAudio(): Promise<void>;
114
- //# sourceMappingURL=tone-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tone-context.d.ts","sourceRoot":"","sources":["../../src/audio/tone-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAG1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAEH;;sDAEsD;AACtD,MAAM,WAAW,eAAe;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B;;oCAEgC;IAChC,SAAS,IAAI,OAAO,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,YAAY,GAAG,eAAe,CAM7E;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,GAAG,IAAI,CAE9F;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAEvD"}
@@ -1,39 +0,0 @@
1
- import * as Tone from 'tone';
2
- /**
3
- * Point Tone's global context at `context` (typically
4
- * `setupAudio(camera).listener.context` from `setup/setup-audio.ts`). Call
5
- * this once per game boot, after `setupAudio(camera)`, before constructing
6
- * any Tone node.
7
- */
8
- export function bridgeToneToThreeAudio(context) {
9
- Tone.setContext(context);
10
- return {
11
- context,
12
- isBridged: () => Tone.getContext().rawContext === context,
13
- };
14
- }
15
- /**
16
- * Route a Tone output node (a bus, `Tone.getDestination()`, or any
17
- * `Tone.Gain` used as a submix) into the SAME `masterGain`
18
- * `setupAudio()` created, so Tone output is silenced/attenuated by the
19
- * identical mute/volume control as every `THREE.Audio`/`THREE.PositionalAudio`
20
- * source. `toneNode` is Tone's own `ToneAudioNode` type (no VGAI wrapper);
21
- * `masterGain` is the plain native `GainNode` `setupAudio()` already
22
- * returns — Tone's `.connect()` natively accepts a raw `AudioNode` as its
23
- * destination, so no adapter node is needed on either side.
24
- */
25
- export function connectToneBusToMasterGain(toneNode, masterGain) {
26
- toneNode.connect(masterGain);
27
- }
28
- /**
29
- * Resume the shared context after a user gesture. Because
30
- * {@link bridgeToneToThreeAudio} guarantees Tone and THREE share the
31
- * identical native context, calling `Tone.start()` — which both resumes the
32
- * context AND runs Tone's own autoplay-unlock bookkeeping (a silent-buffer
33
- * trick required on some browsers) — is sufficient to unstick BOTH systems;
34
- * a separate `context.resume()` call on the THREE side is redundant once
35
- * bridged, not required.
36
- */
37
- export async function resumeSharedAudio() {
38
- await Tone.start();
39
- }