@vgai/engine 0.5.4 → 0.5.6

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 (448) hide show
  1. package/dist/adapter/adapter-surface.d.ts +30 -0
  2. package/dist/adapter/adapter-surface.d.ts.map +1 -0
  3. package/dist/adapter/adapter-surface.js +18 -0
  4. package/dist/adapter/authoring.d.ts +597 -0
  5. package/dist/adapter/authoring.d.ts.map +1 -0
  6. package/dist/adapter/authoring.js +22 -0
  7. package/dist/adapter/colyseus-networking-adapter.d.ts +77 -0
  8. package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -0
  9. package/dist/adapter/colyseus-networking-adapter.js +76 -0
  10. package/dist/adapter/first-party-systems.d.ts +23 -0
  11. package/dist/adapter/first-party-systems.d.ts.map +1 -0
  12. package/dist/adapter/first-party-systems.js +196 -0
  13. package/dist/adapter/host-context.d.ts +194 -0
  14. package/dist/adapter/host-context.d.ts.map +1 -0
  15. package/dist/adapter/host-context.js +80 -0
  16. package/dist/adapter/index.d.ts +33 -0
  17. package/dist/adapter/index.d.ts.map +1 -0
  18. package/dist/adapter/index.js +25 -0
  19. package/dist/adapter/ingest/game-contract.d.ts +53 -0
  20. package/dist/adapter/ingest/game-contract.d.ts.map +1 -0
  21. package/dist/adapter/ingest/game-contract.js +30 -0
  22. package/dist/adapter/ingest/scene-capture.d.ts +121 -0
  23. package/dist/adapter/ingest/scene-capture.d.ts.map +1 -0
  24. package/dist/adapter/ingest/scene-capture.js +270 -0
  25. package/dist/adapter/ingest/structural-ids.d.ts +64 -0
  26. package/dist/adapter/ingest/structural-ids.d.ts.map +1 -0
  27. package/dist/adapter/ingest/structural-ids.js +110 -0
  28. package/dist/adapter/ingest/upstream-pin.d.ts +44 -0
  29. package/dist/adapter/ingest/upstream-pin.d.ts.map +1 -0
  30. package/dist/adapter/ingest/upstream-pin.js +47 -0
  31. package/dist/adapter/loop-gate-report.d.ts +34 -0
  32. package/dist/adapter/loop-gate-report.d.ts.map +1 -0
  33. package/dist/adapter/loop-gate-report.js +37 -0
  34. package/dist/adapter/rapier-physics-adapter.d.ts +69 -0
  35. package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -0
  36. package/dist/adapter/rapier-physics-adapter.js +135 -0
  37. package/dist/adapter/root-adapter.d.ts +195 -0
  38. package/dist/adapter/root-adapter.d.ts.map +1 -0
  39. package/dist/adapter/root-adapter.js +25 -0
  40. package/dist/adapter/setup-three-root-adapter.d.ts +87 -0
  41. package/dist/adapter/setup-three-root-adapter.d.ts.map +1 -0
  42. package/dist/adapter/setup-three-root-adapter.js +791 -0
  43. package/dist/adapter/system-adapter.d.ts +453 -0
  44. package/dist/adapter/system-adapter.d.ts.map +1 -0
  45. package/dist/adapter/system-adapter.js +13 -0
  46. package/dist/adapter/transform.d.ts +18 -0
  47. package/dist/adapter/transform.d.ts.map +1 -0
  48. package/dist/adapter/transform.js +1 -0
  49. package/dist/ai/navigation.d.ts +78 -0
  50. package/dist/ai/navigation.d.ts.map +1 -0
  51. package/dist/ai/navigation.js +152 -0
  52. package/dist/animation/anim-graph-types.d.ts +25 -0
  53. package/dist/animation/anim-graph-types.d.ts.map +1 -0
  54. package/dist/animation/anim-graph-types.js +1 -0
  55. package/dist/animation/animation-clock.d.ts +213 -0
  56. package/dist/animation/animation-clock.d.ts.map +1 -0
  57. package/dist/animation/animation-clock.js +301 -0
  58. package/dist/animation/blend-node.d.ts +22 -0
  59. package/dist/animation/blend-node.d.ts.map +1 -0
  60. package/dist/animation/blend-node.js +97 -0
  61. package/dist/animation/camera-ownership.d.ts +249 -0
  62. package/dist/animation/camera-ownership.d.ts.map +1 -0
  63. package/dist/animation/camera-ownership.js +169 -0
  64. package/dist/animation/cinematic-cues.d.ts +200 -0
  65. package/dist/animation/cinematic-cues.d.ts.map +1 -0
  66. package/dist/animation/cinematic-cues.js +213 -0
  67. package/dist/animation/clip-map.d.ts +12 -0
  68. package/dist/animation/clip-map.d.ts.map +1 -0
  69. package/dist/animation/clip-map.js +31 -0
  70. package/dist/animation/cubic-spline-interpolant.d.ts +54 -0
  71. package/dist/animation/cubic-spline-interpolant.d.ts.map +1 -0
  72. package/dist/animation/cubic-spline-interpolant.js +111 -0
  73. package/dist/animation/theatre-clock-binding.d.ts +89 -0
  74. package/dist/animation/theatre-clock-binding.d.ts.map +1 -0
  75. package/dist/animation/theatre-clock-binding.js +29 -0
  76. package/dist/animation/theatre-director.d.ts +277 -0
  77. package/dist/animation/theatre-director.d.ts.map +1 -0
  78. package/dist/animation/theatre-director.js +248 -0
  79. package/dist/animation/theatre-object-binding.d.ts +305 -0
  80. package/dist/animation/theatre-object-binding.d.ts.map +1 -0
  81. package/dist/animation/theatre-object-binding.js +351 -0
  82. package/dist/animation/xstate-animation-binding.d.ts +119 -0
  83. package/dist/animation/xstate-animation-binding.d.ts.map +1 -0
  84. package/dist/animation/xstate-animation-binding.js +349 -0
  85. package/dist/animation/xstate-animation-meta.d.ts +266 -0
  86. package/dist/animation/xstate-animation-meta.d.ts.map +1 -0
  87. package/dist/animation/xstate-animation-meta.js +252 -0
  88. package/dist/asset-formats/camera.d.ts +15 -0
  89. package/dist/asset-formats/camera.d.ts.map +1 -0
  90. package/dist/asset-formats/camera.js +15 -0
  91. package/dist/asset-formats/collider.d.ts +21 -0
  92. package/dist/asset-formats/collider.d.ts.map +1 -0
  93. package/dist/asset-formats/collider.js +53 -0
  94. package/dist/asset-formats/index.d.ts +46 -0
  95. package/dist/asset-formats/index.d.ts.map +1 -0
  96. package/dist/asset-formats/index.js +36 -0
  97. package/dist/asset-formats/instances.d.ts +17 -0
  98. package/dist/asset-formats/instances.d.ts.map +1 -0
  99. package/dist/asset-formats/instances.js +31 -0
  100. package/dist/asset-formats/light.d.ts +21 -0
  101. package/dist/asset-formats/light.d.ts.map +1 -0
  102. package/dist/asset-formats/light.js +35 -0
  103. package/dist/asset-formats/material.d.ts +129 -0
  104. package/dist/asset-formats/material.d.ts.map +1 -0
  105. package/dist/asset-formats/material.js +88 -0
  106. package/dist/asset-formats/mesh.d.ts +22 -0
  107. package/dist/asset-formats/mesh.d.ts.map +1 -0
  108. package/dist/asset-formats/mesh.js +64 -0
  109. package/dist/asset-formats/parse.d.ts +20 -0
  110. package/dist/asset-formats/parse.d.ts.map +1 -0
  111. package/dist/asset-formats/parse.js +34 -0
  112. package/dist/asset-formats/particles.d.ts +1390 -0
  113. package/dist/asset-formats/particles.d.ts.map +1 -0
  114. package/dist/asset-formats/particles.js +319 -0
  115. package/dist/asset-formats/render-env.d.ts +387 -0
  116. package/dist/asset-formats/render-env.d.ts.map +1 -0
  117. package/dist/asset-formats/render-env.js +300 -0
  118. package/dist/asset-formats/tuples.d.ts +12 -0
  119. package/dist/asset-formats/tuples.d.ts.map +1 -0
  120. package/dist/asset-formats/tuples.js +14 -0
  121. package/dist/asset-loaders.d.ts +97 -0
  122. package/dist/asset-loaders.d.ts.map +1 -0
  123. package/dist/asset-loaders.js +209 -0
  124. package/dist/asset-parse-error.d.ts +24 -0
  125. package/dist/asset-parse-error.d.ts.map +1 -0
  126. package/dist/asset-parse-error.js +29 -0
  127. package/dist/asset-registry.d.ts +38 -0
  128. package/dist/asset-registry.d.ts.map +1 -0
  129. package/dist/asset-registry.js +66 -0
  130. package/dist/assets.d.ts +26 -0
  131. package/dist/assets.d.ts.map +1 -0
  132. package/dist/assets.js +55 -0
  133. package/dist/audio/wav-encode.d.ts +38 -0
  134. package/dist/audio/wav-encode.d.ts.map +1 -0
  135. package/dist/audio/wav-encode.js +97 -0
  136. package/dist/canvas-react/engine-bridge.d.ts +45 -0
  137. package/dist/canvas-react/engine-bridge.d.ts.map +1 -0
  138. package/dist/canvas-react/engine-bridge.js +45 -0
  139. package/dist/canvas-react/index.d.ts +42 -0
  140. package/dist/canvas-react/index.d.ts.map +1 -0
  141. package/dist/canvas-react/index.js +41 -0
  142. package/dist/canvas-react/pixi-primitive.d.ts +85 -0
  143. package/dist/canvas-react/pixi-primitive.d.ts.map +1 -0
  144. package/dist/canvas-react/pixi-primitive.js +181 -0
  145. package/dist/canvas-react/pixi-react-adapter.d.ts +71 -0
  146. package/dist/canvas-react/pixi-react-adapter.d.ts.map +1 -0
  147. package/dist/canvas-react/pixi-react-adapter.js +229 -0
  148. package/dist/canvas-react/pixi-react-root-factory.d.ts +56 -0
  149. package/dist/canvas-react/pixi-react-root-factory.d.ts.map +1 -0
  150. package/dist/canvas-react/pixi-react-root-factory.js +73 -0
  151. package/dist/canvas-react/world-context.d.ts +88 -0
  152. package/dist/canvas-react/world-context.d.ts.map +1 -0
  153. package/dist/canvas-react/world-context.js +212 -0
  154. package/dist/config.d.ts +9 -0
  155. package/dist/config.d.ts.map +1 -0
  156. package/dist/config.js +8 -0
  157. package/dist/core/frame-pacing.d.ts +90 -0
  158. package/dist/core/frame-pacing.d.ts.map +1 -0
  159. package/dist/core/frame-pacing.js +89 -0
  160. package/dist/core/game-loop.d.ts +62 -0
  161. package/dist/core/game-loop.d.ts.map +1 -0
  162. package/dist/core/game-loop.js +189 -0
  163. package/dist/core/seeded-random.d.ts +69 -0
  164. package/dist/core/seeded-random.d.ts.map +1 -0
  165. package/dist/core/seeded-random.js +121 -0
  166. package/dist/core/sim-clock.d.ts +199 -0
  167. package/dist/core/sim-clock.d.ts.map +1 -0
  168. package/dist/core/sim-clock.js +291 -0
  169. package/dist/core/system-runner.d.ts +96 -0
  170. package/dist/core/system-runner.d.ts.map +1 -0
  171. package/dist/core/system-runner.js +253 -0
  172. package/dist/core/types.d.ts +111 -0
  173. package/dist/core/types.d.ts.map +1 -0
  174. package/dist/core/types.js +25 -0
  175. package/dist/data/data-asset.d.ts +101 -0
  176. package/dist/data/data-asset.d.ts.map +1 -0
  177. package/dist/data/data-asset.js +122 -0
  178. package/dist/data/data-check-core.d.ts +109 -0
  179. package/dist/data/data-check-core.d.ts.map +1 -0
  180. package/dist/data/data-check-core.js +177 -0
  181. package/dist/data/data-ref.d.ts +79 -0
  182. package/dist/data/data-ref.d.ts.map +1 -0
  183. package/dist/data/data-ref.js +130 -0
  184. package/dist/data/vite-plugin-data.d.ts +79 -0
  185. package/dist/data/vite-plugin-data.d.ts.map +1 -0
  186. package/dist/data/vite-plugin-data.js +217 -0
  187. package/dist/defaults.d.ts +233 -0
  188. package/dist/defaults.d.ts.map +1 -0
  189. package/dist/defaults.js +137 -0
  190. package/dist/dev/chrome-trace.d.ts +45 -0
  191. package/dist/dev/chrome-trace.d.ts.map +1 -0
  192. package/dist/dev/chrome-trace.js +114 -0
  193. package/dist/dev/console-bridge.d.ts +22 -0
  194. package/dist/dev/console-bridge.d.ts.map +1 -0
  195. package/dist/dev/console-bridge.js +71 -0
  196. package/dist/dev/debug-draw.d.ts +24 -0
  197. package/dist/dev/debug-draw.d.ts.map +1 -0
  198. package/dist/dev/debug-draw.js +73 -0
  199. package/dist/dev/instruments.d.ts +133 -0
  200. package/dist/dev/instruments.d.ts.map +1 -0
  201. package/dist/dev/instruments.js +231 -0
  202. package/dist/dev/logger.d.ts +30 -0
  203. package/dist/dev/logger.d.ts.map +1 -0
  204. package/dist/dev/logger.js +90 -0
  205. package/dist/dev/performance-profiler.d.ts +111 -0
  206. package/dist/dev/performance-profiler.d.ts.map +1 -0
  207. package/dist/dev/performance-profiler.js +215 -0
  208. package/dist/dev/render-debug-adapter.d.ts +57 -0
  209. package/dist/dev/render-debug-adapter.d.ts.map +1 -0
  210. package/dist/dev/render-debug-adapter.js +141 -0
  211. package/dist/dev/render-memory.d.ts +53 -0
  212. package/dist/dev/render-memory.d.ts.map +1 -0
  213. package/dist/dev/render-memory.js +190 -0
  214. package/dist/dev/webgl-frame-capture.d.ts +134 -0
  215. package/dist/dev/webgl-frame-capture.d.ts.map +1 -0
  216. package/dist/dev/webgl-frame-capture.js +270 -0
  217. package/dist/dev/webgl-gpu-timer.d.ts +8 -0
  218. package/dist/dev/webgl-gpu-timer.d.ts.map +1 -0
  219. package/dist/dev/webgl-gpu-timer.js +52 -0
  220. package/dist/ecs/scene-index.d.ts +179 -0
  221. package/dist/ecs/scene-index.d.ts.map +1 -0
  222. package/dist/ecs/scene-index.js +331 -0
  223. package/dist/ecs/scene-query.d.ts +6 -0
  224. package/dist/ecs/scene-query.d.ts.map +1 -0
  225. package/dist/ecs/scene-query.js +40 -0
  226. package/dist/ecs/user-data.d.ts +193 -0
  227. package/dist/ecs/user-data.d.ts.map +1 -0
  228. package/dist/ecs/user-data.js +145 -0
  229. package/dist/index.d.ts +35 -0
  230. package/dist/index.d.ts.map +1 -0
  231. package/dist/index.js +29 -0
  232. package/dist/input/input-manager.d.ts +944 -0
  233. package/dist/input/input-manager.d.ts.map +1 -0
  234. package/dist/input/input-manager.js +2209 -0
  235. package/dist/input/input-types.d.ts +174 -0
  236. package/dist/input/input-types.d.ts.map +1 -0
  237. package/dist/input/input-types.js +1 -0
  238. package/dist/input/prompt-labels.d.ts +21 -0
  239. package/dist/input/prompt-labels.d.ts.map +1 -0
  240. package/dist/input/prompt-labels.js +121 -0
  241. package/dist/input/rebind-controller.d.ts +59 -0
  242. package/dist/input/rebind-controller.d.ts.map +1 -0
  243. package/dist/input/rebind-controller.js +85 -0
  244. package/dist/input/schema.d.ts +16 -0
  245. package/dist/input/schema.d.ts.map +1 -0
  246. package/dist/input/schema.js +228 -0
  247. package/dist/loader.d.ts +76 -0
  248. package/dist/loader.d.ts.map +1 -0
  249. package/dist/loader.js +114 -0
  250. package/dist/manifest/editor-port.d.ts +53 -0
  251. package/dist/manifest/editor-port.d.ts.map +1 -0
  252. package/dist/manifest/editor-port.js +67 -0
  253. package/dist/manifest/filename.d.ts +14 -0
  254. package/dist/manifest/filename.d.ts.map +1 -0
  255. package/dist/manifest/filename.js +43 -0
  256. package/dist/manifest/index.d.ts +6 -0
  257. package/dist/manifest/index.d.ts.map +1 -0
  258. package/dist/manifest/index.js +9 -0
  259. package/dist/manifest/load-file.d.ts +7 -0
  260. package/dist/manifest/load-file.d.ts.map +1 -0
  261. package/dist/manifest/load-file.js +23 -0
  262. package/dist/manifest/load.d.ts +161 -0
  263. package/dist/manifest/load.d.ts.map +1 -0
  264. package/dist/manifest/load.js +269 -0
  265. package/dist/manifest/locate.d.ts +24 -0
  266. package/dist/manifest/locate.d.ts.map +1 -0
  267. package/dist/manifest/locate.js +48 -0
  268. package/dist/manifest/schema.d.ts +293 -0
  269. package/dist/manifest/schema.d.ts.map +1 -0
  270. package/dist/manifest/schema.js +633 -0
  271. package/dist/physics/collider-dimensions.d.ts +63 -0
  272. package/dist/physics/collider-dimensions.d.ts.map +1 -0
  273. package/dist/physics/collider-dimensions.js +98 -0
  274. package/dist/physics/collision-system.d.ts +41 -0
  275. package/dist/physics/collision-system.d.ts.map +1 -0
  276. package/dist/physics/collision-system.js +64 -0
  277. package/dist/physics/physics-registry.d.ts +45 -0
  278. package/dist/physics/physics-registry.d.ts.map +1 -0
  279. package/dist/physics/physics-registry.js +65 -0
  280. package/dist/physics/transform-writer.d.ts +16 -0
  281. package/dist/physics/transform-writer.d.ts.map +1 -0
  282. package/dist/physics/transform-writer.js +38 -0
  283. package/dist/pixi/authoring.d.ts +93 -0
  284. package/dist/pixi/authoring.d.ts.map +1 -0
  285. package/dist/pixi/authoring.js +207 -0
  286. package/dist/pixi/index.d.ts +16 -0
  287. package/dist/pixi/index.d.ts.map +1 -0
  288. package/dist/pixi/index.js +15 -0
  289. package/dist/pixi/ingest-iframe.d.ts +82 -0
  290. package/dist/pixi/ingest-iframe.d.ts.map +1 -0
  291. package/dist/pixi/ingest-iframe.js +166 -0
  292. package/dist/pixi/ingest.d.ts +97 -0
  293. package/dist/pixi/ingest.d.ts.map +1 -0
  294. package/dist/pixi/ingest.js +40 -0
  295. package/dist/pixi/physics-registry.d.ts +24 -0
  296. package/dist/pixi/physics-registry.d.ts.map +1 -0
  297. package/dist/pixi/physics-registry.js +38 -0
  298. package/dist/pixi/scene-capture.d.ts +43 -0
  299. package/dist/pixi/scene-capture.d.ts.map +1 -0
  300. package/dist/pixi/scene-capture.js +92 -0
  301. package/dist/pixi/system-adapters.d.ts +16 -0
  302. package/dist/pixi/system-adapters.d.ts.map +1 -0
  303. package/dist/pixi/system-adapters.js +37 -0
  304. package/dist/react/unmanaged-root-detector.d.ts +18 -0
  305. package/dist/react/unmanaged-root-detector.d.ts.map +1 -0
  306. package/dist/react/unmanaged-root-detector.js +70 -0
  307. package/dist/react/use-data.d.ts +60 -0
  308. package/dist/react/use-data.d.ts.map +1 -0
  309. package/dist/react/use-data.js +101 -0
  310. package/dist/react/use-selection.d.ts +54 -0
  311. package/dist/react/use-selection.d.ts.map +1 -0
  312. package/dist/react/use-selection.js +71 -0
  313. package/dist/react/world-state.d.ts +154 -0
  314. package/dist/react/world-state.d.ts.map +1 -0
  315. package/dist/react/world-state.js +220 -0
  316. package/dist/render/auto-batcher.d.ts +34 -0
  317. package/dist/render/auto-batcher.d.ts.map +1 -0
  318. package/dist/render/auto-batcher.js +140 -0
  319. package/dist/render/instance-mesh.d.ts +5 -0
  320. package/dist/render/instance-mesh.d.ts.map +1 -0
  321. package/dist/render/instance-mesh.js +19 -0
  322. package/dist/render/light-camera-factory.d.ts +24 -0
  323. package/dist/render/light-camera-factory.d.ts.map +1 -0
  324. package/dist/render/light-camera-factory.js +71 -0
  325. package/dist/render/lod.d.ts +13 -0
  326. package/dist/render/lod.d.ts.map +1 -0
  327. package/dist/render/lod.js +16 -0
  328. package/dist/render/material-factory.d.ts +15 -0
  329. package/dist/render/material-factory.d.ts.map +1 -0
  330. package/dist/render/material-factory.js +186 -0
  331. package/dist/render/mesh-shadow.d.ts +11 -0
  332. package/dist/render/mesh-shadow.d.ts.map +1 -0
  333. package/dist/render/mesh-shadow.js +19 -0
  334. package/dist/render/particles-factory.d.ts +99 -0
  335. package/dist/render/particles-factory.d.ts.map +1 -0
  336. package/dist/render/particles-factory.js +361 -0
  337. package/dist/render/render-batch-system.d.ts +33 -0
  338. package/dist/render/render-batch-system.d.ts.map +1 -0
  339. package/dist/render/render-batch-system.js +223 -0
  340. package/dist/render/render-features.d.ts +47 -0
  341. package/dist/render/render-features.d.ts.map +1 -0
  342. package/dist/render/render-features.js +105 -0
  343. package/dist/render/render-settings.d.ts +35 -0
  344. package/dist/render/render-settings.d.ts.map +1 -0
  345. package/dist/render/render-settings.js +51 -0
  346. package/dist/render/spark-renderer-lifecycle.d.ts +18 -0
  347. package/dist/render/spark-renderer-lifecycle.d.ts.map +1 -0
  348. package/dist/render/spark-renderer-lifecycle.js +57 -0
  349. package/dist/render/viewport-shading.d.ts +17 -0
  350. package/dist/render/viewport-shading.d.ts.map +1 -0
  351. package/dist/render/viewport-shading.js +87 -0
  352. package/dist/runtime/create-runtime.d.ts +259 -0
  353. package/dist/runtime/create-runtime.d.ts.map +1 -0
  354. package/dist/runtime/create-runtime.js +666 -0
  355. package/dist/runtime/debug-bridge.d.ts +288 -0
  356. package/dist/runtime/debug-bridge.d.ts.map +1 -0
  357. package/dist/runtime/debug-bridge.js +277 -0
  358. package/dist/runtime/debug-registry.d.ts +287 -0
  359. package/dist/runtime/debug-registry.d.ts.map +1 -0
  360. package/dist/runtime/debug-registry.js +528 -0
  361. package/dist/runtime/dev-layers.d.ts +34 -0
  362. package/dist/runtime/dev-layers.d.ts.map +1 -0
  363. package/dist/runtime/dev-layers.js +40 -0
  364. package/dist/runtime/frame-selector-cache.d.ts +41 -0
  365. package/dist/runtime/frame-selector-cache.d.ts.map +1 -0
  366. package/dist/runtime/frame-selector-cache.js +65 -0
  367. package/dist/runtime/game.d.ts +576 -0
  368. package/dist/runtime/game.d.ts.map +1 -0
  369. package/dist/runtime/game.js +1003 -0
  370. package/dist/runtime/gameplay-rng-trap.d.ts +47 -0
  371. package/dist/runtime/gameplay-rng-trap.d.ts.map +1 -0
  372. package/dist/runtime/gameplay-rng-trap.js +95 -0
  373. package/dist/runtime/input-router.d.ts +78 -0
  374. package/dist/runtime/input-router.d.ts.map +1 -0
  375. package/dist/runtime/input-router.js +171 -0
  376. package/dist/runtime/mount-game.d.ts +126 -0
  377. package/dist/runtime/mount-game.d.ts.map +1 -0
  378. package/dist/runtime/mount-game.js +159 -0
  379. package/dist/runtime/mount-manifest.d.ts +174 -0
  380. package/dist/runtime/mount-manifest.d.ts.map +1 -0
  381. package/dist/runtime/mount-manifest.js +304 -0
  382. package/dist/runtime/presentation.d.ts +85 -0
  383. package/dist/runtime/presentation.d.ts.map +1 -0
  384. package/dist/runtime/presentation.js +92 -0
  385. package/dist/runtime/render-audio-control.d.ts +126 -0
  386. package/dist/runtime/render-audio-control.d.ts.map +1 -0
  387. package/dist/runtime/render-audio-control.js +116 -0
  388. package/dist/runtime/render-control.d.ts +347 -0
  389. package/dist/runtime/render-control.d.ts.map +1 -0
  390. package/dist/runtime/render-control.js +317 -0
  391. package/dist/runtime/render-seed.d.ts +56 -0
  392. package/dist/runtime/render-seed.d.ts.map +1 -0
  393. package/dist/runtime/render-seed.js +73 -0
  394. package/dist/runtime/state-bridge.d.ts +60 -0
  395. package/dist/runtime/state-bridge.d.ts.map +1 -0
  396. package/dist/runtime/state-bridge.js +62 -0
  397. package/dist/runtime/types.d.ts +285 -0
  398. package/dist/runtime/types.d.ts.map +1 -0
  399. package/dist/runtime/types.js +1 -0
  400. package/dist/runtime/unexported-game-trap.d.ts +36 -0
  401. package/dist/runtime/unexported-game-trap.d.ts.map +1 -0
  402. package/dist/runtime/unexported-game-trap.js +80 -0
  403. package/dist/setup/setup-audio.d.ts +20 -0
  404. package/dist/setup/setup-audio.d.ts.map +1 -0
  405. package/dist/setup/setup-audio.js +41 -0
  406. package/dist/setup/setup-particles.d.ts +17 -0
  407. package/dist/setup/setup-particles.d.ts.map +1 -0
  408. package/dist/setup/setup-particles.js +16 -0
  409. package/dist/setup/setup-physics.d.ts +25 -0
  410. package/dist/setup/setup-physics.d.ts.map +1 -0
  411. package/dist/setup/setup-physics.js +51 -0
  412. package/dist/setup/setup-renderer.d.ts +82 -0
  413. package/dist/setup/setup-renderer.d.ts.map +1 -0
  414. package/dist/setup/setup-renderer.js +381 -0
  415. package/dist/world3d-react/engine-bridge.d.ts +47 -0
  416. package/dist/world3d-react/engine-bridge.d.ts.map +1 -0
  417. package/dist/world3d-react/engine-bridge.js +48 -0
  418. package/dist/world3d-react/index.d.ts +47 -0
  419. package/dist/world3d-react/index.d.ts.map +1 -0
  420. package/dist/world3d-react/index.js +46 -0
  421. package/dist/world3d-react/r3f-adapter.d.ts +51 -0
  422. package/dist/world3d-react/r3f-adapter.d.ts.map +1 -0
  423. package/dist/world3d-react/r3f-adapter.js +368 -0
  424. package/dist/world3d-react/r3f-root-factory.d.ts +62 -0
  425. package/dist/world3d-react/r3f-root-factory.d.ts.map +1 -0
  426. package/dist/world3d-react/r3f-root-factory.js +79 -0
  427. package/dist/world3d-react/rapier-physics-bridge.d.ts +76 -0
  428. package/dist/world3d-react/rapier-physics-bridge.d.ts.map +1 -0
  429. package/dist/world3d-react/rapier-physics-bridge.js +120 -0
  430. package/dist/world3d-react/renderer-config.d.ts +58 -0
  431. package/dist/world3d-react/renderer-config.d.ts.map +1 -0
  432. package/dist/world3d-react/renderer-config.js +96 -0
  433. package/dist/world3d-react/world-context.d.ts +123 -0
  434. package/dist/world3d-react/world-context.d.ts.map +1 -0
  435. package/dist/world3d-react/world-context.js +204 -0
  436. package/dist-config/config.js +303 -0
  437. package/dist-config/config.js.map +7 -0
  438. package/package.json +14 -3
  439. package/src/adapter/rapier-physics-adapter.ts +77 -34
  440. package/src/config.ts +8 -0
  441. package/src/core/frame-pacing.ts +26 -0
  442. package/src/core/game-loop.ts +4 -3
  443. package/src/dev/instruments.ts +302 -0
  444. package/src/runtime/mount-game.ts +6 -0
  445. package/src/runtime/unexported-game-trap.ts +82 -0
  446. package/src/setup/setup-renderer.ts +2 -0
  447. package/src/world3d-react/index.ts +9 -0
  448. package/src/world3d-react/rapier-physics-bridge.tsx +137 -0
@@ -0,0 +1,105 @@
1
+ import { z } from 'zod';
2
+ export const RENDER_FEATURES = [
3
+ {
4
+ key: 'autoBatch',
5
+ label: 'Auto-batching',
6
+ description: 'Automatically batch entities sharing geometry+material into one draw call (InstancedMesh/BatchedMesh) while keeping each Object3D as the handle. The headline perf win; opt out per-entity for custom-shader/skinned meshes.',
7
+ kind: 'toggle',
8
+ default: true,
9
+ apply: 'live',
10
+ perEntity: true,
11
+ },
12
+ {
13
+ key: 'frustumCulling',
14
+ label: 'Frustum culling',
15
+ description: 'Per-instance frustum culling for batched content.',
16
+ kind: 'toggle',
17
+ default: true,
18
+ apply: 'live',
19
+ perEntity: true,
20
+ },
21
+ {
22
+ key: 'lod',
23
+ label: 'Level of detail',
24
+ description: 'Distance-based geometry swap (LOD) for eligible entities.',
25
+ kind: 'toggle',
26
+ default: true,
27
+ apply: 'live',
28
+ perEntity: true,
29
+ },
30
+ {
31
+ key: 'shadows',
32
+ label: 'Shadows',
33
+ description: 'Enable the shadow map. Per-entity cast/receive still applies.',
34
+ kind: 'toggle',
35
+ default: true,
36
+ apply: 'live',
37
+ perEntity: true,
38
+ },
39
+ {
40
+ key: 'postProcessing',
41
+ label: 'Post-processing',
42
+ description: 'Master switch for the post-processing stack (individual effects nest beneath it).',
43
+ kind: 'toggle',
44
+ default: true,
45
+ apply: 'live',
46
+ perEntity: false,
47
+ },
48
+ {
49
+ key: 'resolutionScale',
50
+ label: 'Resolution scale',
51
+ description: 'Device-pixel-ratio multiplier (1.0 = native). The cheapest perf dial.',
52
+ kind: 'number',
53
+ default: 1,
54
+ apply: 'live',
55
+ perEntity: false,
56
+ range: [0.25, 2],
57
+ },
58
+ {
59
+ key: 'antialias',
60
+ label: 'Antialiasing',
61
+ description: 'MSAA via renderer construction. Applies on reload (renderer re-init).',
62
+ kind: 'toggle',
63
+ default: true,
64
+ apply: 'reload',
65
+ perEntity: false,
66
+ },
67
+ {
68
+ key: 'backend',
69
+ label: 'Renderer backend',
70
+ description: 'GPU backend: auto picks WebGPU when available, else WebGL2. Applies on reload.',
71
+ kind: 'enum',
72
+ default: 'auto',
73
+ apply: 'reload',
74
+ perEntity: false,
75
+ options: ['auto', 'webgl', 'webgpu'],
76
+ },
77
+ ];
78
+ /** Map for O(1) lookup by key. */
79
+ export const RENDER_FEATURE_BY_KEY = new Map(RENDER_FEATURES.map((f) => [f.key, f]));
80
+ /**
81
+ * Build a Zod object for the render settings, derived from the registry so the
82
+ * schema can never drift from the feature list. All fields optional — absence
83
+ * means "inherit" in the cascade. `perEntityOnly` builds the per-entity override
84
+ * schema (only features whose `perEntity` is true).
85
+ */
86
+ export function buildRenderingZod(opts = {}) {
87
+ const shape = {};
88
+ for (const f of RENDER_FEATURES) {
89
+ if (opts.perEntityOnly && !f.perEntity)
90
+ continue;
91
+ let base;
92
+ if (f.kind === 'toggle')
93
+ base = z.boolean();
94
+ else if (f.kind === 'number')
95
+ base = z.number();
96
+ else
97
+ base = z.enum(f.options);
98
+ shape[f.key] = base.optional().describe(f.description);
99
+ }
100
+ return z
101
+ .object(shape)
102
+ .describe(opts.perEntityOnly
103
+ ? 'Per-entity render overrides (omit a field to inherit from the scene/engine default)'
104
+ : 'Scene render settings (omit a field to inherit the engine default)');
105
+ }
@@ -0,0 +1,35 @@
1
+ import { type RenderFeatureValue } from './render-features';
2
+ /**
3
+ * Cascade resolution for render settings: engine default → scene → entity, with
4
+ * tri-state inherit (an absent value inherits from the next level up)..
5
+ */
6
+ /** A partial override map (scene-level or entity-level). Absent key = inherit. */
7
+ export type RenderScope = Partial<Record<string, RenderFeatureValue>>;
8
+ /** Fully-resolved settings: every registry key present. */
9
+ export type ResolvedRenderSettings = Record<string, RenderFeatureValue>;
10
+ /**
11
+ * Resolve effective settings. `entity` overrides only apply to features whose
12
+ * `perEntity` flag is set; non-per-entity features resolve across engine→scene
13
+ * only. `??` walks up the chain on `undefined` (inherit) but lets an explicit
14
+ * `false`/`0` override (they are not nullish).
15
+ */
16
+ export declare function resolveRenderSettings(scene?: RenderScope, entity?: RenderScope): ResolvedRenderSettings;
17
+ /**
18
+ * A small observable holding the live scene-level resolved settings. Live
19
+ * features re-apply when a value changes (subscribers are notified with the
20
+ * changed key). This is the seam a future player-facing graphics menu would
21
+ * drive — for now it backs the editor toggles + the runtime systems.
22
+ */
23
+ export declare class RenderSettings {
24
+ private values;
25
+ private listeners;
26
+ constructor(scene?: RenderScope);
27
+ get(key: string): RenderFeatureValue;
28
+ /** Set a scene-level value; notifies subscribers if it changed. */
29
+ set(key: string, value: RenderFeatureValue): void;
30
+ /** Resolve the effective value for an entity (entity override → scene → default). */
31
+ forEntity(key: string, entity?: RenderScope): RenderFeatureValue;
32
+ subscribe(fn: (key: string, value: RenderFeatureValue) => void): () => void;
33
+ snapshot(): ResolvedRenderSettings;
34
+ }
35
+ //# sourceMappingURL=render-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render-settings.d.ts","sourceRoot":"","sources":["../../src/render/render-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE7E;;;GAGG;AAEH,kFAAkF;AAClF,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAEtE,2DAA2D;AAC3D,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,CAAC,EAAE,WAAW,EACnB,MAAM,CAAC,EAAE,WAAW,GACnB,sBAAsB,CAOxB;AAED;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,SAAS,CAA+D;gBAEpE,KAAK,CAAC,EAAE,WAAW;IAI/B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB;IAIpC,mEAAmE;IACnE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,IAAI;IAMjD,qFAAqF;IACrF,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,kBAAkB;IAKhE,SAAS,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,KAAK,IAAI,GAAG,MAAM,IAAI;IAK3E,QAAQ,IAAI,sBAAsB;CAGnC"}
@@ -0,0 +1,51 @@
1
+ import { RENDER_FEATURES } from './render-features';
2
+ /**
3
+ * Resolve effective settings. `entity` overrides only apply to features whose
4
+ * `perEntity` flag is set; non-per-entity features resolve across engine→scene
5
+ * only. `??` walks up the chain on `undefined` (inherit) but lets an explicit
6
+ * `false`/`0` override (they are not nullish).
7
+ */
8
+ export function resolveRenderSettings(scene, entity) {
9
+ const out = {};
10
+ for (const f of RENDER_FEATURES) {
11
+ const entityVal = f.perEntity ? entity?.[f.key] : undefined;
12
+ out[f.key] = entityVal ?? scene?.[f.key] ?? f.default;
13
+ }
14
+ return out;
15
+ }
16
+ /**
17
+ * A small observable holding the live scene-level resolved settings. Live
18
+ * features re-apply when a value changes (subscribers are notified with the
19
+ * changed key). This is the seam a future player-facing graphics menu would
20
+ * drive — for now it backs the editor toggles + the runtime systems.
21
+ */
22
+ export class RenderSettings {
23
+ values;
24
+ listeners = new Set();
25
+ constructor(scene) {
26
+ this.values = resolveRenderSettings(scene);
27
+ }
28
+ get(key) {
29
+ return this.values[key];
30
+ }
31
+ /** Set a scene-level value; notifies subscribers if it changed. */
32
+ set(key, value) {
33
+ if (this.values[key] === value)
34
+ return;
35
+ this.values[key] = value;
36
+ for (const fn of this.listeners)
37
+ fn(key, value);
38
+ }
39
+ /** Resolve the effective value for an entity (entity override → scene → default). */
40
+ forEntity(key, entity) {
41
+ const f = entity?.[key];
42
+ return f ?? this.values[key];
43
+ }
44
+ subscribe(fn) {
45
+ this.listeners.add(fn);
46
+ return () => this.listeners.delete(fn);
47
+ }
48
+ snapshot() {
49
+ return { ...this.values };
50
+ }
51
+ }
@@ -0,0 +1,18 @@
1
+ import type { SparkRenderer } from '@sparkjsdev/spark';
2
+ import type * as THREE from 'three';
3
+ export declare const SPARK_DISCOVERY_INTERVAL_MS = 500;
4
+ /** Gate fallback discovery so ordinary non-splat scenes are never traversed every frame. */
5
+ export declare function shouldDiscoverGaussianSplat(lastCheckAt: number, now: number): boolean;
6
+ /** True when a native scene currently contains at least one Gaussian payload. */
7
+ export declare function sceneHasGaussianSplat(scene: THREE.Object3D): boolean;
8
+ /**
9
+ * Stop and dispose Spark after its asynchronous depth-sort worker is idle.
10
+ *
11
+ * SparkRenderer.dispose() rejects any worker calls still in flight. Spark's
12
+ * automatic update path intentionally does not await those calls, so disposing
13
+ * synchronously during an editor stop otherwise produces an unhandled
14
+ * `Worker terminate` rejection. Disable future work immediately, then release
15
+ * the renderer once the current sort has naturally settled.
16
+ */
17
+ export declare function disposeSparkRendererWhenIdle(renderer: SparkRenderer): void;
18
+ //# sourceMappingURL=spark-renderer-lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spark-renderer-lifecycle.d.ts","sourceRoot":"","sources":["../../src/render/spark-renderer-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAKpC,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C,4FAA4F;AAC5F,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAErF;AAED,iFAAiF;AACjF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,QAAQ,GAAG,OAAO,CAMpE;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAgC1E"}
@@ -0,0 +1,57 @@
1
+ import { hasUserData } from '../ecs/user-data';
2
+ const IDLE_POLL_MS = 16;
3
+ const MAX_IDLE_WAIT_MS = 3_000;
4
+ export const SPARK_DISCOVERY_INTERVAL_MS = 500;
5
+ /** Gate fallback discovery so ordinary non-splat scenes are never traversed every frame. */
6
+ export function shouldDiscoverGaussianSplat(lastCheckAt, now) {
7
+ return now - lastCheckAt >= SPARK_DISCOVERY_INTERVAL_MS;
8
+ }
9
+ /** True when a native scene currently contains at least one Gaussian payload. */
10
+ export function sceneHasGaussianSplat(scene) {
11
+ let found = false;
12
+ scene.traverse((object) => {
13
+ if (!found && hasUserData(object, 'gaussianSplat'))
14
+ found = true;
15
+ });
16
+ return found;
17
+ }
18
+ /**
19
+ * Stop and dispose Spark after its asynchronous depth-sort worker is idle.
20
+ *
21
+ * SparkRenderer.dispose() rejects any worker calls still in flight. Spark's
22
+ * automatic update path intentionally does not await those calls, so disposing
23
+ * synchronously during an editor stop otherwise produces an unhandled
24
+ * `Worker terminate` rejection. Disable future work immediately, then release
25
+ * the renderer once the current sort has naturally settled.
26
+ */
27
+ export function disposeSparkRendererWhenIdle(renderer) {
28
+ renderer.autoUpdate = false;
29
+ renderer.sortDirty = false;
30
+ if (renderer.updateTimeoutId !== -1) {
31
+ clearTimeout(renderer.updateTimeoutId);
32
+ renderer.updateTimeoutId = -1;
33
+ }
34
+ if (renderer.sortTimeoutId !== -1) {
35
+ clearTimeout(renderer.sortTimeoutId);
36
+ renderer.sortTimeoutId = -1;
37
+ }
38
+ let remainingIdleWaitMs = MAX_IDLE_WAIT_MS;
39
+ const disposeWhenIdle = () => {
40
+ if (renderer.sorting) {
41
+ if (remainingIdleWaitMs > 0) {
42
+ remainingIdleWaitMs -= IDLE_POLL_MS;
43
+ setTimeout(disposeWhenIdle, IDLE_POLL_MS);
44
+ }
45
+ else {
46
+ // A stuck upstream worker is safer to abandon than to turn a routine
47
+ // editor stop into an unhandled rejection. Page teardown will reclaim
48
+ // the worker; normal sorts complete in a few milliseconds.
49
+ // biome-ignore lint/suspicious/noConsole: This rare upstream worker leak must degrade loudly.
50
+ console.warn('SparkRenderer did not become idle; skipped worker termination.');
51
+ }
52
+ return;
53
+ }
54
+ renderer.dispose();
55
+ };
56
+ disposeWhenIdle();
57
+ }
@@ -0,0 +1,17 @@
1
+ import * as THREE from 'three';
2
+ /** Temporary developer-facing shading modes. These never become scene data. */
3
+ export type ViewportShadingMode = 'solid' | 'unlit' | 'wireframe' | 'normals' | 'overdraw';
4
+ /**
5
+ * Applies a render-only material view and restores every native material in a
6
+ * `finally` block. Gameplay and authoring therefore always observe the real
7
+ * materials; only renderer work inside {@link render} sees the diagnostic view.
8
+ */
9
+ export declare class ViewportShadingRenderer {
10
+ private readonly _derived;
11
+ private readonly _normals;
12
+ private readonly _overdraw;
13
+ render(scene: THREE.Scene, mode: ViewportShadingMode, draw: () => void, include?: (mesh: THREE.Mesh) => boolean): void;
14
+ dispose(): void;
15
+ private _materialFor;
16
+ }
17
+ //# sourceMappingURL=viewport-shading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewport-shading.d.ts","sourceRoot":"","sources":["../../src/render/viewport-shading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,+EAA+E;AAC/E,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;AAoB3F;;;;GAIG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2C;IACpE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAkC;IAC3D,OAAO,CAAC,QAAQ,CAAC,SAAS,CASvB;IAEH,MAAM,CACJ,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,IAAI,EAAE,mBAAmB,EACzB,IAAI,EAAE,MAAM,IAAI,EAChB,OAAO,GAAE,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,OAAoB,GAClD,IAAI;IA0BP,OAAO,IAAI,IAAI;IAUf,OAAO,CAAC,YAAY;CAgCrB"}
@@ -0,0 +1,87 @@
1
+ import * as THREE from 'three';
2
+ function materialColor(material) {
3
+ const color = material.color;
4
+ return color?.clone() ?? new THREE.Color(0xbec7d1);
5
+ }
6
+ function textureOf(material, key) {
7
+ return (material[key] ?? null);
8
+ }
9
+ /**
10
+ * Applies a render-only material view and restores every native material in a
11
+ * `finally` block. Gameplay and authoring therefore always observe the real
12
+ * materials; only renderer work inside {@link render} sees the diagnostic view.
13
+ */
14
+ export class ViewportShadingRenderer {
15
+ _derived = new Map();
16
+ _normals = new THREE.MeshNormalMaterial();
17
+ _overdraw = new THREE.MeshBasicMaterial({
18
+ color: 0xffffff,
19
+ transparent: true,
20
+ opacity: 0.08,
21
+ depthTest: false,
22
+ depthWrite: false,
23
+ blending: THREE.AdditiveBlending,
24
+ side: THREE.DoubleSide,
25
+ toneMapped: false,
26
+ });
27
+ render(scene, mode, draw, include = () => true) {
28
+ if (mode === 'solid') {
29
+ draw();
30
+ return;
31
+ }
32
+ const originals = [];
33
+ scene.traverse((object) => {
34
+ const mesh = object;
35
+ if (!mesh.isMesh || !mesh.material || !include(mesh))
36
+ return;
37
+ originals.push({ mesh, material: mesh.material });
38
+ mesh.material = Array.isArray(mesh.material)
39
+ ? mesh.material.map((material) => this._materialFor(material, mode))
40
+ : this._materialFor(mesh.material, mode);
41
+ });
42
+ try {
43
+ draw();
44
+ }
45
+ finally {
46
+ for (const { mesh, material } of originals)
47
+ mesh.material = material;
48
+ }
49
+ }
50
+ dispose() {
51
+ for (const pair of this._derived.values()) {
52
+ pair.unlit.dispose();
53
+ pair.wireframe.dispose();
54
+ }
55
+ this._derived.clear();
56
+ this._normals.dispose();
57
+ this._overdraw.dispose();
58
+ }
59
+ _materialFor(material, mode) {
60
+ if (mode === 'normals')
61
+ return this._normals;
62
+ if (mode === 'overdraw')
63
+ return this._overdraw;
64
+ let pair = this._derived.get(material);
65
+ if (!pair) {
66
+ const common = {
67
+ color: materialColor(material),
68
+ map: textureOf(material, 'map'),
69
+ alphaMap: textureOf(material, 'alphaMap'),
70
+ alphaTest: material.alphaTest,
71
+ opacity: material.opacity,
72
+ transparent: material.transparent,
73
+ side: material.side,
74
+ depthTest: material.depthTest,
75
+ depthWrite: material.depthWrite,
76
+ vertexColors: Boolean(material.vertexColors),
77
+ fog: material.fog ?? true,
78
+ };
79
+ pair = {
80
+ unlit: new THREE.MeshBasicMaterial(common),
81
+ wireframe: new THREE.MeshBasicMaterial({ ...common, wireframe: true }),
82
+ };
83
+ this._derived.set(material, pair);
84
+ }
85
+ return pair[mode];
86
+ }
87
+ }
@@ -0,0 +1,259 @@
1
+ import * as THREE from 'three';
2
+ import type { DomHostContext } from '../adapter/host-context';
3
+ import type { MountedPixiRoot, MountedReactRoot, MountedRoot, MountedThreeRoot, RootAdapter } from '../adapter/root-adapter';
4
+ import { type Game, type GameInternal, type RootInstance } from './game';
5
+ import type { PlaytestContext } from './types';
6
+ /**
7
+ * Register a three world onto the Game shell. `opts.id` defaults to
8
+ * `'main'` — the single-world callers (`createGameRuntime`, slice-1/2 tests)
9
+ * are unaffected; a second/third world (T7.1 slice 3's two-world proof, and
10
+ * real multi-world manifests later) pass an explicit id. This is the ONE
11
+ * registration code path for a three world, whatever its id.
12
+ */
13
+ export declare function registerThreeRoot(game: GameInternal, adapter: RootAdapter, mounted: MountedThreeRoot, opts?: {
14
+ id?: string | undefined;
15
+ pausable?: boolean | undefined;
16
+ }): RootInstance;
17
+ /**
18
+ * Register a canvas world onto the Game shell — the pixi analog of
19
+ * {@link registerThreeRoot}. `adapter` is the seam's own
20
+ * `RootAdapter<'canvas'>`; `RootInstance.adapter` itself only needs `.id`
21
+ * (`AdapterHandle`, `runtime/game.ts`), so this passes through with zero cast.
22
+ * `stage` is the one field every `MountedPixiRoot` actually carries.
23
+ */
24
+ export declare function registerPixiRoot(game: GameInternal, adapter: RootAdapter<'canvas'>, mounted: MountedPixiRoot, opts?: {
25
+ id?: string | undefined;
26
+ pausable?: boolean | undefined;
27
+ }): RootInstance;
28
+ /**
29
+ * Register a react world onto the Game shell (T6.2 slice 1) — the react
30
+ * analog of {@link registerThreeRoot}/{@link registerPixiRoot}. A react
31
+ * world has no `frame` hooks (react's own
32
+ * `createRoot` schedules its commits; `GameInternal.runFrame` correctly
33
+ * leaves a world with no `frame` untouched by its opaque-`update` fallback
34
+ * too, since `MountedReactGame` declares no `update`). `adapter` is typed
35
+ * as the real {@link ReactRootAdapter} shape (T7.5, same reasoning as
36
+ * `registerPixiRoot`'s doc comment above) — `RootInstance.adapter` only
37
+ * needs `.id`, so this passes through with zero cast.
38
+ */
39
+ export declare function registerReactRoot(game: GameInternal, adapter: RootAdapter<'dom'>, mounted: MountedReactRoot, container: HTMLElement, opts?: {
40
+ id?: string | undefined;
41
+ pausable?: boolean | undefined;
42
+ }): RootInstance;
43
+ /**
44
+ * One world to mount in the {@link RootsRuntimeConfig} roots path (T6.1
45
+ * slice 1) — the host-facing mirror of `manifest/load.ts`'s
46
+ * `ResolvedAdapterRoot` (same `id`/`zOrder`/`pausable`/`loop` fields; the
47
+ * manifest-to-host translation itself is the editor's job, not this file's).
48
+ *
49
+ * `react` (T6.2 slice 1) mounts as a DOM-root layer `<div>` in the SAME
50
+ * stack instead of a canvas — see {@link ReactRootMountSpec}/{@link
51
+ * ReactRootAdapter} below.
52
+ */
53
+ export interface RootMountSpecBase {
54
+ /** Manifest id — must be unique within one `roots` array. */
55
+ readonly id: string;
56
+ /** Canvas stacking order (D5 §1); ties broken by array
57
+ * order, mirroring `manifest/load.ts`'s `loadGameManifest` sort. Defaults
58
+ * to `0`. */
59
+ readonly zOrder?: number | undefined;
60
+ /** Whether play-mode pause/step applies to this world (D10). Defaults to `true`. */
61
+ readonly pausable?: boolean | undefined;
62
+ /**
63
+ * `vgai.project.json`'s `dev: true` — this root is a DEV LAYER (the game's
64
+ * own dev GUI), not shipped game content. Two things happen here: the
65
+ * surface is stacked ABOVE every non-dev root (a dev layer sits topmost),
66
+ * and it is marked `data-vgai-dev-layer="true"` so the play compositor can
67
+ * leave it out of a capture (`composite-screenshot.ts`). Whether a dev root
68
+ * reaches this function at all is the CALLER's gate —
69
+ * `mountManifestRoots` asks `devLayersEnabled()` before building the spec.
70
+ *
71
+ * It steals no input from the game while closed for a reason that predates
72
+ * this flag and needs no new mechanism: a dev layer is a `dom` root, DOM
73
+ * layers are `pointer-events:none` (see `mountOneReactRoot`) with the
74
+ * mounted tree opting individual elements back in, and the input router
75
+ * never sees DOM roots at all.
76
+ */
77
+ readonly dev?: boolean | undefined;
78
+ /** `'gated'` (host-driven, default) or `'self-driven'` (this world drives
79
+ * its own loop — D5's "composited, unsynchronized" tier). Carried through
80
+ * for parity with `ResolvedAdapterRoot`; T6.1 slice 1 does not yet
81
+ * validate it against the mounted adapter's actual `drivesOwnLoop` (that
82
+ * cross-check, if ever needed, is T7.6's loop-gate surface). */
83
+ readonly loop?: 'gated' | 'self-driven' | undefined;
84
+ /**
85
+ * Optional claim predicate for the delegating input router (D5 §2a), over
86
+ * a point RELATIVE TO THE CONTAINER. Absent means: this world claims only
87
+ * if it ends up the bottom (lowest zOrder) world — see
88
+ * `input-router.ts`'s `resolveClaimingRoot`.
89
+ */
90
+ readonly hitTest?: ((x: number, y: number) => boolean) | undefined;
91
+ }
92
+ export interface ThreeRootMountSpec extends RootMountSpecBase {
93
+ readonly kind: 'three';
94
+ readonly adapter: RootAdapter;
95
+ }
96
+ /**
97
+ * `adapter` is the SEAM's `RootAdapter<'canvas'>` — a canvas root's mount
98
+ * honestly returns only a `MountedPixiRoot`, and naming the real contract
99
+ * here is what keeps the resolver cast-free.
100
+ */
101
+ export interface PixiRootMountSpec extends RootMountSpecBase {
102
+ readonly kind: 'canvas';
103
+ readonly adapter: RootAdapter<'canvas'>;
104
+ }
105
+ /**
106
+ * A live, mounted react world (T6.2 slice 1) — the react analog of a mounted
107
+ * canvas world. React roots render from game state via the T7.4 bridge
108
+ * instead of a per-frame `update`, so this shape carries no `update`/`fixedUpdate`/
109
+ * `ctx`/`frame` — `drivesOwnLoop` is always `false` (react's `createRoot`
110
+ * schedules its OWN commits; the host's fixed-step loop never drives it,
111
+ * and it is correctly skipped by `GameInternal.runFrame`'s per-world
112
+ * `frame`-hooks/opaque-`update` dispatch — see `registerReactRoot` below,
113
+ * which registers this `RootInstance` with no `frame`, same as any other
114
+ * opaque mount with nothing to tick).
115
+ *
116
+ * Deliberately carries NO `firstParty: true` brand: that brand specifically
117
+ * means "has a `.ctx: GameContext`" (`isFirstPartyMounted`,
118
+ * `runtime/game.ts`) — a react world has no Rapier/ComponentManager/
119
+ * GameContext at all, so branding it first-party would be a type lie.
120
+ * `Game.registerRoot`'s "no state bridge" console warning explicitly exempts
121
+ * `kind: 'dom'` (§7.1-15): a react world has no `observe` BY DESIGN — that
122
+ * hook is scoped to `useRootObservation` (the ingested/foreign-world case),
123
+ * not `useWorldState` (`ui/game-state.tsx`), which a react world's own
124
+ * mounted tree uses instead — it reads `Game.state` directly (T7.4's actual
125
+ * bridge for first-party-observable state), never a per-world `observe`.
126
+ *
127
+ * `kind`/`container` (T7.5) satisfy `MountedReactRoot` (`adapter/
128
+ * root-adapter.ts`) — `container` is the SAME `DomHostContext.container` the
129
+ * adapter's `mount` was handed (identity matters, mirroring `threeScene()`/
130
+ * `pixiStage()`'s "same instance the adapter mounted" contract); every
131
+ * `ReactRootAdapter` implementer echoes it back here so `mounted` alone
132
+ * (with no separately-threaded `container`) satisfies the union
133
+ * `RootInstanceInit.mounted`/`RootInstance.mounted` with zero cast.
134
+ */
135
+ export interface MountedReactGame extends MountedReactRoot {
136
+ readonly drivesOwnLoop: false;
137
+ }
138
+ /**
139
+ * A react-shaped adapter — the structural contract `RootMountSpec`'s
140
+ * `react` variant requires. Deliberately
141
+ * NOT tied to a concrete implementer here so an editor-resolved adapter (the
142
+ * `default-react` resolver branch, T6.2's editor-side follow-up) can satisfy
143
+ * this shape without this file importing react-dom or any editor code.
144
+ *
145
+ * A genuine `RootAdapter<'dom'>` refinement (`HostContextFor<'dom'>` =
146
+ * `DomHostContext` = {@link DomHostContext}), narrowing only the return type to
147
+ * {@link MountedReactGame}.
148
+ */
149
+ export interface ReactRootAdapter extends RootAdapter<'dom'> {
150
+ readonly id: string;
151
+ mount(host: DomHostContext): Promise<MountedReactGame>;
152
+ }
153
+ /** WO-34, same reasoning as {@link PixiRootMountSpec} above: the seam's
154
+ * `RootAdapter<'dom'>` is what a DOM root actually guarantees. */
155
+ export interface ReactRootMountSpec extends RootMountSpecBase {
156
+ readonly kind: 'dom';
157
+ readonly adapter: RootAdapter<'dom'>;
158
+ }
159
+ export type RootMountSpec = ThreeRootMountSpec | PixiRootMountSpec | ReactRootMountSpec;
160
+ /**
161
+ * Mount N adapter roots (three + canvas + react)
162
+ * on ONE `Game`, stacked in `container` per D5 §1.
163
+ * `roots[0]` participates in `Game.defaultRoot`'s existing "first three
164
+ * root, else first root" rule.
165
+ */
166
+ export interface RootsRuntimeConfig {
167
+ /** The host creates one absolutely-positioned surface per world inside
168
+ * this element (D5 §1) — a canvas for three/canvas, a DOM-root `<div>`
169
+ * layer for react — plus one shared UI overlay above all of them. */
170
+ container: HTMLElement;
171
+ roots: RootMountSpec[];
172
+ width?: number | undefined;
173
+ height?: number | undefined;
174
+ /**
175
+ * Mirrors `ThreeHostContext.headless` (Node conformance tests — no GPU): skips
176
+ * real `WebGLRenderer` construction for every three world in this
177
+ * session (a stand-in renderer is used instead, exactly as
178
+ * `SetupThreeRootAdapter.mount` already special-cases `host.headless`
179
+ * internally). Pixijs roots are unaffected — Pixi already falls back to
180
+ * a 2D canvas renderer with no GPU. Never set `true` in a real host.
181
+ */
182
+ headless?: boolean | undefined;
183
+ /** D15 (T-D15.1) — the root seed `ctx.random` boots from on every world
184
+ * mounted onto this session's Game, forwarded to `createGame` BEFORE any
185
+ * world's `mount()`/`setup()` runs (this function constructs the Game
186
+ * first — see `createRootsGameRuntime`). The manifest-aware boot path
187
+ * (`mount-manifest.ts`'s `mountManifestRoots`) is the real caller that
188
+ * resolves this from `manifest.determinism`/`?vgai-seed=`/its own
189
+ * explicit-config leg; a caller building `RootsRuntimeConfig` by hand
190
+ * (a test, a bespoke host) may also set it directly. Omitting it falls
191
+ * back to `createGame`'s own fixed default. */
192
+ seed?: number | undefined;
193
+ /** Private-play or Team Test identity supplied by the host. Networking
194
+ * remains game-owned; games may use `roomKey` in their direct room join. */
195
+ playtest?: PlaytestContext | null | undefined;
196
+ /**
197
+ * Test-only overrides for the render-control seam this host now wires up
198
+ * for EVERY session (see `createRootsGameRuntime`): `location` is where
199
+ * `?vgai-render=1` is read from (defaults to the real `window.location`;
200
+ * a Node test has no `window` and must inject one to exercise the seam),
201
+ * `target` is where the harness publishes (defaults to the real `window`
202
+ * — override in a unit test to avoid touching the global object; mirrors
203
+ * `RenderControlHarnessOptions.target`/`.location` and the
204
+ * `debugBridge.url` override precedent in `mount-manifest.ts`).
205
+ */
206
+ renderControl?: {
207
+ readonly location?: {
208
+ readonly search: string;
209
+ } | undefined;
210
+ readonly target?: Record<string, unknown> | undefined;
211
+ } | undefined;
212
+ }
213
+ /**
214
+ * Handle returned by createGameRuntime() for controlling the running game.
215
+ *
216
+ * This is the GENERIC host handle — it has no first-party concepts (no
217
+ * `GameContext`, no `GameSetupFn`). First-party features (the live `GameContext`,
218
+ * warm-restart hot reload) are reached by casting `mounted` to `MountedSetupThreeRoot`
219
+ * (the editor does this for HMR/physics-sync — those are inherently first-party).
220
+ *
221
+ * `scene`/`camera`/`mounted` alias the Game's `defaultRoot`: it is the first
222
+ * three root (else the first
223
+ * world) by DECLARATION order, per `Game.defaultRoot`'s existing rule —
224
+ * independent of `zOrder`/canvas stacking, which is a rendering-only concern.
225
+ */
226
+ export interface GameSession {
227
+ stop(): void;
228
+ pause(): void;
229
+ resume(): void;
230
+ step(): void;
231
+ /** Resize every world's render buffer. `pixelRatio` (W2c device preview)
232
+ * optionally re-pins the three renderers' DPR in the same pass; omitted,
233
+ * the mount-time ratio is left untouched (legacy behavior). */
234
+ resize(width: number, height: number, pixelRatio?: number): void;
235
+ readonly scene: THREE.Scene;
236
+ readonly camera: THREE.PerspectiveCamera;
237
+ /** The default world's mounted root, as the honest `MountedRoot` union —
238
+ * narrow on `.kind` before reaching for a surface's own members (the same
239
+ * discriminant `scene`/`camera` above use). This deliberately does NOT
240
+ * claim `MountedThreeRoot`: a roots-path session whose default world is
241
+ * canvas or dom returns that world's mount, and the old
242
+ * `as MountedThreeRoot` cast made every such value a type-level lie. For a
243
+ * first-party three mount, narrow to `'three'` and cast to
244
+ * `MountedSetupThreeRoot` for the first-party extras. */
245
+ readonly mounted: MountedRoot;
246
+ /** The Game root (T6.1 slice 1) — the multi-world entry point
247
+ * (`game.roots`/`game.world(id)`/`game.queryByComponent`) for callers
248
+ * that need more than the default-world aliases above. */
249
+ readonly game: Game;
250
+ }
251
+ /**
252
+ * Bootstrap the game host and mount a game adapter.
253
+ *
254
+ * `createGameRuntime` is the universal HOST: it owns the root surfaces,
255
+ * renderers, loop, and asset cache. Every game — including a one-root game —
256
+ * uses the same explicit adapter-root path.
257
+ */
258
+ export declare function createGameRuntime(config: RootsRuntimeConfig): Promise<GameSession>;
259
+ //# sourceMappingURL=create-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/create-runtime.ts"],"names":[],"mappings":"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"}