@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
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Canonical GLTF / texture
|
|
2
|
+
* Canonical GLTF / texture load + cache layer (A2). (Formerly also hosted the
|
|
3
|
+
* `.animgraph.json` loader — removed by E5; see
|
|
4
|
+
* packages/engine/src/animation/xstate-animation-binding.ts.)
|
|
3
5
|
*
|
|
4
6
|
* ONE place that owns the URL-keyed caches and the clone-safety contract, shared
|
|
5
7
|
* by BOTH the engine runtime (scene-loader, create-runtime) AND the editor
|
|
@@ -22,9 +24,7 @@
|
|
|
22
24
|
|
|
23
25
|
import * as THREE from 'three';
|
|
24
26
|
import * as SkeletonUtils from 'three/addons/utils/SkeletonUtils.js';
|
|
25
|
-
import
|
|
26
|
-
import { AnimGraphFileSchema } from '../animation/schema';
|
|
27
|
-
import { gltfLoader, resolveUrl, textureLoader } from '../loader';
|
|
27
|
+
import { gltfLoader, textureLoader } from '../loader';
|
|
28
28
|
import { SceneParseError } from './parse';
|
|
29
29
|
import { setUserData } from './user-data';
|
|
30
30
|
|
|
@@ -33,7 +33,6 @@ const gltfCache = new Map<
|
|
|
33
33
|
string,
|
|
34
34
|
Promise<{ scene: THREE.Group; animations: THREE.AnimationClip[] }>
|
|
35
35
|
>();
|
|
36
|
-
const animGraphCache = new Map<string, Promise<AnimGraphFile>>();
|
|
37
36
|
|
|
38
37
|
/** Load (and cache) a texture via the shared, prefix-aware TextureLoader. */
|
|
39
38
|
export function loadTexture(url: string): THREE.Texture {
|
|
@@ -146,34 +145,10 @@ export function resolveGltfNode(
|
|
|
146
145
|
}
|
|
147
146
|
|
|
148
147
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*/
|
|
154
|
-
export function loadAnimGraphData(src: string): Promise<AnimGraphFile> {
|
|
155
|
-
let cached = animGraphCache.get(src);
|
|
156
|
-
if (!cached) {
|
|
157
|
-
cached = fetch(resolveUrl(src))
|
|
158
|
-
.then((r) => {
|
|
159
|
-
if (!r.ok) throw new Error(`Failed to load animgraph: ${src}`);
|
|
160
|
-
return r.json();
|
|
161
|
-
})
|
|
162
|
-
.then((json) => {
|
|
163
|
-
const result = AnimGraphFileSchema.safeParse(json);
|
|
164
|
-
if (!result.success) throw new SceneParseError(result.error.issues, src);
|
|
165
|
-
return result.data;
|
|
166
|
-
});
|
|
167
|
-
animGraphCache.set(src, cached);
|
|
168
|
-
}
|
|
169
|
-
return cached;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Clear the module-level GLTF / texture / animgraph caches. Call on full runtime
|
|
174
|
-
* teardown (create-runtime fullCleanup / hot-reload) to release cached GPU
|
|
175
|
-
* resources and avoid leaking across editor Play sessions. See the lifetime note
|
|
176
|
-
* at the top of this file for why these are NOT cleared per scene load.
|
|
148
|
+
* Clear the module-level GLTF / texture caches. Call on full runtime teardown
|
|
149
|
+
* (create-runtime fullCleanup / hot-reload) to release cached GPU resources
|
|
150
|
+
* and avoid leaking across editor Play sessions. See the lifetime note at the
|
|
151
|
+
* top of this file for why these are NOT cleared per scene load.
|
|
177
152
|
*
|
|
178
153
|
* NOTE: the IBL/skybox env-map cache lives in scene-loader (it needs a
|
|
179
154
|
* WebGLRenderer for PMREM); scene-loader's `clearAssetCaches` wraps this and
|
|
@@ -182,7 +157,6 @@ export function loadAnimGraphData(src: string): Promise<AnimGraphFile> {
|
|
|
182
157
|
export function clearAssetCaches(): void {
|
|
183
158
|
textureCache.clear();
|
|
184
159
|
gltfCache.clear();
|
|
185
|
-
animGraphCache.clear();
|
|
186
160
|
}
|
|
187
161
|
|
|
188
162
|
/**
|
|
@@ -190,6 +164,6 @@ export function clearAssetCaches(): void {
|
|
|
190
164
|
* test to assert caches stay bounded (one entry per distinct asset URL) across
|
|
191
165
|
* repeated loads of the same scene, rather than growing per load.
|
|
192
166
|
*/
|
|
193
|
-
export function assetCacheSizes(): { textures: number; gltf: number
|
|
194
|
-
return { textures: textureCache.size, gltf: gltfCache.size
|
|
167
|
+
export function assetCacheSizes(): { textures: number; gltf: number } {
|
|
168
|
+
return { textures: textureCache.size, gltf: gltfCache.size };
|
|
195
169
|
}
|
package/src/scene/asset-paths.ts
CHANGED
|
@@ -75,7 +75,6 @@ export function collectAssetPaths(
|
|
|
75
75
|
if (e.particles?.material?.map) paths.add(e.particles.material.map);
|
|
76
76
|
|
|
77
77
|
if (e.audio?.src) paths.add(e.audio.src);
|
|
78
|
-
if (e.animation?.animGraph) paths.add(e.animation.animGraph);
|
|
79
78
|
if (e.prefab && isFilePrefab(e.prefab)) paths.add(e.prefab);
|
|
80
79
|
});
|
|
81
80
|
|
|
@@ -102,7 +101,6 @@ function renameInEntity(e: SceneEntity, oldPath: string, newPath: string): void
|
|
|
102
101
|
if (e.particles?.material?.map === oldPath) e.particles.material.map = newPath;
|
|
103
102
|
|
|
104
103
|
if (e.audio?.src === oldPath) e.audio.src = newPath;
|
|
105
|
-
if (e.animation?.animGraph === oldPath) e.animation.animGraph = newPath;
|
|
106
104
|
if (e.prefab === oldPath) e.prefab = newPath;
|
|
107
105
|
}
|
|
108
106
|
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared asset-reference integrity check (B6 follow-up to B2 item #20,
|
|
3
|
+
* docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md §8 B6).
|
|
4
|
+
*
|
|
5
|
+
* RELOCATED HERE (from `packages/vgai-cli/src/apply-diff.ts`, where it was
|
|
6
|
+
* originally built as `dereferenceNewAssetRefs`) so it can be shared by BOTH
|
|
7
|
+
* `vgai apply-diff` (the file-mode CLI verb) and the SDK's
|
|
8
|
+
* `project.scene.apply` operation (`packages/vgai-sdk/src/project/scene-operations.ts`)
|
|
9
|
+
* WITHOUT the SDK importing from the CLI — that would invert the intended
|
|
10
|
+
* dependency direction (CLI -> SDK -> engine, §3.4). The engine's scene layer
|
|
11
|
+
* is the correct shared home: both the CLI and the SDK already depend
|
|
12
|
+
* directly on `@vgai/engine/scene/*` for scene parsing/patching, so this
|
|
13
|
+
* module sits alongside `parse.ts`/`scene-apply.ts` as one more piece of
|
|
14
|
+
* scene-layer machinery neither caller re-implements.
|
|
15
|
+
*
|
|
16
|
+
* WHAT THIS CATCHES that schema validation alone does not: the Zod scene
|
|
17
|
+
* schema only checks that e.g. `materialRef` is a STRING — never that the
|
|
18
|
+
* string points at anything real. A diff introducing
|
|
19
|
+
* `materialRef: "materials/typo.mat.json"` (nonexistent, or present but
|
|
20
|
+
* malformed) passes ordinary scene/patch validation and would be written;
|
|
21
|
+
* the failure would otherwise only surface later, at runtime asset fetch.
|
|
22
|
+
* `dereferenceNewAssetRefs` closes that gap by re-resolving every asset
|
|
23
|
+
* reference the diff INTRODUCED (present in `result`, absent from
|
|
24
|
+
* `inputScene` — deliberately not pre-existing refs, so a scene with
|
|
25
|
+
* unrelated prior breakage can still receive an unrelated repair;
|
|
26
|
+
* `validate-scenes` remains the whole-project content gate) against disk,
|
|
27
|
+
* refusing the write if anything is missing or fails its own schema.
|
|
28
|
+
*
|
|
29
|
+
* Reference kinds and their treatment (unchanged from the original CLI-only
|
|
30
|
+
* implementation):
|
|
31
|
+
* - Zod-validated (JSON formats with engine Zod schemas): `materialRef`
|
|
32
|
+
* (.mat.json -> parseMaterialFile), `prefab` in its file-path form
|
|
33
|
+
* (.prefab.json -> parsePrefabFile). Prefabs are validated ONE level
|
|
34
|
+
* deep — the referenced prefab file itself must exist and parse; assets
|
|
35
|
+
* IT references are that file's own concern. (`animation.animGraph` ->
|
|
36
|
+
* AnimGraphFileSchema was removed by E5 — AnimGraph no longer exists.)
|
|
37
|
+
* - Existence-checked only (binary formats with no Zod schema to parse
|
|
38
|
+
* them through): gltf `mesh.src`, every material texture-map path
|
|
39
|
+
* (including the nested clearcoat/transmission/sheen/iridescence groups),
|
|
40
|
+
* `particles.material.map`, `audio.src`, `environment.skybox`.
|
|
41
|
+
* - `.inputmap.json` is structurally out of scope: no `.vscn.json`/
|
|
42
|
+
* `.prefab.json` field references an input map.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
46
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
47
|
+
import { parseMaterialFile, parsePrefabFile, SceneParseError } from './parse';
|
|
48
|
+
import type { SceneEntity, SceneFile } from './scene-types';
|
|
49
|
+
|
|
50
|
+
/** One asset reference found in a scene document: where it is + what it points at. */
|
|
51
|
+
export interface AssetRef {
|
|
52
|
+
/** The authored path string (web-root-relative, optionally /-prefixed). */
|
|
53
|
+
path: string;
|
|
54
|
+
/** Human-readable field location for error messages, e.g. `entity "crate" field materialRef`. */
|
|
55
|
+
field: string;
|
|
56
|
+
kind: 'material' | 'prefab' | 'binary';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* One asset reference that failed to dereference. `reason` is a one-line-or-
|
|
61
|
+
* more human-readable explanation (schema-validation failures may be
|
|
62
|
+
* multi-line); `field`/`path` mirror `AssetRef` and `diskPath` is the
|
|
63
|
+
* resolved absolute path that was checked, so every caller (CLI text report,
|
|
64
|
+
* SDK structured error data) can build its own presentation from the same
|
|
65
|
+
* facts without re-deriving them.
|
|
66
|
+
*/
|
|
67
|
+
export interface AssetRefError {
|
|
68
|
+
field: string;
|
|
69
|
+
path: string;
|
|
70
|
+
diskPath: string;
|
|
71
|
+
reason: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Material texture-map fields that hold image paths — top-level and nested feature groups. */
|
|
75
|
+
const MATERIAL_MAP_KEYS = [
|
|
76
|
+
'map',
|
|
77
|
+
'normalMap',
|
|
78
|
+
'emissiveMap',
|
|
79
|
+
'aoMap',
|
|
80
|
+
'roughnessMap',
|
|
81
|
+
'metalnessMap',
|
|
82
|
+
'displacementMap',
|
|
83
|
+
] as const;
|
|
84
|
+
const MATERIAL_GROUP_MAP_KEYS: Record<string, readonly string[]> = {
|
|
85
|
+
clearcoat: ['clearcoatMap', 'clearcoatRoughnessMap'],
|
|
86
|
+
transmission: ['transmissionMap'],
|
|
87
|
+
sheen: ['sheenColorMap', 'sheenRoughnessMap'],
|
|
88
|
+
iridescence: ['iridescenceMap', 'iridescenceThicknessMap'],
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** Same file-path-vs-registry-id heuristic as `asset-paths.ts`. */
|
|
92
|
+
function isFilePrefab(value: string): boolean {
|
|
93
|
+
return value.includes('/');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function entityLabel(e: SceneEntity): string {
|
|
97
|
+
return e.id ? `entity "${e.name}" (id ${e.id})` : `entity "${e.name}"`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Collect every asset reference in a scene document (entities walked recursively + environment), labeled for error messages. */
|
|
101
|
+
export function collectAssetRefs(doc: SceneFile): AssetRef[] {
|
|
102
|
+
const refs: AssetRef[] = [];
|
|
103
|
+
|
|
104
|
+
function walk(entities: SceneEntity[]): void {
|
|
105
|
+
for (const e of entities) {
|
|
106
|
+
const label = entityLabel(e);
|
|
107
|
+
if (e.mesh?.type === 'gltf' && e.mesh.src) {
|
|
108
|
+
refs.push({ path: e.mesh.src, field: `${label} field mesh.src`, kind: 'binary' });
|
|
109
|
+
}
|
|
110
|
+
if (e.material) {
|
|
111
|
+
const mat = e.material as Record<string, unknown>;
|
|
112
|
+
for (const key of MATERIAL_MAP_KEYS) {
|
|
113
|
+
const val = mat[key];
|
|
114
|
+
if (typeof val === 'string') {
|
|
115
|
+
refs.push({ path: val, field: `${label} field material.${key}`, kind: 'binary' });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
for (const [group, keys] of Object.entries(MATERIAL_GROUP_MAP_KEYS)) {
|
|
119
|
+
const groupVal = mat[group];
|
|
120
|
+
if (groupVal && typeof groupVal === 'object') {
|
|
121
|
+
for (const key of keys) {
|
|
122
|
+
const val = (groupVal as Record<string, unknown>)[key];
|
|
123
|
+
if (typeof val === 'string') {
|
|
124
|
+
refs.push({
|
|
125
|
+
path: val,
|
|
126
|
+
field: `${label} field material.${group}.${key}`,
|
|
127
|
+
kind: 'binary',
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (e.materialRef) {
|
|
135
|
+
refs.push({ path: e.materialRef, field: `${label} field materialRef`, kind: 'material' });
|
|
136
|
+
}
|
|
137
|
+
if (e.particles?.material?.map) {
|
|
138
|
+
refs.push({
|
|
139
|
+
path: e.particles.material.map,
|
|
140
|
+
field: `${label} field particles.material.map`,
|
|
141
|
+
kind: 'binary',
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
if (e.audio?.src) {
|
|
145
|
+
refs.push({ path: e.audio.src, field: `${label} field audio.src`, kind: 'binary' });
|
|
146
|
+
}
|
|
147
|
+
if (e.prefab && isFilePrefab(e.prefab)) {
|
|
148
|
+
refs.push({ path: e.prefab, field: `${label} field prefab`, kind: 'prefab' });
|
|
149
|
+
}
|
|
150
|
+
if (e.children) walk(e.children);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
walk(doc.entities);
|
|
155
|
+
if (doc.environment?.skybox) {
|
|
156
|
+
refs.push({ path: doc.environment.skybox, field: 'environment.skybox', kind: 'binary' });
|
|
157
|
+
}
|
|
158
|
+
return refs;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Resolve the asset root the scene's references are relative to. Asset paths
|
|
163
|
+
* are web-root-relative (the runtime fetches them from the served `public/`
|
|
164
|
+
* directory), and scene files conventionally live INSIDE `public/`
|
|
165
|
+
* (`public/scenes/*.vscn.json`) — so the nearest ancestor directory literally
|
|
166
|
+
* named `public` is the root. Fallback for scenes not under a `public/`
|
|
167
|
+
* ancestor: the scene's own directory.
|
|
168
|
+
*/
|
|
169
|
+
export function findAssetRoot(scenePath: string): string {
|
|
170
|
+
const dir = resolve(dirname(scenePath));
|
|
171
|
+
let cursor = dir;
|
|
172
|
+
for (;;) {
|
|
173
|
+
if (basename(cursor) === 'public') return cursor;
|
|
174
|
+
const parent = dirname(cursor);
|
|
175
|
+
if (parent === cursor) return dir;
|
|
176
|
+
cursor = parent;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Format Zod/scene-parse issues as `path: message`, one per line. */
|
|
181
|
+
function formatIssues(issues: { path: PropertyKey[]; message: string }[]): string {
|
|
182
|
+
return issues.map((i) => ` ${i.path.join('.')}: ${i.message}`).join('\n');
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Dereference every asset reference `result` introduces relative to
|
|
187
|
+
* `inputScene` (present in the result, absent from the input) against disk,
|
|
188
|
+
* relative to `scenePath`'s asset root (see `findAssetRoot`). Returns
|
|
189
|
+
* structured errors (empty = every new reference resolved and validated) —
|
|
190
|
+
* never throws; callers decide how to present/escalate a non-empty result
|
|
191
|
+
* (the CLI folds these into one `ApplyDiffCliError` message, the SDK raises
|
|
192
|
+
* a declared `ASSET_REF_INVALID` `OperationError`).
|
|
193
|
+
*/
|
|
194
|
+
export function dereferenceNewAssetRefs(
|
|
195
|
+
inputScene: SceneFile,
|
|
196
|
+
result: SceneFile,
|
|
197
|
+
scenePath: string,
|
|
198
|
+
): AssetRefError[] {
|
|
199
|
+
const preexisting = new Set(collectAssetRefs(inputScene).map((r) => r.path));
|
|
200
|
+
const newRefs = collectAssetRefs(result).filter((r) => !preexisting.has(r.path));
|
|
201
|
+
if (newRefs.length === 0) return [];
|
|
202
|
+
|
|
203
|
+
const assetRoot = findAssetRoot(scenePath);
|
|
204
|
+
const errors: AssetRefError[] = [];
|
|
205
|
+
|
|
206
|
+
for (const ref of newRefs) {
|
|
207
|
+
const diskPath = join(assetRoot, ref.path.replace(/^\//, ''));
|
|
208
|
+
if (!existsSync(diskPath)) {
|
|
209
|
+
errors.push({
|
|
210
|
+
field: ref.field,
|
|
211
|
+
path: ref.path,
|
|
212
|
+
diskPath,
|
|
213
|
+
reason: `file not found at ${diskPath} (resolved against ${assetRoot})`,
|
|
214
|
+
});
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
if (ref.kind === 'binary') continue; // existence-only (see the exclusion note above)
|
|
218
|
+
|
|
219
|
+
let json: unknown;
|
|
220
|
+
try {
|
|
221
|
+
json = JSON.parse(readFileSync(diskPath, 'utf-8'));
|
|
222
|
+
} catch (err) {
|
|
223
|
+
errors.push({
|
|
224
|
+
field: ref.field,
|
|
225
|
+
path: ref.path,
|
|
226
|
+
diskPath,
|
|
227
|
+
reason: `${diskPath} is not valid JSON: ${err instanceof Error ? err.message : err}`,
|
|
228
|
+
});
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
try {
|
|
232
|
+
if (ref.kind === 'material') {
|
|
233
|
+
parseMaterialFile(json, diskPath);
|
|
234
|
+
} else {
|
|
235
|
+
parsePrefabFile(json, diskPath);
|
|
236
|
+
}
|
|
237
|
+
} catch (err) {
|
|
238
|
+
const detail = err instanceof SceneParseError ? `\n${formatIssues(err.issues)}` : ` ${err}`;
|
|
239
|
+
errors.push({
|
|
240
|
+
field: ref.field,
|
|
241
|
+
path: ref.path,
|
|
242
|
+
diskPath,
|
|
243
|
+
reason: `${diskPath} fails schema validation:${detail}`,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return errors;
|
|
248
|
+
}
|
package/src/scene/parse.ts
CHANGED
|
@@ -23,7 +23,138 @@ export class SceneParseError extends Error {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
// D8 — removed-format migration guard: declarative property tracks
|
|
28
|
+
// (`animation.tracks`) were deleted (spec §3.2/§10 D8; Theatre — `@theatre/core`
|
|
29
|
+
// — is the sole authored continuous-animation source now). `SceneAnimationSchema`
|
|
30
|
+
// no longer declares a `tracks` field at all (so the generated JSON schema stays
|
|
31
|
+
// clean), which means Zod's default object mode would otherwise silently STRIP
|
|
32
|
+
// an authored `animation.tracks` rather than reporting it — violating Global AC
|
|
33
|
+
// §6 ("Removed formats fail with a concise migration/removal error rather than
|
|
34
|
+
// being partially read"). This walks the RAW pre-Zod JSON (Zod would already
|
|
35
|
+
// have stripped `tracks` by the time any schema-level check could see it) and
|
|
36
|
+
// throws a `SceneParseError` before Zod ever parses the data. Matches on the
|
|
37
|
+
// literal key `animation` (singular, an object) carrying a `tracks` property —
|
|
38
|
+
// this is deliberately narrower than Scene UI's unrelated, RETAINED
|
|
39
|
+
// `ui[].animations[].tracks` (plural `animations`), which this guard must not
|
|
40
|
+
// trip on.
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
|
|
43
|
+
/** True when `value` is a plain object (not an array) carrying a `tracks` property — the shape
|
|
44
|
+
* `SceneAnimationSchema` used to declare before D8 deleted it. */
|
|
45
|
+
function isRemovedTracksAnimation(value: unknown): boolean {
|
|
46
|
+
return !!value && typeof value === 'object' && !Array.isArray(value) && 'tracks' in value;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function findRemovedPropertyTrackPathInArray(node: unknown[], path: string): string | undefined {
|
|
50
|
+
for (let i = 0; i < node.length; i++) {
|
|
51
|
+
const hit = findRemovedPropertyTrackPath(node[i], `${path}[${i}]`);
|
|
52
|
+
if (hit) return hit;
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function findRemovedPropertyTrackPathInObject(
|
|
58
|
+
obj: Record<string, unknown>,
|
|
59
|
+
path: string,
|
|
60
|
+
): string | undefined {
|
|
61
|
+
if (isRemovedTracksAnimation(obj['animation'])) {
|
|
62
|
+
return `${path ? `${path}.` : ''}animation.tracks`;
|
|
63
|
+
}
|
|
64
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
65
|
+
const hit = findRemovedPropertyTrackPath(value, path ? `${path}.${key}` : key);
|
|
66
|
+
if (hit) return hit;
|
|
67
|
+
}
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function findRemovedPropertyTrackPath(node: unknown, path: string): string | undefined {
|
|
72
|
+
if (Array.isArray(node)) return findRemovedPropertyTrackPathInArray(node, path);
|
|
73
|
+
if (node && typeof node === 'object') {
|
|
74
|
+
return findRemovedPropertyTrackPathInObject(node as Record<string, unknown>, path);
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function assertNoRemovedPropertyTracks(json: unknown, filePath?: string): void {
|
|
80
|
+
const hit = findRemovedPropertyTrackPath(json, '');
|
|
81
|
+
if (!hit) return;
|
|
82
|
+
const issue: ZodIssue = {
|
|
83
|
+
code: 'custom',
|
|
84
|
+
message:
|
|
85
|
+
'property tracks were removed; author continuous animation with Theatre (@theatre/core) ' +
|
|
86
|
+
'instead — see docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md §3.2/§10 D8.',
|
|
87
|
+
path: hit.split('.'),
|
|
88
|
+
};
|
|
89
|
+
throw new SceneParseError([issue], filePath);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
// E5 — removed-format migration guard: the AnimGraph state-machine runtime,
|
|
94
|
+
// `.animgraph.json` format, and `SceneAnimationSchema.animGraph` field were
|
|
95
|
+
// deleted (spec §3.3/§11 E5; XState + native Three `AnimationMixer` — see
|
|
96
|
+
// `xstate-animation-binding.ts` — replace it). `SceneAnimationSchema` no
|
|
97
|
+
// longer declares an `animGraph` field at all (so it carries zero trace in
|
|
98
|
+
// the generated JSON schema), which means Zod's default object mode would
|
|
99
|
+
// otherwise silently STRIP an authored `animation.animGraph` rather than
|
|
100
|
+
// reporting it — violating Global AC §6. Mirrors
|
|
101
|
+
// `assertNoRemovedPropertyTracks` above exactly: walks the RAW pre-Zod JSON
|
|
102
|
+
// and throws a `SceneParseError` before Zod ever parses the data.
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
|
|
105
|
+
/** True when `value` is a plain object (not an array) carrying an `animGraph` property — the
|
|
106
|
+
* shape `SceneAnimationSchema` used to declare before E5 deleted it. */
|
|
107
|
+
function isRemovedAnimGraphAnimation(value: unknown): boolean {
|
|
108
|
+
return !!value && typeof value === 'object' && !Array.isArray(value) && 'animGraph' in value;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function findRemovedAnimGraphPathInArray(node: unknown[], path: string): string | undefined {
|
|
112
|
+
for (let i = 0; i < node.length; i++) {
|
|
113
|
+
const hit = findRemovedAnimGraphPath(node[i], `${path}[${i}]`);
|
|
114
|
+
if (hit) return hit;
|
|
115
|
+
}
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function findRemovedAnimGraphPathInObject(
|
|
120
|
+
obj: Record<string, unknown>,
|
|
121
|
+
path: string,
|
|
122
|
+
): string | undefined {
|
|
123
|
+
if (isRemovedAnimGraphAnimation(obj['animation'])) {
|
|
124
|
+
return `${path ? `${path}.` : ''}animation.animGraph`;
|
|
125
|
+
}
|
|
126
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
127
|
+
const hit = findRemovedAnimGraphPath(value, path ? `${path}.${key}` : key);
|
|
128
|
+
if (hit) return hit;
|
|
129
|
+
}
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function findRemovedAnimGraphPath(node: unknown, path: string): string | undefined {
|
|
134
|
+
if (Array.isArray(node)) return findRemovedAnimGraphPathInArray(node, path);
|
|
135
|
+
if (node && typeof node === 'object') {
|
|
136
|
+
return findRemovedAnimGraphPathInObject(node as Record<string, unknown>, path);
|
|
137
|
+
}
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function assertNoRemovedAnimGraph(json: unknown, filePath?: string): void {
|
|
142
|
+
const hit = findRemovedAnimGraphPath(json, '');
|
|
143
|
+
if (!hit) return;
|
|
144
|
+
const issue: ZodIssue = {
|
|
145
|
+
code: 'custom',
|
|
146
|
+
message:
|
|
147
|
+
'AnimGraph was removed; drive character animation with an XState animation machine instead ' +
|
|
148
|
+
'— see docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md §3.3/§5.6/§11 E5 and ' +
|
|
149
|
+
'packages/engine/src/animation/xstate-animation-binding.ts.',
|
|
150
|
+
path: hit.split('.'),
|
|
151
|
+
};
|
|
152
|
+
throw new SceneParseError([issue], filePath);
|
|
153
|
+
}
|
|
154
|
+
|
|
26
155
|
export function parseSceneFile(json: unknown, filePath?: string): SceneFile {
|
|
156
|
+
assertNoRemovedPropertyTracks(json, filePath);
|
|
157
|
+
assertNoRemovedAnimGraph(json, filePath);
|
|
27
158
|
const result = SceneFileSchema.safeParse(json);
|
|
28
159
|
if (!result.success) {
|
|
29
160
|
throw new SceneParseError(result.error.issues, filePath);
|
|
@@ -36,6 +167,8 @@ export function parseSceneFile(json: unknown, filePath?: string): SceneFile {
|
|
|
36
167
|
}
|
|
37
168
|
|
|
38
169
|
export function parsePrefabFile(json: unknown, filePath?: string): PrefabFile {
|
|
170
|
+
assertNoRemovedPropertyTracks(json, filePath);
|
|
171
|
+
assertNoRemovedAnimGraph(json, filePath);
|
|
39
172
|
const result = PrefabFileSchema.safeParse(json);
|
|
40
173
|
if (!result.success) {
|
|
41
174
|
throw new SceneParseError(result.error.issues, filePath);
|