@vgai/engine 0.3.0 → 0.4.0-canary.20260715.0

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 (559) hide show
  1. package/package.json +8 -2
  2. package/schemas/engine-api.json +124 -0
  3. package/schemas/engine-api.md +53 -0
  4. package/schemas/engine-capabilities.json +124 -0
  5. package/schemas/inputmap.schema.json +314 -0
  6. package/schemas/mat.schema.json +286 -0
  7. package/schemas/prefab.schema.json +10148 -0
  8. package/schemas/scn2d.schema.json +475 -0
  9. package/schemas/vgai-game.schema.json +383 -0
  10. package/schemas/vscn.schema.json +11007 -0
  11. package/src/adapter/{world-kind.ts → adapter-surface.ts} +6 -6
  12. package/src/adapter/authoring.ts +67 -0
  13. package/src/adapter/game-adapter.ts +8 -8
  14. package/src/adapter/host-context.ts +2 -4
  15. package/src/adapter/index.ts +3 -1
  16. package/src/adapter/system-adapter.ts +73 -0
  17. package/src/adapter/vgai-scene-game-adapter.ts +239 -180
  18. package/src/animation/xstate-animation-binding.ts +300 -262
  19. package/src/animation/xstate-animation-meta.ts +50 -13
  20. package/src/character/cloth-sim.ts +533 -0
  21. package/src/character/spring-chain.ts +307 -0
  22. package/src/core/game-loop.ts +41 -3
  23. package/src/core/seeded-random.ts +161 -0
  24. package/src/core/system-runner.ts +20 -3
  25. package/src/core/types.ts +37 -0
  26. package/src/data/data-asset.ts +1 -1
  27. package/src/dev/performance-profiler.ts +213 -0
  28. package/src/dev/webgl-gpu-timer.ts +53 -0
  29. package/src/ecs/component-manager.ts +45 -12
  30. package/src/ecs/game-component.ts +95 -11
  31. package/src/humanoid/bake.operation.ts +326 -0
  32. package/src/humanoid/body.ts +663 -0
  33. package/src/humanoid/clips.ts +149 -0
  34. package/src/humanoid/compose.ts +209 -0
  35. package/src/humanoid/generate.ts +189 -0
  36. package/src/humanoid/index.ts +36 -0
  37. package/src/humanoid/schema.ts +108 -0
  38. package/src/humanoid/skeleton.ts +345 -0
  39. package/src/index.ts +5 -5
  40. package/src/input/input-manager.ts +701 -22
  41. package/src/input/input-types.ts +5 -2
  42. package/src/manifest/index.ts +5 -5
  43. package/src/manifest/load.ts +125 -72
  44. package/src/manifest/schema.ts +362 -255
  45. package/src/react/game-state.tsx +135 -32
  46. package/src/react/root-adapter.tsx +49 -0
  47. package/src/react/unmanaged-root-detector.ts +66 -0
  48. package/src/react/use-data.ts +12 -2
  49. package/src/runtime/create-runtime.ts +100 -282
  50. package/src/runtime/debug-bridge.ts +483 -0
  51. package/src/runtime/debug-registry.ts +856 -0
  52. package/src/runtime/game.ts +342 -93
  53. package/src/runtime/gameplay-rng-trap.ts +134 -0
  54. package/src/runtime/input-router.ts +7 -7
  55. package/src/runtime/mount-game.ts +40 -38
  56. package/src/runtime/mount-manifest.ts +169 -37
  57. package/src/runtime/render-control.ts +13 -13
  58. package/src/runtime/render-seed.ts +1 -1
  59. package/src/runtime/state-bridge.ts +24 -10
  60. package/src/runtime/types.ts +110 -28
  61. package/src/scene/asset-registry.ts +22 -0
  62. package/src/scene/component-registry.ts +14 -3
  63. package/src/scene/defaults.ts +1 -0
  64. package/src/scene/light-camera-factory.ts +11 -3
  65. package/src/scene/scene-apply.ts +55 -4
  66. package/src/scene/scene-loader.ts +10 -27
  67. package/src/scene/scene-types.ts +0 -1
  68. package/src/scene/schema/index.ts +0 -34
  69. package/src/scene/schema/light.ts +16 -1
  70. package/src/scene/schema/material.ts +96 -91
  71. package/src/scene/schema/scene-file.ts +1 -7
  72. package/src/scene/user-data.ts +14 -1
  73. package/src/setup/setup-renderer.ts +1 -1
  74. package/src/tools/define-tool.ts +50 -11
  75. package/src/world2d/authoring-2d.ts +17 -1
  76. package/src/world2d/collision-2d.ts +1 -1
  77. package/src/world2d/pixi-game-adapter.ts +19 -17
  78. package/src/world2d/scene2d-loader.ts +1 -0
  79. package/src/world2d/types.ts +8 -2
  80. package/dist/adapter/authoring.d.ts +0 -404
  81. package/dist/adapter/authoring.d.ts.map +0 -1
  82. package/dist/adapter/authoring.js +0 -22
  83. package/dist/adapter/colyseus-networking-adapter.d.ts +0 -43
  84. package/dist/adapter/colyseus-networking-adapter.d.ts.map +0 -1
  85. package/dist/adapter/colyseus-networking-adapter.js +0 -38
  86. package/dist/adapter/first-party-systems.d.ts +0 -38
  87. package/dist/adapter/first-party-systems.d.ts.map +0 -1
  88. package/dist/adapter/first-party-systems.js +0 -77
  89. package/dist/adapter/game-adapter.d.ts +0 -133
  90. package/dist/adapter/game-adapter.d.ts.map +0 -1
  91. package/dist/adapter/game-adapter.js +0 -10
  92. package/dist/adapter/host-context.d.ts +0 -73
  93. package/dist/adapter/host-context.d.ts.map +0 -1
  94. package/dist/adapter/host-context.js +0 -16
  95. package/dist/adapter/index.d.ts +0 -22
  96. package/dist/adapter/index.d.ts.map +0 -1
  97. package/dist/adapter/index.js +0 -15
  98. package/dist/adapter/ingest/game-contract.d.ts +0 -53
  99. package/dist/adapter/ingest/game-contract.d.ts.map +0 -1
  100. package/dist/adapter/ingest/game-contract.js +0 -30
  101. package/dist/adapter/ingest/overlay-applier.d.ts +0 -118
  102. package/dist/adapter/ingest/overlay-applier.d.ts.map +0 -1
  103. package/dist/adapter/ingest/overlay-applier.js +0 -132
  104. package/dist/adapter/ingest/overlay-apply.d.ts +0 -60
  105. package/dist/adapter/ingest/overlay-apply.d.ts.map +0 -1
  106. package/dist/adapter/ingest/overlay-apply.js +0 -101
  107. package/dist/adapter/ingest/overlay-file.d.ts +0 -79
  108. package/dist/adapter/ingest/overlay-file.d.ts.map +0 -1
  109. package/dist/adapter/ingest/overlay-file.js +0 -66
  110. package/dist/adapter/ingest/overlay-report.d.ts +0 -113
  111. package/dist/adapter/ingest/overlay-report.d.ts.map +0 -1
  112. package/dist/adapter/ingest/overlay-report.js +0 -103
  113. package/dist/adapter/ingest/scene-capture.d.ts +0 -97
  114. package/dist/adapter/ingest/scene-capture.d.ts.map +0 -1
  115. package/dist/adapter/ingest/scene-capture.js +0 -248
  116. package/dist/adapter/ingest/upstream-pin.d.ts +0 -47
  117. package/dist/adapter/ingest/upstream-pin.d.ts.map +0 -1
  118. package/dist/adapter/ingest/upstream-pin.js +0 -50
  119. package/dist/adapter/loop-gate-report.d.ts +0 -34
  120. package/dist/adapter/loop-gate-report.d.ts.map +0 -1
  121. package/dist/adapter/loop-gate-report.js +0 -37
  122. package/dist/adapter/rapier-physics-adapter.d.ts +0 -12
  123. package/dist/adapter/rapier-physics-adapter.d.ts.map +0 -1
  124. package/dist/adapter/rapier-physics-adapter.js +0 -46
  125. package/dist/adapter/system-adapter.d.ts +0 -133
  126. package/dist/adapter/system-adapter.d.ts.map +0 -1
  127. package/dist/adapter/system-adapter.js +0 -13
  128. package/dist/adapter/transform.d.ts +0 -18
  129. package/dist/adapter/transform.d.ts.map +0 -1
  130. package/dist/adapter/transform.js +0 -1
  131. package/dist/adapter/vgai-scene-game-adapter.d.ts +0 -116
  132. package/dist/adapter/vgai-scene-game-adapter.d.ts.map +0 -1
  133. package/dist/adapter/vgai-scene-game-adapter.js +0 -714
  134. package/dist/adapter/world-kind.d.ts +0 -30
  135. package/dist/adapter/world-kind.d.ts.map +0 -1
  136. package/dist/adapter/world-kind.js +0 -18
  137. package/dist/ai/navigation.d.ts +0 -64
  138. package/dist/ai/navigation.d.ts.map +0 -1
  139. package/dist/ai/navigation.js +0 -133
  140. package/dist/animation/anim-graph-types.d.ts +0 -25
  141. package/dist/animation/anim-graph-types.d.ts.map +0 -1
  142. package/dist/animation/anim-graph-types.js +0 -1
  143. package/dist/animation/animation-clock.d.ts +0 -213
  144. package/dist/animation/animation-clock.d.ts.map +0 -1
  145. package/dist/animation/animation-clock.js +0 -301
  146. package/dist/animation/blend-node.d.ts +0 -22
  147. package/dist/animation/blend-node.d.ts.map +0 -1
  148. package/dist/animation/blend-node.js +0 -97
  149. package/dist/animation/camera-ownership.d.ts +0 -250
  150. package/dist/animation/camera-ownership.d.ts.map +0 -1
  151. package/dist/animation/camera-ownership.js +0 -169
  152. package/dist/animation/cinematic-cues.d.ts +0 -200
  153. package/dist/animation/cinematic-cues.d.ts.map +0 -1
  154. package/dist/animation/cinematic-cues.js +0 -213
  155. package/dist/animation/clip-map.d.ts +0 -12
  156. package/dist/animation/clip-map.d.ts.map +0 -1
  157. package/dist/animation/clip-map.js +0 -37
  158. package/dist/animation/gsap-registration.d.ts +0 -119
  159. package/dist/animation/gsap-registration.d.ts.map +0 -1
  160. package/dist/animation/gsap-registration.js +0 -92
  161. package/dist/animation/theatre-clock-binding.d.ts +0 -89
  162. package/dist/animation/theatre-clock-binding.d.ts.map +0 -1
  163. package/dist/animation/theatre-clock-binding.js +0 -29
  164. package/dist/animation/theatre-director.d.ts +0 -242
  165. package/dist/animation/theatre-director.d.ts.map +0 -1
  166. package/dist/animation/theatre-director.js +0 -235
  167. package/dist/animation/theatre-object-binding.d.ts +0 -305
  168. package/dist/animation/theatre-object-binding.d.ts.map +0 -1
  169. package/dist/animation/theatre-object-binding.js +0 -351
  170. package/dist/animation/xstate-animation-binding.d.ts +0 -111
  171. package/dist/animation/xstate-animation-binding.d.ts.map +0 -1
  172. package/dist/animation/xstate-animation-binding.js +0 -307
  173. package/dist/animation/xstate-animation-meta.d.ts +0 -228
  174. package/dist/animation/xstate-animation-meta.d.ts.map +0 -1
  175. package/dist/animation/xstate-animation-meta.js +0 -221
  176. package/dist/assets.d.ts +0 -26
  177. package/dist/assets.d.ts.map +0 -1
  178. package/dist/assets.js +0 -55
  179. package/dist/audio/index.d.ts +0 -4
  180. package/dist/audio/index.d.ts.map +0 -1
  181. package/dist/audio/index.js +0 -24
  182. package/dist/audio/tone-clock-binding.d.ts +0 -75
  183. package/dist/audio/tone-clock-binding.d.ts.map +0 -1
  184. package/dist/audio/tone-clock-binding.js +0 -29
  185. package/dist/audio/tone-context.d.ts +0 -114
  186. package/dist/audio/tone-context.d.ts.map +0 -1
  187. package/dist/audio/tone-context.js +0 -39
  188. package/dist/audio/tone-offline-render.d.ts +0 -90
  189. package/dist/audio/tone-offline-render.d.ts.map +0 -1
  190. package/dist/audio/tone-offline-render.js +0 -56
  191. package/dist/audio/wav-encode.d.ts +0 -38
  192. package/dist/audio/wav-encode.d.ts.map +0 -1
  193. package/dist/audio/wav-encode.js +0 -97
  194. package/dist/core/game-loop.d.ts +0 -21
  195. package/dist/core/game-loop.d.ts.map +0 -1
  196. package/dist/core/game-loop.js +0 -130
  197. package/dist/core/system-runner.d.ts +0 -120
  198. package/dist/core/system-runner.d.ts.map +0 -1
  199. package/dist/core/system-runner.js +0 -286
  200. package/dist/core/types.d.ts +0 -58
  201. package/dist/core/types.d.ts.map +0 -1
  202. package/dist/core/types.js +0 -25
  203. package/dist/data/data-asset.d.ts +0 -101
  204. package/dist/data/data-asset.d.ts.map +0 -1
  205. package/dist/data/data-asset.js +0 -122
  206. package/dist/data/data-check-core.d.ts +0 -110
  207. package/dist/data/data-check-core.d.ts.map +0 -1
  208. package/dist/data/data-check-core.js +0 -178
  209. package/dist/data/data-ref.d.ts +0 -79
  210. package/dist/data/data-ref.d.ts.map +0 -1
  211. package/dist/data/data-ref.js +0 -130
  212. package/dist/data/vite-plugin-data.d.ts +0 -79
  213. package/dist/data/vite-plugin-data.d.ts.map +0 -1
  214. package/dist/data/vite-plugin-data.js +0 -217
  215. package/dist/dev/console-bridge.d.ts +0 -22
  216. package/dist/dev/console-bridge.d.ts.map +0 -1
  217. package/dist/dev/console-bridge.js +0 -71
  218. package/dist/dev/debug-draw.d.ts +0 -24
  219. package/dist/dev/debug-draw.d.ts.map +0 -1
  220. package/dist/dev/debug-draw.js +0 -73
  221. package/dist/dev/logger.d.ts +0 -30
  222. package/dist/dev/logger.d.ts.map +0 -1
  223. package/dist/dev/logger.js +0 -90
  224. package/dist/ecs/component-manager.d.ts +0 -189
  225. package/dist/ecs/component-manager.d.ts.map +0 -1
  226. package/dist/ecs/component-manager.js +0 -676
  227. package/dist/ecs/game-component.d.ts +0 -97
  228. package/dist/ecs/game-component.d.ts.map +0 -1
  229. package/dist/ecs/game-component.js +0 -80
  230. package/dist/ecs/hmr-swap-report.d.ts +0 -53
  231. package/dist/ecs/hmr-swap-report.d.ts.map +0 -1
  232. package/dist/ecs/hmr-swap-report.js +0 -55
  233. package/dist/index.d.ts +0 -37
  234. package/dist/index.d.ts.map +0 -1
  235. package/dist/index.js +0 -30
  236. package/dist/input/input-manager.d.ts +0 -596
  237. package/dist/input/input-manager.d.ts.map +0 -1
  238. package/dist/input/input-manager.js +0 -1564
  239. package/dist/input/input-types.d.ts +0 -171
  240. package/dist/input/input-types.d.ts.map +0 -1
  241. package/dist/input/input-types.js +0 -1
  242. package/dist/input/prompt-labels.d.ts +0 -21
  243. package/dist/input/prompt-labels.d.ts.map +0 -1
  244. package/dist/input/prompt-labels.js +0 -121
  245. package/dist/input/rebind-controller.d.ts +0 -59
  246. package/dist/input/rebind-controller.d.ts.map +0 -1
  247. package/dist/input/rebind-controller.js +0 -85
  248. package/dist/input/schema.d.ts +0 -16
  249. package/dist/input/schema.d.ts.map +0 -1
  250. package/dist/input/schema.js +0 -228
  251. package/dist/loader.d.ts +0 -43
  252. package/dist/loader.d.ts.map +0 -1
  253. package/dist/loader.js +0 -59
  254. package/dist/manifest/index.d.ts +0 -5
  255. package/dist/manifest/index.d.ts.map +0 -1
  256. package/dist/manifest/index.js +0 -8
  257. package/dist/manifest/load-file.d.ts +0 -4
  258. package/dist/manifest/load-file.d.ts.map +0 -1
  259. package/dist/manifest/load-file.js +0 -14
  260. package/dist/manifest/load.d.ts +0 -117
  261. package/dist/manifest/load.d.ts.map +0 -1
  262. package/dist/manifest/load.js +0 -255
  263. package/dist/manifest/schema.d.ts +0 -173
  264. package/dist/manifest/schema.d.ts.map +0 -1
  265. package/dist/manifest/schema.js +0 -302
  266. package/dist/physics/collision-system.d.ts +0 -41
  267. package/dist/physics/collision-system.d.ts.map +0 -1
  268. package/dist/physics/collision-system.js +0 -64
  269. package/dist/physics/physics-registry.d.ts +0 -45
  270. package/dist/physics/physics-registry.d.ts.map +0 -1
  271. package/dist/physics/physics-registry.js +0 -65
  272. package/dist/physics/transform-writer.d.ts +0 -16
  273. package/dist/physics/transform-writer.d.ts.map +0 -1
  274. package/dist/physics/transform-writer.js +0 -38
  275. package/dist/physics/trigger-dispatch.d.ts +0 -24
  276. package/dist/physics/trigger-dispatch.d.ts.map +0 -1
  277. package/dist/physics/trigger-dispatch.js +0 -80
  278. package/dist/react/game-state.d.ts +0 -105
  279. package/dist/react/game-state.d.ts.map +0 -1
  280. package/dist/react/game-state.js +0 -144
  281. package/dist/react/use-data.d.ts +0 -60
  282. package/dist/react/use-data.d.ts.map +0 -1
  283. package/dist/react/use-data.js +0 -96
  284. package/dist/react/use-selection.d.ts +0 -75
  285. package/dist/react/use-selection.d.ts.map +0 -1
  286. package/dist/react/use-selection.js +0 -90
  287. package/dist/render/auto-batcher.d.ts +0 -34
  288. package/dist/render/auto-batcher.d.ts.map +0 -1
  289. package/dist/render/auto-batcher.js +0 -140
  290. package/dist/render/render-batch-system.d.ts +0 -33
  291. package/dist/render/render-batch-system.d.ts.map +0 -1
  292. package/dist/render/render-batch-system.js +0 -230
  293. package/dist/render/render-features.d.ts +0 -47
  294. package/dist/render/render-features.d.ts.map +0 -1
  295. package/dist/render/render-features.js +0 -105
  296. package/dist/render/render-settings.d.ts +0 -36
  297. package/dist/render/render-settings.d.ts.map +0 -1
  298. package/dist/render/render-settings.js +0 -51
  299. package/dist/runtime/create-runtime.d.ts +0 -280
  300. package/dist/runtime/create-runtime.d.ts.map +0 -1
  301. package/dist/runtime/create-runtime.js +0 -795
  302. package/dist/runtime/frame-selector-cache.d.ts +0 -41
  303. package/dist/runtime/frame-selector-cache.d.ts.map +0 -1
  304. package/dist/runtime/frame-selector-cache.js +0 -65
  305. package/dist/runtime/game.d.ts +0 -433
  306. package/dist/runtime/game.d.ts.map +0 -1
  307. package/dist/runtime/game.js +0 -569
  308. package/dist/runtime/input-router.d.ts +0 -78
  309. package/dist/runtime/input-router.d.ts.map +0 -1
  310. package/dist/runtime/input-router.js +0 -171
  311. package/dist/runtime/mount-game.d.ts +0 -129
  312. package/dist/runtime/mount-game.d.ts.map +0 -1
  313. package/dist/runtime/mount-game.js +0 -152
  314. package/dist/runtime/mount-manifest.d.ts +0 -119
  315. package/dist/runtime/mount-manifest.d.ts.map +0 -1
  316. package/dist/runtime/mount-manifest.js +0 -204
  317. package/dist/runtime/render-audio-control.d.ts +0 -110
  318. package/dist/runtime/render-audio-control.d.ts.map +0 -1
  319. package/dist/runtime/render-audio-control.js +0 -111
  320. package/dist/runtime/render-control.d.ts +0 -291
  321. package/dist/runtime/render-control.d.ts.map +0 -1
  322. package/dist/runtime/render-control.js +0 -264
  323. package/dist/runtime/render-seed.d.ts +0 -57
  324. package/dist/runtime/render-seed.d.ts.map +0 -1
  325. package/dist/runtime/render-seed.js +0 -74
  326. package/dist/runtime/scene-ui-bridge.d.ts +0 -69
  327. package/dist/runtime/scene-ui-bridge.d.ts.map +0 -1
  328. package/dist/runtime/scene-ui-bridge.js +0 -23
  329. package/dist/runtime/scene-ui-data.d.ts +0 -13
  330. package/dist/runtime/scene-ui-data.d.ts.map +0 -1
  331. package/dist/runtime/scene-ui-data.js +0 -92
  332. package/dist/runtime/state-bridge.d.ts +0 -47
  333. package/dist/runtime/state-bridge.d.ts.map +0 -1
  334. package/dist/runtime/state-bridge.js +0 -53
  335. package/dist/runtime/types.d.ts +0 -179
  336. package/dist/runtime/types.d.ts.map +0 -1
  337. package/dist/runtime/types.js +0 -1
  338. package/dist/scene/asset-loaders.d.ts +0 -79
  339. package/dist/scene/asset-loaders.d.ts.map +0 -1
  340. package/dist/scene/asset-loaders.js +0 -141
  341. package/dist/scene/asset-paths.d.ts +0 -11
  342. package/dist/scene/asset-paths.d.ts.map +0 -1
  343. package/dist/scene/asset-paths.js +0 -108
  344. package/dist/scene/asset-ref-check.d.ts +0 -88
  345. package/dist/scene/asset-ref-check.d.ts.map +0 -1
  346. package/dist/scene/asset-ref-check.js +0 -214
  347. package/dist/scene/asset-registry.d.ts +0 -30
  348. package/dist/scene/asset-registry.d.ts.map +0 -1
  349. package/dist/scene/asset-registry.js +0 -50
  350. package/dist/scene/collider-dimensions.d.ts +0 -63
  351. package/dist/scene/collider-dimensions.d.ts.map +0 -1
  352. package/dist/scene/collider-dimensions.js +0 -98
  353. package/dist/scene/component-registry.d.ts +0 -17
  354. package/dist/scene/component-registry.d.ts.map +0 -1
  355. package/dist/scene/component-registry.js +0 -28
  356. package/dist/scene/defaults.d.ts +0 -252
  357. package/dist/scene/defaults.d.ts.map +0 -1
  358. package/dist/scene/defaults.js +0 -151
  359. package/dist/scene/geometries/index.d.ts +0 -8
  360. package/dist/scene/geometries/index.d.ts.map +0 -1
  361. package/dist/scene/geometries/index.js +0 -7
  362. package/dist/scene/geometries/terrain.d.ts +0 -2
  363. package/dist/scene/geometries/terrain.d.ts.map +0 -1
  364. package/dist/scene/geometries/terrain.js +0 -37
  365. package/dist/scene/geometry-registry.d.ts +0 -24
  366. package/dist/scene/geometry-registry.d.ts.map +0 -1
  367. package/dist/scene/geometry-registry.js +0 -20
  368. package/dist/scene/instance-registry.d.ts +0 -36
  369. package/dist/scene/instance-registry.d.ts.map +0 -1
  370. package/dist/scene/instance-registry.js +0 -55
  371. package/dist/scene/instancers/grid.d.ts +0 -2
  372. package/dist/scene/instancers/grid.d.ts.map +0 -1
  373. package/dist/scene/instancers/grid.js +0 -36
  374. package/dist/scene/instancers/index.d.ts +0 -8
  375. package/dist/scene/instancers/index.d.ts.map +0 -1
  376. package/dist/scene/instancers/index.js +0 -7
  377. package/dist/scene/light-camera-factory.d.ts +0 -23
  378. package/dist/scene/light-camera-factory.d.ts.map +0 -1
  379. package/dist/scene/light-camera-factory.js +0 -68
  380. package/dist/scene/material-factory.d.ts +0 -17
  381. package/dist/scene/material-factory.d.ts.map +0 -1
  382. package/dist/scene/material-factory.js +0 -197
  383. package/dist/scene/material-registry.d.ts +0 -40
  384. package/dist/scene/material-registry.d.ts.map +0 -1
  385. package/dist/scene/material-registry.js +0 -44
  386. package/dist/scene/materials/index.d.ts +0 -8
  387. package/dist/scene/materials/index.d.ts.map +0 -1
  388. package/dist/scene/materials/index.js +0 -7
  389. package/dist/scene/materials/water.d.ts +0 -2
  390. package/dist/scene/materials/water.d.ts.map +0 -1
  391. package/dist/scene/materials/water.js +0 -54
  392. package/dist/scene/parse.d.ts +0 -23
  393. package/dist/scene/parse.d.ts.map +0 -1
  394. package/dist/scene/parse.js +0 -179
  395. package/dist/scene/particles-factory.d.ts +0 -33
  396. package/dist/scene/particles-factory.d.ts.map +0 -1
  397. package/dist/scene/particles-factory.js +0 -282
  398. package/dist/scene/scene-apply.d.ts +0 -109
  399. package/dist/scene/scene-apply.d.ts.map +0 -1
  400. package/dist/scene/scene-apply.js +0 -326
  401. package/dist/scene/scene-diff-schema.d.ts +0 -285
  402. package/dist/scene/scene-diff-schema.d.ts.map +0 -1
  403. package/dist/scene/scene-diff-schema.js +0 -92
  404. package/dist/scene/scene-diff-types.d.ts +0 -40
  405. package/dist/scene/scene-diff-types.d.ts.map +0 -1
  406. package/dist/scene/scene-diff-types.js +0 -14
  407. package/dist/scene/scene-loader.d.ts +0 -177
  408. package/dist/scene/scene-loader.d.ts.map +0 -1
  409. package/dist/scene/scene-loader.js +0 -1213
  410. package/dist/scene/scene-query.d.ts +0 -11
  411. package/dist/scene/scene-query.d.ts.map +0 -1
  412. package/dist/scene/scene-query.js +0 -63
  413. package/dist/scene/scene-types.d.ts +0 -10
  414. package/dist/scene/scene-types.d.ts.map +0 -1
  415. package/dist/scene/scene-types.js +0 -8
  416. package/dist/scene/scene-version.d.ts +0 -26
  417. package/dist/scene/scene-version.d.ts.map +0 -1
  418. package/dist/scene/scene-version.js +0 -34
  419. package/dist/scene/schema/animation.d.ts +0 -8
  420. package/dist/scene/schema/animation.d.ts.map +0 -1
  421. package/dist/scene/schema/animation.js +0 -42
  422. package/dist/scene/schema/audio.d.ts +0 -13
  423. package/dist/scene/schema/audio.d.ts.map +0 -1
  424. package/dist/scene/schema/audio.js +0 -22
  425. package/dist/scene/schema/camera.d.ts +0 -28
  426. package/dist/scene/schema/camera.d.ts.map +0 -1
  427. package/dist/scene/schema/camera.js +0 -17
  428. package/dist/scene/schema/collider.d.ts +0 -40
  429. package/dist/scene/schema/collider.d.ts.map +0 -1
  430. package/dist/scene/schema/collider.js +0 -55
  431. package/dist/scene/schema/entity-ref.d.ts +0 -31
  432. package/dist/scene/schema/entity-ref.d.ts.map +0 -1
  433. package/dist/scene/schema/entity-ref.js +0 -61
  434. package/dist/scene/schema/entity.d.ts +0 -1036
  435. package/dist/scene/schema/entity.d.ts.map +0 -1
  436. package/dist/scene/schema/entity.js +0 -153
  437. package/dist/scene/schema/environment.d.ts +0 -425
  438. package/dist/scene/schema/environment.d.ts.map +0 -1
  439. package/dist/scene/schema/environment.js +0 -357
  440. package/dist/scene/schema/index.d.ts +0 -39
  441. package/dist/scene/schema/index.d.ts.map +0 -1
  442. package/dist/scene/schema/index.js +0 -20
  443. package/dist/scene/schema/instances.d.ts +0 -14
  444. package/dist/scene/schema/instances.d.ts.map +0 -1
  445. package/dist/scene/schema/instances.js +0 -28
  446. package/dist/scene/schema/joint.d.ts +0 -23
  447. package/dist/scene/schema/joint.d.ts.map +0 -1
  448. package/dist/scene/schema/joint.js +0 -23
  449. package/dist/scene/schema/light.d.ts +0 -38
  450. package/dist/scene/schema/light.d.ts.map +0 -1
  451. package/dist/scene/schema/light.js +0 -26
  452. package/dist/scene/schema/material.d.ts +0 -199
  453. package/dist/scene/schema/material.d.ts.map +0 -1
  454. package/dist/scene/schema/material.js +0 -99
  455. package/dist/scene/schema/mesh.d.ts +0 -48
  456. package/dist/scene/schema/mesh.d.ts.map +0 -1
  457. package/dist/scene/schema/mesh.js +0 -82
  458. package/dist/scene/schema/particles.d.ts +0 -2178
  459. package/dist/scene/schema/particles.d.ts.map +0 -1
  460. package/dist/scene/schema/particles.js +0 -321
  461. package/dist/scene/schema/physics.d.ts +0 -56
  462. package/dist/scene/schema/physics.d.ts.map +0 -1
  463. package/dist/scene/schema/physics.js +0 -37
  464. package/dist/scene/schema/scene-file.d.ts +0 -304
  465. package/dist/scene/schema/scene-file.d.ts.map +0 -1
  466. package/dist/scene/schema/scene-file.js +0 -262
  467. package/dist/scene/schema/shadow.d.ts +0 -28
  468. package/dist/scene/schema/shadow.d.ts.map +0 -1
  469. package/dist/scene/schema/shadow.js +0 -20
  470. package/dist/scene/schema/spline.d.ts +0 -25
  471. package/dist/scene/schema/spline.d.ts.map +0 -1
  472. package/dist/scene/schema/spline.js +0 -15
  473. package/dist/scene/schema/tuples.d.ts +0 -12
  474. package/dist/scene/schema/tuples.d.ts.map +0 -1
  475. package/dist/scene/schema/tuples.js +0 -14
  476. package/dist/scene/schema/ui.d.ts +0 -880
  477. package/dist/scene/schema/ui.d.ts.map +0 -1
  478. package/dist/scene/schema/ui.js +0 -506
  479. package/dist/scene/user-data.d.ts +0 -171
  480. package/dist/scene/user-data.d.ts.map +0 -1
  481. package/dist/scene/user-data.js +0 -137
  482. package/dist/setup/setup-audio.d.ts +0 -20
  483. package/dist/setup/setup-audio.d.ts.map +0 -1
  484. package/dist/setup/setup-audio.js +0 -41
  485. package/dist/setup/setup-particles.d.ts +0 -17
  486. package/dist/setup/setup-particles.d.ts.map +0 -1
  487. package/dist/setup/setup-particles.js +0 -16
  488. package/dist/setup/setup-physics.d.ts +0 -25
  489. package/dist/setup/setup-physics.d.ts.map +0 -1
  490. package/dist/setup/setup-physics.js +0 -51
  491. package/dist/setup/setup-renderer.d.ts +0 -69
  492. package/dist/setup/setup-renderer.d.ts.map +0 -1
  493. package/dist/setup/setup-renderer.js +0 -363
  494. package/dist/tools/define-tool.d.ts +0 -105
  495. package/dist/tools/define-tool.d.ts.map +0 -1
  496. package/dist/tools/define-tool.js +0 -82
  497. package/dist/world2d/authoring-2d.d.ts +0 -76
  498. package/dist/world2d/authoring-2d.d.ts.map +0 -1
  499. package/dist/world2d/authoring-2d.js +0 -176
  500. package/dist/world2d/capture-to-scene2d.d.ts +0 -5
  501. package/dist/world2d/capture-to-scene2d.d.ts.map +0 -1
  502. package/dist/world2d/capture-to-scene2d.js +0 -49
  503. package/dist/world2d/collision-2d.d.ts +0 -52
  504. package/dist/world2d/collision-2d.d.ts.map +0 -1
  505. package/dist/world2d/collision-2d.js +0 -70
  506. package/dist/world2d/components-2d.d.ts +0 -47
  507. package/dist/world2d/components-2d.d.ts.map +0 -1
  508. package/dist/world2d/components-2d.js +0 -77
  509. package/dist/world2d/index.d.ts +0 -34
  510. package/dist/world2d/index.d.ts.map +0 -1
  511. package/dist/world2d/index.js +0 -32
  512. package/dist/world2d/ingest-iframe-2d.d.ts +0 -82
  513. package/dist/world2d/ingest-iframe-2d.d.ts.map +0 -1
  514. package/dist/world2d/ingest-iframe-2d.js +0 -166
  515. package/dist/world2d/ingest2d.d.ts +0 -97
  516. package/dist/world2d/ingest2d.d.ts.map +0 -1
  517. package/dist/world2d/ingest2d.js +0 -40
  518. package/dist/world2d/physics2d-registry.d.ts +0 -24
  519. package/dist/world2d/physics2d-registry.d.ts.map +0 -1
  520. package/dist/world2d/physics2d-registry.js +0 -38
  521. package/dist/world2d/pixi-game-adapter.d.ts +0 -107
  522. package/dist/world2d/pixi-game-adapter.d.ts.map +0 -1
  523. package/dist/world2d/pixi-game-adapter.js +0 -211
  524. package/dist/world2d/pixi-surface.d.ts +0 -39
  525. package/dist/world2d/pixi-surface.d.ts.map +0 -1
  526. package/dist/world2d/pixi-surface.js +0 -47
  527. package/dist/world2d/scene-capture-2d.d.ts +0 -43
  528. package/dist/world2d/scene-capture-2d.d.ts.map +0 -1
  529. package/dist/world2d/scene-capture-2d.js +0 -92
  530. package/dist/world2d/scene2d-loader.d.ts +0 -27
  531. package/dist/world2d/scene2d-loader.d.ts.map +0 -1
  532. package/dist/world2d/scene2d-loader.js +0 -274
  533. package/dist/world2d/schema/entity2d.d.ts +0 -102
  534. package/dist/world2d/schema/entity2d.d.ts.map +0 -1
  535. package/dist/world2d/schema/entity2d.js +0 -119
  536. package/dist/world2d/schema/physics2d.d.ts +0 -46
  537. package/dist/world2d/schema/physics2d.d.ts.map +0 -1
  538. package/dist/world2d/schema/physics2d.js +0 -45
  539. package/dist/world2d/schema/sprite.d.ts +0 -42
  540. package/dist/world2d/schema/sprite.d.ts.map +0 -1
  541. package/dist/world2d/schema/sprite.js +0 -63
  542. package/dist/world2d/schema/tilemap.d.ts +0 -15
  543. package/dist/world2d/schema/tilemap.d.ts.map +0 -1
  544. package/dist/world2d/schema/tilemap.js +0 -19
  545. package/dist/world2d/schema/tuples2d.d.ts +0 -20
  546. package/dist/world2d/schema/tuples2d.d.ts.map +0 -1
  547. package/dist/world2d/schema/tuples2d.js +0 -19
  548. package/dist/world2d/system-adapters-2d.d.ts +0 -16
  549. package/dist/world2d/system-adapters-2d.d.ts.map +0 -1
  550. package/dist/world2d/system-adapters-2d.js +0 -37
  551. package/dist/world2d/transform-writer-2d.d.ts +0 -16
  552. package/dist/world2d/transform-writer-2d.d.ts.map +0 -1
  553. package/dist/world2d/transform-writer-2d.js +0 -22
  554. package/dist/world2d/types.d.ts +0 -53
  555. package/dist/world2d/types.d.ts.map +0 -1
  556. package/dist/world2d/types.js +0 -1
  557. package/src/runtime/scene-ui-bridge.ts +0 -86
  558. package/src/runtime/scene-ui-data.ts +0 -119
  559. package/src/scene/schema/ui.ts +0 -602
@@ -1,103 +1,108 @@
1
1
  import { z } from 'zod';
2
2
 
3
- export const SceneMaterialSchema = z
4
- .object({
5
- type: z
6
- .enum(['standard', 'physical', 'basic', 'toon', 'custom'])
7
- .describe('Material shading model. "custom" resolves `def` against the material registry'),
8
- def: z
9
- .string()
10
- .optional()
11
- .describe('Registered custom-material name (required when type is "custom")'),
12
- uniforms: z
13
- .record(z.string(), z.union([z.number(), z.string(), z.boolean(), z.array(z.number())]))
14
- .optional()
15
- .describe('Authored uniform values for a custom material, keyed by uniform name'),
16
- color: z.string().optional().describe('Base color as CSS hex string (e.g. "#ff0000")'),
17
- metalness: z.number().optional().describe('Metalness factor 0–1 (standard/physical only)'),
18
- roughness: z.number().optional().describe('Roughness factor 0–1 (standard/physical only)'),
19
- map: z.string().optional().describe('Path to albedo/diffuse texture image'),
20
- normalMap: z.string().optional().describe('Path to normal map texture image'),
21
- emissive: z.string().optional().describe('Emissive color as CSS hex string'),
22
- emissiveIntensity: z.number().optional().describe('Emissive light intensity multiplier'),
23
- emissiveMap: z.string().optional().describe('Path to emissive map texture image'),
24
- aoMap: z.string().optional().describe('Path to ambient occlusion map texture image'),
25
- lightMap: z
26
- .string()
27
- .optional()
28
- .describe(
29
- "Path to a baked lightmap texture (uses the mesh's second UV set). Applies the pre-baked GI/shadow result on top of the material.",
30
- ),
31
- lightMapIntensity: z.number().optional().describe('Lightmap intensity multiplier (default 1).'),
32
- roughnessMap: z.string().optional().describe('Path to roughness map texture image'),
33
- metalnessMap: z.string().optional().describe('Path to metalness map texture image'),
34
- opacity: z.number().optional().describe('Opacity 0–1. Set transparent: true to enable'),
35
- transparent: z.boolean().optional().describe('Enable alpha blending for this material'),
36
- side: z.enum(['front', 'back', 'double']).optional().describe('Which face sides to render'),
37
- flatShading: z.boolean().optional().describe('Use flat (faceted) shading instead of smooth'),
3
+ const SceneMaterialObjectSchema = z.object({
4
+ type: z
5
+ .enum(['standard', 'physical', 'basic', 'toon', 'custom'])
6
+ .describe('Material shading model. "custom" resolves `def` against the material registry'),
7
+ def: z
8
+ .string()
9
+ .optional()
10
+ .describe('Registered custom-material name (required when type is "custom")'),
11
+ uniforms: z
12
+ .record(z.string(), z.union([z.number(), z.string(), z.boolean(), z.array(z.number())]))
13
+ .optional()
14
+ .describe('Authored uniform values for a custom material, keyed by uniform name'),
15
+ color: z.string().optional().describe('Base color as CSS hex string (e.g. "#ff0000")'),
16
+ metalness: z.number().optional().describe('Metalness factor 0–1 (standard/physical only)'),
17
+ roughness: z.number().optional().describe('Roughness factor 0–1 (standard/physical only)'),
18
+ map: z.string().optional().describe('Path to albedo/diffuse texture image'),
19
+ normalMap: z.string().optional().describe('Path to normal map texture image'),
20
+ emissive: z.string().optional().describe('Emissive color as CSS hex string'),
21
+ emissiveIntensity: z.number().optional().describe('Emissive light intensity multiplier'),
22
+ emissiveMap: z.string().optional().describe('Path to emissive map texture image'),
23
+ aoMap: z.string().optional().describe('Path to ambient occlusion map texture image'),
24
+ lightMap: z
25
+ .string()
26
+ .optional()
27
+ .describe(
28
+ "Path to a baked lightmap texture (uses the mesh's second UV set). Applies the pre-baked GI/shadow result on top of the material.",
29
+ ),
30
+ lightMapIntensity: z.number().optional().describe('Lightmap intensity multiplier (default 1).'),
31
+ roughnessMap: z.string().optional().describe('Path to roughness map texture image'),
32
+ metalnessMap: z.string().optional().describe('Path to metalness map texture image'),
33
+ opacity: z.number().optional().describe('Opacity 0–1. Set transparent: true to enable'),
34
+ transparent: z.boolean().optional().describe('Enable alpha blending for this material'),
35
+ side: z.enum(['front', 'back', 'double']).optional().describe('Which face sides to render'),
36
+ flatShading: z.boolean().optional().describe('Use flat (faceted) shading instead of smooth'),
38
37
 
39
- // Physical material feature groups (physical only, all optional)
40
- clearcoat: z
41
- .object({
42
- clearcoat: z.number().describe('Clearcoat layer intensity 0–1'),
43
- clearcoatRoughness: z.number().optional().describe('Clearcoat roughness 0–1'),
44
- clearcoatMap: z.string().optional().describe('Path to clearcoat intensity map'),
45
- clearcoatRoughnessMap: z.string().optional().describe('Path to clearcoat roughness map'),
46
- })
47
- .optional()
48
- .describe('Clearcoat layer (physical only)'),
38
+ // Physical material feature groups (physical only, all optional)
39
+ clearcoat: z
40
+ .object({
41
+ clearcoat: z.number().describe('Clearcoat layer intensity 0–1'),
42
+ clearcoatRoughness: z.number().optional().describe('Clearcoat roughness 0–1'),
43
+ clearcoatMap: z.string().optional().describe('Path to clearcoat intensity map'),
44
+ clearcoatRoughnessMap: z.string().optional().describe('Path to clearcoat roughness map'),
45
+ })
46
+ .optional()
47
+ .describe('Clearcoat layer (physical only)'),
49
48
 
50
- transmission: z
51
- .object({
52
- transmission: z.number().describe('Transmission intensity 0–1 (glass, liquid)'),
53
- ior: z.number().optional().describe('Index of refraction (default 1.5)'),
54
- thickness: z.number().optional().describe('Volume thickness for refraction'),
55
- attenuationColor: z.string().optional().describe('Color absorbed over distance'),
56
- attenuationDistance: z
57
- .number()
58
- .optional()
59
- .describe('Distance at which attenuation color takes full effect'),
60
- transmissionMap: z.string().optional().describe('Path to transmission map'),
61
- })
62
- .optional()
63
- .describe('Light transmission (physical only)'),
49
+ transmission: z
50
+ .object({
51
+ transmission: z.number().describe('Transmission intensity 0–1 (glass, liquid)'),
52
+ ior: z.number().optional().describe('Index of refraction (default 1.5)'),
53
+ thickness: z.number().optional().describe('Volume thickness for refraction'),
54
+ attenuationColor: z.string().optional().describe('Color absorbed over distance'),
55
+ attenuationDistance: z
56
+ .number()
57
+ .optional()
58
+ .describe('Distance at which attenuation color takes full effect'),
59
+ transmissionMap: z.string().optional().describe('Path to transmission map'),
60
+ })
61
+ .optional()
62
+ .describe('Light transmission (physical only)'),
64
63
 
65
- sheen: z
66
- .object({
67
- sheen: z.number().describe('Sheen intensity 0–1 (fabric, velvet)'),
68
- sheenColor: z.string().optional().describe('Sheen tint color'),
69
- sheenRoughness: z.number().optional().describe('Sheen roughness 0–1'),
70
- sheenColorMap: z.string().optional().describe('Path to sheen color map'),
71
- sheenRoughnessMap: z.string().optional().describe('Path to sheen roughness map'),
72
- })
73
- .optional()
74
- .describe('Sheen layer (physical only)'),
64
+ sheen: z
65
+ .object({
66
+ sheen: z.number().describe('Sheen intensity 0–1 (fabric, velvet)'),
67
+ sheenColor: z.string().optional().describe('Sheen tint color'),
68
+ sheenRoughness: z.number().optional().describe('Sheen roughness 0–1'),
69
+ sheenColorMap: z.string().optional().describe('Path to sheen color map'),
70
+ sheenRoughnessMap: z.string().optional().describe('Path to sheen roughness map'),
71
+ })
72
+ .optional()
73
+ .describe('Sheen layer (physical only)'),
75
74
 
76
- iridescence: z
77
- .object({
78
- iridescence: z.number().describe('Iridescence intensity 0–1 (soap bubbles, oil slick)'),
79
- iridescenceIOR: z.number().optional().describe('Thin-film IOR (default 1.3)'),
80
- iridescenceThicknessRange: z
81
- .tuple([z.number(), z.number()])
82
- .optional()
83
- .describe('Min/max thin-film thickness in nm'),
84
- iridescenceMap: z.string().optional().describe('Path to iridescence intensity map'),
85
- iridescenceThicknessMap: z
86
- .string()
87
- .optional()
88
- .describe('Path to iridescence thickness map'),
89
- })
90
- .optional()
91
- .describe('Iridescence thin-film (physical only)'),
75
+ iridescence: z
76
+ .object({
77
+ iridescence: z.number().describe('Iridescence intensity 0–1 (soap bubbles, oil slick)'),
78
+ iridescenceIOR: z.number().optional().describe('Thin-film IOR (default 1.3)'),
79
+ iridescenceThicknessRange: z
80
+ .tuple([z.number(), z.number()])
81
+ .optional()
82
+ .describe('Min/max thin-film thickness in nm'),
83
+ iridescenceMap: z.string().optional().describe('Path to iridescence intensity map'),
84
+ iridescenceThicknessMap: z.string().optional().describe('Path to iridescence thickness map'),
85
+ })
86
+ .optional()
87
+ .describe('Iridescence thin-film (physical only)'),
92
88
 
93
- displacementMap: z.string().optional().describe('Path to displacement/height map'),
94
- displacementScale: z.number().optional().describe('Displacement height multiplier'),
95
- displacementBias: z.number().optional().describe('Displacement offset'),
96
- })
97
- .describe('Material appearance properties');
89
+ displacementMap: z.string().optional().describe('Path to displacement/height map'),
90
+ displacementScale: z.number().optional().describe('Displacement height multiplier'),
91
+ displacementBias: z.number().optional().describe('Displacement offset'),
92
+ });
93
+
94
+ export const SceneMaterialSchema = SceneMaterialObjectSchema.superRefine((material, ctx) => {
95
+ if (material.type === 'custom' && !material.def?.trim()) {
96
+ ctx.addIssue({
97
+ code: 'custom',
98
+ path: ['def'],
99
+ message: 'Custom material requires a non-empty registered definition name',
100
+ });
101
+ }
102
+ }).describe('Material appearance properties');
98
103
 
99
104
  /** Partial schema for prefab instance overrides (type not required). */
100
- export const SceneMaterialOverrideSchema = SceneMaterialSchema.partial();
105
+ export const SceneMaterialOverrideSchema = SceneMaterialObjectSchema.partial();
101
106
 
102
107
  export type SceneMaterial = z.infer<typeof SceneMaterialSchema>;
103
108
 
@@ -1,7 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { type SceneEntity, SceneEntitySchema } from './entity';
3
3
  import { SceneEnvironmentSchema } from './environment';
4
- import { UIRootSchema } from './ui';
5
4
 
6
5
  export const SceneFileSchema = z
7
6
  .object({
@@ -9,13 +8,8 @@ export const SceneFileSchema = z
9
8
  name: z.string().describe('Scene display name'),
10
9
  environment: SceneEnvironmentSchema.optional().describe('Scene-level environment settings'),
11
10
  entities: z.array(SceneEntitySchema).describe('Top-level entities in the scene'),
12
- // UI roots (HUD/menus) attached to the scene graph as data. Optional and
13
- // additive — pre-UI scenes (no `ui` field) load unchanged (A4 versioning).
14
- ui: z
15
- .array(UIRootSchema)
16
- .optional()
17
- .describe('React UI roots (canvases) attached to the scene graph (A1)'),
18
11
  })
12
+ .strict()
19
13
  .describe('Scene file (.vscn.json)');
20
14
 
21
15
  export type SceneFile = z.infer<typeof SceneFileSchema>;
@@ -42,6 +42,8 @@
42
42
  * mixer; see xstate-animation-binding.ts).
43
43
  * - `_availableClips` — string[] of clip names discovered on the GLTF
44
44
  * (inspector dropdown; same names as `_animClips`' keys).
45
+ * - `_xstateAnimation` — live native XState/Three binding exposed for
46
+ * play-mode inspection; removed when binding disposes.
45
47
  *
46
48
  * Disposal contract:
47
49
  * - `__sharedGeometry` — `true` when a mesh's geometry is shared/cached and MUST
@@ -77,6 +79,8 @@
77
79
  * - `editorHelper` — `true` for editor-only helper objects (gizmos, wireframes).
78
80
  * - `editorHelperType` — which kind of helper (lights/particles/pivot/navmesh/...).
79
81
  * - `editorIcon` — `true` for editor billboard icon sprites.
82
+ * - `skeletonVisible` — per-entity editor preference for its bone overlay.
83
+ * - `skeletonEnabled` — resolved visibility preference on a skeleton helper.
80
84
  * - `envObject` — `true` for environment objects (ambient light, etc.).
81
85
  * - `splineControlPoint` — index of a spline control-point drag handle.
82
86
  * - `vcDirIdx` — view-cube face direction index (0=+X,1=-X,2=+Y,...).
@@ -84,6 +88,8 @@
84
88
 
85
89
  import type * as THREE from 'three';
86
90
  import type { ParticleSystem } from 'three.quarks';
91
+ import type { AnyActor } from 'xstate';
92
+ import type { XStateAnimationBinding } from '../animation/xstate-animation-binding';
87
93
  import type { SceneEntity } from './scene-types';
88
94
 
89
95
  /** The kinds of editor helper objects tagged via `editorHelperType`. */
@@ -95,7 +101,8 @@ export type EditorHelperType =
95
101
  | 'splines'
96
102
  | 'particles'
97
103
  | 'pivot'
98
- | 'navmesh';
104
+ | 'navmesh'
105
+ | 'skeletons';
99
106
 
100
107
  /**
101
108
  * Maps each canonical accessor name to its value type. This is the single
@@ -115,6 +122,7 @@ export interface UserDataSchema {
115
122
  _animMixer: THREE.AnimationMixer;
116
123
  _animClips: Map<string, THREE.AnimationClip>;
117
124
  _availableClips: string[];
125
+ _xstateAnimation: XStateAnimationBinding & { readonly actor: AnyActor };
118
126
  __sharedGeometry: boolean;
119
127
  __shadeOrig: THREE.Material | THREE.Material[];
120
128
  __shadeUnlit: THREE.Material[];
@@ -128,6 +136,8 @@ export interface UserDataSchema {
128
136
  editorHelper: boolean;
129
137
  editorHelperType: EditorHelperType;
130
138
  editorIcon: boolean;
139
+ skeletonVisible: boolean;
140
+ skeletonEnabled: boolean;
131
141
  envObject: boolean;
132
142
  vcDirIdx: number;
133
143
  }
@@ -154,6 +164,7 @@ export const UserDataKeys = {
154
164
  _animMixer: '_animMixer',
155
165
  _animClips: '_animClips',
156
166
  _availableClips: '_availableClips',
167
+ _xstateAnimation: '_xstateAnimation',
157
168
  __sharedGeometry: '__sharedGeometry',
158
169
  __shadeOrig: '__shadeOrig',
159
170
  __shadeUnlit: '__shadeUnlit',
@@ -167,6 +178,8 @@ export const UserDataKeys = {
167
178
  editorHelper: 'editorHelper',
168
179
  editorHelperType: 'editorHelperType',
169
180
  editorIcon: 'editorIcon',
181
+ skeletonVisible: 'skeletonVisible',
182
+ skeletonEnabled: 'skeletonEnabled',
170
183
  envObject: 'envObject',
171
184
  vcDirIdx: 'vcDirIdx',
172
185
  } as const satisfies Record<UserDataKey, string>;
@@ -74,7 +74,7 @@ export function applyRendererSettings(
74
74
  * `opts` is additive (T6.1 slice 1, COMPOSITION-DESIGN.md D5 §1/§4): omitted
75
75
  * entirely, construction is byte-identical to before (no `alpha`/
76
76
  * `preserveDrawingBuffer` keys at all) — the legacy single-canvas host never
77
- * passes it. The worlds path passes `alpha:true` for every stacked canvas
77
+ * passes it. The roots path passes `alpha:true` for every stacked canvas
78
78
  * above the bottom one (so its clear-alpha-0 shows the layer below through
79
79
  * it) and `preserveDrawingBuffer:true` for every stacked canvas (the
80
80
  * recorded capture-tier cost, paid once here rather than re-derived later).
@@ -9,7 +9,7 @@
9
9
  * export const tool = defineTool({
10
10
  * id: 'tuning', // stable slug — becomes the tab's test id
11
11
  * title: 'Tuning', // the tab label (rendered after a ⚙ marker)
12
- * placement: 'dock', // project-global dashboard tab (§3.2)
12
+ * placement: 'document', // project-global dashboard (§3.2; 'dock' = deprecated alias)
13
13
  * });
14
14
  * export default function Tuning() { … } // plain React
15
15
  * ```
@@ -42,9 +42,39 @@
42
42
 
43
43
  import type { AuthoringAdapter, EditorNode } from '../adapter';
44
44
 
45
- /** The two placements (§3.2). Deliberately nothing else — no floating
46
- * windows, no in-game overlay host (§3.2 "deliberately NOT built"). */
47
- export type ToolPlacement = 'dock' | 'inspector';
45
+ /**
46
+ * Tool placements. Since W0 of the editor workspace-shell program
47
+ * (docs/EDITOR-WORKSPACE-SHELL-TODO.md §7.2), placement describes MEANING,
48
+ * not a physical container:
49
+ *
50
+ * - `'document'` — a substantial project-global surface (tuning dashboard,
51
+ * table, graph) that belongs in the center workspace;
52
+ * - `'inspector'` — a selection-scoped section in the right Inspector rail;
53
+ * - `'utility'` — a transient output/debug surface for the bottom drawer;
54
+ * - `'dock'` — DEPRECATED physical compatibility alias. Existing dock tools
55
+ * remain in the bottom panel so projects do not lose the ability to tune
56
+ * them while watching the Game/Scene.
57
+ *
58
+ * Only an explicit `document` declaration replaces the center subject.
59
+ * `utility` and legacy `dock` remain in the bottom drawer. Deliberately
60
+ * still nothing else — no floating windows, no in-game overlay
61
+ * host (docs/DATA-TOOLS-DESIGN.md §3.2 "deliberately NOT built").
62
+ */
63
+ export type ToolPlacement = 'document' | 'inspector' | 'utility' | 'dock';
64
+
65
+ /** The project-global (non-selection-scoped) placements. */
66
+ export type GlobalToolPlacement = 'document' | 'utility' | 'dock';
67
+
68
+ /**
69
+ * Compatibility means preserving behavior: legacy `'dock'` tools remain in
70
+ * the bottom panel. New tools choose `'document'`, `'utility'`, or
71
+ * `'inspector'` deliberately.
72
+ */
73
+ export function normalizeToolPlacement(
74
+ placement: ToolPlacement,
75
+ ): 'document' | 'inspector' | 'utility' {
76
+ return placement === 'dock' ? 'utility' : placement;
77
+ }
48
78
 
49
79
  /** Fields every tool declares — see {@link defineTool} for the contract. */
50
80
  interface ToolConfigBase {
@@ -60,9 +90,10 @@ interface ToolConfigBase {
60
90
  title: string;
61
91
  }
62
92
 
63
- /** A project-global dashboard tab in the bottom dock (§3.2, W4). */
64
- export interface DockToolConfig extends ToolConfigBase {
65
- placement: 'dock';
93
+ /** A project-global tool (§3.2 W4; `'dock'` preserves its historical bottom
94
+ * placement through the `'utility'` compatibility normalization). */
95
+ export interface GlobalToolConfig extends ToolConfigBase {
96
+ placement: GlobalToolPlacement;
66
97
  }
67
98
 
68
99
  /** A selection-scoped Inspector section (§3.2, W3). */
@@ -80,7 +111,7 @@ export interface InspectorToolConfig extends ToolConfigBase {
80
111
  }
81
112
 
82
113
  /** Metadata for a project tool — a discriminated union on `placement`. */
83
- export type ToolConfig = DockToolConfig | InspectorToolConfig;
114
+ export type ToolConfig = GlobalToolConfig | InspectorToolConfig;
84
115
 
85
116
  /**
86
117
  * Props the editor passes to an INSPECTOR tool's default-exported component
@@ -120,14 +151,22 @@ export function defineTool(config: ToolConfig): Readonly<ToolConfig> {
120
151
  if (config === null || typeof config !== 'object') {
121
152
  throw toolError(
122
153
  'expected a config object',
123
- "call it as defineTool({ id, title, placement: 'dock' })",
154
+ "call it as defineTool({ id, title, placement: 'document' })",
124
155
  );
125
156
  }
126
157
  const { id, title, placement } = config;
127
- if (placement !== 'dock' && placement !== 'inspector') {
158
+ if (
159
+ placement !== 'document' &&
160
+ placement !== 'utility' &&
161
+ placement !== 'dock' &&
162
+ placement !== 'inspector'
163
+ ) {
128
164
  throw toolError(
129
165
  `unknown placement ${JSON.stringify(placement)}`,
130
- "the placements are 'dock' (project-global bottom tab) and 'inspector' (selection-scoped section, §3.2)",
166
+ "the placements are 'document' (project-global center document), 'inspector' " +
167
+ "(selection-scoped section) and 'utility' (transient bottom-drawer output); " +
168
+ "'dock' remains accepted as a deprecated bottom-panel alias " +
169
+ '(docs/EDITOR-WORKSPACE-SHELL-TODO.md §7.2)',
131
170
  );
132
171
  }
133
172
  if (typeof id !== 'string' || !/^[a-zA-Z0-9_-]+$/.test(id)) {
@@ -31,6 +31,8 @@ export interface Property2D {
31
31
 
32
32
  /** A persisted edit overlay keyed by structural-path id (the 2D analog of IngestOverlay). */
33
33
  export interface Override2D {
34
+ label?: string;
35
+ alpha?: number;
34
36
  position?: [number, number];
35
37
  rotation?: number;
36
38
  scale?: [number, number];
@@ -110,7 +112,11 @@ export class AuthoringAdapter2D {
110
112
  // --- Transforms ---
111
113
  getTransform(id: string): Transform2DValue | null {
112
114
  const o = this.byId.get(id);
113
- if (!o) return null;
115
+ // A tracked node isn't guaranteed to be a real PixiJS display object with
116
+ // a transform (e.g. test doubles / non-positional fixture nodes walked
117
+ // via the composite adapter's overlay path) — treat a missing position
118
+ // the same as a missing node: no transform to report, not a crash.
119
+ if (!o || !o.position || !o.scale) return null;
114
120
  return {
115
121
  position: [o.position.x, o.position.y],
116
122
  rotation: o.rotation,
@@ -156,6 +162,8 @@ export class AuthoringAdapter2D {
156
162
  if (!o) return;
157
163
  o[path] = value;
158
164
  this.overlay[id] ??= {};
165
+ if (path === 'label') this.overlay[id].label = value as string;
166
+ if (path === 'alpha') this.overlay[id].alpha = value as number;
159
167
  if (path === 'tint') this.overlay[id].tint = value as number;
160
168
  if (path === 'visible') this.overlay[id].visible = value as boolean;
161
169
  this.dirty = true;
@@ -164,6 +172,8 @@ export class AuthoringAdapter2D {
164
172
  private applyOverride(id: string, ov: Override2D): void {
165
173
  const o = this.byId.get(id);
166
174
  if (!o) return;
175
+ if (ov.label !== undefined) o.label = ov.label;
176
+ if (ov.alpha !== undefined) o.alpha = ov.alpha;
167
177
  if (ov.position) o.position.set(ov.position[0], ov.position[1]);
168
178
  if (ov.rotation !== undefined) o.rotation = ov.rotation;
169
179
  if (ov.scale) o.scale.set(ov.scale[0], ov.scale[1]);
@@ -201,6 +211,12 @@ export class AuthoringAdapter2D {
201
211
  serializeOverlay(): Overlay2D {
202
212
  return this.overlay;
203
213
  }
214
+ /** Replace, rather than merge, overlay state after an exact history restore. */
215
+ replaceOverlay(overlay: Overlay2D): void {
216
+ this.overlay = structuredClone(overlay);
217
+ for (const [id, ov] of Object.entries(this.overlay)) this.applyOverride(id, ov);
218
+ this.dirty = true;
219
+ }
204
220
  /** Clear the dirty flag after a successful save (mirrors IngestAuthoringAdapter). */
205
221
  markClean(): void {
206
222
  this.dirty = false;
@@ -47,7 +47,7 @@ export type Collision2DSystem = ReturnType<typeof createCollision2DSystem>;
47
47
  * structural slice: the unified `ComponentManager` (`ecs/component-manager.ts`,
48
48
  * what production wires up since T7.3 slice 1, and the only manager left —
49
49
  * the world2d silo's manager is deleted, T7.3 slice 2) satisfies it — this
50
- * dispatcher has no dependency on which `WorldKind` a caller's manager was
50
+ * dispatcher has no dependency on which `AdapterSurface` a caller's manager was
51
51
  * constructed for.
52
52
  */
53
53
  export interface TriggerDispatchComponents {
@@ -25,10 +25,10 @@ export interface World2DHost {
25
25
  canvas: HTMLCanvasElement;
26
26
  width: number;
27
27
  height: number;
28
- /** Screen-space React/HUD overlay container. */
29
- ui?: HTMLDivElement;
28
+ /** Shared Game root when mounted by the universal multi-world host. */
29
+ game?: GameInternal;
30
30
  /** DPR override (T6.1 slice 1, COMPOSITION-DESIGN.md D5 §3 — "one DPR
31
- * everywhere"): the worlds-path host computes ONE dpr for every stacked
31
+ * everywhere"): the roots-path host computes ONE dpr for every stacked
32
32
  * surface and passes it here; omitted -> `createPixiSurface`'s own
33
33
  * default (`window.devicePixelRatio`, uncapped) — today's behavior. */
34
34
  dpr?: number;
@@ -109,7 +109,7 @@ export class PixiSceneGameAdapter {
109
109
  width: host.width,
110
110
  height: host.height,
111
111
  ...(sceneData?.background ? { background: sceneData.background } : {}),
112
- // T6.1 slice 1 (worlds-path host hints — see `World2DHost`'s fields):
112
+ // T6.1 slice 1 (roots-path host hints — see `World2DHost`'s fields):
113
113
  // all optional, all no-ops when the host is the legacy
114
114
  // `createWorld2DRuntime` entry (which never sets them), so behavior
115
115
  // there is unchanged.
@@ -128,15 +128,17 @@ export class PixiSceneGameAdapter {
128
128
  const writeTransforms2D = createTransformWriter2D(physics2d);
129
129
  const collisions2d = createCollision2DSystem(rapier2dWorld, eventQueue);
130
130
 
131
- const systems = createSystemRunner();
132
- systems.add('physics', () => rapier2dWorld.step(eventQueue));
133
- systems.add('postPhysics', () => {
134
- collisions2d.drain();
135
- writeTransforms2D();
136
- });
137
- systems.add('render', () => surface.render());
138
-
139
- const uiContainer = host.ui ?? document.createElement('div');
131
+ const systems = createSystemRunner(host.game?.profiler.systemObserver, 'pixijs');
132
+ systems.add('physics', () => rapier2dWorld.step(eventQueue), { name: 'physics2d.step' });
133
+ systems.add(
134
+ 'postPhysics',
135
+ () => {
136
+ collisions2d.drain();
137
+ writeTransforms2D();
138
+ },
139
+ { name: 'physics2d.sync' },
140
+ );
141
+ systems.add('render', () => surface.render(), { name: 'pixi.render' });
140
142
 
141
143
  const ctx: World2DContext = {
142
144
  app: surface.app,
@@ -147,7 +149,7 @@ export class PixiSceneGameAdapter {
147
149
  collisions2d,
148
150
  components: null!,
149
151
  systems,
150
- uiContainer,
152
+ ...(host.game ? { game: host.game } : {}),
151
153
  };
152
154
 
153
155
  // T7.3 slice 1/2: the pixi world's components attach onto the SAME
@@ -235,16 +237,15 @@ export interface World2DSession {
235
237
  * surface-host-backend-neutral allows). Owns the canvas and constructs a real `Game`
236
238
  * (T7.3 slice 1) with exactly one `'pixijs'`-kind `WorldInstance`, driven each fixed
237
239
  * substep through `Game.runFrame` — the world2d analog of `createGameRuntime`'s
238
- * `registerDefaultThreeWorld` (`runtime/create-runtime.ts`). Before T7.3 this ran its
240
+ * `registerThreeWorld` (`runtime/create-runtime.ts`). Before T7.3 this ran its
239
241
  * own standalone `createGameLoop` calling `mounted.update` directly; that loop is
240
242
  * retired here in favor of one shared frame executor per game root.
241
243
  */
242
244
  export async function createWorld2DRuntime(
243
245
  config: PixiSceneConfig & World2DHost,
244
246
  ): Promise<World2DSession> {
245
- const { canvas, width, height, ui, ...sceneConfig } = config;
247
+ const { canvas, width, height, ...sceneConfig } = config;
246
248
  const adapter = new PixiSceneGameAdapter(sceneConfig);
247
- const mounted = await adapter.mount({ canvas, width, height, ...(ui ? { ui } : {}) });
248
249
 
249
250
  const assets = createAssetCache();
250
251
  // `game` is referenced here before its `const` below only textually — this
@@ -258,6 +259,7 @@ export async function createWorld2DRuntime(
258
259
  },
259
260
  });
260
261
  const game: GameInternal = createGame({ loop, assets });
262
+ const mounted = await adapter.mount({ canvas, width, height, game });
261
263
 
262
264
  // T7.5: `mounted` (a `MountedGame2D`, extending `MountedPixiWorld`) and
263
265
  // `adapter` (this `PixiSceneGameAdapter`, satisfying `WorldInstance.adapter`'s
@@ -183,6 +183,7 @@ function createPhysics2D(ctx: World2DContext, entity: Entity2D, display: Contain
183
183
  if (p.restitution !== undefined) colDesc.setRestitution(p.restitution);
184
184
  if (p.sensor) {
185
185
  colDesc.setSensor(true);
186
+ colDesc.setActiveCollisionTypes(rapier2d.ActiveCollisionTypes.ALL);
186
187
  colDesc.setActiveEvents(rapier2d.ActiveEvents.COLLISION_EVENTS);
187
188
  } else {
188
189
  colDesc.setActiveEvents(rapier2d.ActiveEvents.COLLISION_EVENTS);
@@ -5,6 +5,7 @@ import type { createSystemRunner } from '../core/system-runner';
5
5
  import type { SystemPhaseName } from '../core/types';
6
6
  import type { ComponentManager } from '../ecs/component-manager';
7
7
  import type { GameComponent } from '../ecs/game-component';
8
+ import type { Game } from '../runtime/game';
8
9
  import type { Collision2DSystem } from './collision-2d';
9
10
  import type { Physics2DRegistry } from './physics2d-registry';
10
11
 
@@ -38,8 +39,13 @@ export interface World2DContext {
38
39
  components: ComponentManager;
39
40
  /** The phase-ordered system runner (shared with the 3D path). */
40
41
  systems: ReturnType<typeof createSystemRunner>;
41
- /** DOM overlay for screen-space React/HUD UI (pointer-events:none by default). */
42
- uiContainer: HTMLDivElement;
42
+ /**
43
+ * The shared Game root when this world is mounted by a first-party host.
44
+ * This is the cross-world data path: a Pixi component can query gameplay
45
+ * components owned by a sibling Three.js world without a mirror store or a
46
+ * bespoke synchronization bridge.
47
+ */
48
+ game?: Game | undefined;
43
49
  }
44
50
 
45
51
  /** Constructor type for `GameComponent<'pixijs'>` subclasses used in a world2d