@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,210 +0,0 @@
1
- import RAPIER from '@dimforge/rapier2d-compat';
2
- import { createAssetCache } from '../assets';
3
- import { createGameLoop } from '../core/game-loop';
4
- import { createSystemRunner } from '../core/system-runner';
5
- import { createComponentManager } from '../ecs/component-manager';
6
- import { createGame, createWorldInstance, } from '../runtime/game';
7
- import { createCollision2DSystem, createTriggerDispatch2D } from './collision-2d';
8
- import { createPhysics2DRegistry } from './physics2d-registry';
9
- import { createPixiSurface } from './pixi-surface';
10
- import { loadScene2DFromData } from './scene2d-loader';
11
- import { createTransformWriter2D } from './transform-writer-2d';
12
- /**
13
- * The first-party implementer that mounts an authored world2d scene — the 2D
14
- * analog of `VgaiSceneGameAdapter`. It builds the Pixi surface + Rapier 2D world,
15
- * registers the engine systems into the shared phase runner, loads the scene (or
16
- * runs a setup), and returns a `MountedGame2D`.
17
- */
18
- export class PixiSceneGameAdapter {
19
- config;
20
- id;
21
- constructor(config = {}) {
22
- this.config = config;
23
- this.id = config.id ?? 'pixi-scene';
24
- }
25
- async mount(host) {
26
- const { sceneData, setup, registry = {} } = this.config;
27
- // --- Pixi surface (autoStart:false; engine loop drives render) ---
28
- const surface = await createPixiSurface({
29
- canvas: host.canvas,
30
- width: host.width,
31
- height: host.height,
32
- ...(sceneData?.background ? { background: sceneData.background } : {}),
33
- // T6.1 slice 1 (roots-path host hints — see `World2DHost`'s fields):
34
- // all optional, all no-ops when the host is the legacy
35
- // `createWorld2DRuntime` entry (which never sets them), so behavior
36
- // there is unchanged.
37
- ...(host.dpr !== undefined ? { resolution: host.dpr } : {}),
38
- ...(host.transparent ? { transparent: true } : {}),
39
- ...(host.preserveDrawingBuffer ? { preserveDrawingBuffer: true } : {}),
40
- });
41
- // --- Rapier 2D world (separate from the 3D world) ---
42
- await RAPIER.init();
43
- const gravity = sceneData?.gravity ?? [0, 980];
44
- const rapier2dWorld = new RAPIER.World({ x: gravity[0], y: gravity[1] });
45
- const eventQueue = new RAPIER.EventQueue(true);
46
- const physics2d = createPhysics2DRegistry();
47
- const writeTransforms2D = createTransformWriter2D(physics2d);
48
- const collisions2d = createCollision2DSystem(rapier2dWorld, eventQueue);
49
- const systems = createSystemRunner(host.game?.profiler.systemObserver, 'pixijs');
50
- systems.add('physics', () => rapier2dWorld.step(eventQueue), { name: 'physics2d.step' });
51
- systems.add('postPhysics', () => {
52
- collisions2d.drain();
53
- writeTransforms2D();
54
- }, { name: 'physics2d.sync' });
55
- systems.add('render', () => surface.render(), { name: 'pixi.render' });
56
- const ctx = {
57
- app: surface.app,
58
- stage: surface.world,
59
- rapier2dWorld,
60
- rapier2d: RAPIER,
61
- physics2d,
62
- collisions2d,
63
- components: null,
64
- systems,
65
- ...(host.game ? { game: host.game } : {}),
66
- };
67
- // T7.3 slice 1/2: the pixi world's components attach onto the SAME
68
- // unified `ComponentManager` (`ecs/component-manager.ts`) the threejs
69
- // path uses, constructed for kind `'pixijs'` — the world2d-silo manager
70
- // is deleted (T7.3 slice 2). `ctx` is cast to `GameContext` for the
71
- // manager's internal typing only: at runtime this object IS the real
72
- // `World2DContext` above, so `GameComponent<'pixijs'>` subclasses that
73
- // need real 2D ctx fields (e.g. `Camera2DFollow`, which widens its own
74
- // `update`'s ctx param to `GameContext | World2DContext` and narrows
75
- // back down) still receive their real ctx, unchanged behavior — the
76
- // same cast `test/mirror-tree-guard.test.ts` uses for its unit-level
77
- // pixi manager. `createComponentManager`'s positional `physics`
78
- // parameter (the 3D `PhysicsRegistry`) is optional (T7.3 slice 2) and
79
- // omitted here — a `'pixijs'`-kind manager never reads it (rigidBody/
80
- // collider resolve from `physics2d` instead — see `resolvePhysicsRefs`
81
- // in `ecs/component-manager.ts`).
82
- ctx.components = createComponentManager(ctx, undefined, {
83
- kind: 'pixijs',
84
- physics2d,
85
- });
86
- collisions2d.onCollision(createTriggerDispatch2D(physics2d, ctx.components, rapier2dWorld, ctx));
87
- // --- Load scene or run setup ---
88
- let sceneInstance = null;
89
- let cleanup = null;
90
- if (sceneData) {
91
- sceneInstance = await loadScene2DFromData(sceneData, ctx, registry);
92
- }
93
- else if (setup) {
94
- cleanup = await setup(ctx);
95
- }
96
- return {
97
- kind: 'pixijs',
98
- firstParty: true,
99
- stage: surface.world,
100
- scene: surface.world,
101
- camera: surface.world,
102
- drivesOwnLoop: false,
103
- ctx,
104
- update: (dt) => systems.run(dt),
105
- resize: (w, h) => surface.resize(w, h),
106
- // T7.3 slice 1: no `endFrame` hook — world2d has no per-substep
107
- // post-phase work today (no `input.endFrame()` analog; HUD input is
108
- // plain DOM events, not routed through an engine InputManager).
109
- frame: {
110
- runPhase: (phase, dt) => systems.runPhase(phase, dt),
111
- },
112
- dispose: () => {
113
- cleanup?.dispose();
114
- sceneInstance?.dispose();
115
- ctx.components.clear();
116
- physics2d.clear();
117
- rapier2dWorld.free();
118
- eventQueue.free();
119
- surface.dispose();
120
- },
121
- };
122
- }
123
- }
124
- /**
125
- * Host entry for world2d — the sibling of `createGameRuntime`, kept separate so the
126
- * proven THREE host/interfaces are untouched (the stacked-own-root option the spec's
127
- * surface-host-backend-neutral allows). Owns the canvas and constructs a real `Game`
128
- * (T7.3 slice 1) with exactly one `'pixijs'`-kind `WorldInstance`, driven each fixed
129
- * substep through `Game.runFrame` — the world2d analog of `createGameRuntime`'s
130
- * `registerThreeWorld` (`runtime/create-runtime.ts`). Before T7.3 this ran its
131
- * own standalone `createGameLoop` calling `mounted.update` directly; that loop is
132
- * retired here in favor of one shared frame executor per game root.
133
- */
134
- export async function createWorld2DRuntime(config) {
135
- const { canvas, width, height, ...sceneConfig } = config;
136
- const adapter = new PixiSceneGameAdapter(sceneConfig);
137
- const assets = createAssetCache();
138
- // `game` is referenced here before its `const` below only textually — this
139
- // closure isn't invoked until `loop.start()`, well after `game` exists
140
- // (same forward-reference pattern `create-runtime.ts` uses).
141
- const loop = createGameLoop({
142
- fixedTimestep: 1 / 60,
143
- maxSubSteps: 8,
144
- update: (dt) => {
145
- game.runFrame(dt);
146
- },
147
- });
148
- const game = createGame({ loop, assets });
149
- const mounted = await adapter.mount({ canvas, width, height, game });
150
- // T7.5: `mounted` (a `MountedGame2D`, extending `MountedPixiWorld`) and
151
- // `adapter` (this `PixiSceneGameAdapter`, satisfying `WorldInstance.adapter`'s
152
- // minimal `AdapterHandle` shape — see that field's doc comment in
153
- // `runtime/game.ts`) now pass through with ZERO cast — previously this cast
154
- // through `GameAdapter`/`MountedGame`, which hardwired THREE `scene`/`camera`.
155
- const pixiWorld = createWorldInstance({
156
- id: 'main',
157
- kind: 'pixijs',
158
- adapter,
159
- mounted,
160
- stage: mounted.stage,
161
- physics2d: mounted.ctx.physics2d,
162
- collisions2d: mounted.ctx.collisions2d,
163
- frame: mounted.frame,
164
- });
165
- // T7.2/T7.3 world-wiring backfill (mirrors `registerThreeWorld` in
166
- // `create-runtime.ts`): scene-authored components attach DURING `mount()`,
167
- // before this `WorldInstance` exists, so `instance.world` is left
168
- // `undefined` for each of them — `adoptWorld` backfills it now, once, for
169
- // every already-attached instance still missing a world.
170
- mounted.ctx.components.adoptWorld(pixiWorld);
171
- game.registerWorld(pixiWorld);
172
- loop.start();
173
- if (typeof window !== 'undefined' && import.meta.env?.DEV) {
174
- window['__vgaiWorld2d'] = {
175
- app: mounted.ctx.app,
176
- stage: mounted.stage,
177
- physics2d: mounted.ctx.physics2d,
178
- };
179
- }
180
- return {
181
- stop() {
182
- loop.stop();
183
- mounted.dispose();
184
- },
185
- // D10/T7.6: route through the real `Game.play` control surface instead of
186
- // `loop.timeScale = 0/1` — that starved the accumulator entirely (per D1,
187
- // zero substeps ⇒ zero renders too), the exact bug this control surface
188
- // replaces. `Game.play.pause()` freezes this world's simulation (it is
189
- // `pausable` by default) while its `render` phase keeps running every
190
- // substep — the screen does not go black while paused.
191
- pause() {
192
- game.play.pause();
193
- },
194
- resume() {
195
- game.play.resume();
196
- },
197
- step() {
198
- game.play.step();
199
- },
200
- resize(w, h) {
201
- // T7.5/T7.6 own real per-world resize routing through the Game/host
202
- // surface split (the host is not yet surface-neutral for world2d) —
203
- // kept as today's direct host→surface call for this slice.
204
- mounted.resize?.(w, h);
205
- },
206
- get mounted() {
207
- return mounted;
208
- },
209
- };
210
- }
@@ -1,39 +0,0 @@
1
- import { Application, Container } from 'pixi.js';
2
- export interface PixiSurface {
3
- app: Application;
4
- /** The world container (the 2D "camera": pan/zoom by transforming this). */
5
- world: Container;
6
- /** Render one frame (called from the engine's `render` phase). */
7
- render: () => void;
8
- resize: (width: number, height: number) => void;
9
- dispose: () => void;
10
- }
11
- export interface PixiSurfaceOptions {
12
- canvas: HTMLCanvasElement;
13
- width: number;
14
- height: number;
15
- background?: string;
16
- resolution?: number;
17
- antialias?: boolean;
18
- /** Stacked-composition transparency (COMPOSITION-DESIGN.md D5 §1, T6.1
19
- * slice 1): when true, the surface clears with alpha 0
20
- * (`backgroundAlpha:0`) instead of an opaque `background`, so a world
21
- * layered ABOVE another shows the layer below through it. */
22
- transparent?: boolean;
23
- /** Capture tier cost (D5 §4): flat on `Application.init`, never nested
24
- * under `context:` (the documented pixi trap) — required for any later
25
- * `drawImage()`-based composite capture of this surface. */
26
- preserveDrawingBuffer?: boolean;
27
- }
28
- /**
29
- * Create the world2d render surface — a PixiJS v8 `Application` whose auto-ticker
30
- * is DISABLED (`autoStart:false`), so the engine's fixed-timestep loop drives
31
- * rendering by calling `render()` from the `render` phase (mirroring how the
32
- * Three.js adapter calls `composer.render(dt)`).
33
- *
34
- * `app.stage` holds a single `world` Container — the 2D camera lives here as a
35
- * transform on `world` (pan = world.position, zoom = world.scale), per the spec's
36
- * backend-2d-camera resolution. Screen-space HUD stays in the React/DOM overlay.
37
- */
38
- export declare function createPixiSurface(opts: PixiSurfaceOptions): Promise<PixiSurface>;
39
- //# sourceMappingURL=pixi-surface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pixi-surface.d.ts","sourceRoot":"","sources":["../../src/world2d/pixi-surface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,WAAW,CAAC;IACjB,4EAA4E;IAC5E,KAAK,EAAE,SAAS,CAAC;IACjB,kEAAkE;IAClE,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;kEAG8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;iEAE6D;IAC7D,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,CAqCtF"}
@@ -1,47 +0,0 @@
1
- import { Application, Container } from 'pixi.js';
2
- /**
3
- * Create the world2d render surface — a PixiJS v8 `Application` whose auto-ticker
4
- * is DISABLED (`autoStart:false`), so the engine's fixed-timestep loop drives
5
- * rendering by calling `render()` from the `render` phase (mirroring how the
6
- * Three.js adapter calls `composer.render(dt)`).
7
- *
8
- * `app.stage` holds a single `world` Container — the 2D camera lives here as a
9
- * transform on `world` (pan = world.position, zoom = world.scale), per the spec's
10
- * backend-2d-camera resolution. Screen-space HUD stays in the React/DOM overlay.
11
- */
12
- export async function createPixiSurface(opts) {
13
- const app = new Application();
14
- await app.init({
15
- canvas: opts.canvas,
16
- width: opts.width,
17
- height: opts.height,
18
- background: opts.background ?? '#10101a',
19
- backgroundAlpha: opts.transparent ? 0 : 1,
20
- resolution: opts.resolution ?? (typeof window !== 'undefined' ? window.devicePixelRatio : 1),
21
- autoDensity: true,
22
- antialias: opts.antialias ?? true,
23
- autoStart: false, // engine loop drives rendering — NOT Pixi's ticker
24
- preference: 'webgl',
25
- // Capture tier cost (D5 §4) — FLAT here, never nested under `context:`
26
- // (the documented pixi trap: nesting silently breaks GL bootstrap).
27
- ...(opts.preserveDrawingBuffer ? { preserveDrawingBuffer: true } : {}),
28
- });
29
- // Stop the shared/internal ticker defensively (autoStart:false already prevents start).
30
- app.ticker.stop();
31
- const world = new Container();
32
- world.label = 'world2d-root';
33
- app.stage.addChild(world);
34
- return {
35
- app,
36
- world,
37
- render: () => app.render(),
38
- resize: (width, height) => {
39
- app.renderer.resize(width, height);
40
- },
41
- dispose: () => {
42
- // Tear down the Pixi app + GPU context. Children are destroyed by the loader's
43
- // own dispose; here we release the renderer/canvas binding.
44
- app.destroy({ removeView: false }, { children: true });
45
- },
46
- };
47
- }
@@ -1,43 +0,0 @@
1
- /**
2
- * Scene capture for world2d — the PixiJS analog of the three.js render
3
- * accessor-trap (`adapter/ingest/scene-capture.ts`).
4
- *
5
- * An unmodified PixiJS game owns its own `Application`, `stage`, renderer, and
6
- * ticker. To inspect/host that live scene with ZERO edits to the game, we trap the
7
- * render call and capture the game's `stage` + renderer + app on its first frame.
8
- *
9
- * Unlike three.js's `WebGLRenderer` (whose `render` is an own-instance property,
10
- * forcing a prototype getter/setter), PixiJS's `Application.prototype.render` is a
11
- * normal prototype method — the standard ticker render path (`ticker → app.render()`)
12
- * goes through it — so a direct prototype wrap suffices.
13
- *
14
- * CRITICAL (same module-identity gatekeeper as the 3D path): the trap must be
15
- * installed on the SAME `pixi.js` module instance the game uses. A bundler/dev-server
16
- * that dedupes `pixi.js` makes an ESM game's `import 'pixi.js'` resolve to the host
17
- * instance, so it is trapped; a game bundling its own pixi cannot be captured this
18
- * way (degrade to iframe-reachable or opaque-embed tiers — see the spec).
19
- */
20
- /** A live world2d runtime captured from an external PixiJS game. */
21
- export interface CapturedRuntime2D {
22
- /** The game's root stage Container. */
23
- stage: unknown;
24
- /** The game's PixiJS renderer. */
25
- renderer: unknown;
26
- /** The game's Application (so the host can pause/resume its ticker). */
27
- app: unknown;
28
- }
29
- export interface SceneCapture2DHandle {
30
- readonly captured: CapturedRuntime2D | null;
31
- waitForCapture(timeoutMs?: number): Promise<CapturedRuntime2D>;
32
- getDrawCount(): number;
33
- /** Pause/resume the captured game's own ticker (loop-host gating). */
34
- setPaused(paused: boolean): void;
35
- uninstall(): void;
36
- }
37
- /**
38
- * Install the render trap on `pixiNamespace.Application.prototype.render`. Pass the
39
- * host's `pixi.js` namespace so a shared-instance game is trapped. Install once per
40
- * ingest session; `uninstall()` on teardown.
41
- */
42
- export declare function installSceneCapture2D(pixiNamespace: unknown): SceneCapture2DHandle;
43
- //# sourceMappingURL=scene-capture-2d.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scene-capture-2d.d.ts","sourceRoot":"","sources":["../../src/world2d/scene-capture-2d.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,oEAAoE;AACpE,MAAM,WAAW,iBAAiB;IAChC,uCAAuC;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,kCAAkC;IAClC,QAAQ,EAAE,OAAO,CAAC;IAClB,wEAAwE;IACxE,GAAG,EAAE,OAAO,CAAC;CACd;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC5C,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC/D,YAAY,IAAI,MAAM,CAAC;IACvB,sEAAsE;IACtE,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACjC,SAAS,IAAI,IAAI,CAAC;CACnB;AAMD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,OAAO,GAAG,oBAAoB,CAoElF"}
@@ -1,92 +0,0 @@
1
- /**
2
- * Scene capture for world2d — the PixiJS analog of the three.js render
3
- * accessor-trap (`adapter/ingest/scene-capture.ts`).
4
- *
5
- * An unmodified PixiJS game owns its own `Application`, `stage`, renderer, and
6
- * ticker. To inspect/host that live scene with ZERO edits to the game, we trap the
7
- * render call and capture the game's `stage` + renderer + app on its first frame.
8
- *
9
- * Unlike three.js's `WebGLRenderer` (whose `render` is an own-instance property,
10
- * forcing a prototype getter/setter), PixiJS's `Application.prototype.render` is a
11
- * normal prototype method — the standard ticker render path (`ticker → app.render()`)
12
- * goes through it — so a direct prototype wrap suffices.
13
- *
14
- * CRITICAL (same module-identity gatekeeper as the 3D path): the trap must be
15
- * installed on the SAME `pixi.js` module instance the game uses. A bundler/dev-server
16
- * that dedupes `pixi.js` makes an ESM game's `import 'pixi.js'` resolve to the host
17
- * instance, so it is trapped; a game bundling its own pixi cannot be captured this
18
- * way (degrade to iframe-reachable or opaque-embed tiers — see the spec).
19
- */
20
- /**
21
- * Install the render trap on `pixiNamespace.Application.prototype.render`. Pass the
22
- * host's `pixi.js` namespace so a shared-instance game is trapped. Install once per
23
- * ingest session; `uninstall()` on teardown.
24
- */
25
- export function installSceneCapture2D(pixiNamespace) {
26
- const PIXI = pixiNamespace;
27
- const proto = PIXI.Application.prototype;
28
- let captured = null;
29
- let drawCount = 0;
30
- const waiters = [];
31
- const priorRender = Object.getOwnPropertyDescriptor(proto, 'render');
32
- const realRender = proto['render'];
33
- Object.defineProperty(proto, 'render', {
34
- configurable: true,
35
- writable: true,
36
- value: function (...args) {
37
- drawCount++;
38
- const stage = this['stage'];
39
- if (!captured && stage) {
40
- captured = { stage, renderer: this['renderer'], app: this };
41
- for (const resolve of waiters.splice(0))
42
- resolve(captured);
43
- }
44
- return realRender?.apply(this, args);
45
- },
46
- });
47
- return {
48
- get captured() {
49
- return captured;
50
- },
51
- getDrawCount() {
52
- return drawCount;
53
- },
54
- setPaused(paused) {
55
- const app = captured?.app;
56
- if (!app?.ticker)
57
- return;
58
- if (paused)
59
- app.ticker.stop();
60
- else
61
- app.ticker.start();
62
- },
63
- waitForCapture(timeoutMs = 10_000) {
64
- if (captured)
65
- return Promise.resolve(captured);
66
- return new Promise((resolve, reject) => {
67
- const timer = setTimeout(() => {
68
- const i = waiters.indexOf(wrapped);
69
- if (i >= 0)
70
- waiters.splice(i, 1);
71
- reject(new Error(`world2d scene capture timed out after ${timeoutMs}ms — the game never ` +
72
- `rendered, or it bundles its own (un-shared) copy of pixi.js.`));
73
- }, timeoutMs);
74
- const wrapped = (rt) => {
75
- clearTimeout(timer);
76
- resolve(rt);
77
- };
78
- waiters.push(wrapped);
79
- });
80
- },
81
- uninstall() {
82
- if (priorRender)
83
- Object.defineProperty(proto, 'render', priorRender);
84
- else if (realRender)
85
- Object.defineProperty(proto, 'render', {
86
- configurable: true,
87
- writable: true,
88
- value: realRender,
89
- });
90
- },
91
- };
92
- }
@@ -1,27 +0,0 @@
1
- import { Container } from 'pixi.js';
2
- import { type Scene2DFile } from './schema/entity2d';
3
- import type { Component2DRegistry, World2DContext } from './types';
4
- /** A loaded world2d scene instance: the root display objects + an update/dispose. */
5
- export interface Scene2DInstance {
6
- roots: Container[];
7
- /** id → display object map for editor/lookup (the 2D analog of the loader's entity map). */
8
- byId: Map<string, Container>;
9
- dispose(): void;
10
- }
11
- /**
12
- * Load a world2d scene from authored data — the 2D analog of `loadSceneFromData`.
13
- * Three passes: (1) spawn all entities (recursing into children), building an
14
- * id→display map and creating Rapier 2D bodies; (2) [no joints in 2D yet];
15
- * (3) `componentManager.initAll()` once everything exists.
16
- *
17
- * Re-validates `data` even though the fetch path (`fetchScene2DFile` in
18
- * `packages/editor/src/adapter-resolver.ts`) already validates before calling
19
- * in — not every caller goes through that path (test-constructed
20
- * `PixiSceneConfig.sceneData` literals reach here unvalidated), so a malformed
21
- * payload still throws a `SceneParseError` naming the file, not a raw
22
- * `ZodError` (T4.6 convention, closing §7.1-14). `sourceName` is optional
23
- * because not every caller knows the originating file path; callers that do
24
- * (or gain the ability to) should thread it through for a better message.
25
- */
26
- export declare function loadScene2DFromData(data: Scene2DFile, ctx: World2DContext, registry: Component2DRegistry, sourceName?: string): Promise<Scene2DInstance>;
27
- //# sourceMappingURL=scene2d-loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scene2d-loader.d.ts","sourceRoot":"","sources":["../../src/world2d/scene2d-loader.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,SAAS,EAIV,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAiB,KAAK,WAAW,EAAiB,MAAM,mBAAmB,CAAC;AAGnF,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAoNnE,qFAAqF;AACrF,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,4FAA4F;IAC5F,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC7B,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,cAAc,EACnB,QAAQ,EAAE,mBAAmB,EAC7B,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,eAAe,CAAC,CAmD1B"}