@vgai/engine 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/adapter/authoring.d.ts +404 -0
- package/dist/adapter/authoring.d.ts.map +1 -0
- package/dist/adapter/authoring.js +22 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts +43 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -0
- package/dist/adapter/colyseus-networking-adapter.js +38 -0
- package/dist/adapter/first-party-systems.d.ts +38 -0
- package/dist/adapter/first-party-systems.d.ts.map +1 -0
- package/dist/adapter/first-party-systems.js +77 -0
- package/dist/adapter/game-adapter.d.ts +133 -0
- package/dist/adapter/game-adapter.d.ts.map +1 -0
- package/dist/adapter/game-adapter.js +10 -0
- package/dist/adapter/host-context.d.ts +73 -0
- package/dist/adapter/host-context.d.ts.map +1 -0
- package/dist/adapter/host-context.js +16 -0
- package/dist/adapter/index.d.ts +22 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/index.js +15 -0
- package/dist/adapter/ingest/game-contract.d.ts +53 -0
- package/dist/adapter/ingest/game-contract.d.ts.map +1 -0
- package/dist/adapter/ingest/game-contract.js +30 -0
- package/dist/adapter/ingest/overlay-applier.d.ts +118 -0
- package/dist/adapter/ingest/overlay-applier.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-applier.js +132 -0
- package/dist/adapter/ingest/overlay-apply.d.ts +60 -0
- package/dist/adapter/ingest/overlay-apply.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-apply.js +101 -0
- package/dist/adapter/ingest/overlay-file.d.ts +79 -0
- package/dist/adapter/ingest/overlay-file.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-file.js +66 -0
- package/dist/adapter/ingest/overlay-report.d.ts +113 -0
- package/dist/adapter/ingest/overlay-report.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-report.js +103 -0
- package/dist/adapter/ingest/scene-capture.d.ts +97 -0
- package/dist/adapter/ingest/scene-capture.d.ts.map +1 -0
- package/dist/adapter/ingest/scene-capture.js +248 -0
- package/dist/adapter/ingest/upstream-pin.d.ts +47 -0
- package/dist/adapter/ingest/upstream-pin.d.ts.map +1 -0
- package/dist/adapter/ingest/upstream-pin.js +50 -0
- package/dist/adapter/loop-gate-report.d.ts +34 -0
- package/dist/adapter/loop-gate-report.d.ts.map +1 -0
- package/dist/adapter/loop-gate-report.js +37 -0
- package/dist/adapter/rapier-physics-adapter.d.ts +12 -0
- package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -0
- package/dist/adapter/rapier-physics-adapter.js +46 -0
- package/dist/adapter/system-adapter.d.ts +133 -0
- package/dist/adapter/system-adapter.d.ts.map +1 -0
- package/dist/adapter/system-adapter.js +13 -0
- package/dist/adapter/transform.d.ts +18 -0
- package/dist/adapter/transform.d.ts.map +1 -0
- package/dist/adapter/transform.js +1 -0
- package/dist/adapter/vgai-scene-game-adapter.d.ts +116 -0
- package/dist/adapter/vgai-scene-game-adapter.d.ts.map +1 -0
- package/dist/adapter/vgai-scene-game-adapter.js +714 -0
- package/dist/adapter/world-kind.d.ts +30 -0
- package/dist/adapter/world-kind.d.ts.map +1 -0
- package/dist/adapter/world-kind.js +18 -0
- package/dist/ai/navigation.d.ts +64 -0
- package/dist/ai/navigation.d.ts.map +1 -0
- package/dist/ai/navigation.js +133 -0
- package/dist/animation/anim-graph-types.d.ts +25 -0
- package/dist/animation/anim-graph-types.d.ts.map +1 -0
- package/dist/animation/anim-graph-types.js +1 -0
- package/dist/animation/animation-clock.d.ts +213 -0
- package/dist/animation/animation-clock.d.ts.map +1 -0
- package/dist/animation/animation-clock.js +301 -0
- package/dist/animation/blend-node.d.ts +22 -0
- package/dist/animation/blend-node.d.ts.map +1 -0
- package/dist/animation/blend-node.js +97 -0
- package/dist/animation/camera-ownership.d.ts +250 -0
- package/dist/animation/camera-ownership.d.ts.map +1 -0
- package/dist/animation/camera-ownership.js +169 -0
- package/dist/animation/cinematic-cues.d.ts +200 -0
- package/dist/animation/cinematic-cues.d.ts.map +1 -0
- package/dist/animation/cinematic-cues.js +213 -0
- package/dist/animation/clip-map.d.ts +12 -0
- package/dist/animation/clip-map.d.ts.map +1 -0
- package/dist/animation/clip-map.js +37 -0
- package/dist/animation/gsap-registration.d.ts +119 -0
- package/dist/animation/gsap-registration.d.ts.map +1 -0
- package/dist/animation/gsap-registration.js +92 -0
- package/dist/animation/theatre-clock-binding.d.ts +89 -0
- package/dist/animation/theatre-clock-binding.d.ts.map +1 -0
- package/dist/animation/theatre-clock-binding.js +29 -0
- package/dist/animation/theatre-director.d.ts +242 -0
- package/dist/animation/theatre-director.d.ts.map +1 -0
- package/dist/animation/theatre-director.js +235 -0
- package/dist/animation/theatre-object-binding.d.ts +305 -0
- package/dist/animation/theatre-object-binding.d.ts.map +1 -0
- package/dist/animation/theatre-object-binding.js +351 -0
- package/dist/animation/xstate-animation-binding.d.ts +111 -0
- package/dist/animation/xstate-animation-binding.d.ts.map +1 -0
- package/dist/animation/xstate-animation-binding.js +307 -0
- package/dist/animation/xstate-animation-meta.d.ts +228 -0
- package/dist/animation/xstate-animation-meta.d.ts.map +1 -0
- package/dist/animation/xstate-animation-meta.js +221 -0
- package/dist/assets.d.ts +26 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +55 -0
- package/dist/audio/index.d.ts +4 -0
- package/dist/audio/index.d.ts.map +1 -0
- package/dist/audio/index.js +24 -0
- package/dist/audio/tone-clock-binding.d.ts +75 -0
- package/dist/audio/tone-clock-binding.d.ts.map +1 -0
- package/dist/audio/tone-clock-binding.js +29 -0
- package/dist/audio/tone-context.d.ts +114 -0
- package/dist/audio/tone-context.d.ts.map +1 -0
- package/dist/audio/tone-context.js +39 -0
- package/dist/audio/tone-offline-render.d.ts +90 -0
- package/dist/audio/tone-offline-render.d.ts.map +1 -0
- package/dist/audio/tone-offline-render.js +56 -0
- package/dist/audio/wav-encode.d.ts +38 -0
- package/dist/audio/wav-encode.d.ts.map +1 -0
- package/dist/audio/wav-encode.js +97 -0
- package/dist/core/game-loop.d.ts +21 -0
- package/dist/core/game-loop.d.ts.map +1 -0
- package/dist/core/game-loop.js +130 -0
- package/dist/core/system-runner.d.ts +120 -0
- package/dist/core/system-runner.d.ts.map +1 -0
- package/dist/core/system-runner.js +286 -0
- package/dist/core/types.d.ts +58 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +25 -0
- package/dist/data/data-asset.d.ts +101 -0
- package/dist/data/data-asset.d.ts.map +1 -0
- package/dist/data/data-asset.js +122 -0
- package/dist/data/data-check-core.d.ts +110 -0
- package/dist/data/data-check-core.d.ts.map +1 -0
- package/dist/data/data-check-core.js +178 -0
- package/dist/data/data-ref.d.ts +79 -0
- package/dist/data/data-ref.d.ts.map +1 -0
- package/dist/data/data-ref.js +130 -0
- package/dist/data/vite-plugin-data.d.ts +79 -0
- package/dist/data/vite-plugin-data.d.ts.map +1 -0
- package/dist/data/vite-plugin-data.js +217 -0
- package/dist/dev/console-bridge.d.ts +22 -0
- package/dist/dev/console-bridge.d.ts.map +1 -0
- package/dist/dev/console-bridge.js +71 -0
- package/dist/dev/debug-draw.d.ts +24 -0
- package/dist/dev/debug-draw.d.ts.map +1 -0
- package/dist/dev/debug-draw.js +73 -0
- package/dist/dev/logger.d.ts +30 -0
- package/dist/dev/logger.d.ts.map +1 -0
- package/dist/dev/logger.js +90 -0
- package/dist/ecs/component-manager.d.ts +189 -0
- package/dist/ecs/component-manager.d.ts.map +1 -0
- package/dist/ecs/component-manager.js +676 -0
- package/dist/ecs/game-component.d.ts +97 -0
- package/dist/ecs/game-component.d.ts.map +1 -0
- package/dist/ecs/game-component.js +80 -0
- package/dist/ecs/hmr-swap-report.d.ts +53 -0
- package/dist/ecs/hmr-swap-report.d.ts.map +1 -0
- package/dist/ecs/hmr-swap-report.js +55 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/input/input-manager.d.ts +596 -0
- package/dist/input/input-manager.d.ts.map +1 -0
- package/dist/input/input-manager.js +1564 -0
- package/dist/input/input-types.d.ts +171 -0
- package/dist/input/input-types.d.ts.map +1 -0
- package/dist/input/input-types.js +1 -0
- package/dist/input/prompt-labels.d.ts +21 -0
- package/dist/input/prompt-labels.d.ts.map +1 -0
- package/dist/input/prompt-labels.js +121 -0
- package/dist/input/rebind-controller.d.ts +59 -0
- package/dist/input/rebind-controller.d.ts.map +1 -0
- package/dist/input/rebind-controller.js +85 -0
- package/dist/input/schema.d.ts +16 -0
- package/dist/input/schema.d.ts.map +1 -0
- package/dist/input/schema.js +228 -0
- package/dist/loader.d.ts +43 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +59 -0
- package/dist/manifest/index.d.ts +5 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +8 -0
- package/dist/manifest/load-file.d.ts +4 -0
- package/dist/manifest/load-file.d.ts.map +1 -0
- package/dist/manifest/load-file.js +14 -0
- package/dist/manifest/load.d.ts +117 -0
- package/dist/manifest/load.d.ts.map +1 -0
- package/dist/manifest/load.js +255 -0
- package/dist/manifest/schema.d.ts +173 -0
- package/dist/manifest/schema.d.ts.map +1 -0
- package/dist/manifest/schema.js +302 -0
- package/dist/physics/collision-system.d.ts +41 -0
- package/dist/physics/collision-system.d.ts.map +1 -0
- package/dist/physics/collision-system.js +64 -0
- package/dist/physics/physics-registry.d.ts +45 -0
- package/dist/physics/physics-registry.d.ts.map +1 -0
- package/dist/physics/physics-registry.js +65 -0
- package/dist/physics/transform-writer.d.ts +16 -0
- package/dist/physics/transform-writer.d.ts.map +1 -0
- package/dist/physics/transform-writer.js +38 -0
- package/dist/physics/trigger-dispatch.d.ts +24 -0
- package/dist/physics/trigger-dispatch.d.ts.map +1 -0
- package/dist/physics/trigger-dispatch.js +80 -0
- package/dist/react/game-state.d.ts +105 -0
- package/dist/react/game-state.d.ts.map +1 -0
- package/dist/react/game-state.js +144 -0
- package/dist/react/use-data.d.ts +60 -0
- package/dist/react/use-data.d.ts.map +1 -0
- package/dist/react/use-data.js +96 -0
- package/dist/react/use-selection.d.ts +75 -0
- package/dist/react/use-selection.d.ts.map +1 -0
- package/dist/react/use-selection.js +90 -0
- package/dist/render/auto-batcher.d.ts +34 -0
- package/dist/render/auto-batcher.d.ts.map +1 -0
- package/dist/render/auto-batcher.js +140 -0
- package/dist/render/render-batch-system.d.ts +33 -0
- package/dist/render/render-batch-system.d.ts.map +1 -0
- package/dist/render/render-batch-system.js +230 -0
- package/dist/render/render-features.d.ts +47 -0
- package/dist/render/render-features.d.ts.map +1 -0
- package/dist/render/render-features.js +105 -0
- package/dist/render/render-settings.d.ts +36 -0
- package/dist/render/render-settings.d.ts.map +1 -0
- package/dist/render/render-settings.js +51 -0
- package/dist/runtime/create-runtime.d.ts +280 -0
- package/dist/runtime/create-runtime.d.ts.map +1 -0
- package/dist/runtime/create-runtime.js +795 -0
- package/dist/runtime/frame-selector-cache.d.ts +41 -0
- package/dist/runtime/frame-selector-cache.d.ts.map +1 -0
- package/dist/runtime/frame-selector-cache.js +65 -0
- package/dist/runtime/game.d.ts +433 -0
- package/dist/runtime/game.d.ts.map +1 -0
- package/dist/runtime/game.js +569 -0
- package/dist/runtime/input-router.d.ts +78 -0
- package/dist/runtime/input-router.d.ts.map +1 -0
- package/dist/runtime/input-router.js +171 -0
- package/dist/runtime/mount-game.d.ts +129 -0
- package/dist/runtime/mount-game.d.ts.map +1 -0
- package/dist/runtime/mount-game.js +152 -0
- package/dist/runtime/mount-manifest.d.ts +119 -0
- package/dist/runtime/mount-manifest.d.ts.map +1 -0
- package/dist/runtime/mount-manifest.js +204 -0
- package/dist/runtime/render-audio-control.d.ts +110 -0
- package/dist/runtime/render-audio-control.d.ts.map +1 -0
- package/dist/runtime/render-audio-control.js +111 -0
- package/dist/runtime/render-control.d.ts +291 -0
- package/dist/runtime/render-control.d.ts.map +1 -0
- package/dist/runtime/render-control.js +264 -0
- package/dist/runtime/render-seed.d.ts +57 -0
- package/dist/runtime/render-seed.d.ts.map +1 -0
- package/dist/runtime/render-seed.js +74 -0
- package/dist/runtime/scene-ui-bridge.d.ts +69 -0
- package/dist/runtime/scene-ui-bridge.d.ts.map +1 -0
- package/dist/runtime/scene-ui-bridge.js +23 -0
- package/dist/runtime/scene-ui-data.d.ts +13 -0
- package/dist/runtime/scene-ui-data.d.ts.map +1 -0
- package/dist/runtime/scene-ui-data.js +92 -0
- package/dist/runtime/state-bridge.d.ts +47 -0
- package/dist/runtime/state-bridge.d.ts.map +1 -0
- package/dist/runtime/state-bridge.js +53 -0
- package/dist/runtime/types.d.ts +179 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +1 -0
- package/dist/scene/asset-loaders.d.ts +79 -0
- package/dist/scene/asset-loaders.d.ts.map +1 -0
- package/dist/scene/asset-loaders.js +141 -0
- package/dist/scene/asset-paths.d.ts +11 -0
- package/dist/scene/asset-paths.d.ts.map +1 -0
- package/dist/scene/asset-paths.js +108 -0
- package/dist/scene/asset-ref-check.d.ts +88 -0
- package/dist/scene/asset-ref-check.d.ts.map +1 -0
- package/dist/scene/asset-ref-check.js +214 -0
- package/dist/scene/asset-registry.d.ts +30 -0
- package/dist/scene/asset-registry.d.ts.map +1 -0
- package/dist/scene/asset-registry.js +50 -0
- package/dist/scene/collider-dimensions.d.ts +63 -0
- package/dist/scene/collider-dimensions.d.ts.map +1 -0
- package/dist/scene/collider-dimensions.js +98 -0
- package/dist/scene/component-registry.d.ts +17 -0
- package/dist/scene/component-registry.d.ts.map +1 -0
- package/dist/scene/component-registry.js +28 -0
- package/dist/scene/defaults.d.ts +252 -0
- package/dist/scene/defaults.d.ts.map +1 -0
- package/dist/scene/defaults.js +151 -0
- package/dist/scene/geometries/index.d.ts +8 -0
- package/dist/scene/geometries/index.d.ts.map +1 -0
- package/dist/scene/geometries/index.js +7 -0
- package/dist/scene/geometries/terrain.d.ts +2 -0
- package/dist/scene/geometries/terrain.d.ts.map +1 -0
- package/dist/scene/geometries/terrain.js +37 -0
- package/dist/scene/geometry-registry.d.ts +24 -0
- package/dist/scene/geometry-registry.d.ts.map +1 -0
- package/dist/scene/geometry-registry.js +20 -0
- package/dist/scene/instance-registry.d.ts +36 -0
- package/dist/scene/instance-registry.d.ts.map +1 -0
- package/dist/scene/instance-registry.js +55 -0
- package/dist/scene/instancers/grid.d.ts +2 -0
- package/dist/scene/instancers/grid.d.ts.map +1 -0
- package/dist/scene/instancers/grid.js +36 -0
- package/dist/scene/instancers/index.d.ts +8 -0
- package/dist/scene/instancers/index.d.ts.map +1 -0
- package/dist/scene/instancers/index.js +7 -0
- package/dist/scene/light-camera-factory.d.ts +23 -0
- package/dist/scene/light-camera-factory.d.ts.map +1 -0
- package/dist/scene/light-camera-factory.js +68 -0
- package/dist/scene/material-factory.d.ts +17 -0
- package/dist/scene/material-factory.d.ts.map +1 -0
- package/dist/scene/material-factory.js +197 -0
- package/dist/scene/material-registry.d.ts +40 -0
- package/dist/scene/material-registry.d.ts.map +1 -0
- package/dist/scene/material-registry.js +44 -0
- package/dist/scene/materials/index.d.ts +8 -0
- package/dist/scene/materials/index.d.ts.map +1 -0
- package/dist/scene/materials/index.js +7 -0
- package/dist/scene/materials/water.d.ts +2 -0
- package/dist/scene/materials/water.d.ts.map +1 -0
- package/dist/scene/materials/water.js +54 -0
- package/dist/scene/parse.d.ts +23 -0
- package/dist/scene/parse.d.ts.map +1 -0
- package/dist/scene/parse.js +179 -0
- package/dist/scene/particles-factory.d.ts +33 -0
- package/dist/scene/particles-factory.d.ts.map +1 -0
- package/dist/scene/particles-factory.js +282 -0
- package/dist/scene/scene-apply.d.ts +109 -0
- package/dist/scene/scene-apply.d.ts.map +1 -0
- package/dist/scene/scene-apply.js +326 -0
- package/dist/scene/scene-diff-schema.d.ts +285 -0
- package/dist/scene/scene-diff-schema.d.ts.map +1 -0
- package/dist/scene/scene-diff-schema.js +92 -0
- package/dist/scene/scene-diff-types.d.ts +40 -0
- package/dist/scene/scene-diff-types.d.ts.map +1 -0
- package/dist/scene/scene-diff-types.js +14 -0
- package/dist/scene/scene-loader.d.ts +177 -0
- package/dist/scene/scene-loader.d.ts.map +1 -0
- package/dist/scene/scene-loader.js +1213 -0
- package/dist/scene/scene-query.d.ts +11 -0
- package/dist/scene/scene-query.d.ts.map +1 -0
- package/dist/scene/scene-query.js +63 -0
- package/dist/scene/scene-types.d.ts +10 -0
- package/dist/scene/scene-types.d.ts.map +1 -0
- package/dist/scene/scene-types.js +8 -0
- package/dist/scene/scene-version.d.ts +26 -0
- package/dist/scene/scene-version.d.ts.map +1 -0
- package/dist/scene/scene-version.js +34 -0
- package/dist/scene/schema/animation.d.ts +8 -0
- package/dist/scene/schema/animation.d.ts.map +1 -0
- package/dist/scene/schema/animation.js +42 -0
- package/dist/scene/schema/audio.d.ts +13 -0
- package/dist/scene/schema/audio.d.ts.map +1 -0
- package/dist/scene/schema/audio.js +22 -0
- package/dist/scene/schema/camera.d.ts +28 -0
- package/dist/scene/schema/camera.d.ts.map +1 -0
- package/dist/scene/schema/camera.js +17 -0
- package/dist/scene/schema/collider.d.ts +40 -0
- package/dist/scene/schema/collider.d.ts.map +1 -0
- package/dist/scene/schema/collider.js +55 -0
- package/dist/scene/schema/entity-ref.d.ts +31 -0
- package/dist/scene/schema/entity-ref.d.ts.map +1 -0
- package/dist/scene/schema/entity-ref.js +61 -0
- package/dist/scene/schema/entity.d.ts +1036 -0
- package/dist/scene/schema/entity.d.ts.map +1 -0
- package/dist/scene/schema/entity.js +153 -0
- package/dist/scene/schema/environment.d.ts +425 -0
- package/dist/scene/schema/environment.d.ts.map +1 -0
- package/dist/scene/schema/environment.js +357 -0
- package/dist/scene/schema/index.d.ts +39 -0
- package/dist/scene/schema/index.d.ts.map +1 -0
- package/dist/scene/schema/index.js +20 -0
- package/dist/scene/schema/instances.d.ts +14 -0
- package/dist/scene/schema/instances.d.ts.map +1 -0
- package/dist/scene/schema/instances.js +28 -0
- package/dist/scene/schema/joint.d.ts +23 -0
- package/dist/scene/schema/joint.d.ts.map +1 -0
- package/dist/scene/schema/joint.js +23 -0
- package/dist/scene/schema/light.d.ts +38 -0
- package/dist/scene/schema/light.d.ts.map +1 -0
- package/dist/scene/schema/light.js +26 -0
- package/dist/scene/schema/material.d.ts +199 -0
- package/dist/scene/schema/material.d.ts.map +1 -0
- package/dist/scene/schema/material.js +99 -0
- package/dist/scene/schema/mesh.d.ts +48 -0
- package/dist/scene/schema/mesh.d.ts.map +1 -0
- package/dist/scene/schema/mesh.js +82 -0
- package/dist/scene/schema/particles.d.ts +2178 -0
- package/dist/scene/schema/particles.d.ts.map +1 -0
- package/dist/scene/schema/particles.js +321 -0
- package/dist/scene/schema/physics.d.ts +56 -0
- package/dist/scene/schema/physics.d.ts.map +1 -0
- package/dist/scene/schema/physics.js +37 -0
- package/dist/scene/schema/scene-file.d.ts +304 -0
- package/dist/scene/schema/scene-file.d.ts.map +1 -0
- package/dist/scene/schema/scene-file.js +262 -0
- package/dist/scene/schema/shadow.d.ts +28 -0
- package/dist/scene/schema/shadow.d.ts.map +1 -0
- package/dist/scene/schema/shadow.js +20 -0
- package/dist/scene/schema/spline.d.ts +25 -0
- package/dist/scene/schema/spline.d.ts.map +1 -0
- package/dist/scene/schema/spline.js +15 -0
- package/dist/scene/schema/tuples.d.ts +12 -0
- package/dist/scene/schema/tuples.d.ts.map +1 -0
- package/dist/scene/schema/tuples.js +14 -0
- package/dist/scene/schema/ui.d.ts +880 -0
- package/dist/scene/schema/ui.d.ts.map +1 -0
- package/dist/scene/schema/ui.js +506 -0
- package/dist/scene/user-data.d.ts +171 -0
- package/dist/scene/user-data.d.ts.map +1 -0
- package/dist/scene/user-data.js +137 -0
- package/dist/setup/setup-audio.d.ts +20 -0
- package/dist/setup/setup-audio.d.ts.map +1 -0
- package/dist/setup/setup-audio.js +41 -0
- package/dist/setup/setup-particles.d.ts +17 -0
- package/dist/setup/setup-particles.d.ts.map +1 -0
- package/dist/setup/setup-particles.js +16 -0
- package/dist/setup/setup-physics.d.ts +25 -0
- package/dist/setup/setup-physics.d.ts.map +1 -0
- package/dist/setup/setup-physics.js +51 -0
- package/dist/setup/setup-renderer.d.ts +69 -0
- package/dist/setup/setup-renderer.d.ts.map +1 -0
- package/dist/setup/setup-renderer.js +363 -0
- package/dist/tools/define-tool.d.ts +105 -0
- package/dist/tools/define-tool.d.ts.map +1 -0
- package/dist/tools/define-tool.js +82 -0
- package/dist/world2d/authoring-2d.d.ts +76 -0
- package/dist/world2d/authoring-2d.d.ts.map +1 -0
- package/dist/world2d/authoring-2d.js +176 -0
- package/dist/world2d/capture-to-scene2d.d.ts +5 -0
- package/dist/world2d/capture-to-scene2d.d.ts.map +1 -0
- package/dist/world2d/capture-to-scene2d.js +49 -0
- package/dist/world2d/collision-2d.d.ts +52 -0
- package/dist/world2d/collision-2d.d.ts.map +1 -0
- package/dist/world2d/collision-2d.js +70 -0
- package/dist/world2d/components-2d.d.ts +47 -0
- package/dist/world2d/components-2d.d.ts.map +1 -0
- package/dist/world2d/components-2d.js +77 -0
- package/dist/world2d/index.d.ts +34 -0
- package/dist/world2d/index.d.ts.map +1 -0
- package/dist/world2d/index.js +32 -0
- package/dist/world2d/ingest-iframe-2d.d.ts +82 -0
- package/dist/world2d/ingest-iframe-2d.d.ts.map +1 -0
- package/dist/world2d/ingest-iframe-2d.js +166 -0
- package/dist/world2d/ingest2d.d.ts +97 -0
- package/dist/world2d/ingest2d.d.ts.map +1 -0
- package/dist/world2d/ingest2d.js +40 -0
- package/dist/world2d/physics2d-registry.d.ts +24 -0
- package/dist/world2d/physics2d-registry.d.ts.map +1 -0
- package/dist/world2d/physics2d-registry.js +38 -0
- package/dist/world2d/pixi-game-adapter.d.ts +107 -0
- package/dist/world2d/pixi-game-adapter.d.ts.map +1 -0
- package/dist/world2d/pixi-game-adapter.js +211 -0
- package/dist/world2d/pixi-surface.d.ts +39 -0
- package/dist/world2d/pixi-surface.d.ts.map +1 -0
- package/dist/world2d/pixi-surface.js +47 -0
- package/dist/world2d/scene-capture-2d.d.ts +43 -0
- package/dist/world2d/scene-capture-2d.d.ts.map +1 -0
- package/dist/world2d/scene-capture-2d.js +92 -0
- package/dist/world2d/scene2d-loader.d.ts +27 -0
- package/dist/world2d/scene2d-loader.d.ts.map +1 -0
- package/dist/world2d/scene2d-loader.js +274 -0
- package/dist/world2d/schema/entity2d.d.ts +102 -0
- package/dist/world2d/schema/entity2d.d.ts.map +1 -0
- package/dist/world2d/schema/entity2d.js +119 -0
- package/dist/world2d/schema/physics2d.d.ts +46 -0
- package/dist/world2d/schema/physics2d.d.ts.map +1 -0
- package/dist/world2d/schema/physics2d.js +45 -0
- package/dist/world2d/schema/sprite.d.ts +42 -0
- package/dist/world2d/schema/sprite.d.ts.map +1 -0
- package/dist/world2d/schema/sprite.js +63 -0
- package/dist/world2d/schema/tilemap.d.ts +15 -0
- package/dist/world2d/schema/tilemap.d.ts.map +1 -0
- package/dist/world2d/schema/tilemap.js +19 -0
- package/dist/world2d/schema/tuples2d.d.ts +20 -0
- package/dist/world2d/schema/tuples2d.d.ts.map +1 -0
- package/dist/world2d/schema/tuples2d.js +19 -0
- package/dist/world2d/system-adapters-2d.d.ts +16 -0
- package/dist/world2d/system-adapters-2d.d.ts.map +1 -0
- package/dist/world2d/system-adapters-2d.js +37 -0
- package/dist/world2d/transform-writer-2d.d.ts +16 -0
- package/dist/world2d/transform-writer-2d.d.ts.map +1 -0
- package/dist/world2d/transform-writer-2d.js +22 -0
- package/dist/world2d/types.d.ts +53 -0
- package/dist/world2d/types.d.ts.map +1 -0
- package/dist/world2d/types.js +1 -0
- package/package.json +18 -4
- package/src/adapter/authoring.ts +10 -0
- package/src/adapter/first-party-systems.ts +23 -34
- package/src/adapter/index.ts +1 -3
- package/src/adapter/system-adapter.ts +15 -22
- package/src/adapter/vgai-scene-game-adapter.ts +5 -14
- package/src/animation/anim-graph-types.ts +12 -43
- package/src/animation/animation-clock.ts +479 -0
- package/src/animation/camera-ownership.ts +467 -0
- package/src/animation/cinematic-cues.ts +451 -0
- package/src/animation/clip-map.ts +41 -0
- package/src/animation/gsap-registration.ts +184 -0
- package/src/animation/theatre-clock-binding.ts +111 -0
- package/src/animation/theatre-director.ts +347 -0
- package/src/animation/theatre-object-binding.ts +661 -0
- package/src/animation/xstate-animation-binding.ts +398 -0
- package/src/animation/xstate-animation-meta.ts +282 -0
- package/src/audio/index.ts +39 -7
- package/src/audio/tone-clock-binding.ts +98 -0
- package/src/audio/tone-context.ts +129 -0
- package/src/audio/tone-offline-render.ts +167 -0
- package/src/audio/wav-encode.ts +119 -0
- package/src/core/game-loop.ts +17 -0
- package/src/core/types.ts +13 -0
- package/src/data/data-asset.ts +167 -0
- package/src/data/data-check-core.ts +242 -0
- package/src/data/data-ref.ts +145 -0
- package/src/data/vite-plugin-data.ts +290 -0
- package/src/index.ts +48 -0
- package/src/input/input-manager.ts +1206 -32
- package/src/input/input-types.ts +155 -3
- package/src/input/prompt-labels.ts +122 -0
- package/src/input/rebind-controller.ts +105 -0
- package/src/input/schema.ts +206 -52
- package/src/react/use-data.ts +114 -0
- package/src/react/use-selection.tsx +135 -0
- package/src/runtime/create-runtime.ts +30 -9
- package/src/runtime/render-audio-control.ts +168 -0
- package/src/runtime/render-control.ts +522 -0
- package/src/runtime/render-seed.ts +79 -0
- package/src/runtime/types.ts +0 -5
- package/src/scene/asset-loaders.ts +10 -36
- package/src/scene/asset-paths.ts +0 -2
- package/src/scene/asset-ref-check.ts +248 -0
- package/src/scene/parse.ts +133 -0
- package/src/scene/scene-loader.ts +81 -96
- package/src/scene/schema/animation.ts +30 -79
- package/src/scene/schema/entity.ts +20 -0
- package/src/scene/schema/index.ts +2 -12
- package/src/scene/user-data.ts +8 -9
- package/src/setup/setup-renderer.ts +9 -2
- package/src/tools/define-tool.ts +152 -0
- package/src/animation/anim-graph.ts +0 -406
- package/src/animation/anim-system.ts +0 -28
- package/src/animation/property-track.ts +0 -178
- package/src/animation/schema.ts +0 -204
- package/src/audio/ambient.ts +0 -300
- package/src/audio/impacts.ts +0 -212
- package/src/audio/movement.ts +0 -140
- package/src/audio/musical.ts +0 -200
- package/src/audio/ui-sounds.ts +0 -171
- package/src/audio/vehicle.ts +0 -235
- package/src/audio/weapons.ts +0 -152
|
@@ -0,0 +1,211 @@
|
|
|
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 (worlds-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();
|
|
50
|
+
systems.add('physics', () => rapier2dWorld.step(eventQueue));
|
|
51
|
+
systems.add('postPhysics', () => {
|
|
52
|
+
collisions2d.drain();
|
|
53
|
+
writeTransforms2D();
|
|
54
|
+
});
|
|
55
|
+
systems.add('render', () => surface.render());
|
|
56
|
+
const uiContainer = host.ui ?? document.createElement('div');
|
|
57
|
+
const ctx = {
|
|
58
|
+
app: surface.app,
|
|
59
|
+
stage: surface.world,
|
|
60
|
+
rapier2dWorld,
|
|
61
|
+
rapier2d: RAPIER,
|
|
62
|
+
physics2d,
|
|
63
|
+
collisions2d,
|
|
64
|
+
components: null,
|
|
65
|
+
systems,
|
|
66
|
+
uiContainer,
|
|
67
|
+
};
|
|
68
|
+
// T7.3 slice 1/2: the pixi world's components attach onto the SAME
|
|
69
|
+
// unified `ComponentManager` (`ecs/component-manager.ts`) the threejs
|
|
70
|
+
// path uses, constructed for kind `'pixijs'` — the world2d-silo manager
|
|
71
|
+
// is deleted (T7.3 slice 2). `ctx` is cast to `GameContext` for the
|
|
72
|
+
// manager's internal typing only: at runtime this object IS the real
|
|
73
|
+
// `World2DContext` above, so `GameComponent<'pixijs'>` subclasses that
|
|
74
|
+
// need real 2D ctx fields (e.g. `Camera2DFollow`, which widens its own
|
|
75
|
+
// `update`'s ctx param to `GameContext | World2DContext` and narrows
|
|
76
|
+
// back down) still receive their real ctx, unchanged behavior — the
|
|
77
|
+
// same cast `test/mirror-tree-guard.test.ts` uses for its unit-level
|
|
78
|
+
// pixi manager. `createComponentManager`'s positional `physics`
|
|
79
|
+
// parameter (the 3D `PhysicsRegistry`) is optional (T7.3 slice 2) and
|
|
80
|
+
// omitted here — a `'pixijs'`-kind manager never reads it (rigidBody/
|
|
81
|
+
// collider resolve from `physics2d` instead — see `resolvePhysicsRefs`
|
|
82
|
+
// in `ecs/component-manager.ts`).
|
|
83
|
+
ctx.components = createComponentManager(ctx, undefined, {
|
|
84
|
+
kind: 'pixijs',
|
|
85
|
+
physics2d,
|
|
86
|
+
});
|
|
87
|
+
collisions2d.onCollision(createTriggerDispatch2D(physics2d, ctx.components, rapier2dWorld, ctx));
|
|
88
|
+
// --- Load scene or run setup ---
|
|
89
|
+
let sceneInstance = null;
|
|
90
|
+
let cleanup = null;
|
|
91
|
+
if (sceneData) {
|
|
92
|
+
sceneInstance = await loadScene2DFromData(sceneData, ctx, registry);
|
|
93
|
+
}
|
|
94
|
+
else if (setup) {
|
|
95
|
+
cleanup = await setup(ctx);
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
kind: 'pixijs',
|
|
99
|
+
firstParty: true,
|
|
100
|
+
stage: surface.world,
|
|
101
|
+
scene: surface.world,
|
|
102
|
+
camera: surface.world,
|
|
103
|
+
drivesOwnLoop: false,
|
|
104
|
+
ctx,
|
|
105
|
+
update: (dt) => systems.run(dt),
|
|
106
|
+
resize: (w, h) => surface.resize(w, h),
|
|
107
|
+
// T7.3 slice 1: no `endFrame` hook — world2d has no per-substep
|
|
108
|
+
// post-phase work today (no `input.endFrame()` analog; HUD input is
|
|
109
|
+
// plain DOM events, not routed through an engine InputManager).
|
|
110
|
+
frame: {
|
|
111
|
+
runPhase: (phase, dt) => systems.runPhase(phase, dt),
|
|
112
|
+
},
|
|
113
|
+
dispose: () => {
|
|
114
|
+
cleanup?.dispose();
|
|
115
|
+
sceneInstance?.dispose();
|
|
116
|
+
ctx.components.clear();
|
|
117
|
+
physics2d.clear();
|
|
118
|
+
rapier2dWorld.free();
|
|
119
|
+
eventQueue.free();
|
|
120
|
+
surface.dispose();
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Host entry for world2d — the sibling of `createGameRuntime`, kept separate so the
|
|
127
|
+
* proven THREE host/interfaces are untouched (the stacked-own-root option the spec's
|
|
128
|
+
* surface-host-backend-neutral allows). Owns the canvas and constructs a real `Game`
|
|
129
|
+
* (T7.3 slice 1) with exactly one `'pixijs'`-kind `WorldInstance`, driven each fixed
|
|
130
|
+
* substep through `Game.runFrame` — the world2d analog of `createGameRuntime`'s
|
|
131
|
+
* `registerDefaultThreeWorld` (`runtime/create-runtime.ts`). Before T7.3 this ran its
|
|
132
|
+
* own standalone `createGameLoop` calling `mounted.update` directly; that loop is
|
|
133
|
+
* retired here in favor of one shared frame executor per game root.
|
|
134
|
+
*/
|
|
135
|
+
export async function createWorld2DRuntime(config) {
|
|
136
|
+
const { canvas, width, height, ui, ...sceneConfig } = config;
|
|
137
|
+
const adapter = new PixiSceneGameAdapter(sceneConfig);
|
|
138
|
+
const mounted = await adapter.mount({ canvas, width, height, ...(ui ? { ui } : {}) });
|
|
139
|
+
const assets = createAssetCache();
|
|
140
|
+
// `game` is referenced here before its `const` below only textually — this
|
|
141
|
+
// closure isn't invoked until `loop.start()`, well after `game` exists
|
|
142
|
+
// (same forward-reference pattern `create-runtime.ts` uses).
|
|
143
|
+
const loop = createGameLoop({
|
|
144
|
+
fixedTimestep: 1 / 60,
|
|
145
|
+
maxSubSteps: 8,
|
|
146
|
+
update: (dt) => {
|
|
147
|
+
game.runFrame(dt);
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
const game = createGame({ loop, assets });
|
|
151
|
+
// T7.5: `mounted` (a `MountedGame2D`, extending `MountedPixiWorld`) and
|
|
152
|
+
// `adapter` (this `PixiSceneGameAdapter`, satisfying `WorldInstance.adapter`'s
|
|
153
|
+
// minimal `AdapterHandle` shape — see that field's doc comment in
|
|
154
|
+
// `runtime/game.ts`) now pass through with ZERO cast — previously this cast
|
|
155
|
+
// through `GameAdapter`/`MountedGame`, which hardwired THREE `scene`/`camera`.
|
|
156
|
+
const pixiWorld = createWorldInstance({
|
|
157
|
+
id: 'main',
|
|
158
|
+
kind: 'pixijs',
|
|
159
|
+
adapter,
|
|
160
|
+
mounted,
|
|
161
|
+
stage: mounted.stage,
|
|
162
|
+
physics2d: mounted.ctx.physics2d,
|
|
163
|
+
collisions2d: mounted.ctx.collisions2d,
|
|
164
|
+
frame: mounted.frame,
|
|
165
|
+
});
|
|
166
|
+
// T7.2/T7.3 world-wiring backfill (mirrors `registerThreeWorld` in
|
|
167
|
+
// `create-runtime.ts`): scene-authored components attach DURING `mount()`,
|
|
168
|
+
// before this `WorldInstance` exists, so `instance.world` is left
|
|
169
|
+
// `undefined` for each of them — `adoptWorld` backfills it now, once, for
|
|
170
|
+
// every already-attached instance still missing a world.
|
|
171
|
+
mounted.ctx.components.adoptWorld(pixiWorld);
|
|
172
|
+
game.registerWorld(pixiWorld);
|
|
173
|
+
loop.start();
|
|
174
|
+
if (typeof window !== 'undefined' && import.meta.env?.DEV) {
|
|
175
|
+
window['__vgaiWorld2d'] = {
|
|
176
|
+
app: mounted.ctx.app,
|
|
177
|
+
stage: mounted.stage,
|
|
178
|
+
physics2d: mounted.ctx.physics2d,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
stop() {
|
|
183
|
+
loop.stop();
|
|
184
|
+
mounted.dispose();
|
|
185
|
+
},
|
|
186
|
+
// D10/T7.6: route through the real `Game.play` control surface instead of
|
|
187
|
+
// `loop.timeScale = 0/1` — that starved the accumulator entirely (per D1,
|
|
188
|
+
// zero substeps ⇒ zero renders too), the exact bug this control surface
|
|
189
|
+
// replaces. `Game.play.pause()` freezes this world's simulation (it is
|
|
190
|
+
// `pausable` by default) while its `render` phase keeps running every
|
|
191
|
+
// substep — the screen does not go black while paused.
|
|
192
|
+
pause() {
|
|
193
|
+
game.play.pause();
|
|
194
|
+
},
|
|
195
|
+
resume() {
|
|
196
|
+
game.play.resume();
|
|
197
|
+
},
|
|
198
|
+
step() {
|
|
199
|
+
game.play.step();
|
|
200
|
+
},
|
|
201
|
+
resize(w, h) {
|
|
202
|
+
// T7.5/T7.6 own real per-world resize routing through the Game/host
|
|
203
|
+
// surface split (the host is not yet surface-neutral for world2d) —
|
|
204
|
+
// kept as today's direct host→surface call for this slice.
|
|
205
|
+
mounted.resize?.(w, h);
|
|
206
|
+
},
|
|
207
|
+
get mounted() {
|
|
208
|
+
return mounted;
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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;AAmNnE,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"}
|