@vgai/engine 0.3.0 → 0.4.0-canary.20260715.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/package.json +8 -2
- package/schemas/engine-api.json +124 -0
- package/schemas/engine-api.md +53 -0
- package/schemas/engine-capabilities.json +124 -0
- package/schemas/inputmap.schema.json +314 -0
- package/schemas/mat.schema.json +286 -0
- package/schemas/prefab.schema.json +10148 -0
- package/schemas/scn2d.schema.json +475 -0
- package/schemas/vgai-game.schema.json +383 -0
- package/schemas/vscn.schema.json +11007 -0
- package/src/adapter/{world-kind.ts → adapter-surface.ts} +6 -6
- package/src/adapter/authoring.ts +67 -0
- package/src/adapter/game-adapter.ts +8 -8
- package/src/adapter/host-context.ts +2 -4
- package/src/adapter/index.ts +3 -1
- package/src/adapter/system-adapter.ts +73 -0
- package/src/adapter/vgai-scene-game-adapter.ts +239 -180
- package/src/animation/xstate-animation-binding.ts +300 -262
- package/src/animation/xstate-animation-meta.ts +50 -13
- package/src/character/cloth-sim.ts +533 -0
- package/src/character/spring-chain.ts +307 -0
- package/src/core/game-loop.ts +41 -3
- package/src/core/seeded-random.ts +161 -0
- package/src/core/system-runner.ts +20 -3
- package/src/core/types.ts +37 -0
- package/src/data/data-asset.ts +1 -1
- package/src/dev/performance-profiler.ts +213 -0
- package/src/dev/webgl-gpu-timer.ts +53 -0
- package/src/ecs/component-manager.ts +45 -12
- package/src/ecs/game-component.ts +95 -11
- package/src/humanoid/bake.operation.ts +326 -0
- package/src/humanoid/body.ts +663 -0
- package/src/humanoid/clips.ts +149 -0
- package/src/humanoid/compose.ts +209 -0
- package/src/humanoid/generate.ts +189 -0
- package/src/humanoid/index.ts +36 -0
- package/src/humanoid/schema.ts +108 -0
- package/src/humanoid/skeleton.ts +345 -0
- package/src/index.ts +5 -5
- package/src/input/input-manager.ts +701 -22
- package/src/input/input-types.ts +5 -2
- package/src/manifest/index.ts +5 -5
- package/src/manifest/load.ts +125 -72
- package/src/manifest/schema.ts +362 -255
- package/src/react/game-state.tsx +135 -32
- package/src/react/root-adapter.tsx +49 -0
- package/src/react/unmanaged-root-detector.ts +66 -0
- package/src/react/use-data.ts +12 -2
- package/src/runtime/create-runtime.ts +100 -282
- package/src/runtime/debug-bridge.ts +483 -0
- package/src/runtime/debug-registry.ts +856 -0
- package/src/runtime/game.ts +342 -93
- package/src/runtime/gameplay-rng-trap.ts +134 -0
- package/src/runtime/input-router.ts +7 -7
- package/src/runtime/mount-game.ts +40 -38
- package/src/runtime/mount-manifest.ts +169 -37
- package/src/runtime/render-control.ts +13 -13
- package/src/runtime/render-seed.ts +1 -1
- package/src/runtime/state-bridge.ts +24 -10
- package/src/runtime/types.ts +110 -28
- package/src/scene/asset-registry.ts +22 -0
- package/src/scene/component-registry.ts +14 -3
- package/src/scene/defaults.ts +1 -0
- package/src/scene/light-camera-factory.ts +11 -3
- package/src/scene/scene-apply.ts +55 -4
- package/src/scene/scene-loader.ts +10 -27
- package/src/scene/scene-types.ts +0 -1
- package/src/scene/schema/index.ts +0 -34
- package/src/scene/schema/light.ts +16 -1
- package/src/scene/schema/material.ts +96 -91
- package/src/scene/schema/scene-file.ts +1 -7
- package/src/scene/user-data.ts +14 -1
- package/src/setup/setup-renderer.ts +1 -1
- package/src/tools/define-tool.ts +50 -11
- package/src/world2d/authoring-2d.ts +17 -1
- package/src/world2d/collision-2d.ts +1 -1
- package/src/world2d/pixi-game-adapter.ts +19 -17
- package/src/world2d/scene2d-loader.ts +1 -0
- package/src/world2d/types.ts +8 -2
- package/dist/adapter/authoring.d.ts +0 -404
- 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 -73
- 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 -133
- 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 -116
- package/dist/adapter/vgai-scene-game-adapter.d.ts.map +0 -1
- package/dist/adapter/vgai-scene-game-adapter.js +0 -714
- package/dist/adapter/world-kind.d.ts +0 -30
- package/dist/adapter/world-kind.d.ts.map +0 -1
- package/dist/adapter/world-kind.js +0 -18
- 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 -111
- package/dist/animation/xstate-animation-binding.d.ts.map +0 -1
- package/dist/animation/xstate-animation-binding.js +0 -307
- package/dist/animation/xstate-animation-meta.d.ts +0 -228
- package/dist/animation/xstate-animation-meta.d.ts.map +0 -1
- package/dist/animation/xstate-animation-meta.js +0 -221
- 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/core/game-loop.d.ts +0 -21
- package/dist/core/game-loop.d.ts.map +0 -1
- package/dist/core/game-loop.js +0 -130
- 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 -286
- package/dist/core/types.d.ts +0 -58
- 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/ecs/component-manager.d.ts +0 -189
- package/dist/ecs/component-manager.d.ts.map +0 -1
- package/dist/ecs/component-manager.js +0 -676
- package/dist/ecs/game-component.d.ts +0 -97
- package/dist/ecs/game-component.d.ts.map +0 -1
- package/dist/ecs/game-component.js +0 -80
- 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/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 -596
- package/dist/input/input-manager.d.ts.map +0 -1
- package/dist/input/input-manager.js +0 -1564
- package/dist/input/input-types.d.ts +0 -171
- 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 -117
- package/dist/manifest/load.d.ts.map +0 -1
- package/dist/manifest/load.js +0 -255
- package/dist/manifest/schema.d.ts +0 -173
- package/dist/manifest/schema.d.ts.map +0 -1
- package/dist/manifest/schema.js +0 -302
- 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 -105
- package/dist/react/game-state.d.ts.map +0 -1
- package/dist/react/game-state.js +0 -144
- 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 -96
- 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 -280
- package/dist/runtime/create-runtime.d.ts.map +0 -1
- package/dist/runtime/create-runtime.js +0 -795
- 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 -433
- package/dist/runtime/game.d.ts.map +0 -1
- package/dist/runtime/game.js +0 -569
- 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 -119
- package/dist/runtime/mount-manifest.d.ts.map +0 -1
- package/dist/runtime/mount-manifest.js +0 -204
- 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/scene-ui-bridge.d.ts +0 -69
- package/dist/runtime/scene-ui-bridge.d.ts.map +0 -1
- package/dist/runtime/scene-ui-bridge.js +0 -23
- package/dist/runtime/scene-ui-data.d.ts +0 -13
- package/dist/runtime/scene-ui-data.d.ts.map +0 -1
- package/dist/runtime/scene-ui-data.js +0 -92
- package/dist/runtime/state-bridge.d.ts +0 -47
- package/dist/runtime/state-bridge.d.ts.map +0 -1
- package/dist/runtime/state-bridge.js +0 -53
- package/dist/runtime/types.d.ts +0 -179
- 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 -30
- package/dist/scene/asset-registry.d.ts.map +0 -1
- package/dist/scene/asset-registry.js +0 -50
- 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 -17
- package/dist/scene/component-registry.d.ts.map +0 -1
- package/dist/scene/component-registry.js +0 -28
- 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 -326
- 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 -177
- package/dist/scene/scene-loader.d.ts.map +0 -1
- package/dist/scene/scene-loader.js +0 -1213
- 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 -39
- package/dist/scene/schema/index.d.ts.map +0 -1
- package/dist/scene/schema/index.js +0 -20
- 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 -99
- 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 -304
- package/dist/scene/schema/scene-file.d.ts.map +0 -1
- package/dist/scene/schema/scene-file.js +0 -262
- 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/schema/ui.d.ts +0 -880
- package/dist/scene/schema/ui.d.ts.map +0 -1
- package/dist/scene/schema/ui.js +0 -506
- package/dist/scene/user-data.d.ts +0 -171
- package/dist/scene/user-data.d.ts.map +0 -1
- package/dist/scene/user-data.js +0 -137
- 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 -105
- package/dist/tools/define-tool.d.ts.map +0 -1
- package/dist/tools/define-tool.js +0 -82
- package/dist/world2d/authoring-2d.d.ts +0 -76
- package/dist/world2d/authoring-2d.d.ts.map +0 -1
- package/dist/world2d/authoring-2d.js +0 -176
- 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 -211
- 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 -274
- 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 -53
- package/dist/world2d/types.d.ts.map +0 -1
- package/dist/world2d/types.js +0 -1
- package/src/runtime/scene-ui-bridge.ts +0 -86
- package/src/runtime/scene-ui-data.ts +0 -119
- package/src/scene/schema/ui.ts +0 -602
|
@@ -1,103 +1,108 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
flatShading: z.boolean().optional().describe('Use flat (faceted) shading instead of smooth'),
|
|
3
|
+
const SceneMaterialObjectSchema = z.object({
|
|
4
|
+
type: z
|
|
5
|
+
.enum(['standard', 'physical', 'basic', 'toon', 'custom'])
|
|
6
|
+
.describe('Material shading model. "custom" resolves `def` against the material registry'),
|
|
7
|
+
def: z
|
|
8
|
+
.string()
|
|
9
|
+
.optional()
|
|
10
|
+
.describe('Registered custom-material name (required when type is "custom")'),
|
|
11
|
+
uniforms: z
|
|
12
|
+
.record(z.string(), z.union([z.number(), z.string(), z.boolean(), z.array(z.number())]))
|
|
13
|
+
.optional()
|
|
14
|
+
.describe('Authored uniform values for a custom material, keyed by uniform name'),
|
|
15
|
+
color: z.string().optional().describe('Base color as CSS hex string (e.g. "#ff0000")'),
|
|
16
|
+
metalness: z.number().optional().describe('Metalness factor 0–1 (standard/physical only)'),
|
|
17
|
+
roughness: z.number().optional().describe('Roughness factor 0–1 (standard/physical only)'),
|
|
18
|
+
map: z.string().optional().describe('Path to albedo/diffuse texture image'),
|
|
19
|
+
normalMap: z.string().optional().describe('Path to normal map texture image'),
|
|
20
|
+
emissive: z.string().optional().describe('Emissive color as CSS hex string'),
|
|
21
|
+
emissiveIntensity: z.number().optional().describe('Emissive light intensity multiplier'),
|
|
22
|
+
emissiveMap: z.string().optional().describe('Path to emissive map texture image'),
|
|
23
|
+
aoMap: z.string().optional().describe('Path to ambient occlusion map texture image'),
|
|
24
|
+
lightMap: z
|
|
25
|
+
.string()
|
|
26
|
+
.optional()
|
|
27
|
+
.describe(
|
|
28
|
+
"Path to a baked lightmap texture (uses the mesh's second UV set). Applies the pre-baked GI/shadow result on top of the material.",
|
|
29
|
+
),
|
|
30
|
+
lightMapIntensity: z.number().optional().describe('Lightmap intensity multiplier (default 1).'),
|
|
31
|
+
roughnessMap: z.string().optional().describe('Path to roughness map texture image'),
|
|
32
|
+
metalnessMap: z.string().optional().describe('Path to metalness map texture image'),
|
|
33
|
+
opacity: z.number().optional().describe('Opacity 0–1. Set transparent: true to enable'),
|
|
34
|
+
transparent: z.boolean().optional().describe('Enable alpha blending for this material'),
|
|
35
|
+
side: z.enum(['front', 'back', 'double']).optional().describe('Which face sides to render'),
|
|
36
|
+
flatShading: z.boolean().optional().describe('Use flat (faceted) shading instead of smooth'),
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
// Physical material feature groups (physical only, all optional)
|
|
39
|
+
clearcoat: z
|
|
40
|
+
.object({
|
|
41
|
+
clearcoat: z.number().describe('Clearcoat layer intensity 0–1'),
|
|
42
|
+
clearcoatRoughness: z.number().optional().describe('Clearcoat roughness 0–1'),
|
|
43
|
+
clearcoatMap: z.string().optional().describe('Path to clearcoat intensity map'),
|
|
44
|
+
clearcoatRoughnessMap: z.string().optional().describe('Path to clearcoat roughness map'),
|
|
45
|
+
})
|
|
46
|
+
.optional()
|
|
47
|
+
.describe('Clearcoat layer (physical only)'),
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
transmission: z
|
|
50
|
+
.object({
|
|
51
|
+
transmission: z.number().describe('Transmission intensity 0–1 (glass, liquid)'),
|
|
52
|
+
ior: z.number().optional().describe('Index of refraction (default 1.5)'),
|
|
53
|
+
thickness: z.number().optional().describe('Volume thickness for refraction'),
|
|
54
|
+
attenuationColor: z.string().optional().describe('Color absorbed over distance'),
|
|
55
|
+
attenuationDistance: z
|
|
56
|
+
.number()
|
|
57
|
+
.optional()
|
|
58
|
+
.describe('Distance at which attenuation color takes full effect'),
|
|
59
|
+
transmissionMap: z.string().optional().describe('Path to transmission map'),
|
|
60
|
+
})
|
|
61
|
+
.optional()
|
|
62
|
+
.describe('Light transmission (physical only)'),
|
|
64
63
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
sheen: z
|
|
65
|
+
.object({
|
|
66
|
+
sheen: z.number().describe('Sheen intensity 0–1 (fabric, velvet)'),
|
|
67
|
+
sheenColor: z.string().optional().describe('Sheen tint color'),
|
|
68
|
+
sheenRoughness: z.number().optional().describe('Sheen roughness 0–1'),
|
|
69
|
+
sheenColorMap: z.string().optional().describe('Path to sheen color map'),
|
|
70
|
+
sheenRoughnessMap: z.string().optional().describe('Path to sheen roughness map'),
|
|
71
|
+
})
|
|
72
|
+
.optional()
|
|
73
|
+
.describe('Sheen layer (physical only)'),
|
|
75
74
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})
|
|
90
|
-
.optional()
|
|
91
|
-
.describe('Iridescence thin-film (physical only)'),
|
|
75
|
+
iridescence: z
|
|
76
|
+
.object({
|
|
77
|
+
iridescence: z.number().describe('Iridescence intensity 0–1 (soap bubbles, oil slick)'),
|
|
78
|
+
iridescenceIOR: z.number().optional().describe('Thin-film IOR (default 1.3)'),
|
|
79
|
+
iridescenceThicknessRange: z
|
|
80
|
+
.tuple([z.number(), z.number()])
|
|
81
|
+
.optional()
|
|
82
|
+
.describe('Min/max thin-film thickness in nm'),
|
|
83
|
+
iridescenceMap: z.string().optional().describe('Path to iridescence intensity map'),
|
|
84
|
+
iridescenceThicknessMap: z.string().optional().describe('Path to iridescence thickness map'),
|
|
85
|
+
})
|
|
86
|
+
.optional()
|
|
87
|
+
.describe('Iridescence thin-film (physical only)'),
|
|
92
88
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
displacementMap: z.string().optional().describe('Path to displacement/height map'),
|
|
90
|
+
displacementScale: z.number().optional().describe('Displacement height multiplier'),
|
|
91
|
+
displacementBias: z.number().optional().describe('Displacement offset'),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
export const SceneMaterialSchema = SceneMaterialObjectSchema.superRefine((material, ctx) => {
|
|
95
|
+
if (material.type === 'custom' && !material.def?.trim()) {
|
|
96
|
+
ctx.addIssue({
|
|
97
|
+
code: 'custom',
|
|
98
|
+
path: ['def'],
|
|
99
|
+
message: 'Custom material requires a non-empty registered definition name',
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}).describe('Material appearance properties');
|
|
98
103
|
|
|
99
104
|
/** Partial schema for prefab instance overrides (type not required). */
|
|
100
|
-
export const SceneMaterialOverrideSchema =
|
|
105
|
+
export const SceneMaterialOverrideSchema = SceneMaterialObjectSchema.partial();
|
|
101
106
|
|
|
102
107
|
export type SceneMaterial = z.infer<typeof SceneMaterialSchema>;
|
|
103
108
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { type SceneEntity, SceneEntitySchema } from './entity';
|
|
3
3
|
import { SceneEnvironmentSchema } from './environment';
|
|
4
|
-
import { UIRootSchema } from './ui';
|
|
5
4
|
|
|
6
5
|
export const SceneFileSchema = z
|
|
7
6
|
.object({
|
|
@@ -9,13 +8,8 @@ export const SceneFileSchema = z
|
|
|
9
8
|
name: z.string().describe('Scene display name'),
|
|
10
9
|
environment: SceneEnvironmentSchema.optional().describe('Scene-level environment settings'),
|
|
11
10
|
entities: z.array(SceneEntitySchema).describe('Top-level entities in the scene'),
|
|
12
|
-
// UI roots (HUD/menus) attached to the scene graph as data. Optional and
|
|
13
|
-
// additive — pre-UI scenes (no `ui` field) load unchanged (A4 versioning).
|
|
14
|
-
ui: z
|
|
15
|
-
.array(UIRootSchema)
|
|
16
|
-
.optional()
|
|
17
|
-
.describe('React UI roots (canvases) attached to the scene graph (A1)'),
|
|
18
11
|
})
|
|
12
|
+
.strict()
|
|
19
13
|
.describe('Scene file (.vscn.json)');
|
|
20
14
|
|
|
21
15
|
export type SceneFile = z.infer<typeof SceneFileSchema>;
|
package/src/scene/user-data.ts
CHANGED
|
@@ -42,6 +42,8 @@
|
|
|
42
42
|
* mixer; see xstate-animation-binding.ts).
|
|
43
43
|
* - `_availableClips` — string[] of clip names discovered on the GLTF
|
|
44
44
|
* (inspector dropdown; same names as `_animClips`' keys).
|
|
45
|
+
* - `_xstateAnimation` — live native XState/Three binding exposed for
|
|
46
|
+
* play-mode inspection; removed when binding disposes.
|
|
45
47
|
*
|
|
46
48
|
* Disposal contract:
|
|
47
49
|
* - `__sharedGeometry` — `true` when a mesh's geometry is shared/cached and MUST
|
|
@@ -77,6 +79,8 @@
|
|
|
77
79
|
* - `editorHelper` — `true` for editor-only helper objects (gizmos, wireframes).
|
|
78
80
|
* - `editorHelperType` — which kind of helper (lights/particles/pivot/navmesh/...).
|
|
79
81
|
* - `editorIcon` — `true` for editor billboard icon sprites.
|
|
82
|
+
* - `skeletonVisible` — per-entity editor preference for its bone overlay.
|
|
83
|
+
* - `skeletonEnabled` — resolved visibility preference on a skeleton helper.
|
|
80
84
|
* - `envObject` — `true` for environment objects (ambient light, etc.).
|
|
81
85
|
* - `splineControlPoint` — index of a spline control-point drag handle.
|
|
82
86
|
* - `vcDirIdx` — view-cube face direction index (0=+X,1=-X,2=+Y,...).
|
|
@@ -84,6 +88,8 @@
|
|
|
84
88
|
|
|
85
89
|
import type * as THREE from 'three';
|
|
86
90
|
import type { ParticleSystem } from 'three.quarks';
|
|
91
|
+
import type { AnyActor } from 'xstate';
|
|
92
|
+
import type { XStateAnimationBinding } from '../animation/xstate-animation-binding';
|
|
87
93
|
import type { SceneEntity } from './scene-types';
|
|
88
94
|
|
|
89
95
|
/** The kinds of editor helper objects tagged via `editorHelperType`. */
|
|
@@ -95,7 +101,8 @@ export type EditorHelperType =
|
|
|
95
101
|
| 'splines'
|
|
96
102
|
| 'particles'
|
|
97
103
|
| 'pivot'
|
|
98
|
-
| 'navmesh'
|
|
104
|
+
| 'navmesh'
|
|
105
|
+
| 'skeletons';
|
|
99
106
|
|
|
100
107
|
/**
|
|
101
108
|
* Maps each canonical accessor name to its value type. This is the single
|
|
@@ -115,6 +122,7 @@ export interface UserDataSchema {
|
|
|
115
122
|
_animMixer: THREE.AnimationMixer;
|
|
116
123
|
_animClips: Map<string, THREE.AnimationClip>;
|
|
117
124
|
_availableClips: string[];
|
|
125
|
+
_xstateAnimation: XStateAnimationBinding & { readonly actor: AnyActor };
|
|
118
126
|
__sharedGeometry: boolean;
|
|
119
127
|
__shadeOrig: THREE.Material | THREE.Material[];
|
|
120
128
|
__shadeUnlit: THREE.Material[];
|
|
@@ -128,6 +136,8 @@ export interface UserDataSchema {
|
|
|
128
136
|
editorHelper: boolean;
|
|
129
137
|
editorHelperType: EditorHelperType;
|
|
130
138
|
editorIcon: boolean;
|
|
139
|
+
skeletonVisible: boolean;
|
|
140
|
+
skeletonEnabled: boolean;
|
|
131
141
|
envObject: boolean;
|
|
132
142
|
vcDirIdx: number;
|
|
133
143
|
}
|
|
@@ -154,6 +164,7 @@ export const UserDataKeys = {
|
|
|
154
164
|
_animMixer: '_animMixer',
|
|
155
165
|
_animClips: '_animClips',
|
|
156
166
|
_availableClips: '_availableClips',
|
|
167
|
+
_xstateAnimation: '_xstateAnimation',
|
|
157
168
|
__sharedGeometry: '__sharedGeometry',
|
|
158
169
|
__shadeOrig: '__shadeOrig',
|
|
159
170
|
__shadeUnlit: '__shadeUnlit',
|
|
@@ -167,6 +178,8 @@ export const UserDataKeys = {
|
|
|
167
178
|
editorHelper: 'editorHelper',
|
|
168
179
|
editorHelperType: 'editorHelperType',
|
|
169
180
|
editorIcon: 'editorIcon',
|
|
181
|
+
skeletonVisible: 'skeletonVisible',
|
|
182
|
+
skeletonEnabled: 'skeletonEnabled',
|
|
170
183
|
envObject: 'envObject',
|
|
171
184
|
vcDirIdx: 'vcDirIdx',
|
|
172
185
|
} as const satisfies Record<UserDataKey, string>;
|
|
@@ -74,7 +74,7 @@ export function applyRendererSettings(
|
|
|
74
74
|
* `opts` is additive (T6.1 slice 1, COMPOSITION-DESIGN.md D5 §1/§4): omitted
|
|
75
75
|
* entirely, construction is byte-identical to before (no `alpha`/
|
|
76
76
|
* `preserveDrawingBuffer` keys at all) — the legacy single-canvas host never
|
|
77
|
-
* passes it. The
|
|
77
|
+
* passes it. The roots path passes `alpha:true` for every stacked canvas
|
|
78
78
|
* above the bottom one (so its clear-alpha-0 shows the layer below through
|
|
79
79
|
* it) and `preserveDrawingBuffer:true` for every stacked canvas (the
|
|
80
80
|
* recorded capture-tier cost, paid once here rather than re-derived later).
|
package/src/tools/define-tool.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* export const tool = defineTool({
|
|
10
10
|
* id: 'tuning', // stable slug — becomes the tab's test id
|
|
11
11
|
* title: 'Tuning', // the tab label (rendered after a ⚙ marker)
|
|
12
|
-
* placement: '
|
|
12
|
+
* placement: 'document', // project-global dashboard (§3.2; 'dock' = deprecated alias)
|
|
13
13
|
* });
|
|
14
14
|
* export default function Tuning() { … } // plain React
|
|
15
15
|
* ```
|
|
@@ -42,9 +42,39 @@
|
|
|
42
42
|
|
|
43
43
|
import type { AuthoringAdapter, EditorNode } from '../adapter';
|
|
44
44
|
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Tool placements. Since W0 of the editor workspace-shell program
|
|
47
|
+
* (docs/EDITOR-WORKSPACE-SHELL-TODO.md §7.2), placement describes MEANING,
|
|
48
|
+
* not a physical container:
|
|
49
|
+
*
|
|
50
|
+
* - `'document'` — a substantial project-global surface (tuning dashboard,
|
|
51
|
+
* table, graph) that belongs in the center workspace;
|
|
52
|
+
* - `'inspector'` — a selection-scoped section in the right Inspector rail;
|
|
53
|
+
* - `'utility'` — a transient output/debug surface for the bottom drawer;
|
|
54
|
+
* - `'dock'` — DEPRECATED physical compatibility alias. Existing dock tools
|
|
55
|
+
* remain in the bottom panel so projects do not lose the ability to tune
|
|
56
|
+
* them while watching the Game/Scene.
|
|
57
|
+
*
|
|
58
|
+
* Only an explicit `document` declaration replaces the center subject.
|
|
59
|
+
* `utility` and legacy `dock` remain in the bottom drawer. Deliberately
|
|
60
|
+
* still nothing else — no floating windows, no in-game overlay
|
|
61
|
+
* host (docs/DATA-TOOLS-DESIGN.md §3.2 "deliberately NOT built").
|
|
62
|
+
*/
|
|
63
|
+
export type ToolPlacement = 'document' | 'inspector' | 'utility' | 'dock';
|
|
64
|
+
|
|
65
|
+
/** The project-global (non-selection-scoped) placements. */
|
|
66
|
+
export type GlobalToolPlacement = 'document' | 'utility' | 'dock';
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Compatibility means preserving behavior: legacy `'dock'` tools remain in
|
|
70
|
+
* the bottom panel. New tools choose `'document'`, `'utility'`, or
|
|
71
|
+
* `'inspector'` deliberately.
|
|
72
|
+
*/
|
|
73
|
+
export function normalizeToolPlacement(
|
|
74
|
+
placement: ToolPlacement,
|
|
75
|
+
): 'document' | 'inspector' | 'utility' {
|
|
76
|
+
return placement === 'dock' ? 'utility' : placement;
|
|
77
|
+
}
|
|
48
78
|
|
|
49
79
|
/** Fields every tool declares — see {@link defineTool} for the contract. */
|
|
50
80
|
interface ToolConfigBase {
|
|
@@ -60,9 +90,10 @@ interface ToolConfigBase {
|
|
|
60
90
|
title: string;
|
|
61
91
|
}
|
|
62
92
|
|
|
63
|
-
/** A project-global
|
|
64
|
-
|
|
65
|
-
|
|
93
|
+
/** A project-global tool (§3.2 W4; `'dock'` preserves its historical bottom
|
|
94
|
+
* placement through the `'utility'` compatibility normalization). */
|
|
95
|
+
export interface GlobalToolConfig extends ToolConfigBase {
|
|
96
|
+
placement: GlobalToolPlacement;
|
|
66
97
|
}
|
|
67
98
|
|
|
68
99
|
/** A selection-scoped Inspector section (§3.2, W3). */
|
|
@@ -80,7 +111,7 @@ export interface InspectorToolConfig extends ToolConfigBase {
|
|
|
80
111
|
}
|
|
81
112
|
|
|
82
113
|
/** Metadata for a project tool — a discriminated union on `placement`. */
|
|
83
|
-
export type ToolConfig =
|
|
114
|
+
export type ToolConfig = GlobalToolConfig | InspectorToolConfig;
|
|
84
115
|
|
|
85
116
|
/**
|
|
86
117
|
* Props the editor passes to an INSPECTOR tool's default-exported component
|
|
@@ -120,14 +151,22 @@ export function defineTool(config: ToolConfig): Readonly<ToolConfig> {
|
|
|
120
151
|
if (config === null || typeof config !== 'object') {
|
|
121
152
|
throw toolError(
|
|
122
153
|
'expected a config object',
|
|
123
|
-
"call it as defineTool({ id, title, placement: '
|
|
154
|
+
"call it as defineTool({ id, title, placement: 'document' })",
|
|
124
155
|
);
|
|
125
156
|
}
|
|
126
157
|
const { id, title, placement } = config;
|
|
127
|
-
if (
|
|
158
|
+
if (
|
|
159
|
+
placement !== 'document' &&
|
|
160
|
+
placement !== 'utility' &&
|
|
161
|
+
placement !== 'dock' &&
|
|
162
|
+
placement !== 'inspector'
|
|
163
|
+
) {
|
|
128
164
|
throw toolError(
|
|
129
165
|
`unknown placement ${JSON.stringify(placement)}`,
|
|
130
|
-
"the placements are '
|
|
166
|
+
"the placements are 'document' (project-global center document), 'inspector' " +
|
|
167
|
+
"(selection-scoped section) and 'utility' (transient bottom-drawer output); " +
|
|
168
|
+
"'dock' remains accepted as a deprecated bottom-panel alias " +
|
|
169
|
+
'(docs/EDITOR-WORKSPACE-SHELL-TODO.md §7.2)',
|
|
131
170
|
);
|
|
132
171
|
}
|
|
133
172
|
if (typeof id !== 'string' || !/^[a-zA-Z0-9_-]+$/.test(id)) {
|
|
@@ -31,6 +31,8 @@ export interface Property2D {
|
|
|
31
31
|
|
|
32
32
|
/** A persisted edit overlay keyed by structural-path id (the 2D analog of IngestOverlay). */
|
|
33
33
|
export interface Override2D {
|
|
34
|
+
label?: string;
|
|
35
|
+
alpha?: number;
|
|
34
36
|
position?: [number, number];
|
|
35
37
|
rotation?: number;
|
|
36
38
|
scale?: [number, number];
|
|
@@ -110,7 +112,11 @@ export class AuthoringAdapter2D {
|
|
|
110
112
|
// --- Transforms ---
|
|
111
113
|
getTransform(id: string): Transform2DValue | null {
|
|
112
114
|
const o = this.byId.get(id);
|
|
113
|
-
|
|
115
|
+
// A tracked node isn't guaranteed to be a real PixiJS display object with
|
|
116
|
+
// a transform (e.g. test doubles / non-positional fixture nodes walked
|
|
117
|
+
// via the composite adapter's overlay path) — treat a missing position
|
|
118
|
+
// the same as a missing node: no transform to report, not a crash.
|
|
119
|
+
if (!o || !o.position || !o.scale) return null;
|
|
114
120
|
return {
|
|
115
121
|
position: [o.position.x, o.position.y],
|
|
116
122
|
rotation: o.rotation,
|
|
@@ -156,6 +162,8 @@ export class AuthoringAdapter2D {
|
|
|
156
162
|
if (!o) return;
|
|
157
163
|
o[path] = value;
|
|
158
164
|
this.overlay[id] ??= {};
|
|
165
|
+
if (path === 'label') this.overlay[id].label = value as string;
|
|
166
|
+
if (path === 'alpha') this.overlay[id].alpha = value as number;
|
|
159
167
|
if (path === 'tint') this.overlay[id].tint = value as number;
|
|
160
168
|
if (path === 'visible') this.overlay[id].visible = value as boolean;
|
|
161
169
|
this.dirty = true;
|
|
@@ -164,6 +172,8 @@ export class AuthoringAdapter2D {
|
|
|
164
172
|
private applyOverride(id: string, ov: Override2D): void {
|
|
165
173
|
const o = this.byId.get(id);
|
|
166
174
|
if (!o) return;
|
|
175
|
+
if (ov.label !== undefined) o.label = ov.label;
|
|
176
|
+
if (ov.alpha !== undefined) o.alpha = ov.alpha;
|
|
167
177
|
if (ov.position) o.position.set(ov.position[0], ov.position[1]);
|
|
168
178
|
if (ov.rotation !== undefined) o.rotation = ov.rotation;
|
|
169
179
|
if (ov.scale) o.scale.set(ov.scale[0], ov.scale[1]);
|
|
@@ -201,6 +211,12 @@ export class AuthoringAdapter2D {
|
|
|
201
211
|
serializeOverlay(): Overlay2D {
|
|
202
212
|
return this.overlay;
|
|
203
213
|
}
|
|
214
|
+
/** Replace, rather than merge, overlay state after an exact history restore. */
|
|
215
|
+
replaceOverlay(overlay: Overlay2D): void {
|
|
216
|
+
this.overlay = structuredClone(overlay);
|
|
217
|
+
for (const [id, ov] of Object.entries(this.overlay)) this.applyOverride(id, ov);
|
|
218
|
+
this.dirty = true;
|
|
219
|
+
}
|
|
204
220
|
/** Clear the dirty flag after a successful save (mirrors IngestAuthoringAdapter). */
|
|
205
221
|
markClean(): void {
|
|
206
222
|
this.dirty = false;
|
|
@@ -47,7 +47,7 @@ export type Collision2DSystem = ReturnType<typeof createCollision2DSystem>;
|
|
|
47
47
|
* structural slice: the unified `ComponentManager` (`ecs/component-manager.ts`,
|
|
48
48
|
* what production wires up since T7.3 slice 1, and the only manager left —
|
|
49
49
|
* the world2d silo's manager is deleted, T7.3 slice 2) satisfies it — this
|
|
50
|
-
* dispatcher has no dependency on which `
|
|
50
|
+
* dispatcher has no dependency on which `AdapterSurface` a caller's manager was
|
|
51
51
|
* constructed for.
|
|
52
52
|
*/
|
|
53
53
|
export interface TriggerDispatchComponents {
|
|
@@ -25,10 +25,10 @@ export interface World2DHost {
|
|
|
25
25
|
canvas: HTMLCanvasElement;
|
|
26
26
|
width: number;
|
|
27
27
|
height: number;
|
|
28
|
-
/**
|
|
29
|
-
|
|
28
|
+
/** Shared Game root when mounted by the universal multi-world host. */
|
|
29
|
+
game?: GameInternal;
|
|
30
30
|
/** DPR override (T6.1 slice 1, COMPOSITION-DESIGN.md D5 §3 — "one DPR
|
|
31
|
-
* everywhere"): the
|
|
31
|
+
* everywhere"): the roots-path host computes ONE dpr for every stacked
|
|
32
32
|
* surface and passes it here; omitted -> `createPixiSurface`'s own
|
|
33
33
|
* default (`window.devicePixelRatio`, uncapped) — today's behavior. */
|
|
34
34
|
dpr?: number;
|
|
@@ -109,7 +109,7 @@ export class PixiSceneGameAdapter {
|
|
|
109
109
|
width: host.width,
|
|
110
110
|
height: host.height,
|
|
111
111
|
...(sceneData?.background ? { background: sceneData.background } : {}),
|
|
112
|
-
// T6.1 slice 1 (
|
|
112
|
+
// T6.1 slice 1 (roots-path host hints — see `World2DHost`'s fields):
|
|
113
113
|
// all optional, all no-ops when the host is the legacy
|
|
114
114
|
// `createWorld2DRuntime` entry (which never sets them), so behavior
|
|
115
115
|
// there is unchanged.
|
|
@@ -128,15 +128,17 @@ export class PixiSceneGameAdapter {
|
|
|
128
128
|
const writeTransforms2D = createTransformWriter2D(physics2d);
|
|
129
129
|
const collisions2d = createCollision2DSystem(rapier2dWorld, eventQueue);
|
|
130
130
|
|
|
131
|
-
const systems = createSystemRunner();
|
|
132
|
-
systems.add('physics', () => rapier2dWorld.step(eventQueue));
|
|
133
|
-
systems.add(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
const systems = createSystemRunner(host.game?.profiler.systemObserver, 'pixijs');
|
|
132
|
+
systems.add('physics', () => rapier2dWorld.step(eventQueue), { name: 'physics2d.step' });
|
|
133
|
+
systems.add(
|
|
134
|
+
'postPhysics',
|
|
135
|
+
() => {
|
|
136
|
+
collisions2d.drain();
|
|
137
|
+
writeTransforms2D();
|
|
138
|
+
},
|
|
139
|
+
{ name: 'physics2d.sync' },
|
|
140
|
+
);
|
|
141
|
+
systems.add('render', () => surface.render(), { name: 'pixi.render' });
|
|
140
142
|
|
|
141
143
|
const ctx: World2DContext = {
|
|
142
144
|
app: surface.app,
|
|
@@ -147,7 +149,7 @@ export class PixiSceneGameAdapter {
|
|
|
147
149
|
collisions2d,
|
|
148
150
|
components: null!,
|
|
149
151
|
systems,
|
|
150
|
-
|
|
152
|
+
...(host.game ? { game: host.game } : {}),
|
|
151
153
|
};
|
|
152
154
|
|
|
153
155
|
// T7.3 slice 1/2: the pixi world's components attach onto the SAME
|
|
@@ -235,16 +237,15 @@ export interface World2DSession {
|
|
|
235
237
|
* surface-host-backend-neutral allows). Owns the canvas and constructs a real `Game`
|
|
236
238
|
* (T7.3 slice 1) with exactly one `'pixijs'`-kind `WorldInstance`, driven each fixed
|
|
237
239
|
* substep through `Game.runFrame` — the world2d analog of `createGameRuntime`'s
|
|
238
|
-
* `
|
|
240
|
+
* `registerThreeWorld` (`runtime/create-runtime.ts`). Before T7.3 this ran its
|
|
239
241
|
* own standalone `createGameLoop` calling `mounted.update` directly; that loop is
|
|
240
242
|
* retired here in favor of one shared frame executor per game root.
|
|
241
243
|
*/
|
|
242
244
|
export async function createWorld2DRuntime(
|
|
243
245
|
config: PixiSceneConfig & World2DHost,
|
|
244
246
|
): Promise<World2DSession> {
|
|
245
|
-
const { canvas, width, height,
|
|
247
|
+
const { canvas, width, height, ...sceneConfig } = config;
|
|
246
248
|
const adapter = new PixiSceneGameAdapter(sceneConfig);
|
|
247
|
-
const mounted = await adapter.mount({ canvas, width, height, ...(ui ? { ui } : {}) });
|
|
248
249
|
|
|
249
250
|
const assets = createAssetCache();
|
|
250
251
|
// `game` is referenced here before its `const` below only textually — this
|
|
@@ -258,6 +259,7 @@ export async function createWorld2DRuntime(
|
|
|
258
259
|
},
|
|
259
260
|
});
|
|
260
261
|
const game: GameInternal = createGame({ loop, assets });
|
|
262
|
+
const mounted = await adapter.mount({ canvas, width, height, game });
|
|
261
263
|
|
|
262
264
|
// T7.5: `mounted` (a `MountedGame2D`, extending `MountedPixiWorld`) and
|
|
263
265
|
// `adapter` (this `PixiSceneGameAdapter`, satisfying `WorldInstance.adapter`'s
|
|
@@ -183,6 +183,7 @@ function createPhysics2D(ctx: World2DContext, entity: Entity2D, display: Contain
|
|
|
183
183
|
if (p.restitution !== undefined) colDesc.setRestitution(p.restitution);
|
|
184
184
|
if (p.sensor) {
|
|
185
185
|
colDesc.setSensor(true);
|
|
186
|
+
colDesc.setActiveCollisionTypes(rapier2d.ActiveCollisionTypes.ALL);
|
|
186
187
|
colDesc.setActiveEvents(rapier2d.ActiveEvents.COLLISION_EVENTS);
|
|
187
188
|
} else {
|
|
188
189
|
colDesc.setActiveEvents(rapier2d.ActiveEvents.COLLISION_EVENTS);
|
package/src/world2d/types.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { createSystemRunner } from '../core/system-runner';
|
|
|
5
5
|
import type { SystemPhaseName } from '../core/types';
|
|
6
6
|
import type { ComponentManager } from '../ecs/component-manager';
|
|
7
7
|
import type { GameComponent } from '../ecs/game-component';
|
|
8
|
+
import type { Game } from '../runtime/game';
|
|
8
9
|
import type { Collision2DSystem } from './collision-2d';
|
|
9
10
|
import type { Physics2DRegistry } from './physics2d-registry';
|
|
10
11
|
|
|
@@ -38,8 +39,13 @@ export interface World2DContext {
|
|
|
38
39
|
components: ComponentManager;
|
|
39
40
|
/** The phase-ordered system runner (shared with the 3D path). */
|
|
40
41
|
systems: ReturnType<typeof createSystemRunner>;
|
|
41
|
-
/**
|
|
42
|
-
|
|
42
|
+
/**
|
|
43
|
+
* The shared Game root when this world is mounted by a first-party host.
|
|
44
|
+
* This is the cross-world data path: a Pixi component can query gameplay
|
|
45
|
+
* components owned by a sibling Three.js world without a mirror store or a
|
|
46
|
+
* bespoke synchronization bridge.
|
|
47
|
+
*/
|
|
48
|
+
game?: Game | undefined;
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
/** Constructor type for `GameComponent<'pixijs'>` subclasses used in a world2d
|