@vgai/engine 0.5.0 → 0.5.1
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
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
const now = () => globalThis.performance?.now() ?? Date.now();
|
|
2
|
-
function percentile(values, fraction) {
|
|
3
|
-
if (values.length === 0)
|
|
4
|
-
return 0;
|
|
5
|
-
const sorted = [...values].sort((a, b) => a - b);
|
|
6
|
-
return sorted[Math.min(sorted.length - 1, Math.floor((sorted.length - 1) * fraction))] ?? 0;
|
|
7
|
-
}
|
|
8
|
-
/** Game-owned, bounded external store for browser-native performance diagnostics. */
|
|
9
|
-
export function createPerformanceProfiler(initiallyEnabled = false) {
|
|
10
|
-
const listeners = new Set();
|
|
11
|
-
const frames = [];
|
|
12
|
-
const currentPhases = new Map();
|
|
13
|
-
const currentSystems = new Map();
|
|
14
|
-
const currentComponents = new Map();
|
|
15
|
-
let enabled = initiallyEnabled;
|
|
16
|
-
let recording = false;
|
|
17
|
-
let frameId = 0;
|
|
18
|
-
let frameStart = 0;
|
|
19
|
-
let lastFrameStart = 0;
|
|
20
|
-
let phaseStart = 0;
|
|
21
|
-
let systemStart = 0;
|
|
22
|
-
let componentStart = 0;
|
|
23
|
-
let render = {
|
|
24
|
-
gpuMs: null,
|
|
25
|
-
drawCalls: 0,
|
|
26
|
-
triangles: 0,
|
|
27
|
-
geometries: 0,
|
|
28
|
-
textures: 0,
|
|
29
|
-
};
|
|
30
|
-
let snapshot = {
|
|
31
|
-
enabled,
|
|
32
|
-
recording,
|
|
33
|
-
fps: 0,
|
|
34
|
-
cpuMs: 0,
|
|
35
|
-
p95Ms: 0,
|
|
36
|
-
p99Ms: 0,
|
|
37
|
-
frames,
|
|
38
|
-
phases: [],
|
|
39
|
-
systems: [],
|
|
40
|
-
components: [],
|
|
41
|
-
render,
|
|
42
|
-
};
|
|
43
|
-
function publish() {
|
|
44
|
-
const latest = frames.at(-1);
|
|
45
|
-
const intervals = frames.map((frame) => frame.intervalMs).filter((value) => value > 0);
|
|
46
|
-
snapshot = {
|
|
47
|
-
enabled,
|
|
48
|
-
recording,
|
|
49
|
-
fps: latest?.intervalMs ? 1000 / latest.intervalMs : 0,
|
|
50
|
-
cpuMs: latest?.cpuMs ?? 0,
|
|
51
|
-
p95Ms: percentile(intervals, 0.95),
|
|
52
|
-
p99Ms: percentile(intervals, 0.99),
|
|
53
|
-
frames,
|
|
54
|
-
phases: latest?.phases ?? [],
|
|
55
|
-
systems: [...currentSystems].map(([name, ms]) => ({ name, ms })).sort((a, b) => b.ms - a.ms),
|
|
56
|
-
components: [...currentComponents]
|
|
57
|
-
.map(([name, ms]) => ({ name, ms }))
|
|
58
|
-
.sort((a, b) => b.ms - a.ms),
|
|
59
|
-
render,
|
|
60
|
-
};
|
|
61
|
-
for (const listener of listeners)
|
|
62
|
-
listener();
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
get enabled() {
|
|
66
|
-
return enabled;
|
|
67
|
-
},
|
|
68
|
-
set enabled(value) {
|
|
69
|
-
if (enabled === value)
|
|
70
|
-
return;
|
|
71
|
-
enabled = value;
|
|
72
|
-
publish();
|
|
73
|
-
},
|
|
74
|
-
get recording() {
|
|
75
|
-
return recording;
|
|
76
|
-
},
|
|
77
|
-
startRecording() {
|
|
78
|
-
enabled = true;
|
|
79
|
-
recording = true;
|
|
80
|
-
frames.length = 0;
|
|
81
|
-
publish();
|
|
82
|
-
},
|
|
83
|
-
stopRecording() {
|
|
84
|
-
recording = false;
|
|
85
|
-
publish();
|
|
86
|
-
},
|
|
87
|
-
clear() {
|
|
88
|
-
frames.length = 0;
|
|
89
|
-
publish();
|
|
90
|
-
},
|
|
91
|
-
beginFrame() {
|
|
92
|
-
if (!enabled)
|
|
93
|
-
return;
|
|
94
|
-
currentPhases.clear();
|
|
95
|
-
currentSystems.clear();
|
|
96
|
-
currentComponents.clear();
|
|
97
|
-
render = { gpuMs: null, drawCalls: 0, triangles: 0, geometries: 0, textures: 0 };
|
|
98
|
-
frameStart = now();
|
|
99
|
-
},
|
|
100
|
-
beginPhase() {
|
|
101
|
-
if (!enabled)
|
|
102
|
-
return;
|
|
103
|
-
phaseStart = now();
|
|
104
|
-
},
|
|
105
|
-
endPhase(name) {
|
|
106
|
-
if (!enabled)
|
|
107
|
-
return;
|
|
108
|
-
const elapsed = now() - phaseStart;
|
|
109
|
-
currentPhases.set(name, (currentPhases.get(name) ?? 0) + elapsed);
|
|
110
|
-
if (recording)
|
|
111
|
-
performance.measure(`vgai.phase.${name}`, { start: phaseStart, duration: elapsed });
|
|
112
|
-
},
|
|
113
|
-
systemObserver: {
|
|
114
|
-
beginSystem() {
|
|
115
|
-
if (!enabled)
|
|
116
|
-
return;
|
|
117
|
-
systemStart = now();
|
|
118
|
-
},
|
|
119
|
-
endSystem(scope, phase, name) {
|
|
120
|
-
if (!enabled)
|
|
121
|
-
return;
|
|
122
|
-
const end = now();
|
|
123
|
-
const key = `${scope} / ${phase} / ${name}`;
|
|
124
|
-
currentSystems.set(key, (currentSystems.get(key) ?? 0) + end - systemStart);
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
beginComponent() {
|
|
128
|
-
if (!recording)
|
|
129
|
-
return;
|
|
130
|
-
componentStart = now();
|
|
131
|
-
},
|
|
132
|
-
endComponent(name) {
|
|
133
|
-
if (!recording)
|
|
134
|
-
return;
|
|
135
|
-
currentComponents.set(name, (currentComponents.get(name) ?? 0) + now() - componentStart);
|
|
136
|
-
},
|
|
137
|
-
reportRender(stats) {
|
|
138
|
-
if (!enabled)
|
|
139
|
-
return;
|
|
140
|
-
render = {
|
|
141
|
-
gpuMs: stats.gpuMs ?? render.gpuMs,
|
|
142
|
-
drawCalls: render.drawCalls + stats.drawCalls,
|
|
143
|
-
triangles: render.triangles + stats.triangles,
|
|
144
|
-
geometries: render.geometries + stats.geometries,
|
|
145
|
-
textures: render.textures + stats.textures,
|
|
146
|
-
};
|
|
147
|
-
},
|
|
148
|
-
endFrame() {
|
|
149
|
-
if (!enabled)
|
|
150
|
-
return;
|
|
151
|
-
const timestamp = now();
|
|
152
|
-
const intervalMs = lastFrameStart === 0 ? 0 : frameStart - lastFrameStart;
|
|
153
|
-
lastFrameStart = frameStart;
|
|
154
|
-
const frame = {
|
|
155
|
-
id: ++frameId,
|
|
156
|
-
timestamp,
|
|
157
|
-
intervalMs,
|
|
158
|
-
cpuMs: timestamp - frameStart,
|
|
159
|
-
phases: [...currentPhases].map(([name, ms]) => ({ name, ms })).sort((a, b) => b.ms - a.ms),
|
|
160
|
-
};
|
|
161
|
-
frames.push(frame);
|
|
162
|
-
if (frames.length > 600)
|
|
163
|
-
frames.splice(0, frames.length - 600);
|
|
164
|
-
if (recording)
|
|
165
|
-
performance.measure('vgai.frame', { start: frameStart, duration: frame.cpuMs });
|
|
166
|
-
publish();
|
|
167
|
-
},
|
|
168
|
-
subscribe(listener) {
|
|
169
|
-
listeners.add(listener);
|
|
170
|
-
return () => {
|
|
171
|
-
listeners.delete(listener);
|
|
172
|
-
};
|
|
173
|
-
},
|
|
174
|
-
getSnapshot() {
|
|
175
|
-
return snapshot;
|
|
176
|
-
},
|
|
177
|
-
exportJSON() {
|
|
178
|
-
return JSON.stringify({ version: 1, capturedAt: new Date().toISOString(), frames }, null, 2);
|
|
179
|
-
},
|
|
180
|
-
};
|
|
181
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** Non-blocking WebGL2 timer query; results are consumed on later frames. */
|
|
2
|
-
export declare function createWebGLGpuTimer(context: WebGLRenderingContext | WebGL2RenderingContext): {
|
|
3
|
-
begin(): void;
|
|
4
|
-
end(): void;
|
|
5
|
-
poll(): number | null;
|
|
6
|
-
dispose(): void;
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=webgl-gpu-timer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-gpu-timer.d.ts","sourceRoot":"","sources":["../../src/dev/webgl-gpu-timer.ts"],"names":[],"mappings":"AAKA,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,GAAG,sBAAsB;;;YAsB/E,MAAM,GAAG,IAAI;;EAwBxB"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/** Non-blocking WebGL2 timer query; results are consumed on later frames. */
|
|
2
|
-
export function createWebGLGpuTimer(context) {
|
|
3
|
-
const gl = context;
|
|
4
|
-
const extension = gl.getExtension('EXT_disjoint_timer_query_webgl2');
|
|
5
|
-
const supported = extension !== null && typeof gl.createQuery === 'function';
|
|
6
|
-
const pending = [];
|
|
7
|
-
let active = null;
|
|
8
|
-
let latestMs = null;
|
|
9
|
-
return {
|
|
10
|
-
begin() {
|
|
11
|
-
if (!supported || active)
|
|
12
|
-
return;
|
|
13
|
-
active = gl.createQuery();
|
|
14
|
-
if (active)
|
|
15
|
-
gl.beginQuery(extension.TIME_ELAPSED_EXT, active);
|
|
16
|
-
},
|
|
17
|
-
end() {
|
|
18
|
-
if (!supported || !active)
|
|
19
|
-
return;
|
|
20
|
-
gl.endQuery(extension.TIME_ELAPSED_EXT);
|
|
21
|
-
pending.push(active);
|
|
22
|
-
active = null;
|
|
23
|
-
},
|
|
24
|
-
poll() {
|
|
25
|
-
if (!supported)
|
|
26
|
-
return null;
|
|
27
|
-
if (gl.getParameter(extension.GPU_DISJOINT_EXT)) {
|
|
28
|
-
for (const query of pending.splice(0))
|
|
29
|
-
gl.deleteQuery(query);
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
while (pending.length > 0) {
|
|
33
|
-
const query = pending[0];
|
|
34
|
-
if (!gl.getQueryParameter(query, gl.QUERY_RESULT_AVAILABLE))
|
|
35
|
-
break;
|
|
36
|
-
pending.shift();
|
|
37
|
-
latestMs = gl.getQueryParameter(query, gl.QUERY_RESULT) / 1_000_000;
|
|
38
|
-
gl.deleteQuery(query);
|
|
39
|
-
}
|
|
40
|
-
return latestMs;
|
|
41
|
-
},
|
|
42
|
-
dispose() {
|
|
43
|
-
if (active) {
|
|
44
|
-
gl.endQuery(extension.TIME_ELAPSED_EXT);
|
|
45
|
-
gl.deleteQuery(active);
|
|
46
|
-
active = null;
|
|
47
|
-
}
|
|
48
|
-
for (const query of pending.splice(0))
|
|
49
|
-
gl.deleteQuery(query);
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
}
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import type { PhysicsRegistry } from '../physics/physics-registry';
|
|
2
|
-
import { type AdapterSurface, type WorldInstance } from '../runtime/game';
|
|
3
|
-
import type { GameContext } from '../runtime/types';
|
|
4
|
-
import type { Physics2DRegistry } from '../world2d/physics2d-registry';
|
|
5
|
-
import { GameComponent, type GameComponentClass, type NodeOf } from './game-component';
|
|
6
|
-
/**
|
|
7
|
-
* The manager's node/instance types, widened over every `AdapterSurface` (T7.2
|
|
8
|
-
* slice 2, D8 §3). `NodeOf<AdapterSurface>` distributes to `THREE.Object3D |
|
|
9
|
-
* PIXI.Container` (react contributes `never`, which drops out of the
|
|
10
|
-
* union) — this is what lets a single manager instance be constructed for
|
|
11
|
-
* ANY one kind (threejs, pixijs, or react) while still type-checking
|
|
12
|
-
* `attach()` calls made with a default-kind (`GameComponent`, K =
|
|
13
|
-
* 'threejs') instance, unmodified, from every existing call site.
|
|
14
|
-
*/
|
|
15
|
-
type AnyNode = NodeOf<AdapterSurface>;
|
|
16
|
-
type AnyComponent = GameComponent<AdapterSurface>;
|
|
17
|
-
/**
|
|
18
|
-
* Optional identity a caller of `attach()` can supply for a component instance
|
|
19
|
-
* it looked up in a `ComponentRegistry`/`Component2DRegistry` (T5.4) — `key` is
|
|
20
|
-
* the name the class was registered under (the swap key `hotSwap` matches on),
|
|
21
|
-
* `props` is the raw, pre-`schema.parse` authored data for that instance (kept
|
|
22
|
-
* so a later `hotSwap` can re-validate it against a NEW class version's
|
|
23
|
-
* `static schema`). Deliberately NOT imported from `scene/component-registry.ts`
|
|
24
|
-
* to avoid a cycle (that module already imports `ComponentManager` from here) —
|
|
25
|
-
* this is a structural duck-type of the same shape.
|
|
26
|
-
*/
|
|
27
|
-
export interface RegistryAttachInfo {
|
|
28
|
-
key: string;
|
|
29
|
-
props: Record<string, unknown>;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Manages GameComponent instances attached to entities (Object3Ds).
|
|
33
|
-
*
|
|
34
|
-
* Tracks instances per Object3D and per phase. Registers one tick function per
|
|
35
|
-
* phase via `ctx.systems.setComponentTick(phase, ...)` (T7.1 slice 2) — a
|
|
36
|
-
* dedicated slot, not a bare `add()`ed system. `SystemRunner.runPhase` always
|
|
37
|
-
* runs the componentTick slot after every engine-bucket system and before
|
|
38
|
-
* every game-bucket system in that phase, so component updates interleave
|
|
39
|
-
* correctly with engine systems BY STRUCTURE: an engine system `add()`ed
|
|
40
|
-
* after this manager is constructed still runs before its tick (see
|
|
41
|
-
* `test/system-runs-before-component-tick.test.ts`).
|
|
42
|
-
*
|
|
43
|
-
* Kind (T7.2 slice 2, D8 §3): a manager is constructed for exactly ONE
|
|
44
|
-
* `AdapterSurface` (`opts.kind`, default `'threejs'` — every existing call site
|
|
45
|
-
* omits it and gets the same manager slice 1 built). `attach()` enforces two
|
|
46
|
-
* rules against that kind, loudly:
|
|
47
|
-
* - a `'react'`-kind manager throws on EVERY attach (react entities host no
|
|
48
|
-
* GameComponents — render from game state via the T7.4 state bridge);
|
|
49
|
-
* - any other kind throws when the component's `static declaredKind` is set
|
|
50
|
-
* and doesn't match this manager's kind (`'any'` is exempt — a
|
|
51
|
-
* kind-agnostic component may attach wherever components are legal).
|
|
52
|
-
* A `'pixijs'`-kind manager wires `rigidBody`/`collider` from `opts.physics2d`
|
|
53
|
-
* (a `Physics2DRegistry`) instead of the 3D `physics: PhysicsRegistry`
|
|
54
|
-
* parameter — the field names match by design (`world2d/types.ts`), so this
|
|
55
|
-
* is a retype of the wiring, not a new shape. `physics` is optional (T7.3
|
|
56
|
-
* slice 2) — a `'pixijs'`-kind manager never reads it (`resolvePhysicsRefs`
|
|
57
|
-
* below only reaches the 3D branch for a non-pixijs manager), so a caller
|
|
58
|
-
* building one no longer has to construct a throwaway 3D `PhysicsRegistry`
|
|
59
|
-
* just to satisfy this signature.
|
|
60
|
-
*/
|
|
61
|
-
export declare function createComponentManager(ctx: GameContext, physics?: PhysicsRegistry, opts?: {
|
|
62
|
-
kind?: AdapterSurface;
|
|
63
|
-
physics2d?: Physics2DRegistry;
|
|
64
|
-
}): {
|
|
65
|
-
/** Attach a component instance to an entity node (Object3D in a threejs
|
|
66
|
-
* world, PIXI.Container in a pixijs world). Validates the attach rules
|
|
67
|
-
* (§3: react-world throw, kind-mismatch throw) synchronously before any
|
|
68
|
-
* structural change, whether or not a phase tick is currently running.
|
|
69
|
-
* `registry` (T5.4, optional) records the `componentRegistry` name +
|
|
70
|
-
* pre-`schema.parse` authored data a scene-authored attach looked the
|
|
71
|
-
* class up under — `hotSwap` keys on it instead of the live
|
|
72
|
-
* `constructor.name`. Omit it for an ad-hoc, code-attached instance (no
|
|
73
|
-
* registry entry) — `hotSwap` falls back to matching those by class name,
|
|
74
|
-
* unchanged from pre-T5.4 behavior. */
|
|
75
|
-
attach(node: AnyNode, instance: AnyComponent, registry?: RegistryAttachInfo): void;
|
|
76
|
-
/**
|
|
77
|
-
* Call init() on all components that haven't been initialized yet, and
|
|
78
|
-
* wait for them to resolve. Components attached since the last call are
|
|
79
|
-
* covered. Safe to call even when the automatic per-frame flush has
|
|
80
|
-
* already started some of them — `startInit` is idempotent per instance,
|
|
81
|
-
* so this awaits the same in-flight promise rather than double-invoking
|
|
82
|
-
* init(). Manual calls remain useful when subsequent code depends on an
|
|
83
|
-
* init()'s side effects having completed synchronously (the automatic
|
|
84
|
-
* flush only guarantees "ticking starts once init resolves", not
|
|
85
|
-
* "resolved by the time this function returns").
|
|
86
|
-
*/
|
|
87
|
-
initAll(): Promise<void>;
|
|
88
|
-
/** Remove all components from an entity node, calling dispose. */
|
|
89
|
-
detach(node: AnyNode): void;
|
|
90
|
-
/**
|
|
91
|
-
* Backfill `instance.world` for every already-attached instance whose
|
|
92
|
-
* world is still undefined (T7.2 slice 2 — closes the KNOWN GAP
|
|
93
|
-
* documented on `resolveWorldInstance` above). A ONE-TIME wiring
|
|
94
|
-
* completion, called exactly once by `registerThreeWorld`
|
|
95
|
-
* (`create-runtime.ts`) right after this manager's `WorldInstance` is
|
|
96
|
-
* constructed — NOT a lazy getter, NOT a per-frame sync: a plain
|
|
97
|
-
* backfill pass over the existing `byEntity` bookkeeping, with no
|
|
98
|
-
* ongoing cost once it returns. Idempotent and safe to call more than
|
|
99
|
-
* once (only ever touches instances still missing a world).
|
|
100
|
-
*/
|
|
101
|
-
adoptWorld(world: WorldInstance): void;
|
|
102
|
-
/** Get all component instances for an entity node. */
|
|
103
|
-
getComponents(node: AnyNode): AnyComponent[];
|
|
104
|
-
/**
|
|
105
|
-
* Get the first attached instance of a given component class on an
|
|
106
|
-
* entity node — the typed single-component sibling of `getComponents`
|
|
107
|
-
* (issue #99: `onTriggerEnter`'s `other` is a raw node; this is how a
|
|
108
|
-
* handler asks "does my trigger partner have a `Collectible` (or
|
|
109
|
-
* whatever marker) component?" instead of an untyped `getComponents`
|
|
110
|
-
* walk or a fragile `other.name === '...'` display-name check).
|
|
111
|
-
* Matches via `instanceof`, so a subclass of `cls` is returned too
|
|
112
|
-
* (same subclass handling as `queryByComponent`). Same ordering as
|
|
113
|
-
* `getComponents` (attach order for that node) and, like
|
|
114
|
-
* `getComponents`, does NOT exclude instances pending-detach this tick
|
|
115
|
-
* — a caller inside a phase tick that cares should filter itself, same
|
|
116
|
-
* as any other `getComponents` consumer. `undefined` if the node has no
|
|
117
|
-
* attached instance of `cls`.
|
|
118
|
-
*/
|
|
119
|
-
getComponent<T extends AnyComponent>(node: AnyNode, cls: new () => T): T | undefined;
|
|
120
|
-
/**
|
|
121
|
-
* Query all live attached instances of a given component class within
|
|
122
|
-
* THIS manager — the per-world half of the §5 cross-world query
|
|
123
|
-
* (`docs/GAME-ROOT-DESIGN.md` §5; `Game.queryByComponent` in
|
|
124
|
-
* `runtime/game.ts` is the game-level aggregation over every world's
|
|
125
|
-
* manager).
|
|
126
|
-
*
|
|
127
|
-
* Returns instances (not nodes), `instanceof cls`, in stable attach
|
|
128
|
-
* order — walked from the existing `byEntity` bookkeeping (the same
|
|
129
|
-
* structure `hotSwap`/`clear` iterate), not a new index, so correctness
|
|
130
|
-
* tracks the manager's real attach/detach state rather than a
|
|
131
|
-
* maintained-in-parallel cache. Order note: this is attach order
|
|
132
|
-
* PER ENTITY (the order components were pushed for that Object3D),
|
|
133
|
-
* concatenated in `byEntity`'s insertion order (first-attach order of
|
|
134
|
-
* the entities themselves) — for the common case of each entity
|
|
135
|
-
* attached once this coincides with global chronological attach order;
|
|
136
|
-
* it would not for an entity re-attached to after other entities were
|
|
137
|
-
* attached in between, which this manager does not otherwise track a
|
|
138
|
-
* global order for.
|
|
139
|
-
*
|
|
140
|
-
* Excludes instances pending-detach this tick (`detachedThisTick`) —
|
|
141
|
-
* mirrors the same use-after-dispose guard the phase tick applies, so a
|
|
142
|
-
* query run mid-tick (e.g. from inside a component's `update`) never
|
|
143
|
-
* returns something already torn down this frame.
|
|
144
|
-
*/
|
|
145
|
-
queryByComponent<T extends AnyComponent>(cls: new () => T): T[];
|
|
146
|
-
/**
|
|
147
|
-
* Hot-swap prototypes for every live instance registered under `name`
|
|
148
|
-
* (T5.4). State on `this` survives; method bodies update to the new
|
|
149
|
-
* class. `name` is matched against each instance's RECORDED registry key
|
|
150
|
-
* (`registryKeyOf`, set by `attach()`'s optional `registry` argument) —
|
|
151
|
-
* not the live `constructor.name`, which is fragile under minification, a
|
|
152
|
-
* class rename, or two distinct classes sharing one runtime name (a
|
|
153
|
-
* registry key is stable identity chosen at scene-author time,
|
|
154
|
-
* independent of what the class calls itself). An instance attached
|
|
155
|
-
* WITHOUT a registry key (ad-hoc/code-attached — no `ComponentRegistry`
|
|
156
|
-
* entry) has no such recorded identity, so it falls back to the legacy
|
|
157
|
-
* `constructor.name` compare — this is the ONLY place that fallback
|
|
158
|
-
* applies; a registry-keyed instance never matches by name, so two
|
|
159
|
-
* registry-keyed classes that happen to share a `constructor.name` (e.g.
|
|
160
|
-
* both minified to the same short name) swap independently.
|
|
161
|
-
*
|
|
162
|
-
* Zero matches is a loud swap-miss (`hmr-swap-report.ts`), never a silent
|
|
163
|
-
* no-op — this is "renamed class → loud miss" (docs/BACKBONE-TASKS.md's
|
|
164
|
-
* T5.4 detail note): if a dev renames a component's export, the hot
|
|
165
|
-
* update arrives keyed under the NEW name, no live instance is recorded
|
|
166
|
-
* under it yet (the registry/scene JSON hasn't been re-authored), so
|
|
167
|
-
* nothing matches and the warning fires — the OLD class stays in effect
|
|
168
|
-
* rather than the rename silently doing nothing.
|
|
169
|
-
*
|
|
170
|
-
* GameComponent-subclass guard (§7.1-5, probe7): every editor HMR call
|
|
171
|
-
* site passes any `typeof value === 'function'` module export — that used
|
|
172
|
-
* to include a plain helper function sharing a live component's registry
|
|
173
|
-
* key/name, which this method would happily `Object.setPrototypeOf` onto
|
|
174
|
-
* a live instance, leaving it with no `update()` (a caught-and-logged
|
|
175
|
-
* `TypeError` every frame, forever). `NewClass` is now required to have
|
|
176
|
-
* `GameComponent` somewhere in its prototype chain — anything else is
|
|
177
|
-
* refused OUTRIGHT, loudly, with NO instance touched. This is a second,
|
|
178
|
-
* independent line of defense behind the call-site filter
|
|
179
|
-
* (`play-mode.ts`'s HMR handlers now filter to `value.prototype
|
|
180
|
-
* instanceof GameComponent` before ever calling this) — belt AND
|
|
181
|
-
* suspenders, so a future caller that forgets to filter still can't
|
|
182
|
-
* corrupt a live instance.
|
|
183
|
-
*
|
|
184
|
-
* `opts.warnOnMiss` (default `true`, §7.1-4/probe2b): the multi-world HMR
|
|
185
|
-
* fan-out (`play-mode.ts`'s `hotSwapAcrossWorlds`) calls this once per
|
|
186
|
-
* first-party world and must not let a per-world zero-match here look
|
|
187
|
-
* like "renamed class" when the name simply lives in a DIFFERENT world's
|
|
188
|
-
* manager — the fan-out helper suppresses this method's own warning
|
|
189
|
-
* (`{ warnOnMiss: false }`) and emits the ONE real warning itself only
|
|
190
|
-
* when the total across every world is zero. Every other existing caller
|
|
191
|
-
* (`applyBrowserComponentEdit`, the dev HMR demos, every hotSwap unit
|
|
192
|
-
* test) omits `opts` and keeps today's per-call warn-on-miss behavior
|
|
193
|
-
* unchanged. Returns the number of live instances swapped, so a caller
|
|
194
|
-
* that needs to aggregate across several managers (the fan-out helper)
|
|
195
|
-
* can sum it without re-deriving it from a side-channel.
|
|
196
|
-
*/
|
|
197
|
-
hotSwap(name: string, NewClass: GameComponentClass, opts?: {
|
|
198
|
-
warnOnMiss?: boolean;
|
|
199
|
-
}): number;
|
|
200
|
-
/** Dispose all components and clear all maps. */
|
|
201
|
-
clear(): void;
|
|
202
|
-
};
|
|
203
|
-
export type ComponentManager = ReturnType<typeof createComponentManager>;
|
|
204
|
-
export {};
|
|
205
|
-
//# sourceMappingURL=component-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-manager.d.ts","sourceRoot":"","sources":["../../src/ecs/component-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAe,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,KAAK,cAAc,EAAuB,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAiB,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,EAEvB,KAAK,MAAM,EACZ,MAAM,kBAAkB,CAAC;AAG1B;;;;;;;;GAQG;AACH,KAAK,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AACtC,KAAK,YAAY,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC;AAElD;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAoDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,WAAW,EAChB,OAAO,CAAC,EAAE,eAAe,EACzB,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,cAAc,CAAC;IAAC,SAAS,CAAC,EAAE,iBAAiB,CAAA;CAAE;IA8Z7D;;;;;;;;;4CASwC;iBAC3B,OAAO,YAAY,YAAY,aAAa,kBAAkB;IAW3E;;;;;;;;;;OAUG;;IAMH,kEAAkE;iBACrD,OAAO;IAcpB;;;;;;;;;;OAUG;sBACe,aAAa,GAAG,IAAI;IAQtC,sDAAsD;wBAClC,OAAO,GAAG,YAAY,EAAE;IAI5C;;;;;;;;;;;;;;OAcG;iBACU,CAAC,SAAS,YAAY,QAAQ,OAAO,OAAO,UAAU,CAAC,GAAG,CAAC,GAAG,SAAS;IASpF;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;qBACc,CAAC,SAAS,YAAY,OAAO,UAAU,CAAC,GAAG,CAAC,EAAE;IAW/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkDG;kBAEW,MAAM,YAAY,kBAAkB,SAAS;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM;IAyB5F,iDAAiD;;EA6BpD;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|