@vgai/engine 0.5.0 → 0.5.1

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,88 +0,0 @@
1
- /**
2
- * Shared asset-reference integrity check (B6 follow-up to B2 item #20,
3
- * docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md §8 B6).
4
- *
5
- * RELOCATED HERE (from `packages/vgai-cli/src/apply-diff.ts`, where it was
6
- * originally built as `dereferenceNewAssetRefs`) so it can be shared by BOTH
7
- * `vgai apply-diff` (the file-mode CLI verb) and the SDK's
8
- * `project.scene.apply` operation (`packages/vgai-sdk/src/project/scene-operations.ts`)
9
- * WITHOUT the SDK importing from the CLI — that would invert the intended
10
- * dependency direction (CLI -> SDK -> engine, §3.4). The engine's scene layer
11
- * is the correct shared home: both the CLI and the SDK already depend
12
- * directly on `@vgai/engine/scene/*` for scene parsing/patching, so this
13
- * module sits alongside `parse.ts`/`scene-apply.ts` as one more piece of
14
- * scene-layer machinery neither caller re-implements.
15
- *
16
- * WHAT THIS CATCHES that schema validation alone does not: the Zod scene
17
- * schema only checks that e.g. `materialRef` is a STRING — never that the
18
- * string points at anything real. A diff introducing
19
- * `materialRef: "materials/typo.mat.json"` (nonexistent, or present but
20
- * malformed) passes ordinary scene/patch validation and would be written;
21
- * the failure would otherwise only surface later, at runtime asset fetch.
22
- * `dereferenceNewAssetRefs` closes that gap by re-resolving every asset
23
- * reference the diff INTRODUCED (present in `result`, absent from
24
- * `inputScene` — deliberately not pre-existing refs, so a scene with
25
- * unrelated prior breakage can still receive an unrelated repair;
26
- * `validate-scenes` remains the whole-project content gate) against disk,
27
- * refusing the write if anything is missing or fails its own schema.
28
- *
29
- * Reference kinds and their treatment (unchanged from the original CLI-only
30
- * implementation):
31
- * - Zod-validated (JSON formats with engine Zod schemas): `materialRef`
32
- * (.mat.json -> parseMaterialFile), `prefab` in its file-path form
33
- * (.prefab.json -> parsePrefabFile). Prefabs are validated ONE level
34
- * deep — the referenced prefab file itself must exist and parse; assets
35
- * IT references are that file's own concern. (`animation.animGraph` ->
36
- * AnimGraphFileSchema was removed by E5 — AnimGraph no longer exists.)
37
- * - Existence-checked only (binary formats with no Zod schema to parse
38
- * them through): gltf `mesh.src`, every material texture-map path
39
- * (including the nested clearcoat/transmission/sheen/iridescence groups),
40
- * `particles.material.map`, `audio.src`, `environment.skybox`.
41
- * - `.inputmap.json` is structurally out of scope: no `.vscn.json`/
42
- * `.prefab.json` field references an input map.
43
- */
44
- import type { SceneFile } from './scene-types';
45
- /** One asset reference found in a scene document: where it is + what it points at. */
46
- export interface AssetRef {
47
- /** The authored path string (web-root-relative, optionally /-prefixed). */
48
- path: string;
49
- /** Human-readable field location for error messages, e.g. `entity "crate" field materialRef`. */
50
- field: string;
51
- kind: 'material' | 'prefab' | 'binary';
52
- }
53
- /**
54
- * One asset reference that failed to dereference. `reason` is a one-line-or-
55
- * more human-readable explanation (schema-validation failures may be
56
- * multi-line); `field`/`path` mirror `AssetRef` and `diskPath` is the
57
- * resolved absolute path that was checked, so every caller (CLI text report,
58
- * SDK structured error data) can build its own presentation from the same
59
- * facts without re-deriving them.
60
- */
61
- export interface AssetRefError {
62
- field: string;
63
- path: string;
64
- diskPath: string;
65
- reason: string;
66
- }
67
- /** Collect every asset reference in a scene document (entities walked recursively + environment), labeled for error messages. */
68
- export declare function collectAssetRefs(doc: SceneFile): AssetRef[];
69
- /**
70
- * Resolve the asset root the scene's references are relative to. Asset paths
71
- * are web-root-relative (the runtime fetches them from the served `public/`
72
- * directory), and scene files conventionally live INSIDE `public/`
73
- * (`public/scenes/*.vscn.json`) — so the nearest ancestor directory literally
74
- * named `public` is the root. Fallback for scenes not under a `public/`
75
- * ancestor: the scene's own directory.
76
- */
77
- export declare function findAssetRoot(scenePath: string): string;
78
- /**
79
- * Dereference every asset reference `result` introduces relative to
80
- * `inputScene` (present in the result, absent from the input) against disk,
81
- * relative to `scenePath`'s asset root (see `findAssetRoot`). Returns
82
- * structured errors (empty = every new reference resolved and validated) —
83
- * never throws; callers decide how to present/escalate a non-empty result
84
- * (the CLI folds these into one `ApplyDiffCliError` message, the SDK raises
85
- * a declared `ASSET_REF_INVALID` `OperationError`).
86
- */
87
- export declare function dereferenceNewAssetRefs(inputScene: SceneFile, result: SceneFile, scenePath: string): AssetRefError[];
88
- //# sourceMappingURL=asset-ref-check.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asset-ref-check.d.ts","sourceRoot":"","sources":["../../src/scene/asset-ref-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAKH,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,eAAe,CAAC;AAE5D,sFAAsF;AACtF,MAAM,WAAW,QAAQ;IACvB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,iGAAiG;IACjG,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACxC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AA4BD,iIAAiI;AACjI,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,GAAG,QAAQ,EAAE,CA0D3D;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CASvD;AAOD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,SAAS,EACrB,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,MAAM,GAChB,aAAa,EAAE,CAkDjB"}
@@ -1,214 +0,0 @@
1
- /**
2
- * Shared asset-reference integrity check (B6 follow-up to B2 item #20,
3
- * docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md §8 B6).
4
- *
5
- * RELOCATED HERE (from `packages/vgai-cli/src/apply-diff.ts`, where it was
6
- * originally built as `dereferenceNewAssetRefs`) so it can be shared by BOTH
7
- * `vgai apply-diff` (the file-mode CLI verb) and the SDK's
8
- * `project.scene.apply` operation (`packages/vgai-sdk/src/project/scene-operations.ts`)
9
- * WITHOUT the SDK importing from the CLI — that would invert the intended
10
- * dependency direction (CLI -> SDK -> engine, §3.4). The engine's scene layer
11
- * is the correct shared home: both the CLI and the SDK already depend
12
- * directly on `@vgai/engine/scene/*` for scene parsing/patching, so this
13
- * module sits alongside `parse.ts`/`scene-apply.ts` as one more piece of
14
- * scene-layer machinery neither caller re-implements.
15
- *
16
- * WHAT THIS CATCHES that schema validation alone does not: the Zod scene
17
- * schema only checks that e.g. `materialRef` is a STRING — never that the
18
- * string points at anything real. A diff introducing
19
- * `materialRef: "materials/typo.mat.json"` (nonexistent, or present but
20
- * malformed) passes ordinary scene/patch validation and would be written;
21
- * the failure would otherwise only surface later, at runtime asset fetch.
22
- * `dereferenceNewAssetRefs` closes that gap by re-resolving every asset
23
- * reference the diff INTRODUCED (present in `result`, absent from
24
- * `inputScene` — deliberately not pre-existing refs, so a scene with
25
- * unrelated prior breakage can still receive an unrelated repair;
26
- * `validate-scenes` remains the whole-project content gate) against disk,
27
- * refusing the write if anything is missing or fails its own schema.
28
- *
29
- * Reference kinds and their treatment (unchanged from the original CLI-only
30
- * implementation):
31
- * - Zod-validated (JSON formats with engine Zod schemas): `materialRef`
32
- * (.mat.json -> parseMaterialFile), `prefab` in its file-path form
33
- * (.prefab.json -> parsePrefabFile). Prefabs are validated ONE level
34
- * deep — the referenced prefab file itself must exist and parse; assets
35
- * IT references are that file's own concern. (`animation.animGraph` ->
36
- * AnimGraphFileSchema was removed by E5 — AnimGraph no longer exists.)
37
- * - Existence-checked only (binary formats with no Zod schema to parse
38
- * them through): gltf `mesh.src`, every material texture-map path
39
- * (including the nested clearcoat/transmission/sheen/iridescence groups),
40
- * `particles.material.map`, `audio.src`, `environment.skybox`.
41
- * - `.inputmap.json` is structurally out of scope: no `.vscn.json`/
42
- * `.prefab.json` field references an input map.
43
- */
44
- import { existsSync, readFileSync } from 'node:fs';
45
- import { basename, dirname, join, resolve } from 'node:path';
46
- import { parseMaterialFile, parsePrefabFile, SceneParseError } from './parse';
47
- /** Material texture-map fields that hold image paths — top-level and nested feature groups. */
48
- const MATERIAL_MAP_KEYS = [
49
- 'map',
50
- 'normalMap',
51
- 'emissiveMap',
52
- 'aoMap',
53
- 'roughnessMap',
54
- 'metalnessMap',
55
- 'displacementMap',
56
- ];
57
- const MATERIAL_GROUP_MAP_KEYS = {
58
- clearcoat: ['clearcoatMap', 'clearcoatRoughnessMap'],
59
- transmission: ['transmissionMap'],
60
- sheen: ['sheenColorMap', 'sheenRoughnessMap'],
61
- iridescence: ['iridescenceMap', 'iridescenceThicknessMap'],
62
- };
63
- /** Same file-path-vs-registry-id heuristic as `asset-paths.ts`. */
64
- function isFilePrefab(value) {
65
- return value.includes('/');
66
- }
67
- function entityLabel(e) {
68
- return e.id ? `entity "${e.name}" (id ${e.id})` : `entity "${e.name}"`;
69
- }
70
- /** Collect every asset reference in a scene document (entities walked recursively + environment), labeled for error messages. */
71
- export function collectAssetRefs(doc) {
72
- const refs = [];
73
- function walk(entities) {
74
- for (const e of entities) {
75
- const label = entityLabel(e);
76
- if (e.mesh?.type === 'gltf' && e.mesh.src) {
77
- refs.push({ path: e.mesh.src, field: `${label} field mesh.src`, kind: 'binary' });
78
- }
79
- if (e.material) {
80
- const mat = e.material;
81
- for (const key of MATERIAL_MAP_KEYS) {
82
- const val = mat[key];
83
- if (typeof val === 'string') {
84
- refs.push({ path: val, field: `${label} field material.${key}`, kind: 'binary' });
85
- }
86
- }
87
- for (const [group, keys] of Object.entries(MATERIAL_GROUP_MAP_KEYS)) {
88
- const groupVal = mat[group];
89
- if (groupVal && typeof groupVal === 'object') {
90
- for (const key of keys) {
91
- const val = groupVal[key];
92
- if (typeof val === 'string') {
93
- refs.push({
94
- path: val,
95
- field: `${label} field material.${group}.${key}`,
96
- kind: 'binary',
97
- });
98
- }
99
- }
100
- }
101
- }
102
- }
103
- if (e.materialRef) {
104
- refs.push({ path: e.materialRef, field: `${label} field materialRef`, kind: 'material' });
105
- }
106
- if (e.particles?.material?.map) {
107
- refs.push({
108
- path: e.particles.material.map,
109
- field: `${label} field particles.material.map`,
110
- kind: 'binary',
111
- });
112
- }
113
- if (e.audio?.src) {
114
- refs.push({ path: e.audio.src, field: `${label} field audio.src`, kind: 'binary' });
115
- }
116
- if (e.prefab && isFilePrefab(e.prefab)) {
117
- refs.push({ path: e.prefab, field: `${label} field prefab`, kind: 'prefab' });
118
- }
119
- if (e.children)
120
- walk(e.children);
121
- }
122
- }
123
- walk(doc.entities);
124
- if (doc.environment?.skybox) {
125
- refs.push({ path: doc.environment.skybox, field: 'environment.skybox', kind: 'binary' });
126
- }
127
- return refs;
128
- }
129
- /**
130
- * Resolve the asset root the scene's references are relative to. Asset paths
131
- * are web-root-relative (the runtime fetches them from the served `public/`
132
- * directory), and scene files conventionally live INSIDE `public/`
133
- * (`public/scenes/*.vscn.json`) — so the nearest ancestor directory literally
134
- * named `public` is the root. Fallback for scenes not under a `public/`
135
- * ancestor: the scene's own directory.
136
- */
137
- export function findAssetRoot(scenePath) {
138
- const dir = resolve(dirname(scenePath));
139
- let cursor = dir;
140
- for (;;) {
141
- if (basename(cursor) === 'public')
142
- return cursor;
143
- const parent = dirname(cursor);
144
- if (parent === cursor)
145
- return dir;
146
- cursor = parent;
147
- }
148
- }
149
- /** Format Zod/scene-parse issues as `path: message`, one per line. */
150
- function formatIssues(issues) {
151
- return issues.map((i) => ` ${i.path.join('.')}: ${i.message}`).join('\n');
152
- }
153
- /**
154
- * Dereference every asset reference `result` introduces relative to
155
- * `inputScene` (present in the result, absent from the input) against disk,
156
- * relative to `scenePath`'s asset root (see `findAssetRoot`). Returns
157
- * structured errors (empty = every new reference resolved and validated) —
158
- * never throws; callers decide how to present/escalate a non-empty result
159
- * (the CLI folds these into one `ApplyDiffCliError` message, the SDK raises
160
- * a declared `ASSET_REF_INVALID` `OperationError`).
161
- */
162
- export function dereferenceNewAssetRefs(inputScene, result, scenePath) {
163
- const preexisting = new Set(collectAssetRefs(inputScene).map((r) => r.path));
164
- const newRefs = collectAssetRefs(result).filter((r) => !preexisting.has(r.path));
165
- if (newRefs.length === 0)
166
- return [];
167
- const assetRoot = findAssetRoot(scenePath);
168
- const errors = [];
169
- for (const ref of newRefs) {
170
- const diskPath = join(assetRoot, ref.path.replace(/^\//, ''));
171
- if (!existsSync(diskPath)) {
172
- errors.push({
173
- field: ref.field,
174
- path: ref.path,
175
- diskPath,
176
- reason: `file not found at ${diskPath} (resolved against ${assetRoot})`,
177
- });
178
- continue;
179
- }
180
- if (ref.kind === 'binary')
181
- continue; // existence-only (see the exclusion note above)
182
- let json;
183
- try {
184
- json = JSON.parse(readFileSync(diskPath, 'utf-8'));
185
- }
186
- catch (err) {
187
- errors.push({
188
- field: ref.field,
189
- path: ref.path,
190
- diskPath,
191
- reason: `${diskPath} is not valid JSON: ${err instanceof Error ? err.message : err}`,
192
- });
193
- continue;
194
- }
195
- try {
196
- if (ref.kind === 'material') {
197
- parseMaterialFile(json, diskPath);
198
- }
199
- else {
200
- parsePrefabFile(json, diskPath);
201
- }
202
- }
203
- catch (err) {
204
- const detail = err instanceof SceneParseError ? `\n${formatIssues(err.issues)}` : ` ${err}`;
205
- errors.push({
206
- field: ref.field,
207
- path: ref.path,
208
- diskPath,
209
- reason: `${diskPath} fails schema validation:${detail}`,
210
- });
211
- }
212
- }
213
- return errors;
214
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * Central asset registry — stores per-asset metadata (import corrections, etc.).
3
- *
4
- * Loaded once via fetch(), cached in memory. Both the runtime scene loader
5
- * and editor entity factory import from this module.
6
- */
7
- import * as THREE from 'three';
8
- export interface ImportCorrection {
9
- /** Uniform scale factor applied to the GLTF clone before entity transform. */
10
- scale?: number;
11
- /** Euler rotation in degrees [x, y, z] applied to the GLTF clone before entity transform. */
12
- rotation?: [number, number, number];
13
- }
14
- export interface AssetMeta {
15
- importCorrection?: ImportCorrection;
16
- }
17
- /**
18
- * Apply an asset's visual-only import correction to the loaded GLTF content.
19
- * Call this on the model child, before placing it under the entity wrapper, so
20
- * gameplay transforms, physics, cameras, and movement remain in VGAI's Y-up /
21
- * -Z-forward coordinate contract.
22
- */
23
- export declare function applyImportCorrection(content: THREE.Object3D, correction: ImportCorrection | undefined): void;
24
- type AssetRegistry = Record<string, AssetMeta>;
25
- /**
26
- * Fetch and cache the asset registry. Safe to call multiple times —
27
- * returns the cached result after the first successful load.
28
- */
29
- export declare function loadRegistry(): Promise<AssetRegistry>;
30
- /** Get metadata for an asset path, or undefined if not in the registry. */
31
- export declare function getAssetMeta(path: string): AssetMeta | undefined;
32
- /**
33
- * Update the in-memory cache directly (used by the editor after saving
34
- * import settings, to avoid a re-fetch).
35
- */
36
- export declare function setRegistryCache(data: AssetRegistry): void;
37
- export {};
38
- //# sourceMappingURL=asset-registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asset-registry.d.ts","sourceRoot":"","sources":["../../src/scene/asset-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,gBAAgB;IAC/B,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,SAAS;IACxB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,KAAK,CAAC,QAAQ,EACvB,UAAU,EAAE,gBAAgB,GAAG,SAAS,GACvC,IAAI,CAUN;AAED,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAU/C;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAAC,aAAa,CAAC,CAgBrD;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAIhE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAG1D"}
@@ -1,66 +0,0 @@
1
- /**
2
- * Central asset registry — stores per-asset metadata (import corrections, etc.).
3
- *
4
- * Loaded once via fetch(), cached in memory. Both the runtime scene loader
5
- * and editor entity factory import from this module.
6
- */
7
- import * as THREE from 'three';
8
- import { resolveUrl } from '../loader';
9
- /**
10
- * Apply an asset's visual-only import correction to the loaded GLTF content.
11
- * Call this on the model child, before placing it under the entity wrapper, so
12
- * gameplay transforms, physics, cameras, and movement remain in VGAI's Y-up /
13
- * -Z-forward coordinate contract.
14
- */
15
- export function applyImportCorrection(content, correction) {
16
- if (!correction)
17
- return;
18
- if (correction.scale !== undefined)
19
- content.scale.multiplyScalar(correction.scale);
20
- if (correction.rotation) {
21
- content.rotation.set(THREE.MathUtils.degToRad(correction.rotation[0]), THREE.MathUtils.degToRad(correction.rotation[1]), THREE.MathUtils.degToRad(correction.rotation[2]));
22
- }
23
- }
24
- let registryCache = null;
25
- let registryPromise = null;
26
- /** Normalize asset path for registry lookup (strip leading slash). */
27
- function normalize(path) {
28
- return path.startsWith('/') ? path.slice(1) : path;
29
- }
30
- /**
31
- * Fetch and cache the asset registry. Safe to call multiple times —
32
- * returns the cached result after the first successful load.
33
- */
34
- export function loadRegistry() {
35
- if (registryCache)
36
- return Promise.resolve(registryCache);
37
- if (registryPromise)
38
- return registryPromise;
39
- registryPromise = fetch(resolveUrl('asset-registry.json'))
40
- .then((res) => {
41
- if (!res.ok)
42
- return {};
43
- return res.json();
44
- })
45
- .catch(() => ({}))
46
- .then((data) => {
47
- registryCache = data;
48
- return data;
49
- });
50
- return registryPromise;
51
- }
52
- /** Get metadata for an asset path, or undefined if not in the registry. */
53
- export function getAssetMeta(path) {
54
- if (!registryCache)
55
- return undefined;
56
- // Try exact match first, then normalized
57
- return registryCache[path] ?? registryCache[normalize(path)];
58
- }
59
- /**
60
- * Update the in-memory cache directly (used by the editor after saving
61
- * import settings, to avoid a re-fetch).
62
- */
63
- export function setRegistryCache(data) {
64
- registryCache = data;
65
- registryPromise = null;
66
- }
@@ -1,63 +0,0 @@
1
- /**
2
- * Shared world-scale collider dimension math (T1.2).
3
- *
4
- * Rapier colliders have no notion of a parent Object3D's `scale` — a body's
5
- * shape is defined in absolute world units at creation time. Three.js meshes,
6
- * by contrast, scale visually for free via the normal Object3D hierarchy. To
7
- * keep the physical collider matching what's on screen, the LOADER must bake
8
- * the entity's composed WORLD scale (self × every transformed ancestor — see
9
- * T1.1's world-transform composition) into the collider's dimensions at
10
- * creation time.
11
- *
12
- * This is the ONE place that does that math, so both the runtime loader
13
- * (scene-loader.ts `createPhysicsBody`) and the editor's collider gizmo
14
- * (gizmo-registry.ts) agree on exactly the same numbers — previously the
15
- * editor gizmo only rendered the entity's own live Object3D scale (via normal
16
- * Three.js parenting) while the Rapier body ignored scale entirely, so the
17
- * two silently agreed by coincidence for uniform scale and disagreed for
18
- * everything else.
19
- *
20
- * Round colliders (ball/capsule) can only represent a uniform radius — Rapier
21
- * has no ellipsoid/elliptical-capsule shape. A non-uniform world scale on a
22
- * round collider's round axes throws a loud error naming the entity, rather
23
- * than silently simulating (or rendering) the wrong shape.
24
- */
25
- import type { SceneCollider } from './scene-types';
26
- export interface ColliderWorldDimensions {
27
- /** cuboid only: per-axis half-extents, world scale applied. */
28
- halfExtents?: [number, number, number];
29
- /** ball/capsule only: radius, world scale applied (uniform axes required). */
30
- radius?: number;
31
- /** capsule only: half-height along the capsule's axis, world scale applied. */
32
- halfHeight?: number;
33
- }
34
- /**
35
- * Compute a collider's WORLD-space dimensions given the entity's composed
36
- * world scale (self × ancestors, per-axis, in the entity's own local frame —
37
- * X/Y/Z order matches `SceneEntity.transform.scale`).
38
- *
39
- * @param collider - the entity's authored (unscaled) collider definition.
40
- * @param worldScale - composed world scale `[x, y, z]`.
41
- * @param entityLabel - human-readable entity identifier, used only in thrown
42
- * error messages (loud-failure naming, never silently wrong).
43
- * @throws if a ball/capsule collider's round cross-section axes have a
44
- * non-uniform world scale (beyond {@link UNIFORM_SCALE_EPSILON}).
45
- */
46
- export declare function computeColliderWorldDimensions(collider: SceneCollider, worldScale: readonly [number, number, number], entityLabel: string): ColliderWorldDimensions;
47
- /**
48
- * Compute a collider's WORLD-scaled translation offset (sibling to
49
- * {@link computeColliderWorldDimensions}, same input contract).
50
- *
51
- * Rapier's `ColliderDesc.setTranslation` is a raw physics-engine offset with no
52
- * notion of a parent Object3D's scale — like dimensions, an authored `offset`
53
- * (in the entity's own local units) must be scaled per-axis by the entity's
54
- * composed world scale before being handed to Rapier, or the collider's center
55
- * silently drifts away from its visual anchor point under any non-1 scale.
56
- * Applies to every collider type (including trimesh, which is otherwise not
57
- * handled by {@link computeColliderWorldDimensions}).
58
- *
59
- * Returns `undefined` when no offset is authored, mirroring the `if (col.offset)`
60
- * guard call sites already use.
61
- */
62
- export declare function computeColliderWorldOffset(offset: readonly [number, number, number] | undefined, worldScale: readonly [number, number, number]): [number, number, number] | undefined;
63
- //# sourceMappingURL=collider-dimensions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"collider-dimensions.d.ts","sourceRoot":"","sources":["../../src/scene/collider-dimensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAKnD,MAAM,WAAW,uBAAuB;IACtC,+DAA+D;IAC/D,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,aAAa,EACvB,UAAU,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAC7C,WAAW,EAAE,MAAM,GAClB,uBAAuB,CA4CzB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EACrD,UAAU,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAC5C,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAItC"}
@@ -1,98 +0,0 @@
1
- /**
2
- * Shared world-scale collider dimension math (T1.2).
3
- *
4
- * Rapier colliders have no notion of a parent Object3D's `scale` — a body's
5
- * shape is defined in absolute world units at creation time. Three.js meshes,
6
- * by contrast, scale visually for free via the normal Object3D hierarchy. To
7
- * keep the physical collider matching what's on screen, the LOADER must bake
8
- * the entity's composed WORLD scale (self × every transformed ancestor — see
9
- * T1.1's world-transform composition) into the collider's dimensions at
10
- * creation time.
11
- *
12
- * This is the ONE place that does that math, so both the runtime loader
13
- * (scene-loader.ts `createPhysicsBody`) and the editor's collider gizmo
14
- * (gizmo-registry.ts) agree on exactly the same numbers — previously the
15
- * editor gizmo only rendered the entity's own live Object3D scale (via normal
16
- * Three.js parenting) while the Rapier body ignored scale entirely, so the
17
- * two silently agreed by coincidence for uniform scale and disagreed for
18
- * everything else.
19
- *
20
- * Round colliders (ball/capsule) can only represent a uniform radius — Rapier
21
- * has no ellipsoid/elliptical-capsule shape. A non-uniform world scale on a
22
- * round collider's round axes throws a loud error naming the entity, rather
23
- * than silently simulating (or rendering) the wrong shape.
24
- */
25
- import { DEFAULTS } from './defaults';
26
- /** Axes are considered "uniform enough" within this tolerance (float error only). */
27
- const UNIFORM_SCALE_EPSILON = 1e-4;
28
- /**
29
- * Compute a collider's WORLD-space dimensions given the entity's composed
30
- * world scale (self × ancestors, per-axis, in the entity's own local frame —
31
- * X/Y/Z order matches `SceneEntity.transform.scale`).
32
- *
33
- * @param collider - the entity's authored (unscaled) collider definition.
34
- * @param worldScale - composed world scale `[x, y, z]`.
35
- * @param entityLabel - human-readable entity identifier, used only in thrown
36
- * error messages (loud-failure naming, never silently wrong).
37
- * @throws if a ball/capsule collider's round cross-section axes have a
38
- * non-uniform world scale (beyond {@link UNIFORM_SCALE_EPSILON}).
39
- */
40
- export function computeColliderWorldDimensions(collider, worldScale, entityLabel) {
41
- const [sx, sy, sz] = worldScale;
42
- switch (collider.type) {
43
- case 'cuboid': {
44
- const he = collider.halfExtents ?? DEFAULTS.collider.cuboid.halfExtents;
45
- return { halfExtents: [he[0] * sx, he[1] * sy, he[2] * sz] };
46
- }
47
- case 'ball': {
48
- if (Math.abs(sx - sy) > UNIFORM_SCALE_EPSILON ||
49
- Math.abs(sy - sz) > UNIFORM_SCALE_EPSILON ||
50
- Math.abs(sx - sz) > UNIFORM_SCALE_EPSILON) {
51
- throw new Error(`Entity "${entityLabel}" has a "ball" collider under a non-uniform world scale ` +
52
- `[${sx}, ${sy}, ${sz}]. Rapier ball colliders are always perfect spheres — a ` +
53
- `non-uniform scale cannot be represented and would silently simulate the wrong ` +
54
- `shape. Use a uniform scale on this entity (and every transformed ancestor), or ` +
55
- `switch to a "cuboid" collider.`);
56
- }
57
- const radius = collider.radius ?? DEFAULTS.collider.ball.radius;
58
- return { radius: radius * sx };
59
- }
60
- case 'capsule': {
61
- // Rapier capsules run their half-height along the local Y axis, with a
62
- // circular cross-section in the XZ plane — so only X/Z need to match.
63
- if (Math.abs(sx - sz) > UNIFORM_SCALE_EPSILON) {
64
- throw new Error(`Entity "${entityLabel}" has a "capsule" collider whose X/Z world scale differs ` +
65
- `(x=${sx}, z=${sz}). Rapier capsule colliders have a circular cross-section — a ` +
66
- `non-uniform X/Z scale cannot be represented and would silently simulate the ` +
67
- `wrong shape. Use a uniform X/Z scale on this entity (and every transformed ` +
68
- `ancestor), or switch to a "cuboid" collider.`);
69
- }
70
- const radius = collider.radius ?? DEFAULTS.collider.capsule.radius;
71
- const halfHeight = collider.halfHeight ?? DEFAULTS.collider.capsule.halfHeight;
72
- return { radius: radius * sx, halfHeight: halfHeight * sy };
73
- }
74
- default:
75
- return {};
76
- }
77
- }
78
- /**
79
- * Compute a collider's WORLD-scaled translation offset (sibling to
80
- * {@link computeColliderWorldDimensions}, same input contract).
81
- *
82
- * Rapier's `ColliderDesc.setTranslation` is a raw physics-engine offset with no
83
- * notion of a parent Object3D's scale — like dimensions, an authored `offset`
84
- * (in the entity's own local units) must be scaled per-axis by the entity's
85
- * composed world scale before being handed to Rapier, or the collider's center
86
- * silently drifts away from its visual anchor point under any non-1 scale.
87
- * Applies to every collider type (including trimesh, which is otherwise not
88
- * handled by {@link computeColliderWorldDimensions}).
89
- *
90
- * Returns `undefined` when no offset is authored, mirroring the `if (col.offset)`
91
- * guard call sites already use.
92
- */
93
- export function computeColliderWorldOffset(offset, worldScale) {
94
- if (!offset)
95
- return undefined;
96
- const [sx, sy, sz] = worldScale;
97
- return [offset[0] * sx, offset[1] * sy, offset[2] * sz];
98
- }
@@ -1,22 +0,0 @@
1
- import type * as THREE from 'three';
2
- import type { ComponentManager } from '../ecs/component-manager';
3
- import { type GameComponentClass } from '../ecs/game-component';
4
- /** A registry mapping component names to GameComponent classes. */
5
- export type ComponentRegistry = Record<string, GameComponentClass>;
6
- /** Type guard: is this value a GameComponent class? `instanceof` alone is NOT
7
- * enough: a scaffolded project's node-side scripts resolve TWO physical
8
- * copies of the engine (published `@vgai/engine/*` + the `@engine/*` source
9
- * alias), and a class extending the OTHER copy's `GameComponent` fails the
10
- * prototype-chain check — so this also accepts the cross-copy
11
- * {@link GAME_COMPONENT_BRAND}. */
12
- export declare function isGameComponentClass(entry: unknown): entry is GameComponentClass;
13
- /**
14
- * Apply components from scene JSON data onto an entity (an Object3D).
15
- *
16
- * For each named component: look up its class in the registry, validate +
17
- * default the authored data through the optional `static schema` (Zod), assign
18
- * onto a fresh instance, and attach it via the ComponentManager (which wires the
19
- * Object3D + physics refs and queues init()).
20
- */
21
- export declare function applyComponents(registry: ComponentRegistry, object3D: THREE.Object3D, components: Record<string, Record<string, unknown>>, manager: ComponentManager): void;
22
- //# sourceMappingURL=component-registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component-registry.d.ts","sourceRoot":"","sources":["../../src/scene/component-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAE/B,mEAAmE;AACnE,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AAEnE;;;;;oCAKoC;AACpC,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAIhF;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACnD,OAAO,EAAE,gBAAgB,GACxB,IAAI,CAcN"}
@@ -1,37 +0,0 @@
1
- import { GAME_COMPONENT_BRAND, GameComponent, } from '../ecs/game-component';
2
- /** Type guard: is this value a GameComponent class? `instanceof` alone is NOT
3
- * enough: a scaffolded project's node-side scripts resolve TWO physical
4
- * copies of the engine (published `@vgai/engine/*` + the `@engine/*` source
5
- * alias), and a class extending the OTHER copy's `GameComponent` fails the
6
- * prototype-chain check — so this also accepts the cross-copy
7
- * {@link GAME_COMPONENT_BRAND}. */
8
- export function isGameComponentClass(entry) {
9
- if (typeof entry !== 'function')
10
- return false;
11
- if (entry.prototype instanceof GameComponent)
12
- return true;
13
- return entry[GAME_COMPONENT_BRAND] === true;
14
- }
15
- /**
16
- * Apply components from scene JSON data onto an entity (an Object3D).
17
- *
18
- * For each named component: look up its class in the registry, validate +
19
- * default the authored data through the optional `static schema` (Zod), assign
20
- * onto a fresh instance, and attach it via the ComponentManager (which wires the
21
- * Object3D + physics refs and queues init()).
22
- */
23
- export function applyComponents(registry, object3D, components, manager) {
24
- for (const [name, data] of Object.entries(components)) {
25
- const Klass = registry[name];
26
- if (!Klass) {
27
- throw new Error(`Component "${name}" not found in registry`);
28
- }
29
- const parsed = Klass.schema ? Klass.schema.parse(data) : data;
30
- const inst = new Klass();
31
- Object.assign(inst, parsed);
32
- // T5.4: record the registry name + raw authored data so a later `hotSwap`
33
- // keys on this stable identity (not the live `constructor.name`) and can
34
- // re-validate `data` against a NEW class version's schema.
35
- manager.attach(object3D, inst, { key: name, props: data });
36
- }
37
- }