@vgai/engine 0.5.0 → 0.5.2
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/package.json +1 -1
- package/schemas/engine-capabilities.json +4 -4
- package/schemas/vgai-game.schema.json +2 -2
- package/src/adapter/authoring.ts +42 -0
- package/src/adapter/index.ts +3 -0
- package/src/adapter/ingest/overlay-apply.ts +50 -6
- package/src/adapter/ingest/scene-capture.ts +51 -2
- package/src/adapter/vgai-scene-game-adapter.ts +24 -0
- package/src/manifest/schema.ts +7 -3
- package/src/runtime/create-runtime.ts +97 -0
- package/src/runtime/game.ts +11 -1
- package/src/scene/asset-ref-check.ts +1 -1
- package/src/scene/scene-loader.ts +2 -2
- package/src/scene/user-data.ts +18 -0
- package/src/world3d-react/behavior.tsx +19 -11
- package/src/world3d-react/r3f-adapter.tsx +8 -0
- package/dist/adapter/adapter-surface.d.ts +0 -30
- package/dist/adapter/adapter-surface.d.ts.map +0 -1
- package/dist/adapter/adapter-surface.js +0 -18
- package/dist/adapter/authoring.d.ts +0 -461
- package/dist/adapter/authoring.d.ts.map +0 -1
- package/dist/adapter/authoring.js +0 -22
- package/dist/adapter/colyseus-networking-adapter.d.ts +0 -43
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +0 -1
- package/dist/adapter/colyseus-networking-adapter.js +0 -38
- package/dist/adapter/first-party-systems.d.ts +0 -38
- package/dist/adapter/first-party-systems.d.ts.map +0 -1
- package/dist/adapter/first-party-systems.js +0 -77
- package/dist/adapter/game-adapter.d.ts +0 -133
- package/dist/adapter/game-adapter.d.ts.map +0 -1
- package/dist/adapter/game-adapter.js +0 -10
- package/dist/adapter/host-context.d.ts +0 -71
- package/dist/adapter/host-context.d.ts.map +0 -1
- package/dist/adapter/host-context.js +0 -16
- package/dist/adapter/index.d.ts +0 -22
- package/dist/adapter/index.d.ts.map +0 -1
- package/dist/adapter/index.js +0 -15
- package/dist/adapter/ingest/game-contract.d.ts +0 -53
- package/dist/adapter/ingest/game-contract.d.ts.map +0 -1
- package/dist/adapter/ingest/game-contract.js +0 -30
- package/dist/adapter/ingest/overlay-applier.d.ts +0 -118
- package/dist/adapter/ingest/overlay-applier.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-applier.js +0 -132
- package/dist/adapter/ingest/overlay-apply.d.ts +0 -60
- package/dist/adapter/ingest/overlay-apply.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-apply.js +0 -101
- package/dist/adapter/ingest/overlay-file.d.ts +0 -79
- package/dist/adapter/ingest/overlay-file.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-file.js +0 -66
- package/dist/adapter/ingest/overlay-report.d.ts +0 -113
- package/dist/adapter/ingest/overlay-report.d.ts.map +0 -1
- package/dist/adapter/ingest/overlay-report.js +0 -103
- package/dist/adapter/ingest/scene-capture.d.ts +0 -97
- package/dist/adapter/ingest/scene-capture.d.ts.map +0 -1
- package/dist/adapter/ingest/scene-capture.js +0 -248
- package/dist/adapter/ingest/upstream-pin.d.ts +0 -47
- package/dist/adapter/ingest/upstream-pin.d.ts.map +0 -1
- package/dist/adapter/ingest/upstream-pin.js +0 -50
- package/dist/adapter/loop-gate-report.d.ts +0 -34
- package/dist/adapter/loop-gate-report.d.ts.map +0 -1
- package/dist/adapter/loop-gate-report.js +0 -37
- package/dist/adapter/rapier-physics-adapter.d.ts +0 -12
- package/dist/adapter/rapier-physics-adapter.d.ts.map +0 -1
- package/dist/adapter/rapier-physics-adapter.js +0 -46
- package/dist/adapter/system-adapter.d.ts +0 -206
- package/dist/adapter/system-adapter.d.ts.map +0 -1
- package/dist/adapter/system-adapter.js +0 -13
- package/dist/adapter/transform.d.ts +0 -18
- package/dist/adapter/transform.d.ts.map +0 -1
- package/dist/adapter/transform.js +0 -1
- package/dist/adapter/vgai-scene-game-adapter.d.ts +0 -108
- package/dist/adapter/vgai-scene-game-adapter.d.ts.map +0 -1
- package/dist/adapter/vgai-scene-game-adapter.js +0 -762
- package/dist/ai/navigation.d.ts +0 -64
- package/dist/ai/navigation.d.ts.map +0 -1
- package/dist/ai/navigation.js +0 -133
- package/dist/animation/anim-graph-types.d.ts +0 -25
- package/dist/animation/anim-graph-types.d.ts.map +0 -1
- package/dist/animation/anim-graph-types.js +0 -1
- package/dist/animation/animation-clock.d.ts +0 -213
- package/dist/animation/animation-clock.d.ts.map +0 -1
- package/dist/animation/animation-clock.js +0 -301
- package/dist/animation/blend-node.d.ts +0 -22
- package/dist/animation/blend-node.d.ts.map +0 -1
- package/dist/animation/blend-node.js +0 -97
- package/dist/animation/camera-ownership.d.ts +0 -250
- package/dist/animation/camera-ownership.d.ts.map +0 -1
- package/dist/animation/camera-ownership.js +0 -169
- package/dist/animation/cinematic-cues.d.ts +0 -200
- package/dist/animation/cinematic-cues.d.ts.map +0 -1
- package/dist/animation/cinematic-cues.js +0 -213
- package/dist/animation/clip-map.d.ts +0 -12
- package/dist/animation/clip-map.d.ts.map +0 -1
- package/dist/animation/clip-map.js +0 -37
- package/dist/animation/gsap-registration.d.ts +0 -119
- package/dist/animation/gsap-registration.d.ts.map +0 -1
- package/dist/animation/gsap-registration.js +0 -92
- package/dist/animation/theatre-clock-binding.d.ts +0 -89
- package/dist/animation/theatre-clock-binding.d.ts.map +0 -1
- package/dist/animation/theatre-clock-binding.js +0 -29
- package/dist/animation/theatre-director.d.ts +0 -242
- package/dist/animation/theatre-director.d.ts.map +0 -1
- package/dist/animation/theatre-director.js +0 -235
- package/dist/animation/theatre-object-binding.d.ts +0 -305
- package/dist/animation/theatre-object-binding.d.ts.map +0 -1
- package/dist/animation/theatre-object-binding.js +0 -351
- package/dist/animation/xstate-animation-binding.d.ts +0 -56
- package/dist/animation/xstate-animation-binding.d.ts.map +0 -1
- package/dist/animation/xstate-animation-binding.js +0 -331
- package/dist/animation/xstate-animation-meta.d.ts +0 -266
- package/dist/animation/xstate-animation-meta.d.ts.map +0 -1
- package/dist/animation/xstate-animation-meta.js +0 -252
- package/dist/assets.d.ts +0 -26
- package/dist/assets.d.ts.map +0 -1
- package/dist/assets.js +0 -55
- package/dist/audio/index.d.ts +0 -4
- package/dist/audio/index.d.ts.map +0 -1
- package/dist/audio/index.js +0 -24
- package/dist/audio/tone-clock-binding.d.ts +0 -75
- package/dist/audio/tone-clock-binding.d.ts.map +0 -1
- package/dist/audio/tone-clock-binding.js +0 -29
- package/dist/audio/tone-context.d.ts +0 -114
- package/dist/audio/tone-context.d.ts.map +0 -1
- package/dist/audio/tone-context.js +0 -39
- package/dist/audio/tone-offline-render.d.ts +0 -90
- package/dist/audio/tone-offline-render.d.ts.map +0 -1
- package/dist/audio/tone-offline-render.js +0 -56
- package/dist/audio/wav-encode.d.ts +0 -38
- package/dist/audio/wav-encode.d.ts.map +0 -1
- package/dist/audio/wav-encode.js +0 -97
- package/dist/character/cloth-sim.d.ts +0 -179
- package/dist/character/cloth-sim.d.ts.map +0 -1
- package/dist/character/cloth-sim.js +0 -334
- package/dist/character/spring-chain.d.ts +0 -135
- package/dist/character/spring-chain.d.ts.map +0 -1
- package/dist/character/spring-chain.js +0 -165
- package/dist/core/game-loop.d.ts +0 -42
- package/dist/core/game-loop.d.ts.map +0 -1
- package/dist/core/game-loop.js +0 -167
- package/dist/core/seeded-random.d.ts +0 -69
- package/dist/core/seeded-random.d.ts.map +0 -1
- package/dist/core/seeded-random.js +0 -121
- package/dist/core/system-runner.d.ts +0 -120
- package/dist/core/system-runner.d.ts.map +0 -1
- package/dist/core/system-runner.js +0 -297
- package/dist/core/types.d.ts +0 -92
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js +0 -25
- package/dist/data/data-asset.d.ts +0 -101
- package/dist/data/data-asset.d.ts.map +0 -1
- package/dist/data/data-asset.js +0 -122
- package/dist/data/data-check-core.d.ts +0 -110
- package/dist/data/data-check-core.d.ts.map +0 -1
- package/dist/data/data-check-core.js +0 -178
- package/dist/data/data-ref.d.ts +0 -79
- package/dist/data/data-ref.d.ts.map +0 -1
- package/dist/data/data-ref.js +0 -130
- package/dist/data/vite-plugin-data.d.ts +0 -79
- package/dist/data/vite-plugin-data.d.ts.map +0 -1
- package/dist/data/vite-plugin-data.js +0 -217
- package/dist/dev/console-bridge.d.ts +0 -22
- package/dist/dev/console-bridge.d.ts.map +0 -1
- package/dist/dev/console-bridge.js +0 -71
- package/dist/dev/debug-draw.d.ts +0 -24
- package/dist/dev/debug-draw.d.ts.map +0 -1
- package/dist/dev/debug-draw.js +0 -73
- package/dist/dev/logger.d.ts +0 -30
- package/dist/dev/logger.d.ts.map +0 -1
- package/dist/dev/logger.js +0 -90
- package/dist/dev/performance-profiler.d.ts +0 -60
- package/dist/dev/performance-profiler.d.ts.map +0 -1
- package/dist/dev/performance-profiler.js +0 -181
- package/dist/dev/webgl-gpu-timer.d.ts +0 -8
- package/dist/dev/webgl-gpu-timer.d.ts.map +0 -1
- package/dist/dev/webgl-gpu-timer.js +0 -52
- package/dist/ecs/component-manager.d.ts +0 -205
- package/dist/ecs/component-manager.d.ts.map +0 -1
- package/dist/ecs/component-manager.js +0 -706
- package/dist/ecs/game-component.d.ts +0 -146
- package/dist/ecs/game-component.d.ts.map +0 -1
- package/dist/ecs/game-component.js +0 -141
- package/dist/ecs/hmr-swap-report.d.ts +0 -53
- package/dist/ecs/hmr-swap-report.d.ts.map +0 -1
- package/dist/ecs/hmr-swap-report.js +0 -55
- package/dist/humanoid/bake.operation.d.ts +0 -119
- package/dist/humanoid/bake.operation.d.ts.map +0 -1
- package/dist/humanoid/bake.operation.js +0 -228
- package/dist/humanoid/body.d.ts +0 -101
- package/dist/humanoid/body.d.ts.map +0 -1
- package/dist/humanoid/body.js +0 -530
- package/dist/humanoid/clips.d.ts +0 -62
- package/dist/humanoid/clips.d.ts.map +0 -1
- package/dist/humanoid/clips.js +0 -121
- package/dist/humanoid/compose.d.ts +0 -75
- package/dist/humanoid/compose.d.ts.map +0 -1
- package/dist/humanoid/compose.js +0 -176
- package/dist/humanoid/generate.d.ts +0 -92
- package/dist/humanoid/generate.d.ts.map +0 -1
- package/dist/humanoid/generate.js +0 -124
- package/dist/humanoid/index.d.ts +0 -24
- package/dist/humanoid/index.d.ts.map +0 -1
- package/dist/humanoid/index.js +0 -18
- package/dist/humanoid/schema.d.ts +0 -35
- package/dist/humanoid/schema.d.ts.map +0 -1
- package/dist/humanoid/schema.js +0 -87
- package/dist/humanoid/skeleton.d.ts +0 -103
- package/dist/humanoid/skeleton.d.ts.map +0 -1
- package/dist/humanoid/skeleton.js +0 -289
- package/dist/index.d.ts +0 -37
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -30
- package/dist/input/input-manager.d.ts +0 -945
- package/dist/input/input-manager.d.ts.map +0 -1
- package/dist/input/input-manager.js +0 -2207
- package/dist/input/input-types.d.ts +0 -174
- package/dist/input/input-types.d.ts.map +0 -1
- package/dist/input/input-types.js +0 -1
- package/dist/input/prompt-labels.d.ts +0 -21
- package/dist/input/prompt-labels.d.ts.map +0 -1
- package/dist/input/prompt-labels.js +0 -121
- package/dist/input/rebind-controller.d.ts +0 -59
- package/dist/input/rebind-controller.d.ts.map +0 -1
- package/dist/input/rebind-controller.js +0 -85
- package/dist/input/schema.d.ts +0 -16
- package/dist/input/schema.d.ts.map +0 -1
- package/dist/input/schema.js +0 -228
- package/dist/loader.d.ts +0 -43
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js +0 -59
- package/dist/manifest/index.d.ts +0 -5
- package/dist/manifest/index.d.ts.map +0 -1
- package/dist/manifest/index.js +0 -8
- package/dist/manifest/load-file.d.ts +0 -4
- package/dist/manifest/load-file.d.ts.map +0 -1
- package/dist/manifest/load-file.js +0 -14
- package/dist/manifest/load.d.ts +0 -144
- package/dist/manifest/load.d.ts.map +0 -1
- package/dist/manifest/load.js +0 -273
- package/dist/manifest/schema.d.ts +0 -230
- package/dist/manifest/schema.d.ts.map +0 -1
- package/dist/manifest/schema.js +0 -394
- package/dist/physics/collision-system.d.ts +0 -41
- package/dist/physics/collision-system.d.ts.map +0 -1
- package/dist/physics/collision-system.js +0 -64
- package/dist/physics/physics-registry.d.ts +0 -45
- package/dist/physics/physics-registry.d.ts.map +0 -1
- package/dist/physics/physics-registry.js +0 -65
- package/dist/physics/transform-writer.d.ts +0 -16
- package/dist/physics/transform-writer.d.ts.map +0 -1
- package/dist/physics/transform-writer.js +0 -38
- package/dist/physics/trigger-dispatch.d.ts +0 -24
- package/dist/physics/trigger-dispatch.d.ts.map +0 -1
- package/dist/physics/trigger-dispatch.js +0 -80
- package/dist/react/game-state.d.ts +0 -156
- package/dist/react/game-state.d.ts.map +0 -1
- package/dist/react/game-state.js +0 -222
- package/dist/react/root-adapter.d.ts +0 -11
- package/dist/react/root-adapter.d.ts.map +0 -1
- package/dist/react/root-adapter.js +0 -41
- package/dist/react/unmanaged-root-detector.d.ts +0 -12
- package/dist/react/unmanaged-root-detector.d.ts.map +0 -1
- package/dist/react/unmanaged-root-detector.js +0 -45
- package/dist/react/use-data.d.ts +0 -60
- package/dist/react/use-data.d.ts.map +0 -1
- package/dist/react/use-data.js +0 -101
- package/dist/react/use-selection.d.ts +0 -75
- package/dist/react/use-selection.d.ts.map +0 -1
- package/dist/react/use-selection.js +0 -90
- package/dist/render/auto-batcher.d.ts +0 -34
- package/dist/render/auto-batcher.d.ts.map +0 -1
- package/dist/render/auto-batcher.js +0 -140
- package/dist/render/render-batch-system.d.ts +0 -33
- package/dist/render/render-batch-system.d.ts.map +0 -1
- package/dist/render/render-batch-system.js +0 -230
- package/dist/render/render-features.d.ts +0 -47
- package/dist/render/render-features.d.ts.map +0 -1
- package/dist/render/render-features.js +0 -105
- package/dist/render/render-settings.d.ts +0 -36
- package/dist/render/render-settings.d.ts.map +0 -1
- package/dist/render/render-settings.js +0 -51
- package/dist/runtime/create-runtime.d.ts +0 -249
- package/dist/runtime/create-runtime.d.ts.map +0 -1
- package/dist/runtime/create-runtime.js +0 -641
- package/dist/runtime/debug-bridge.d.ts +0 -257
- package/dist/runtime/debug-bridge.d.ts.map +0 -1
- package/dist/runtime/debug-bridge.js +0 -224
- package/dist/runtime/debug-registry.d.ts +0 -288
- package/dist/runtime/debug-registry.d.ts.map +0 -1
- package/dist/runtime/debug-registry.js +0 -513
- package/dist/runtime/frame-selector-cache.d.ts +0 -41
- package/dist/runtime/frame-selector-cache.d.ts.map +0 -1
- package/dist/runtime/frame-selector-cache.js +0 -65
- package/dist/runtime/game.d.ts +0 -496
- package/dist/runtime/game.d.ts.map +0 -1
- package/dist/runtime/game.js +0 -741
- package/dist/runtime/gameplay-rng-trap.d.ts +0 -48
- package/dist/runtime/gameplay-rng-trap.d.ts.map +0 -1
- package/dist/runtime/gameplay-rng-trap.js +0 -96
- package/dist/runtime/input-router.d.ts +0 -78
- package/dist/runtime/input-router.d.ts.map +0 -1
- package/dist/runtime/input-router.js +0 -171
- package/dist/runtime/mount-game.d.ts +0 -129
- package/dist/runtime/mount-game.d.ts.map +0 -1
- package/dist/runtime/mount-game.js +0 -152
- package/dist/runtime/mount-manifest.d.ts +0 -173
- package/dist/runtime/mount-manifest.d.ts.map +0 -1
- package/dist/runtime/mount-manifest.js +0 -297
- package/dist/runtime/render-audio-control.d.ts +0 -110
- package/dist/runtime/render-audio-control.d.ts.map +0 -1
- package/dist/runtime/render-audio-control.js +0 -111
- package/dist/runtime/render-control.d.ts +0 -291
- package/dist/runtime/render-control.d.ts.map +0 -1
- package/dist/runtime/render-control.js +0 -264
- package/dist/runtime/render-seed.d.ts +0 -57
- package/dist/runtime/render-seed.d.ts.map +0 -1
- package/dist/runtime/render-seed.js +0 -74
- package/dist/runtime/state-bridge.d.ts +0 -61
- package/dist/runtime/state-bridge.d.ts.map +0 -1
- package/dist/runtime/state-bridge.js +0 -63
- package/dist/runtime/types.d.ts +0 -253
- package/dist/runtime/types.d.ts.map +0 -1
- package/dist/runtime/types.js +0 -1
- package/dist/scene/asset-loaders.d.ts +0 -79
- package/dist/scene/asset-loaders.d.ts.map +0 -1
- package/dist/scene/asset-loaders.js +0 -141
- package/dist/scene/asset-paths.d.ts +0 -11
- package/dist/scene/asset-paths.d.ts.map +0 -1
- package/dist/scene/asset-paths.js +0 -108
- package/dist/scene/asset-ref-check.d.ts +0 -88
- package/dist/scene/asset-ref-check.d.ts.map +0 -1
- package/dist/scene/asset-ref-check.js +0 -214
- package/dist/scene/asset-registry.d.ts +0 -38
- package/dist/scene/asset-registry.d.ts.map +0 -1
- package/dist/scene/asset-registry.js +0 -66
- package/dist/scene/collider-dimensions.d.ts +0 -63
- package/dist/scene/collider-dimensions.d.ts.map +0 -1
- package/dist/scene/collider-dimensions.js +0 -98
- package/dist/scene/component-registry.d.ts +0 -22
- package/dist/scene/component-registry.d.ts.map +0 -1
- package/dist/scene/component-registry.js +0 -37
- package/dist/scene/defaults.d.ts +0 -252
- package/dist/scene/defaults.d.ts.map +0 -1
- package/dist/scene/defaults.js +0 -151
- package/dist/scene/geometries/index.d.ts +0 -8
- package/dist/scene/geometries/index.d.ts.map +0 -1
- package/dist/scene/geometries/index.js +0 -7
- package/dist/scene/geometries/terrain.d.ts +0 -2
- package/dist/scene/geometries/terrain.d.ts.map +0 -1
- package/dist/scene/geometries/terrain.js +0 -37
- package/dist/scene/geometry-registry.d.ts +0 -24
- package/dist/scene/geometry-registry.d.ts.map +0 -1
- package/dist/scene/geometry-registry.js +0 -20
- package/dist/scene/instance-registry.d.ts +0 -36
- package/dist/scene/instance-registry.d.ts.map +0 -1
- package/dist/scene/instance-registry.js +0 -55
- package/dist/scene/instancers/grid.d.ts +0 -2
- package/dist/scene/instancers/grid.d.ts.map +0 -1
- package/dist/scene/instancers/grid.js +0 -36
- package/dist/scene/instancers/index.d.ts +0 -8
- package/dist/scene/instancers/index.d.ts.map +0 -1
- package/dist/scene/instancers/index.js +0 -7
- package/dist/scene/light-camera-factory.d.ts +0 -23
- package/dist/scene/light-camera-factory.d.ts.map +0 -1
- package/dist/scene/light-camera-factory.js +0 -68
- package/dist/scene/material-factory.d.ts +0 -17
- package/dist/scene/material-factory.d.ts.map +0 -1
- package/dist/scene/material-factory.js +0 -197
- package/dist/scene/material-registry.d.ts +0 -40
- package/dist/scene/material-registry.d.ts.map +0 -1
- package/dist/scene/material-registry.js +0 -44
- package/dist/scene/materials/index.d.ts +0 -8
- package/dist/scene/materials/index.d.ts.map +0 -1
- package/dist/scene/materials/index.js +0 -7
- package/dist/scene/materials/water.d.ts +0 -2
- package/dist/scene/materials/water.d.ts.map +0 -1
- package/dist/scene/materials/water.js +0 -54
- package/dist/scene/parse.d.ts +0 -23
- package/dist/scene/parse.d.ts.map +0 -1
- package/dist/scene/parse.js +0 -179
- package/dist/scene/particles-factory.d.ts +0 -33
- package/dist/scene/particles-factory.d.ts.map +0 -1
- package/dist/scene/particles-factory.js +0 -282
- package/dist/scene/scene-apply.d.ts +0 -109
- package/dist/scene/scene-apply.d.ts.map +0 -1
- package/dist/scene/scene-apply.js +0 -370
- package/dist/scene/scene-diff-schema.d.ts +0 -285
- package/dist/scene/scene-diff-schema.d.ts.map +0 -1
- package/dist/scene/scene-diff-schema.js +0 -92
- package/dist/scene/scene-diff-types.d.ts +0 -40
- package/dist/scene/scene-diff-types.d.ts.map +0 -1
- package/dist/scene/scene-diff-types.js +0 -14
- package/dist/scene/scene-loader.d.ts +0 -167
- package/dist/scene/scene-loader.d.ts.map +0 -1
- package/dist/scene/scene-loader.js +0 -1211
- package/dist/scene/scene-query.d.ts +0 -11
- package/dist/scene/scene-query.d.ts.map +0 -1
- package/dist/scene/scene-query.js +0 -63
- package/dist/scene/scene-types.d.ts +0 -10
- package/dist/scene/scene-types.d.ts.map +0 -1
- package/dist/scene/scene-types.js +0 -8
- package/dist/scene/scene-version.d.ts +0 -26
- package/dist/scene/scene-version.d.ts.map +0 -1
- package/dist/scene/scene-version.js +0 -34
- package/dist/scene/schema/animation.d.ts +0 -8
- package/dist/scene/schema/animation.d.ts.map +0 -1
- package/dist/scene/schema/animation.js +0 -42
- package/dist/scene/schema/audio.d.ts +0 -13
- package/dist/scene/schema/audio.d.ts.map +0 -1
- package/dist/scene/schema/audio.js +0 -22
- package/dist/scene/schema/camera.d.ts +0 -28
- package/dist/scene/schema/camera.d.ts.map +0 -1
- package/dist/scene/schema/camera.js +0 -17
- package/dist/scene/schema/collider.d.ts +0 -40
- package/dist/scene/schema/collider.d.ts.map +0 -1
- package/dist/scene/schema/collider.js +0 -55
- package/dist/scene/schema/entity-ref.d.ts +0 -31
- package/dist/scene/schema/entity-ref.d.ts.map +0 -1
- package/dist/scene/schema/entity-ref.js +0 -61
- package/dist/scene/schema/entity.d.ts +0 -1036
- package/dist/scene/schema/entity.d.ts.map +0 -1
- package/dist/scene/schema/entity.js +0 -153
- package/dist/scene/schema/environment.d.ts +0 -425
- package/dist/scene/schema/environment.d.ts.map +0 -1
- package/dist/scene/schema/environment.js +0 -357
- package/dist/scene/schema/index.d.ts +0 -37
- package/dist/scene/schema/index.d.ts.map +0 -1
- package/dist/scene/schema/index.js +0 -19
- package/dist/scene/schema/instances.d.ts +0 -14
- package/dist/scene/schema/instances.d.ts.map +0 -1
- package/dist/scene/schema/instances.js +0 -28
- package/dist/scene/schema/joint.d.ts +0 -23
- package/dist/scene/schema/joint.d.ts.map +0 -1
- package/dist/scene/schema/joint.js +0 -23
- package/dist/scene/schema/light.d.ts +0 -38
- package/dist/scene/schema/light.d.ts.map +0 -1
- package/dist/scene/schema/light.js +0 -26
- package/dist/scene/schema/material.d.ts +0 -199
- package/dist/scene/schema/material.d.ts.map +0 -1
- package/dist/scene/schema/material.js +0 -103
- package/dist/scene/schema/mesh.d.ts +0 -48
- package/dist/scene/schema/mesh.d.ts.map +0 -1
- package/dist/scene/schema/mesh.js +0 -82
- package/dist/scene/schema/particles.d.ts +0 -2178
- package/dist/scene/schema/particles.d.ts.map +0 -1
- package/dist/scene/schema/particles.js +0 -321
- package/dist/scene/schema/physics.d.ts +0 -56
- package/dist/scene/schema/physics.d.ts.map +0 -1
- package/dist/scene/schema/physics.js +0 -37
- package/dist/scene/schema/scene-file.d.ts +0 -303
- package/dist/scene/schema/scene-file.d.ts.map +0 -1
- package/dist/scene/schema/scene-file.js +0 -256
- package/dist/scene/schema/shadow.d.ts +0 -28
- package/dist/scene/schema/shadow.d.ts.map +0 -1
- package/dist/scene/schema/shadow.js +0 -20
- package/dist/scene/schema/spline.d.ts +0 -25
- package/dist/scene/schema/spline.d.ts.map +0 -1
- package/dist/scene/schema/spline.js +0 -15
- package/dist/scene/schema/tuples.d.ts +0 -12
- package/dist/scene/schema/tuples.d.ts.map +0 -1
- package/dist/scene/schema/tuples.js +0 -14
- package/dist/scene/user-data.d.ts +0 -185
- package/dist/scene/user-data.d.ts.map +0 -1
- package/dist/scene/user-data.js +0 -144
- package/dist/setup/setup-audio.d.ts +0 -20
- package/dist/setup/setup-audio.d.ts.map +0 -1
- package/dist/setup/setup-audio.js +0 -41
- package/dist/setup/setup-particles.d.ts +0 -17
- package/dist/setup/setup-particles.d.ts.map +0 -1
- package/dist/setup/setup-particles.js +0 -16
- package/dist/setup/setup-physics.d.ts +0 -25
- package/dist/setup/setup-physics.d.ts.map +0 -1
- package/dist/setup/setup-physics.js +0 -51
- package/dist/setup/setup-renderer.d.ts +0 -69
- package/dist/setup/setup-renderer.d.ts.map +0 -1
- package/dist/setup/setup-renderer.js +0 -363
- package/dist/tools/define-tool.d.ts +0 -130
- package/dist/tools/define-tool.d.ts.map +0 -1
- package/dist/tools/define-tool.js +0 -96
- package/dist/world2d/authoring-2d.d.ts +0 -80
- package/dist/world2d/authoring-2d.d.ts.map +0 -1
- package/dist/world2d/authoring-2d.js +0 -195
- package/dist/world2d/capture-to-scene2d.d.ts +0 -5
- package/dist/world2d/capture-to-scene2d.d.ts.map +0 -1
- package/dist/world2d/capture-to-scene2d.js +0 -49
- package/dist/world2d/collision-2d.d.ts +0 -52
- package/dist/world2d/collision-2d.d.ts.map +0 -1
- package/dist/world2d/collision-2d.js +0 -70
- package/dist/world2d/components-2d.d.ts +0 -47
- package/dist/world2d/components-2d.d.ts.map +0 -1
- package/dist/world2d/components-2d.js +0 -77
- package/dist/world2d/index.d.ts +0 -34
- package/dist/world2d/index.d.ts.map +0 -1
- package/dist/world2d/index.js +0 -32
- package/dist/world2d/ingest-iframe-2d.d.ts +0 -82
- package/dist/world2d/ingest-iframe-2d.d.ts.map +0 -1
- package/dist/world2d/ingest-iframe-2d.js +0 -166
- package/dist/world2d/ingest2d.d.ts +0 -97
- package/dist/world2d/ingest2d.d.ts.map +0 -1
- package/dist/world2d/ingest2d.js +0 -40
- package/dist/world2d/physics2d-registry.d.ts +0 -24
- package/dist/world2d/physics2d-registry.d.ts.map +0 -1
- package/dist/world2d/physics2d-registry.js +0 -38
- package/dist/world2d/pixi-game-adapter.d.ts +0 -107
- package/dist/world2d/pixi-game-adapter.d.ts.map +0 -1
- package/dist/world2d/pixi-game-adapter.js +0 -210
- package/dist/world2d/pixi-surface.d.ts +0 -39
- package/dist/world2d/pixi-surface.d.ts.map +0 -1
- package/dist/world2d/pixi-surface.js +0 -47
- package/dist/world2d/scene-capture-2d.d.ts +0 -43
- package/dist/world2d/scene-capture-2d.d.ts.map +0 -1
- package/dist/world2d/scene-capture-2d.js +0 -92
- package/dist/world2d/scene2d-loader.d.ts +0 -27
- package/dist/world2d/scene2d-loader.d.ts.map +0 -1
- package/dist/world2d/scene2d-loader.js +0 -275
- package/dist/world2d/schema/entity2d.d.ts +0 -102
- package/dist/world2d/schema/entity2d.d.ts.map +0 -1
- package/dist/world2d/schema/entity2d.js +0 -119
- package/dist/world2d/schema/physics2d.d.ts +0 -46
- package/dist/world2d/schema/physics2d.d.ts.map +0 -1
- package/dist/world2d/schema/physics2d.js +0 -45
- package/dist/world2d/schema/sprite.d.ts +0 -42
- package/dist/world2d/schema/sprite.d.ts.map +0 -1
- package/dist/world2d/schema/sprite.js +0 -63
- package/dist/world2d/schema/tilemap.d.ts +0 -15
- package/dist/world2d/schema/tilemap.d.ts.map +0 -1
- package/dist/world2d/schema/tilemap.js +0 -19
- package/dist/world2d/schema/tuples2d.d.ts +0 -20
- package/dist/world2d/schema/tuples2d.d.ts.map +0 -1
- package/dist/world2d/schema/tuples2d.js +0 -19
- package/dist/world2d/system-adapters-2d.d.ts +0 -16
- package/dist/world2d/system-adapters-2d.d.ts.map +0 -1
- package/dist/world2d/system-adapters-2d.js +0 -37
- package/dist/world2d/transform-writer-2d.d.ts +0 -16
- package/dist/world2d/transform-writer-2d.d.ts.map +0 -1
- package/dist/world2d/transform-writer-2d.js +0 -22
- package/dist/world2d/types.d.ts +0 -59
- package/dist/world2d/types.d.ts.map +0 -1
- package/dist/world2d/types.js +0 -1
package/dist/runtime/types.d.ts
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import type RAPIER from '@dimforge/rapier3d-compat';
|
|
2
|
-
import type { EffectComposer } from 'postprocessing';
|
|
3
|
-
import type * as THREE from 'three';
|
|
4
|
-
import type { z } from 'zod';
|
|
5
|
-
import type { SystemAdapters } from '../adapter/system-adapter';
|
|
6
|
-
import type { AssetCache } from '../assets';
|
|
7
|
-
import type { SeededRandom } from '../core/seeded-random';
|
|
8
|
-
import type { createSystemRunner } from '../core/system-runner';
|
|
9
|
-
import type { createDebugDraw } from '../dev/debug-draw';
|
|
10
|
-
import type { ComponentManager } from '../ecs/component-manager';
|
|
11
|
-
import type { InputManager } from '../input/input-manager';
|
|
12
|
-
import type { CollisionSystem } from '../physics/collision-system';
|
|
13
|
-
import type { PhysicsRegistry } from '../physics/physics-registry';
|
|
14
|
-
import type { SceneFile } from '../scene/scene-types';
|
|
15
|
-
import type { AudioContext as GameAudio } from '../setup/setup-audio';
|
|
16
|
-
import type { ParticlesContext } from '../setup/setup-particles';
|
|
17
|
-
import type { Game, WorldInstance } from './game';
|
|
18
|
-
/**
|
|
19
|
-
* The minimal structural shape `ctx.debug.attachRoom` needs from a joined
|
|
20
|
-
* Colyseus room (Task 2.2, `docs/SYNTHETIC-PLAYER-SPEC.md` §3.1's "Multiplayer
|
|
21
|
-
* locus" note): just enough to send the reserved `__vgai:debugCommand`
|
|
22
|
-
* message and listen for its `__vgai:debugCommandResult` reply. Structural,
|
|
23
|
-
* not a Colyseus type import — the same seam-boundary style every other
|
|
24
|
-
* `DebugCtxSurface` member uses (no wrapper around Colyseus itself, D2).
|
|
25
|
-
* `onMessage`'s return type is `unknown` because Colyseus's own return shape
|
|
26
|
-
* (void in some client versions, an unsubscribe function in others) isn't
|
|
27
|
-
* load-bearing here: the registry calls it defensively (invokes it on detach
|
|
28
|
-
* only if it's actually a function).
|
|
29
|
-
*/
|
|
30
|
-
export interface DebugRoomHandle {
|
|
31
|
-
send(type: string, message?: unknown): void;
|
|
32
|
-
onMessage(type: string, cb: (message: unknown) => void): unknown;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Infers a `registerCommand`/`registerReactCommand`/`useDebugCommand`
|
|
36
|
-
* handler's parameter tuple from its declared Zod `args` tuple (dry-run
|
|
37
|
-
* finding, `docs/ACCEPTANCE-DRIVER-BUILD-PLAN.md` Wave 6 ledger —
|
|
38
|
-
* "`registerCommand` fn typing forces `unknown[]` casts"): a real
|
|
39
|
-
* `z.ZodTuple` infers its element types (`z.tuple([z.number(), z.string()])`
|
|
40
|
-
* → `(n: number, s: string) => ...`), while omitting `args` (the generic's
|
|
41
|
-
* `undefined` default) resolves to the original permissive
|
|
42
|
-
* `(...args: unknown[]) => ...` shape every command had before this generic
|
|
43
|
-
* existed. That permissive fallback is deliberate, not just a placeholder —
|
|
44
|
-
* it keeps every existing no-schema registration (including ones whose
|
|
45
|
-
* handler reads positional args the runtime never validates, since
|
|
46
|
-
* `invoke()` only parses `args` against a schema when one is declared)
|
|
47
|
-
* compiling byte-for-byte unchanged.
|
|
48
|
-
*/
|
|
49
|
-
export type DebugCommandArgs<T extends z.ZodTuple | undefined = undefined> = T extends z.ZodTuple ? z.infer<T> : unknown[];
|
|
50
|
-
/**
|
|
51
|
-
* The authoring half of the debug/synthetic-player seam
|
|
52
|
-
* (`docs/SYNTHETIC-PLAYER-SPEC.md` §3.1) — the read/actuate half is
|
|
53
|
-
* `SystemAdapters.DebugAdapter` (`adapter/system-adapter.ts`). Callable from
|
|
54
|
-
* any GameComponent's `init` (one file per new provider/command), or from a
|
|
55
|
-
* react world's `useDebugProvider`/`useDebugCommand`/`useDebugEmit` hooks. Every registration
|
|
56
|
-
* feeds the ONE game-scoped registry (`runtime/debug-registry.ts`) — never a
|
|
57
|
-
* per-world accumulator.
|
|
58
|
-
*/
|
|
59
|
-
export interface DebugCtxSurface {
|
|
60
|
-
/** Register (or replace) a named, JSON-serializable state read. Duplicate
|
|
61
|
-
* names from the SAME world replace + warn once; the SAME name from a
|
|
62
|
-
* DIFFERENT world throws (`DebugError` code `DEBUG_NAME_COLLISION`). */
|
|
63
|
-
registerStateProvider(name: string, fn: () => unknown, opts?: {
|
|
64
|
-
tier?: 'observable' | 'assisted';
|
|
65
|
-
}): void;
|
|
66
|
-
/** Register (or replace) an invokable command. `locus` is REQUIRED once the
|
|
67
|
-
* project declares a Colyseus room (`DebugRegistry.setRoomDeclared`) — a
|
|
68
|
-
* fixture must say whether it mutates authoritative (server) or predicted
|
|
69
|
-
* (client) state.
|
|
70
|
-
*
|
|
71
|
-
* Generic over the declared `args` Zod tuple ({@link DebugCommandArgs}) so
|
|
72
|
-
* `fn`'s parameters INFER from it: `registerCommand('setHp', { args:
|
|
73
|
-
* z.tuple([z.number()]) }, (hp) => ...)` types `hp` as `number` with no
|
|
74
|
-
* cast. Leaving `args` off keeps `fn` typed `(...args: unknown[]) => ...`,
|
|
75
|
-
* same as before this generic existed. */
|
|
76
|
-
registerCommand<T extends z.ZodTuple | undefined = undefined>(name: string, spec: {
|
|
77
|
-
description?: string;
|
|
78
|
-
args?: T;
|
|
79
|
-
locus?: 'client' | 'server';
|
|
80
|
-
}, fn: (...args: DebugCommandArgs<T>) => unknown | Promise<unknown>): void;
|
|
81
|
-
/** Push a tick-stamped event onto the debug event ring (spec §3.3) — the
|
|
82
|
-
* engine stamps `tick`/`simT` at emission, not at read time. */
|
|
83
|
-
emit(event: string, detail?: unknown): void;
|
|
84
|
-
/**
|
|
85
|
-
* Task 2.2 — server-locus command routing (client leg). Call once your
|
|
86
|
-
* game code has joined its Colyseus room, so `locus: 'server'` commands
|
|
87
|
-
* have somewhere to send `__vgai:debugCommand`. Returns a detach function
|
|
88
|
-
* (call on room leave/dispose) — game-scoped, last-attached room wins.
|
|
89
|
-
*/
|
|
90
|
-
attachRoom(room: DebugRoomHandle): () => void;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* All engine subsystems, passed to every game `setup(ctx)` and to each
|
|
94
|
-
* GameComponent lifecycle method (`init`/`update`/`dispose`/trigger callbacks).
|
|
95
|
-
*
|
|
96
|
-
* The surface is intentionally split in two:
|
|
97
|
-
*
|
|
98
|
-
* - **Raw libraries** — the actual Three.js / Rapier / postprocessing objects.
|
|
99
|
-
* Call their documented APIs directly; do NOT build wrappers around them.
|
|
100
|
-
* - **Engine handles** — thin VGAI-owned managers that bridge those libraries
|
|
101
|
-
* into the phase-ordered game loop. Reach for these when you need behavior the
|
|
102
|
-
* raw library doesn't provide (physics↔Object3D mapping, system phases, etc.).
|
|
103
|
-
*/
|
|
104
|
-
export interface GameContext {
|
|
105
|
-
/** Three.js scene graph root. Add/remove any `Object3D` (meshes, lights,
|
|
106
|
-
* groups) here. This is THE scene — there is no separate engine scene. */
|
|
107
|
-
scene: THREE.Scene;
|
|
108
|
-
/** The single render camera. Move/aim it directly, or (preferred) drive it
|
|
109
|
-
* from a camera GameComponent — see the camera-precedence note below. */
|
|
110
|
-
camera: THREE.PerspectiveCamera;
|
|
111
|
-
/** The Rapier physics `World`. Step/query it, create bodies & colliders via
|
|
112
|
-
* `ctx.rapier`. One shared world for the whole scene. */
|
|
113
|
-
rapierWorld: RAPIER.World;
|
|
114
|
-
/** The Rapier module namespace itself (`RigidBodyDesc`, `ColliderDesc`,
|
|
115
|
-
* `Vector3`, enums, …). Use to construct physics descriptors. */
|
|
116
|
-
rapier: typeof RAPIER;
|
|
117
|
-
/** The `postprocessing` EffectComposer driving the final render. Use to
|
|
118
|
-
* add/remove passes (bloom, vignette, …) or reach the underlying
|
|
119
|
-
* `WebGLRenderer` via `composer.getRenderer()`. */
|
|
120
|
-
composer: EffectComposer;
|
|
121
|
-
/** Keyboard/mouse/gamepad input. Polled once per frame in the `input` phase;
|
|
122
|
-
* read action/axis state inside your `update`. */
|
|
123
|
-
input: InputManager;
|
|
124
|
-
/** Rapier collision-event dispatcher. Register handlers with
|
|
125
|
-
* `collisions.onCollision(...)`; it is drained each `postPhysics`. Prefer a
|
|
126
|
-
* GameComponent's `onTriggerEnter/Exit` for per-entity sensor logic. */
|
|
127
|
-
collisions: CollisionSystem;
|
|
128
|
-
/** `Object3D ↔ Rapier body/collider` registry (+ collider→Object3D reverse
|
|
129
|
-
* index). Use to find an entity's body/collider, or the entity behind a
|
|
130
|
-
* raw collision. Inside a component, `this.rigidBody`/`this.collider` are
|
|
131
|
-
* pre-resolved from here. */
|
|
132
|
-
physics: PhysicsRegistry;
|
|
133
|
-
/** Procedural audio: master gain, listener, and one-shot/impact helpers.
|
|
134
|
-
* Use for SFX and music; the listener tracks the camera. */
|
|
135
|
-
audio: GameAudio;
|
|
136
|
-
/** three.quarks particle system: the batched renderer + spawn helpers. Use
|
|
137
|
-
* to emit runtime particle effects; declarative scene particles register
|
|
138
|
-
* here automatically. */
|
|
139
|
-
particles: ParticlesContext;
|
|
140
|
-
/** Immediate-mode debug drawing (`line`/`box`/`sphere`/`arrow`). Drawn
|
|
141
|
-
* objects persist until you call `debugDraw.clear()` yourself (the
|
|
142
|
-
* adapter also clears on scene dispose/hot-reload) — nothing clears it
|
|
143
|
-
* automatically per frame. Dev-only visualization — not for shipped
|
|
144
|
-
* visuals. */
|
|
145
|
-
debugDraw: ReturnType<typeof createDebugDraw>;
|
|
146
|
-
/** Shared GLTF/texture cache. Use `assets.loadGLTF(...)` etc. to load+cache
|
|
147
|
-
* models at runtime so repeated loads reuse geometry/material. */
|
|
148
|
-
assets: AssetCache;
|
|
149
|
-
/** The phase-ordered system runner. `systems.add(phase, fn)` registers a
|
|
150
|
-
* per-frame callback. Reserve this for non-gameplay infra (audio mixers,
|
|
151
|
-
* network send); per-entity GAMEPLAY belongs in a GameComponent. */
|
|
152
|
-
systems: ReturnType<typeof createSystemRunner>;
|
|
153
|
-
/** Manager for all live GameComponent instances (attach/detach/HMR). The
|
|
154
|
-
* scene loader drives this; gameplay code rarely touches it directly. */
|
|
155
|
-
components: ComponentManager;
|
|
156
|
-
/** Register a game-owned `SystemAdapters` capability (networking,
|
|
157
|
-
* navigation, …) on the mounted game's adapter surface, so the editor's
|
|
158
|
-
* introspection panels (via `getActiveSystems()`) can see it. The engine
|
|
159
|
-
* wires the first-party physics/input/assets/audio entries itself;
|
|
160
|
-
* capabilities the GAME owns (a Colyseus connection, a NavMeshManager)
|
|
161
|
-
* are registered here by the game's setup. Optional capability — absent
|
|
162
|
-
* in contexts that expose no adapter surface (some test harnesses);
|
|
163
|
-
* call as `ctx.registerSystemAdapter?.(…)`.
|
|
164
|
-
*
|
|
165
|
-
* Ordering contract: **game registrations always win** — the engine seeds
|
|
166
|
-
* its first-party entries (physics/input/assets/audio) BEFORE setup()
|
|
167
|
-
* runs, so a game that registers any of those same kinds during its own
|
|
168
|
-
* setup overrides the engine's entry, not the other way around. This also
|
|
169
|
-
* holds across a warm restart (`hotReload`): every kind the outgoing game
|
|
170
|
-
* registered is stripped back to the engine's entry (or absent, for
|
|
171
|
-
* game-only kinds like networking/navigation) before the incoming game's
|
|
172
|
-
* setup runs, so a disposed game's adapter is never left stale on the
|
|
173
|
-
* mounted surface. */
|
|
174
|
-
registerSystemAdapter?<K extends keyof SystemAdapters>(kind: K, adapter: SystemAdapters[K]): void;
|
|
175
|
-
/** The debug/synthetic-player authoring surface (`docs/SYNTHETIC-PLAYER-SPEC.md`
|
|
176
|
-
* §3.1) — see {@link DebugCtxSurface}. Optional, same absence precedent as
|
|
177
|
-
* `registerSystemAdapter`: present on every first-party mount, absent only
|
|
178
|
-
* in bare test harnesses that build a hand-rolled `ctx`. */
|
|
179
|
-
debug?: DebugCtxSurface;
|
|
180
|
-
/**
|
|
181
|
-
* D15 (T-D15.1, `docs/D15-DETERMINISM-DESIGN.md` §2.a) — the game-scoped,
|
|
182
|
-
* named-stream seeded PRNG. `ctx.random()` draws from the `'gameplay'`
|
|
183
|
-
* stream; `ctx.random.stream('vfx')` (or any other name) draws from an
|
|
184
|
-
* INDEPENDENT stream, so a cosmetic/VFX draw can never shift the gameplay
|
|
185
|
-
* draw sequence. Use this instead of raw `Math.random()` for anything a
|
|
186
|
-
* project wants to keep reproducible; `ctx.random` itself always exists
|
|
187
|
-
* and is always internally consistent (same seed ⇒ same sequence) whether
|
|
188
|
-
* or not the project's manifest declares `determinism.seededRandom` — that
|
|
189
|
-
* flag only gates the BOOT-TIME seeding from
|
|
190
|
-
* `manifest.determinism.defaultSeed`/`?vgai-seed=`, the burn-down lint
|
|
191
|
-
* scan, and the dev-mode `Math.random` phase trap (three separate
|
|
192
|
-
* enforcers, `test/gameplay-rng-ban.test.ts` + `runtime/gameplay-rng-trap.ts`),
|
|
193
|
-
* never `ctx.random`'s mere presence. Same absence precedent as `debug`
|
|
194
|
-
* above: present on every first-party mount, optional only for bare test
|
|
195
|
-
* harnesses that build a hand-rolled `ctx`. `reseed(seed)` (future draws
|
|
196
|
-
* only) is `play.seed.set`'s eventual target (T-D15.6, not yet wired).
|
|
197
|
-
*/
|
|
198
|
-
random?: SeededRandom;
|
|
199
|
-
/** The Game root — the loop, the world registry, and game-scoped handles.
|
|
200
|
-
* Absent only in bare test harnesses that construct a partial context (the
|
|
201
|
-
* host always sets it in `createGameRuntime`). Optional so every existing
|
|
202
|
-
* harness that builds a hand-rolled `ctx` object keeps compiling
|
|
203
|
-
* unmodified — the same precedent as `registerSystemAdapter`. */
|
|
204
|
-
game?: Game | undefined;
|
|
205
|
-
/** Alias for `game.roots` — the live, declaration-ordered world registry.
|
|
206
|
-
* Same optionality/absence rule as `game` above. */
|
|
207
|
-
roots?: ReadonlyArray<WorldInstance> | undefined;
|
|
208
|
-
}
|
|
209
|
-
/** Return value from a game setup function. */
|
|
210
|
-
export interface GameCleanup {
|
|
211
|
-
dispose: () => void;
|
|
212
|
-
}
|
|
213
|
-
/** Context passed to setup() when launched from the editor's play mode. */
|
|
214
|
-
export interface EditorPreview {
|
|
215
|
-
/** Path of the .vscn.json file the user has open (null if unsaved). */
|
|
216
|
-
scenePath: string | null;
|
|
217
|
-
/** The editor's in-memory scene document, including unsaved edits. */
|
|
218
|
-
sceneData: SceneFile;
|
|
219
|
-
/** Editor viewport camera transform — use this as the initial game camera viewpoint. */
|
|
220
|
-
viewportCamera?: {
|
|
221
|
-
position: [number, number, number];
|
|
222
|
-
quaternion: [number, number, number, number];
|
|
223
|
-
};
|
|
224
|
-
/**
|
|
225
|
-
* Which bundled example the static/browser build's project picker wants to
|
|
226
|
-
* run (docs/EXAMPLES-AS-PROJECTS-DESIGN.md §4 — Adjudication H). Only
|
|
227
|
-
* meaningful to `packages/editor/src/browser-play-entry.ts`'s dispatch over
|
|
228
|
-
* the generated `SETUP_BY_EXAMPLE_ID` table; every other `GameSetupFn`
|
|
229
|
-
* consumer ignores it. Undefined ⇒ the generic scene-loader fallback
|
|
230
|
-
* (today's only reachable behavior — no caller sets this yet, since the
|
|
231
|
-
* picker itself is a later wave).
|
|
232
|
-
*/
|
|
233
|
-
exampleId?: string | undefined;
|
|
234
|
-
/**
|
|
235
|
-
* Asset prefix for the static/browser build's GENERIC scene-loader fallback,
|
|
236
|
-
* set INSTEAD of `exampleId` when the editor has a non-default scene of a
|
|
237
|
-
* bundled example open (hosted `?project=<id>&scene=<project-relative>` —
|
|
238
|
-
* Track H): the open scene plays via `sceneData`, but its relative asset
|
|
239
|
-
* refs still live under the example's staged `/examples/<id>/` public root.
|
|
240
|
-
* Ignored whenever `exampleId` is set; undefined ⇒ root prefix `/`.
|
|
241
|
-
*/
|
|
242
|
-
assetPrefix?: string | undefined;
|
|
243
|
-
}
|
|
244
|
-
/** A game setup function: receives engine context, returns cleanup.
|
|
245
|
-
*
|
|
246
|
-
* This is the MOUNT body of the FIRST-PARTY implementer. The host no longer
|
|
247
|
-
* depends on it — the host depends on `GameAdapter` (`@engine/adapter`), and
|
|
248
|
-
* `GameSetupFn` is wrapped into a `VgaiSceneGameAdapter` via `fromSetup`. See
|
|
249
|
-
* docs/ADAPTER-ARCHITECTURE.md. (The former `GameAdapter` `{ setup, components }`
|
|
250
|
-
* interface lived here; it is superseded by the real adapter interfaces in
|
|
251
|
-
* `@engine/adapter`.) */
|
|
252
|
-
export type GameSetupFn = (ctx: GameContext, editor?: EditorPreview) => Promise<GameCleanup>;
|
|
253
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"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"}
|
package/dist/runtime/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
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.)
|
|
5
|
-
*
|
|
6
|
-
* ONE place that owns the URL-keyed caches and the clone-safety contract, shared
|
|
7
|
-
* by BOTH the engine runtime (scene-loader, create-runtime) AND the editor
|
|
8
|
-
* (entity-factory, scene-sync). Previously this logic was duplicated across six
|
|
9
|
-
* sites with three separate GLTF caches and four GLTFLoader instances, so fixes
|
|
10
|
-
* (DRACO wiring, the `__sharedGeometry` clone-safety tag, skybox handling) did
|
|
11
|
-
* not propagate. Everything funnels through the shared loaders in `../loader`
|
|
12
|
-
* (`gltfLoader` is DRACO-wired — CB2 — and `textureLoader` shares the engine
|
|
13
|
-
* LoadingManager / asset-prefix rewrite).
|
|
14
|
-
*
|
|
15
|
-
* Cache lifetime / P1.8: these caches are intentionally module-level and persist
|
|
16
|
-
* ACROSS hot-reloads / scene switches (they are NOT cleared on every scene load).
|
|
17
|
-
* This is deliberate: (1) it makes repeated Play→Stop→Play cheap, and (2) it
|
|
18
|
-
* underpins the `__sharedGeometry` contract from P0.2 — GLTF clones share the
|
|
19
|
-
* cached source geometry, so clearing mid-session would orphan live clones. The
|
|
20
|
-
* caches are keyed by URL, so loading the SAME asset N times is bounded (one
|
|
21
|
-
* entry per distinct URL, not per load). They are released only on full runtime
|
|
22
|
-
* teardown via {@link clearAssetCaches}.
|
|
23
|
-
*/
|
|
24
|
-
import * as THREE from 'three';
|
|
25
|
-
/** Load (and cache) a texture via the shared, prefix-aware TextureLoader. */
|
|
26
|
-
export declare function loadTexture(url: string): THREE.Texture;
|
|
27
|
-
/**
|
|
28
|
-
* Load a GLTF/GLB and return a fresh, disposal-safe clone (+ the source's
|
|
29
|
-
* animation clips). DRACO decoding is handled by the shared `gltfLoader`.
|
|
30
|
-
*
|
|
31
|
-
* Clone-safety contract (P0.2 — load-bearing, tested):
|
|
32
|
-
* `SkeletonUtils.clone` shares geometry AND materials with the cached source.
|
|
33
|
-
* We give each clone its OWN materials (so scene cleanup can dispose them
|
|
34
|
-
* without corrupting the cache) and tag every mesh `userData.__sharedGeometry`
|
|
35
|
-
* so cleanup (engine create-runtime fullCleanup + editor scene-sync
|
|
36
|
-
* disposeObject3D) skips disposing the shared geometry buffers.
|
|
37
|
-
*/
|
|
38
|
-
export declare function loadGLTF(url: string): Promise<{
|
|
39
|
-
scene: THREE.Group;
|
|
40
|
-
animations: THREE.AnimationClip[];
|
|
41
|
-
}>;
|
|
42
|
-
/**
|
|
43
|
-
* Resolve a single named node inside an already-loaded glTF scene graph (F4,
|
|
44
|
-
* docs/VSCN-STRUCTURAL-GAPS-DESIGN.md `mesh.node`). Pure and headlessly
|
|
45
|
-
* testable — no fetch, no cache lookups; callers pass the `scene` they already
|
|
46
|
-
* got from {@link loadGLTF}.
|
|
47
|
-
*
|
|
48
|
-
* The returned node is the SAME object (and shares the SAME geometry) as
|
|
49
|
-
* found in `scene` — nothing is cloned or copied out. `scene` is already a
|
|
50
|
-
* fresh `SkeletonUtils.clone()` per {@link loadGLTF}'s clone-safety contract,
|
|
51
|
-
* so mutating/detaching the returned node is safe.
|
|
52
|
-
*
|
|
53
|
-
* Atomic-subtree guard: a `SkinnedMesh` cannot be lifted out of its armature
|
|
54
|
-
* (its skeleton/bind matrices reference sibling bone nodes elsewhere in the
|
|
55
|
-
* hierarchy), so resolving a node that IS a SkinnedMesh, or that CONTAINS one,
|
|
56
|
-
* throws a loud `SceneParseError` instead of silently producing broken skinning.
|
|
57
|
-
*/
|
|
58
|
-
export declare function resolveGltfNode(scene: THREE.Object3D, nodeName: string, src: string): THREE.Object3D;
|
|
59
|
-
/**
|
|
60
|
-
* Clear the module-level GLTF / texture caches. Call on full runtime teardown
|
|
61
|
-
* (create-runtime fullCleanup / hot-reload) to release cached GPU resources
|
|
62
|
-
* and avoid leaking across editor Play sessions. See the lifetime note at the
|
|
63
|
-
* top of this file for why these are NOT cleared per scene load.
|
|
64
|
-
*
|
|
65
|
-
* NOTE: the IBL/skybox env-map cache lives in scene-loader (it needs a
|
|
66
|
-
* WebGLRenderer for PMREM); scene-loader's `clearAssetCaches` wraps this and
|
|
67
|
-
* also clears that env cache.
|
|
68
|
-
*/
|
|
69
|
-
export declare function clearAssetCaches(): void;
|
|
70
|
-
/**
|
|
71
|
-
* Test-only: current sizes of the module-level caches. Used by the P1.8 headless
|
|
72
|
-
* test to assert caches stay bounded (one entry per distinct asset URL) across
|
|
73
|
-
* repeated loads of the same scene, rather than growing per load.
|
|
74
|
-
*/
|
|
75
|
-
export declare function assetCacheSizes(): {
|
|
76
|
-
textures: number;
|
|
77
|
-
gltf: number;
|
|
78
|
-
};
|
|
79
|
-
//# sourceMappingURL=asset-loaders.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asset-loaders.d.ts","sourceRoot":"","sources":["../../src/scene/asset-loaders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,CAMtD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IAAC,UAAU,EAAE,KAAK,CAAC,aAAa,EAAE,CAAA;CAAE,CAAC,CAyBpE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,KAAK,CAAC,QAAQ,EACrB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV,KAAK,CAAC,QAAQ,CAuChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAGvC;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAEpE"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
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.)
|
|
5
|
-
*
|
|
6
|
-
* ONE place that owns the URL-keyed caches and the clone-safety contract, shared
|
|
7
|
-
* by BOTH the engine runtime (scene-loader, create-runtime) AND the editor
|
|
8
|
-
* (entity-factory, scene-sync). Previously this logic was duplicated across six
|
|
9
|
-
* sites with three separate GLTF caches and four GLTFLoader instances, so fixes
|
|
10
|
-
* (DRACO wiring, the `__sharedGeometry` clone-safety tag, skybox handling) did
|
|
11
|
-
* not propagate. Everything funnels through the shared loaders in `../loader`
|
|
12
|
-
* (`gltfLoader` is DRACO-wired — CB2 — and `textureLoader` shares the engine
|
|
13
|
-
* LoadingManager / asset-prefix rewrite).
|
|
14
|
-
*
|
|
15
|
-
* Cache lifetime / P1.8: these caches are intentionally module-level and persist
|
|
16
|
-
* ACROSS hot-reloads / scene switches (they are NOT cleared on every scene load).
|
|
17
|
-
* This is deliberate: (1) it makes repeated Play→Stop→Play cheap, and (2) it
|
|
18
|
-
* underpins the `__sharedGeometry` contract from P0.2 — GLTF clones share the
|
|
19
|
-
* cached source geometry, so clearing mid-session would orphan live clones. The
|
|
20
|
-
* caches are keyed by URL, so loading the SAME asset N times is bounded (one
|
|
21
|
-
* entry per distinct URL, not per load). They are released only on full runtime
|
|
22
|
-
* teardown via {@link clearAssetCaches}.
|
|
23
|
-
*/
|
|
24
|
-
import * as THREE from 'three';
|
|
25
|
-
import * as SkeletonUtils from 'three/addons/utils/SkeletonUtils.js';
|
|
26
|
-
import { gltfLoader, textureLoader } from '../loader';
|
|
27
|
-
import { SceneParseError } from './parse';
|
|
28
|
-
import { setUserData } from './user-data';
|
|
29
|
-
const textureCache = new Map();
|
|
30
|
-
const gltfCache = new Map();
|
|
31
|
-
/** Load (and cache) a texture via the shared, prefix-aware TextureLoader. */
|
|
32
|
-
export function loadTexture(url) {
|
|
33
|
-
const cached = textureCache.get(url);
|
|
34
|
-
if (cached)
|
|
35
|
-
return cached;
|
|
36
|
-
const tex = textureLoader.load(url);
|
|
37
|
-
textureCache.set(url, tex);
|
|
38
|
-
return tex;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Load a GLTF/GLB and return a fresh, disposal-safe clone (+ the source's
|
|
42
|
-
* animation clips). DRACO decoding is handled by the shared `gltfLoader`.
|
|
43
|
-
*
|
|
44
|
-
* Clone-safety contract (P0.2 — load-bearing, tested):
|
|
45
|
-
* `SkeletonUtils.clone` shares geometry AND materials with the cached source.
|
|
46
|
-
* We give each clone its OWN materials (so scene cleanup can dispose them
|
|
47
|
-
* without corrupting the cache) and tag every mesh `userData.__sharedGeometry`
|
|
48
|
-
* so cleanup (engine create-runtime fullCleanup + editor scene-sync
|
|
49
|
-
* disposeObject3D) skips disposing the shared geometry buffers.
|
|
50
|
-
*/
|
|
51
|
-
export function loadGLTF(url) {
|
|
52
|
-
let cached = gltfCache.get(url);
|
|
53
|
-
if (!cached) {
|
|
54
|
-
cached = new Promise((resolve, reject) => {
|
|
55
|
-
gltfLoader.load(url, (gltf) => resolve({ scene: gltf.scene, animations: gltf.animations }), undefined, (err) => reject(err));
|
|
56
|
-
});
|
|
57
|
-
gltfCache.set(url, cached);
|
|
58
|
-
}
|
|
59
|
-
return cached.then((entry) => {
|
|
60
|
-
const scene = SkeletonUtils.clone(entry.scene);
|
|
61
|
-
scene.traverse((child) => {
|
|
62
|
-
if (child instanceof THREE.Mesh) {
|
|
63
|
-
child.material = Array.isArray(child.material)
|
|
64
|
-
? child.material.map((m) => m.clone())
|
|
65
|
-
: child.material.clone();
|
|
66
|
-
setUserData(child, '__sharedGeometry', true);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
return { scene, animations: entry.animations };
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Resolve a single named node inside an already-loaded glTF scene graph (F4,
|
|
74
|
-
* docs/VSCN-STRUCTURAL-GAPS-DESIGN.md `mesh.node`). Pure and headlessly
|
|
75
|
-
* testable — no fetch, no cache lookups; callers pass the `scene` they already
|
|
76
|
-
* got from {@link loadGLTF}.
|
|
77
|
-
*
|
|
78
|
-
* The returned node is the SAME object (and shares the SAME geometry) as
|
|
79
|
-
* found in `scene` — nothing is cloned or copied out. `scene` is already a
|
|
80
|
-
* fresh `SkeletonUtils.clone()` per {@link loadGLTF}'s clone-safety contract,
|
|
81
|
-
* so mutating/detaching the returned node is safe.
|
|
82
|
-
*
|
|
83
|
-
* Atomic-subtree guard: a `SkinnedMesh` cannot be lifted out of its armature
|
|
84
|
-
* (its skeleton/bind matrices reference sibling bone nodes elsewhere in the
|
|
85
|
-
* hierarchy), so resolving a node that IS a SkinnedMesh, or that CONTAINS one,
|
|
86
|
-
* throws a loud `SceneParseError` instead of silently producing broken skinning.
|
|
87
|
-
*/
|
|
88
|
-
export function resolveGltfNode(scene, nodeName, src) {
|
|
89
|
-
const node = scene.getObjectByName(nodeName);
|
|
90
|
-
if (!node) {
|
|
91
|
-
throw new SceneParseError([
|
|
92
|
-
{
|
|
93
|
-
code: 'custom',
|
|
94
|
-
path: ['mesh', 'node'],
|
|
95
|
-
message: `glTF "${src}" has no node named "${nodeName}" (getObjectByName found nothing)`,
|
|
96
|
-
},
|
|
97
|
-
], src);
|
|
98
|
-
}
|
|
99
|
-
const isSkinned = (o) => o.isSkinnedMesh;
|
|
100
|
-
let containsSkinned = isSkinned(node);
|
|
101
|
-
if (!containsSkinned) {
|
|
102
|
-
node.traverse((child) => {
|
|
103
|
-
if (isSkinned(child))
|
|
104
|
-
containsSkinned = true;
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
if (containsSkinned) {
|
|
108
|
-
throw new SceneParseError([
|
|
109
|
-
{
|
|
110
|
-
code: 'custom',
|
|
111
|
-
path: ['mesh', 'node'],
|
|
112
|
-
message: `glTF "${src}" node "${nodeName}" is (or contains) a SkinnedMesh — a skinned mesh ` +
|
|
113
|
-
'cannot be lifted out of its armature (atomic-subtree rule). Reference the whole ' +
|
|
114
|
-
'file instead of a `node`, or bake/export a non-skinned sub-asset.',
|
|
115
|
-
},
|
|
116
|
-
], src);
|
|
117
|
-
}
|
|
118
|
-
return node;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Clear the module-level GLTF / texture caches. Call on full runtime teardown
|
|
122
|
-
* (create-runtime fullCleanup / hot-reload) to release cached GPU resources
|
|
123
|
-
* and avoid leaking across editor Play sessions. See the lifetime note at the
|
|
124
|
-
* top of this file for why these are NOT cleared per scene load.
|
|
125
|
-
*
|
|
126
|
-
* NOTE: the IBL/skybox env-map cache lives in scene-loader (it needs a
|
|
127
|
-
* WebGLRenderer for PMREM); scene-loader's `clearAssetCaches` wraps this and
|
|
128
|
-
* also clears that env cache.
|
|
129
|
-
*/
|
|
130
|
-
export function clearAssetCaches() {
|
|
131
|
-
textureCache.clear();
|
|
132
|
-
gltfCache.clear();
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Test-only: current sizes of the module-level caches. Used by the P1.8 headless
|
|
136
|
-
* test to assert caches stay bounded (one entry per distinct asset URL) across
|
|
137
|
-
* repeated loads of the same scene, rather than growing per load.
|
|
138
|
-
*/
|
|
139
|
-
export function assetCacheSizes() {
|
|
140
|
-
return { textures: textureCache.size, gltf: gltfCache.size };
|
|
141
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { SceneEntity, SceneEnvironment, SceneFile } from './scene-types';
|
|
2
|
-
/**
|
|
3
|
-
* Collect all external asset paths referenced by a scene's entities and environment.
|
|
4
|
-
*/
|
|
5
|
-
export declare function collectAssetPaths(entities: SceneEntity[], environment?: SceneEnvironment): Set<string>;
|
|
6
|
-
/**
|
|
7
|
-
* Deep-clone a scene document and replace all occurrences of oldPath with newPath
|
|
8
|
-
* in asset reference fields. Returns the new document.
|
|
9
|
-
*/
|
|
10
|
-
export declare function applyAssetRename(doc: SceneFile, oldPath: string, newPath: string): SceneFile;
|
|
11
|
-
//# sourceMappingURL=asset-paths.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asset-paths.d.ts","sourceRoot":"","sources":["../../src/scene/asset-paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAuD9E;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,WAAW,EAAE,EACvB,WAAW,CAAC,EAAE,gBAAgB,GAC7B,GAAG,CAAC,MAAM,CAAC,CAsBb;AAuBD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAU5F"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Every material field that holds a texture-file path, as [group, key] pairs —
|
|
3
|
-
* group `null` for top-level fields, otherwise the physical feature group
|
|
4
|
-
* (clearcoat/transmission/sheen/iridescence) the key nests under. One table
|
|
5
|
-
* drives both collect and rename so the two can never disagree;
|
|
6
|
-
* `asset-paths.test.ts` derives the expected set from SceneMaterialSchema's
|
|
7
|
-
* `.describe()` strings so this list can't silently fall behind the schema.
|
|
8
|
-
*/
|
|
9
|
-
const MATERIAL_TEXTURE_FIELDS = [
|
|
10
|
-
[null, 'map'],
|
|
11
|
-
[null, 'normalMap'],
|
|
12
|
-
[null, 'emissiveMap'],
|
|
13
|
-
[null, 'aoMap'],
|
|
14
|
-
[null, 'lightMap'],
|
|
15
|
-
[null, 'roughnessMap'],
|
|
16
|
-
[null, 'metalnessMap'],
|
|
17
|
-
[null, 'displacementMap'],
|
|
18
|
-
['clearcoat', 'clearcoatMap'],
|
|
19
|
-
['clearcoat', 'clearcoatRoughnessMap'],
|
|
20
|
-
['transmission', 'transmissionMap'],
|
|
21
|
-
['sheen', 'sheenColorMap'],
|
|
22
|
-
['sheen', 'sheenRoughnessMap'],
|
|
23
|
-
['iridescence', 'iridescenceMap'],
|
|
24
|
-
['iridescence', 'iridescenceThicknessMap'],
|
|
25
|
-
];
|
|
26
|
-
/** Visit every authored texture path on a material (inline or override). */
|
|
27
|
-
function forEachMaterialTexturePath(material, fn) {
|
|
28
|
-
for (const [group, key] of MATERIAL_TEXTURE_FIELDS) {
|
|
29
|
-
const holder = group
|
|
30
|
-
? material[group]
|
|
31
|
-
: material;
|
|
32
|
-
if (!holder || typeof holder !== 'object')
|
|
33
|
-
continue;
|
|
34
|
-
const value = holder[key];
|
|
35
|
-
if (typeof value === 'string')
|
|
36
|
-
fn(holder, key, value);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function isFilePrefab(value) {
|
|
40
|
-
return value.includes('/');
|
|
41
|
-
}
|
|
42
|
-
function walkEntities(entities, fn) {
|
|
43
|
-
for (const e of entities) {
|
|
44
|
-
fn(e);
|
|
45
|
-
if (e.children)
|
|
46
|
-
walkEntities(e.children, fn);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Collect all external asset paths referenced by a scene's entities and environment.
|
|
51
|
-
*/
|
|
52
|
-
export function collectAssetPaths(entities, environment) {
|
|
53
|
-
const paths = new Set();
|
|
54
|
-
walkEntities(entities, (e) => {
|
|
55
|
-
if (e.mesh?.type === 'gltf' && e.mesh.src)
|
|
56
|
-
paths.add(e.mesh.src);
|
|
57
|
-
if (e.mesh?.instances)
|
|
58
|
-
paths.add(e.mesh.instances);
|
|
59
|
-
if (e.material) {
|
|
60
|
-
forEachMaterialTexturePath(e.material, (_holder, _key, value) => paths.add(value));
|
|
61
|
-
}
|
|
62
|
-
if (e.materialRef)
|
|
63
|
-
paths.add(e.materialRef);
|
|
64
|
-
if (e.particles?.material?.map)
|
|
65
|
-
paths.add(e.particles.material.map);
|
|
66
|
-
if (e.audio?.src)
|
|
67
|
-
paths.add(e.audio.src);
|
|
68
|
-
if (e.prefab && isFilePrefab(e.prefab))
|
|
69
|
-
paths.add(e.prefab);
|
|
70
|
-
});
|
|
71
|
-
if (environment?.skybox)
|
|
72
|
-
paths.add(environment.skybox);
|
|
73
|
-
return paths;
|
|
74
|
-
}
|
|
75
|
-
/** Replace oldPath with newPath in a single entity's asset fields. Mutates in place. */
|
|
76
|
-
function renameInEntity(e, oldPath, newPath) {
|
|
77
|
-
if (e.mesh?.type === 'gltf' && e.mesh.src === oldPath) {
|
|
78
|
-
e.mesh.src = newPath;
|
|
79
|
-
}
|
|
80
|
-
if (e.mesh?.instances === oldPath)
|
|
81
|
-
e.mesh.instances = newPath;
|
|
82
|
-
if (e.material) {
|
|
83
|
-
forEachMaterialTexturePath(e.material, (holder, key, value) => {
|
|
84
|
-
if (value === oldPath)
|
|
85
|
-
holder[key] = newPath;
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
if (e.materialRef === oldPath)
|
|
89
|
-
e.materialRef = newPath;
|
|
90
|
-
if (e.particles?.material?.map === oldPath)
|
|
91
|
-
e.particles.material.map = newPath;
|
|
92
|
-
if (e.audio?.src === oldPath)
|
|
93
|
-
e.audio.src = newPath;
|
|
94
|
-
if (e.prefab === oldPath)
|
|
95
|
-
e.prefab = newPath;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Deep-clone a scene document and replace all occurrences of oldPath with newPath
|
|
99
|
-
* in asset reference fields. Returns the new document.
|
|
100
|
-
*/
|
|
101
|
-
export function applyAssetRename(doc, oldPath, newPath) {
|
|
102
|
-
const cloned = JSON.parse(JSON.stringify(doc));
|
|
103
|
-
walkEntities(cloned.entities, (e) => renameInEntity(e, oldPath, newPath));
|
|
104
|
-
if (cloned.environment?.skybox === oldPath) {
|
|
105
|
-
cloned.environment.skybox = newPath;
|
|
106
|
-
}
|
|
107
|
-
return cloned;
|
|
108
|
-
}
|