@vgai/engine 0.5.5 → 0.5.7
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/dist/adapter/adapter-surface.d.ts +30 -0
- package/dist/adapter/adapter-surface.d.ts.map +1 -0
- package/dist/adapter/adapter-surface.js +18 -0
- package/dist/adapter/authoring.d.ts +597 -0
- package/dist/adapter/authoring.d.ts.map +1 -0
- package/dist/adapter/authoring.js +22 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts +77 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -0
- package/dist/adapter/colyseus-networking-adapter.js +76 -0
- package/dist/adapter/first-party-systems.d.ts +23 -0
- package/dist/adapter/first-party-systems.d.ts.map +1 -0
- package/dist/adapter/first-party-systems.js +196 -0
- package/dist/adapter/host-context.d.ts +194 -0
- package/dist/adapter/host-context.d.ts.map +1 -0
- package/dist/adapter/host-context.js +80 -0
- package/dist/adapter/index.d.ts +33 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/index.js +25 -0
- package/dist/adapter/ingest/game-contract.d.ts +53 -0
- package/dist/adapter/ingest/game-contract.d.ts.map +1 -0
- package/dist/adapter/ingest/game-contract.js +30 -0
- package/dist/adapter/ingest/scene-capture.d.ts +121 -0
- package/dist/adapter/ingest/scene-capture.d.ts.map +1 -0
- package/dist/adapter/ingest/scene-capture.js +270 -0
- package/dist/adapter/ingest/structural-ids.d.ts +64 -0
- package/dist/adapter/ingest/structural-ids.d.ts.map +1 -0
- package/dist/adapter/ingest/structural-ids.js +110 -0
- package/dist/adapter/ingest/upstream-pin.d.ts +44 -0
- package/dist/adapter/ingest/upstream-pin.d.ts.map +1 -0
- package/dist/adapter/ingest/upstream-pin.js +47 -0
- package/dist/adapter/loop-gate-report.d.ts +34 -0
- package/dist/adapter/loop-gate-report.d.ts.map +1 -0
- package/dist/adapter/loop-gate-report.js +37 -0
- package/dist/adapter/rapier-physics-adapter.d.ts +69 -0
- package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -0
- package/dist/adapter/rapier-physics-adapter.js +135 -0
- package/dist/adapter/root-adapter.d.ts +195 -0
- package/dist/adapter/root-adapter.d.ts.map +1 -0
- package/dist/adapter/root-adapter.js +25 -0
- package/dist/adapter/setup-three-root-adapter.d.ts +87 -0
- package/dist/adapter/setup-three-root-adapter.d.ts.map +1 -0
- package/dist/adapter/setup-three-root-adapter.js +791 -0
- package/dist/adapter/system-adapter.d.ts +453 -0
- package/dist/adapter/system-adapter.d.ts.map +1 -0
- package/dist/adapter/system-adapter.js +13 -0
- package/dist/adapter/transform.d.ts +18 -0
- package/dist/adapter/transform.d.ts.map +1 -0
- package/dist/adapter/transform.js +1 -0
- package/dist/ai/navigation.d.ts +78 -0
- package/dist/ai/navigation.d.ts.map +1 -0
- package/dist/ai/navigation.js +152 -0
- package/dist/animation/anim-graph-types.d.ts +25 -0
- package/dist/animation/anim-graph-types.d.ts.map +1 -0
- package/dist/animation/anim-graph-types.js +1 -0
- package/dist/animation/animation-clock.d.ts +213 -0
- package/dist/animation/animation-clock.d.ts.map +1 -0
- package/dist/animation/animation-clock.js +301 -0
- package/dist/animation/blend-node.d.ts +22 -0
- package/dist/animation/blend-node.d.ts.map +1 -0
- package/dist/animation/blend-node.js +97 -0
- package/dist/animation/camera-ownership.d.ts +249 -0
- package/dist/animation/camera-ownership.d.ts.map +1 -0
- package/dist/animation/camera-ownership.js +169 -0
- package/dist/animation/cinematic-cues.d.ts +200 -0
- package/dist/animation/cinematic-cues.d.ts.map +1 -0
- package/dist/animation/cinematic-cues.js +213 -0
- package/dist/animation/clip-map.d.ts +12 -0
- package/dist/animation/clip-map.d.ts.map +1 -0
- package/dist/animation/clip-map.js +31 -0
- package/dist/animation/cubic-spline-interpolant.d.ts +54 -0
- package/dist/animation/cubic-spline-interpolant.d.ts.map +1 -0
- package/dist/animation/cubic-spline-interpolant.js +111 -0
- package/dist/animation/theatre-clock-binding.d.ts +89 -0
- package/dist/animation/theatre-clock-binding.d.ts.map +1 -0
- package/dist/animation/theatre-clock-binding.js +29 -0
- package/dist/animation/theatre-director.d.ts +277 -0
- package/dist/animation/theatre-director.d.ts.map +1 -0
- package/dist/animation/theatre-director.js +248 -0
- package/dist/animation/theatre-object-binding.d.ts +305 -0
- package/dist/animation/theatre-object-binding.d.ts.map +1 -0
- package/dist/animation/theatre-object-binding.js +351 -0
- package/dist/animation/xstate-animation-binding.d.ts +119 -0
- package/dist/animation/xstate-animation-binding.d.ts.map +1 -0
- package/dist/animation/xstate-animation-binding.js +349 -0
- package/dist/animation/xstate-animation-meta.d.ts +266 -0
- package/dist/animation/xstate-animation-meta.d.ts.map +1 -0
- package/dist/animation/xstate-animation-meta.js +252 -0
- package/dist/asset-formats/camera.d.ts +15 -0
- package/dist/asset-formats/camera.d.ts.map +1 -0
- package/dist/asset-formats/camera.js +15 -0
- package/dist/asset-formats/collider.d.ts +21 -0
- package/dist/asset-formats/collider.d.ts.map +1 -0
- package/dist/asset-formats/collider.js +53 -0
- package/dist/asset-formats/index.d.ts +46 -0
- package/dist/asset-formats/index.d.ts.map +1 -0
- package/dist/asset-formats/index.js +36 -0
- package/dist/asset-formats/instances.d.ts +17 -0
- package/dist/asset-formats/instances.d.ts.map +1 -0
- package/dist/asset-formats/instances.js +31 -0
- package/dist/asset-formats/light.d.ts +21 -0
- package/dist/asset-formats/light.d.ts.map +1 -0
- package/dist/asset-formats/light.js +35 -0
- package/dist/asset-formats/material.d.ts +129 -0
- package/dist/asset-formats/material.d.ts.map +1 -0
- package/dist/asset-formats/material.js +88 -0
- package/dist/asset-formats/mesh.d.ts +22 -0
- package/dist/asset-formats/mesh.d.ts.map +1 -0
- package/dist/asset-formats/mesh.js +64 -0
- package/dist/asset-formats/parse.d.ts +20 -0
- package/dist/asset-formats/parse.d.ts.map +1 -0
- package/dist/asset-formats/parse.js +34 -0
- package/dist/asset-formats/particles.d.ts +1390 -0
- package/dist/asset-formats/particles.d.ts.map +1 -0
- package/dist/asset-formats/particles.js +319 -0
- package/dist/asset-formats/render-env.d.ts +387 -0
- package/dist/asset-formats/render-env.d.ts.map +1 -0
- package/dist/asset-formats/render-env.js +300 -0
- package/dist/asset-formats/tuples.d.ts +12 -0
- package/dist/asset-formats/tuples.d.ts.map +1 -0
- package/dist/asset-formats/tuples.js +14 -0
- package/dist/asset-loaders.d.ts +97 -0
- package/dist/asset-loaders.d.ts.map +1 -0
- package/dist/asset-loaders.js +209 -0
- package/dist/asset-parse-error.d.ts +24 -0
- package/dist/asset-parse-error.d.ts.map +1 -0
- package/dist/asset-parse-error.js +29 -0
- package/dist/asset-registry.d.ts +38 -0
- package/dist/asset-registry.d.ts.map +1 -0
- package/dist/asset-registry.js +66 -0
- package/dist/assets.d.ts +26 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +55 -0
- package/dist/audio/wav-encode.d.ts +38 -0
- package/dist/audio/wav-encode.d.ts.map +1 -0
- package/dist/audio/wav-encode.js +97 -0
- package/dist/canvas-react/engine-bridge.d.ts +45 -0
- package/dist/canvas-react/engine-bridge.d.ts.map +1 -0
- package/dist/canvas-react/engine-bridge.js +45 -0
- package/dist/canvas-react/index.d.ts +42 -0
- package/dist/canvas-react/index.d.ts.map +1 -0
- package/dist/canvas-react/index.js +41 -0
- package/dist/canvas-react/pixi-primitive.d.ts +85 -0
- package/dist/canvas-react/pixi-primitive.d.ts.map +1 -0
- package/dist/canvas-react/pixi-primitive.js +181 -0
- package/dist/canvas-react/pixi-react-adapter.d.ts +71 -0
- package/dist/canvas-react/pixi-react-adapter.d.ts.map +1 -0
- package/dist/canvas-react/pixi-react-adapter.js +229 -0
- package/dist/canvas-react/pixi-react-root-factory.d.ts +56 -0
- package/dist/canvas-react/pixi-react-root-factory.d.ts.map +1 -0
- package/dist/canvas-react/pixi-react-root-factory.js +73 -0
- package/dist/canvas-react/world-context.d.ts +88 -0
- package/dist/canvas-react/world-context.d.ts.map +1 -0
- package/dist/canvas-react/world-context.js +212 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +8 -0
- package/dist/core/frame-pacing.d.ts +90 -0
- package/dist/core/frame-pacing.d.ts.map +1 -0
- package/dist/core/frame-pacing.js +89 -0
- package/dist/core/game-loop.d.ts +62 -0
- package/dist/core/game-loop.d.ts.map +1 -0
- package/dist/core/game-loop.js +189 -0
- package/dist/core/seeded-random.d.ts +69 -0
- package/dist/core/seeded-random.d.ts.map +1 -0
- package/dist/core/seeded-random.js +121 -0
- package/dist/core/sim-clock.d.ts +199 -0
- package/dist/core/sim-clock.d.ts.map +1 -0
- package/dist/core/sim-clock.js +291 -0
- package/dist/core/system-runner.d.ts +96 -0
- package/dist/core/system-runner.d.ts.map +1 -0
- package/dist/core/system-runner.js +253 -0
- package/dist/core/types.d.ts +111 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +25 -0
- package/dist/data/data-asset.d.ts +101 -0
- package/dist/data/data-asset.d.ts.map +1 -0
- package/dist/data/data-asset.js +122 -0
- package/dist/data/data-check-core.d.ts +109 -0
- package/dist/data/data-check-core.d.ts.map +1 -0
- package/dist/data/data-check-core.js +177 -0
- package/dist/data/data-ref.d.ts +79 -0
- package/dist/data/data-ref.d.ts.map +1 -0
- package/dist/data/data-ref.js +130 -0
- package/dist/data/vite-plugin-data.d.ts +79 -0
- package/dist/data/vite-plugin-data.d.ts.map +1 -0
- package/dist/data/vite-plugin-data.js +217 -0
- package/dist/defaults.d.ts +233 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/defaults.js +137 -0
- package/dist/dev/chrome-trace.d.ts +45 -0
- package/dist/dev/chrome-trace.d.ts.map +1 -0
- package/dist/dev/chrome-trace.js +114 -0
- package/dist/dev/console-bridge.d.ts +22 -0
- package/dist/dev/console-bridge.d.ts.map +1 -0
- package/dist/dev/console-bridge.js +71 -0
- package/dist/dev/debug-draw.d.ts +24 -0
- package/dist/dev/debug-draw.d.ts.map +1 -0
- package/dist/dev/debug-draw.js +73 -0
- package/dist/dev/instruments.d.ts +133 -0
- package/dist/dev/instruments.d.ts.map +1 -0
- package/dist/dev/instruments.js +231 -0
- package/dist/dev/logger.d.ts +30 -0
- package/dist/dev/logger.d.ts.map +1 -0
- package/dist/dev/logger.js +90 -0
- package/dist/dev/performance-profiler.d.ts +111 -0
- package/dist/dev/performance-profiler.d.ts.map +1 -0
- package/dist/dev/performance-profiler.js +215 -0
- package/dist/dev/render-debug-adapter.d.ts +57 -0
- package/dist/dev/render-debug-adapter.d.ts.map +1 -0
- package/dist/dev/render-debug-adapter.js +141 -0
- package/dist/dev/render-memory.d.ts +53 -0
- package/dist/dev/render-memory.d.ts.map +1 -0
- package/dist/dev/render-memory.js +190 -0
- package/dist/dev/webgl-frame-capture.d.ts +134 -0
- package/dist/dev/webgl-frame-capture.d.ts.map +1 -0
- package/dist/dev/webgl-frame-capture.js +270 -0
- package/dist/dev/webgl-gpu-timer.d.ts +8 -0
- package/dist/dev/webgl-gpu-timer.d.ts.map +1 -0
- package/dist/dev/webgl-gpu-timer.js +52 -0
- package/dist/ecs/scene-index.d.ts +179 -0
- package/dist/ecs/scene-index.d.ts.map +1 -0
- package/dist/ecs/scene-index.js +331 -0
- package/dist/ecs/scene-query.d.ts +6 -0
- package/dist/ecs/scene-query.d.ts.map +1 -0
- package/dist/ecs/scene-query.js +40 -0
- package/dist/ecs/user-data.d.ts +193 -0
- package/dist/ecs/user-data.d.ts.map +1 -0
- package/dist/ecs/user-data.js +145 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/input/input-manager.d.ts +944 -0
- package/dist/input/input-manager.d.ts.map +1 -0
- package/dist/input/input-manager.js +2209 -0
- package/dist/input/input-types.d.ts +174 -0
- package/dist/input/input-types.d.ts.map +1 -0
- package/dist/input/input-types.js +1 -0
- package/dist/input/prompt-labels.d.ts +21 -0
- package/dist/input/prompt-labels.d.ts.map +1 -0
- package/dist/input/prompt-labels.js +121 -0
- package/dist/input/rebind-controller.d.ts +59 -0
- package/dist/input/rebind-controller.d.ts.map +1 -0
- package/dist/input/rebind-controller.js +85 -0
- package/dist/input/schema.d.ts +16 -0
- package/dist/input/schema.d.ts.map +1 -0
- package/dist/input/schema.js +228 -0
- package/dist/loader.d.ts +76 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +114 -0
- package/dist/manifest/editor-port.d.ts +53 -0
- package/dist/manifest/editor-port.d.ts.map +1 -0
- package/dist/manifest/editor-port.js +67 -0
- package/dist/manifest/filename.d.ts +14 -0
- package/dist/manifest/filename.d.ts.map +1 -0
- package/dist/manifest/filename.js +43 -0
- package/dist/manifest/index.d.ts +6 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +9 -0
- package/dist/manifest/load-file.d.ts +7 -0
- package/dist/manifest/load-file.d.ts.map +1 -0
- package/dist/manifest/load-file.js +23 -0
- package/dist/manifest/load.d.ts +161 -0
- package/dist/manifest/load.d.ts.map +1 -0
- package/dist/manifest/load.js +269 -0
- package/dist/manifest/locate.d.ts +24 -0
- package/dist/manifest/locate.d.ts.map +1 -0
- package/dist/manifest/locate.js +48 -0
- package/dist/manifest/schema.d.ts +293 -0
- package/dist/manifest/schema.d.ts.map +1 -0
- package/dist/manifest/schema.js +633 -0
- package/dist/physics/collider-dimensions.d.ts +63 -0
- package/dist/physics/collider-dimensions.d.ts.map +1 -0
- package/dist/physics/collider-dimensions.js +98 -0
- package/dist/physics/collision-system.d.ts +41 -0
- package/dist/physics/collision-system.d.ts.map +1 -0
- package/dist/physics/collision-system.js +64 -0
- package/dist/physics/physics-registry.d.ts +45 -0
- package/dist/physics/physics-registry.d.ts.map +1 -0
- package/dist/physics/physics-registry.js +65 -0
- package/dist/physics/transform-writer.d.ts +16 -0
- package/dist/physics/transform-writer.d.ts.map +1 -0
- package/dist/physics/transform-writer.js +38 -0
- package/dist/pixi/authoring.d.ts +93 -0
- package/dist/pixi/authoring.d.ts.map +1 -0
- package/dist/pixi/authoring.js +207 -0
- package/dist/pixi/index.d.ts +16 -0
- package/dist/pixi/index.d.ts.map +1 -0
- package/dist/pixi/index.js +15 -0
- package/dist/pixi/ingest-iframe.d.ts +82 -0
- package/dist/pixi/ingest-iframe.d.ts.map +1 -0
- package/dist/pixi/ingest-iframe.js +166 -0
- package/dist/pixi/ingest.d.ts +97 -0
- package/dist/pixi/ingest.d.ts.map +1 -0
- package/dist/pixi/ingest.js +40 -0
- package/dist/pixi/physics-registry.d.ts +24 -0
- package/dist/pixi/physics-registry.d.ts.map +1 -0
- package/dist/pixi/physics-registry.js +38 -0
- package/dist/pixi/scene-capture.d.ts +43 -0
- package/dist/pixi/scene-capture.d.ts.map +1 -0
- package/dist/pixi/scene-capture.js +92 -0
- package/dist/pixi/system-adapters.d.ts +16 -0
- package/dist/pixi/system-adapters.d.ts.map +1 -0
- package/dist/pixi/system-adapters.js +37 -0
- package/dist/react/unmanaged-root-detector.d.ts +18 -0
- package/dist/react/unmanaged-root-detector.d.ts.map +1 -0
- package/dist/react/unmanaged-root-detector.js +70 -0
- package/dist/react/use-data.d.ts +60 -0
- package/dist/react/use-data.d.ts.map +1 -0
- package/dist/react/use-data.js +101 -0
- package/dist/react/use-selection.d.ts +54 -0
- package/dist/react/use-selection.d.ts.map +1 -0
- package/dist/react/use-selection.js +71 -0
- package/dist/react/world-state.d.ts +154 -0
- package/dist/react/world-state.d.ts.map +1 -0
- package/dist/react/world-state.js +220 -0
- package/dist/render/auto-batcher.d.ts +34 -0
- package/dist/render/auto-batcher.d.ts.map +1 -0
- package/dist/render/auto-batcher.js +140 -0
- package/dist/render/instance-mesh.d.ts +5 -0
- package/dist/render/instance-mesh.d.ts.map +1 -0
- package/dist/render/instance-mesh.js +19 -0
- package/dist/render/light-camera-factory.d.ts +24 -0
- package/dist/render/light-camera-factory.d.ts.map +1 -0
- package/dist/render/light-camera-factory.js +71 -0
- package/dist/render/lod.d.ts +13 -0
- package/dist/render/lod.d.ts.map +1 -0
- package/dist/render/lod.js +16 -0
- package/dist/render/material-factory.d.ts +15 -0
- package/dist/render/material-factory.d.ts.map +1 -0
- package/dist/render/material-factory.js +186 -0
- package/dist/render/mesh-shadow.d.ts +11 -0
- package/dist/render/mesh-shadow.d.ts.map +1 -0
- package/dist/render/mesh-shadow.js +19 -0
- package/dist/render/particles-factory.d.ts +99 -0
- package/dist/render/particles-factory.d.ts.map +1 -0
- package/dist/render/particles-factory.js +361 -0
- package/dist/render/render-batch-system.d.ts +33 -0
- package/dist/render/render-batch-system.d.ts.map +1 -0
- package/dist/render/render-batch-system.js +223 -0
- package/dist/render/render-features.d.ts +47 -0
- package/dist/render/render-features.d.ts.map +1 -0
- package/dist/render/render-features.js +105 -0
- package/dist/render/render-settings.d.ts +35 -0
- package/dist/render/render-settings.d.ts.map +1 -0
- package/dist/render/render-settings.js +51 -0
- package/dist/render/spark-renderer-lifecycle.d.ts +18 -0
- package/dist/render/spark-renderer-lifecycle.d.ts.map +1 -0
- package/dist/render/spark-renderer-lifecycle.js +57 -0
- package/dist/render/viewport-shading.d.ts +17 -0
- package/dist/render/viewport-shading.d.ts.map +1 -0
- package/dist/render/viewport-shading.js +87 -0
- package/dist/runtime/create-runtime.d.ts +259 -0
- package/dist/runtime/create-runtime.d.ts.map +1 -0
- package/dist/runtime/create-runtime.js +666 -0
- package/dist/runtime/debug-bridge.d.ts +288 -0
- package/dist/runtime/debug-bridge.d.ts.map +1 -0
- package/dist/runtime/debug-bridge.js +277 -0
- package/dist/runtime/debug-registry.d.ts +287 -0
- package/dist/runtime/debug-registry.d.ts.map +1 -0
- package/dist/runtime/debug-registry.js +528 -0
- package/dist/runtime/dev-layers.d.ts +34 -0
- package/dist/runtime/dev-layers.d.ts.map +1 -0
- package/dist/runtime/dev-layers.js +40 -0
- package/dist/runtime/frame-selector-cache.d.ts +41 -0
- package/dist/runtime/frame-selector-cache.d.ts.map +1 -0
- package/dist/runtime/frame-selector-cache.js +65 -0
- package/dist/runtime/game.d.ts +576 -0
- package/dist/runtime/game.d.ts.map +1 -0
- package/dist/runtime/game.js +1003 -0
- package/dist/runtime/gameplay-rng-trap.d.ts +47 -0
- package/dist/runtime/gameplay-rng-trap.d.ts.map +1 -0
- package/dist/runtime/gameplay-rng-trap.js +95 -0
- package/dist/runtime/input-router.d.ts +78 -0
- package/dist/runtime/input-router.d.ts.map +1 -0
- package/dist/runtime/input-router.js +171 -0
- package/dist/runtime/mount-game.d.ts +126 -0
- package/dist/runtime/mount-game.d.ts.map +1 -0
- package/dist/runtime/mount-game.js +159 -0
- package/dist/runtime/mount-manifest.d.ts +174 -0
- package/dist/runtime/mount-manifest.d.ts.map +1 -0
- package/dist/runtime/mount-manifest.js +304 -0
- package/dist/runtime/presentation.d.ts +85 -0
- package/dist/runtime/presentation.d.ts.map +1 -0
- package/dist/runtime/presentation.js +92 -0
- package/dist/runtime/render-audio-control.d.ts +126 -0
- package/dist/runtime/render-audio-control.d.ts.map +1 -0
- package/dist/runtime/render-audio-control.js +116 -0
- package/dist/runtime/render-control.d.ts +347 -0
- package/dist/runtime/render-control.d.ts.map +1 -0
- package/dist/runtime/render-control.js +317 -0
- package/dist/runtime/render-seed.d.ts +56 -0
- package/dist/runtime/render-seed.d.ts.map +1 -0
- package/dist/runtime/render-seed.js +73 -0
- package/dist/runtime/state-bridge.d.ts +60 -0
- package/dist/runtime/state-bridge.d.ts.map +1 -0
- package/dist/runtime/state-bridge.js +62 -0
- package/dist/runtime/types.d.ts +285 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/unexported-game-trap.d.ts +36 -0
- package/dist/runtime/unexported-game-trap.d.ts.map +1 -0
- package/dist/runtime/unexported-game-trap.js +80 -0
- package/dist/setup/setup-audio.d.ts +20 -0
- package/dist/setup/setup-audio.d.ts.map +1 -0
- package/dist/setup/setup-audio.js +41 -0
- package/dist/setup/setup-particles.d.ts +17 -0
- package/dist/setup/setup-particles.d.ts.map +1 -0
- package/dist/setup/setup-particles.js +16 -0
- package/dist/setup/setup-physics.d.ts +25 -0
- package/dist/setup/setup-physics.d.ts.map +1 -0
- package/dist/setup/setup-physics.js +51 -0
- package/dist/setup/setup-renderer.d.ts +82 -0
- package/dist/setup/setup-renderer.d.ts.map +1 -0
- package/dist/setup/setup-renderer.js +381 -0
- package/dist/world3d-react/engine-bridge.d.ts +47 -0
- package/dist/world3d-react/engine-bridge.d.ts.map +1 -0
- package/dist/world3d-react/engine-bridge.js +48 -0
- package/dist/world3d-react/index.d.ts +47 -0
- package/dist/world3d-react/index.d.ts.map +1 -0
- package/dist/world3d-react/index.js +46 -0
- package/dist/world3d-react/r3f-adapter.d.ts +51 -0
- package/dist/world3d-react/r3f-adapter.d.ts.map +1 -0
- package/dist/world3d-react/r3f-adapter.js +368 -0
- package/dist/world3d-react/r3f-root-factory.d.ts +62 -0
- package/dist/world3d-react/r3f-root-factory.d.ts.map +1 -0
- package/dist/world3d-react/r3f-root-factory.js +79 -0
- package/dist/world3d-react/rapier-physics-bridge.d.ts +76 -0
- package/dist/world3d-react/rapier-physics-bridge.d.ts.map +1 -0
- package/dist/world3d-react/rapier-physics-bridge.js +120 -0
- package/dist/world3d-react/renderer-config.d.ts +58 -0
- package/dist/world3d-react/renderer-config.d.ts.map +1 -0
- package/dist/world3d-react/renderer-config.js +96 -0
- package/dist/world3d-react/world-context.d.ts +123 -0
- package/dist/world3d-react/world-context.d.ts.map +1 -0
- package/dist/world3d-react/world-context.js +204 -0
- package/dist-config/config.js +303 -0
- package/dist-config/config.js.map +7 -0
- package/package.json +14 -3
- package/src/adapter/rapier-physics-adapter.ts +77 -34
- package/src/config.ts +8 -0
- package/src/core/frame-pacing.ts +26 -0
- package/src/core/game-loop.ts +4 -3
- package/src/dev/instruments.ts +302 -0
- package/src/setup/setup-renderer.ts +2 -0
- package/src/world3d-react/index.ts +9 -0
- package/src/world3d-react/rapier-physics-bridge.tsx +137 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The GENERIC fetched-asset parse error.
|
|
3
|
+
*
|
|
4
|
+
* Every authored asset format the engine validates at fetch time throws this
|
|
5
|
+
* when Zod rejects the payload, naming the offending file (T4.6). It lives
|
|
6
|
+
* here — beside `loader.ts`/`assets.ts` — rather than inside a format module so
|
|
7
|
+
* every caller (the `.mat.json` parser, the input-map loader in
|
|
8
|
+
* `input/input-manager.ts`) does not have to reach into the format half for
|
|
9
|
+
* it.
|
|
10
|
+
*
|
|
11
|
+
* It was called `SceneParseError` until WO-9 task #6. The extraction that gave
|
|
12
|
+
* this file its name deliberately deferred the class rename ("extraction, not
|
|
13
|
+
* redesign"); with `.vscn` gone the old name described nothing — a `.mat.json`
|
|
14
|
+
* or `.inputmap.json` failure is not a scene failure — so the class and its
|
|
15
|
+
* message header now say `asset`.
|
|
16
|
+
*/
|
|
17
|
+
import type { ZodIssue } from 'zod';
|
|
18
|
+
export declare class AssetParseError extends Error {
|
|
19
|
+
readonly issues: ZodIssue[];
|
|
20
|
+
/** The offending file's path/URL, when the caller knows it (T4.6). */
|
|
21
|
+
readonly filePath?: string | undefined;
|
|
22
|
+
constructor(issues: ZodIssue[], filePath?: string);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=asset-parse-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-parse-error.d.ts","sourceRoot":"","sources":["../src/asset-parse-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAEpC,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC;IAC5B,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE3B,MAAM,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM;CAQlD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The GENERIC fetched-asset parse error.
|
|
3
|
+
*
|
|
4
|
+
* Every authored asset format the engine validates at fetch time throws this
|
|
5
|
+
* when Zod rejects the payload, naming the offending file (T4.6). It lives
|
|
6
|
+
* here — beside `loader.ts`/`assets.ts` — rather than inside a format module so
|
|
7
|
+
* every caller (the `.mat.json` parser, the input-map loader in
|
|
8
|
+
* `input/input-manager.ts`) does not have to reach into the format half for
|
|
9
|
+
* it.
|
|
10
|
+
*
|
|
11
|
+
* It was called `SceneParseError` until WO-9 task #6. The extraction that gave
|
|
12
|
+
* this file its name deliberately deferred the class rename ("extraction, not
|
|
13
|
+
* redesign"); with `.vscn` gone the old name described nothing — a `.mat.json`
|
|
14
|
+
* or `.inputmap.json` failure is not a scene failure — so the class and its
|
|
15
|
+
* message header now say `asset`.
|
|
16
|
+
*/
|
|
17
|
+
export class AssetParseError extends Error {
|
|
18
|
+
issues;
|
|
19
|
+
/** The offending file's path/URL, when the caller knows it (T4.6). */
|
|
20
|
+
filePath;
|
|
21
|
+
constructor(issues, filePath) {
|
|
22
|
+
const msg = issues.map((i) => ` ${i.path.join('.')}: ${i.message}`).join('\n');
|
|
23
|
+
const header = filePath ? `Asset validation failed (${filePath}):` : 'Asset validation failed:';
|
|
24
|
+
super(`${header}\n${msg}`);
|
|
25
|
+
this.name = 'AssetParseError';
|
|
26
|
+
this.issues = issues;
|
|
27
|
+
this.filePath = filePath;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central asset registry — stores per-asset metadata (import corrections, etc.).
|
|
3
|
+
*
|
|
4
|
+
* Loaded once via fetch(), cached in memory. Both the runtime scene loader
|
|
5
|
+
* and editor entity factory import from this module.
|
|
6
|
+
*/
|
|
7
|
+
import * as THREE from 'three';
|
|
8
|
+
export interface ImportCorrection {
|
|
9
|
+
/** Uniform scale factor applied to the GLTF clone before entity transform. */
|
|
10
|
+
scale?: number;
|
|
11
|
+
/** Euler rotation in degrees [x, y, z] applied to the GLTF clone before entity transform. */
|
|
12
|
+
rotation?: [number, number, number];
|
|
13
|
+
}
|
|
14
|
+
export interface AssetMeta {
|
|
15
|
+
importCorrection?: ImportCorrection;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Apply an asset's visual-only import correction to the loaded GLTF content.
|
|
19
|
+
* Call this on the model child, before placing it under the entity wrapper, so
|
|
20
|
+
* gameplay transforms, physics, cameras, and movement remain in VGAI's Y-up /
|
|
21
|
+
* -Z-forward coordinate contract.
|
|
22
|
+
*/
|
|
23
|
+
export declare function applyImportCorrection(content: THREE.Object3D, correction: ImportCorrection | undefined): void;
|
|
24
|
+
type AssetRegistry = Record<string, AssetMeta>;
|
|
25
|
+
/**
|
|
26
|
+
* Fetch and cache the asset registry. Safe to call multiple times —
|
|
27
|
+
* returns the cached result after the first successful load.
|
|
28
|
+
*/
|
|
29
|
+
export declare function loadRegistry(): Promise<AssetRegistry>;
|
|
30
|
+
/** Get metadata for an asset path, or undefined if not in the registry. */
|
|
31
|
+
export declare function getAssetMeta(path: string): AssetMeta | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Update the in-memory cache directly (used by the editor after saving
|
|
34
|
+
* import settings, to avoid a re-fetch).
|
|
35
|
+
*/
|
|
36
|
+
export declare function setRegistryCache(data: AssetRegistry): void;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=asset-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-registry.d.ts","sourceRoot":"","sources":["../src/asset-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,gBAAgB;IAC/B,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,SAAS;IACxB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,KAAK,CAAC,QAAQ,EACvB,UAAU,EAAE,gBAAgB,GAAG,SAAS,GACvC,IAAI,CAUN;AAED,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAU/C;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAAC,aAAa,CAAC,CAgBrD;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAIhE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAG1D"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central asset registry — stores per-asset metadata (import corrections, etc.).
|
|
3
|
+
*
|
|
4
|
+
* Loaded once via fetch(), cached in memory. Both the runtime scene loader
|
|
5
|
+
* and editor entity factory import from this module.
|
|
6
|
+
*/
|
|
7
|
+
import * as THREE from 'three';
|
|
8
|
+
import { resolveUrl } from './loader';
|
|
9
|
+
/**
|
|
10
|
+
* Apply an asset's visual-only import correction to the loaded GLTF content.
|
|
11
|
+
* Call this on the model child, before placing it under the entity wrapper, so
|
|
12
|
+
* gameplay transforms, physics, cameras, and movement remain in VGAI's Y-up /
|
|
13
|
+
* -Z-forward coordinate contract.
|
|
14
|
+
*/
|
|
15
|
+
export function applyImportCorrection(content, correction) {
|
|
16
|
+
if (!correction)
|
|
17
|
+
return;
|
|
18
|
+
if (correction.scale !== undefined)
|
|
19
|
+
content.scale.multiplyScalar(correction.scale);
|
|
20
|
+
if (correction.rotation) {
|
|
21
|
+
content.rotation.set(THREE.MathUtils.degToRad(correction.rotation[0]), THREE.MathUtils.degToRad(correction.rotation[1]), THREE.MathUtils.degToRad(correction.rotation[2]));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
let registryCache = null;
|
|
25
|
+
let registryPromise = null;
|
|
26
|
+
/** Normalize asset path for registry lookup (strip leading slash). */
|
|
27
|
+
function normalize(path) {
|
|
28
|
+
return path.startsWith('/') ? path.slice(1) : path;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Fetch and cache the asset registry. Safe to call multiple times —
|
|
32
|
+
* returns the cached result after the first successful load.
|
|
33
|
+
*/
|
|
34
|
+
export function loadRegistry() {
|
|
35
|
+
if (registryCache)
|
|
36
|
+
return Promise.resolve(registryCache);
|
|
37
|
+
if (registryPromise)
|
|
38
|
+
return registryPromise;
|
|
39
|
+
registryPromise = fetch(resolveUrl('asset-registry.json'))
|
|
40
|
+
.then((res) => {
|
|
41
|
+
if (!res.ok)
|
|
42
|
+
return {};
|
|
43
|
+
return res.json();
|
|
44
|
+
})
|
|
45
|
+
.catch(() => ({}))
|
|
46
|
+
.then((data) => {
|
|
47
|
+
registryCache = data;
|
|
48
|
+
return data;
|
|
49
|
+
});
|
|
50
|
+
return registryPromise;
|
|
51
|
+
}
|
|
52
|
+
/** Get metadata for an asset path, or undefined if not in the registry. */
|
|
53
|
+
export function getAssetMeta(path) {
|
|
54
|
+
if (!registryCache)
|
|
55
|
+
return undefined;
|
|
56
|
+
// Try exact match first, then normalized
|
|
57
|
+
return registryCache[path] ?? registryCache[normalize(path)];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Update the in-memory cache directly (used by the editor after saving
|
|
61
|
+
* import settings, to avoid a re-fetch).
|
|
62
|
+
*/
|
|
63
|
+
export function setRegistryCache(data) {
|
|
64
|
+
registryCache = data;
|
|
65
|
+
registryPromise = null;
|
|
66
|
+
}
|
package/dist/assets.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared asset cache — URL-keyed, deduplicating loader for GLTF and JSON.
|
|
3
|
+
*
|
|
4
|
+
* Inspired by Unity's Resources.Load / Godot's load():
|
|
5
|
+
* assets.load<T>(url) — async, returns Promise<T>, deduplicates concurrent loads
|
|
6
|
+
* assets.get<T>(url) — sync, returns T, throws if not yet loaded
|
|
7
|
+
*
|
|
8
|
+
* GLTF files (.glb/.gltf) resolve to GLTFResult.
|
|
9
|
+
* JSON files resolve to the parsed object (caller provides type via generic).
|
|
10
|
+
*
|
|
11
|
+
* Cache lives for the app lifetime — no dispose needed.
|
|
12
|
+
*/
|
|
13
|
+
import type * as THREE from 'three';
|
|
14
|
+
/** Result of loading a .glb/.gltf file. */
|
|
15
|
+
export interface GLTFResult {
|
|
16
|
+
scene: THREE.Group;
|
|
17
|
+
animations: THREE.AnimationClip[];
|
|
18
|
+
}
|
|
19
|
+
export interface AssetCache {
|
|
20
|
+
/** Load an asset by URL. Returns a cached promise if already loading/loaded. */
|
|
21
|
+
load<T = unknown>(url: string): Promise<T>;
|
|
22
|
+
/** Get a previously-loaded asset synchronously. Throws if not yet loaded. */
|
|
23
|
+
get<T = unknown>(url: string): T;
|
|
24
|
+
}
|
|
25
|
+
export declare function createAssetCache(): AssetCache;
|
|
26
|
+
//# sourceMappingURL=assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAGpC,2CAA2C;AAC3C,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IACnB,UAAU,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,UAAU;IACzB,gFAAgF;IAChF,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAE3C,6EAA6E;IAC7E,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC;CAClC;AAED,wBAAgB,gBAAgB,IAAI,UAAU,CAiD7C"}
|
package/dist/assets.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared asset cache — URL-keyed, deduplicating loader for GLTF and JSON.
|
|
3
|
+
*
|
|
4
|
+
* Inspired by Unity's Resources.Load / Godot's load():
|
|
5
|
+
* assets.load<T>(url) — async, returns Promise<T>, deduplicates concurrent loads
|
|
6
|
+
* assets.get<T>(url) — sync, returns T, throws if not yet loaded
|
|
7
|
+
*
|
|
8
|
+
* GLTF files (.glb/.gltf) resolve to GLTFResult.
|
|
9
|
+
* JSON files resolve to the parsed object (caller provides type via generic).
|
|
10
|
+
*
|
|
11
|
+
* Cache lives for the app lifetime — no dispose needed.
|
|
12
|
+
*/
|
|
13
|
+
import { gltfLoader, resolveUrl } from './loader';
|
|
14
|
+
export function createAssetCache() {
|
|
15
|
+
const cache = new Map();
|
|
16
|
+
const resolved = new Map();
|
|
17
|
+
// Use the shared, DRACO-wired GLTFLoader (A2 / CB2) — no second loader instance.
|
|
18
|
+
// This cache keeps the parsed source GLTFResult (load/get semantics for gameplay
|
|
19
|
+
// code); it does NOT clone. Callers that need disposal-safe clones use
|
|
20
|
+
// asset-loaders `loadGLTF`, which clones + tags `__sharedGeometry`.
|
|
21
|
+
function load(url) {
|
|
22
|
+
const existing = cache.get(url);
|
|
23
|
+
if (existing)
|
|
24
|
+
return existing;
|
|
25
|
+
let promise;
|
|
26
|
+
if (url.endsWith('.glb') || url.endsWith('.gltf')) {
|
|
27
|
+
promise = new Promise((resolve, reject) => {
|
|
28
|
+
gltfLoader.load(url, (gltf) => resolve({ scene: gltf.scene, animations: gltf.animations }), undefined, reject);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else if (url.endsWith('.json')) {
|
|
32
|
+
promise = fetch(resolveUrl(url)).then((r) => {
|
|
33
|
+
if (!r.ok)
|
|
34
|
+
throw new Error(`Failed to fetch ${url}: ${r.status}`);
|
|
35
|
+
return r.json();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
throw new Error(`AssetCache: unsupported file type for "${url}"`);
|
|
40
|
+
}
|
|
41
|
+
const tracked = promise.then((value) => {
|
|
42
|
+
resolved.set(url, value);
|
|
43
|
+
return value;
|
|
44
|
+
});
|
|
45
|
+
cache.set(url, tracked);
|
|
46
|
+
return tracked;
|
|
47
|
+
}
|
|
48
|
+
function get(url) {
|
|
49
|
+
if (!resolved.has(url)) {
|
|
50
|
+
throw new Error(`AssetCache: "${url}" not loaded. Call load() first and await it.`);
|
|
51
|
+
}
|
|
52
|
+
return resolved.get(url);
|
|
53
|
+
}
|
|
54
|
+
return { load, get };
|
|
55
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure PCM -> 16-bit WAV encoder (spec §15 I6 "Encode and Mux", audio half).
|
|
3
|
+
* This module takes already-rendered Float32 channel data (e.g.
|
|
4
|
+
* `AudioBuffer.getChannelData(n)` from a `Tone.Offline` render,
|
|
5
|
+
* `audio/tone-offline-render.ts`) and produces a standard little-endian,
|
|
6
|
+
* 16-bit-PCM, interleaved RIFF/WAVE file as raw bytes — no
|
|
7
|
+
* `AudioBuffer`/`AudioContext` dependency, so this runs equally in a browser
|
|
8
|
+
* render-mode page (`runtime/render-audio-control.ts`) and in plain Node (this
|
|
9
|
+
* module's own `packages/engine/test/audio/wav-encode.test.ts`, no Playwright
|
|
10
|
+
* needed).
|
|
11
|
+
*
|
|
12
|
+
* 16-bit PCM (not 32-bit float) is the deliberate choice named by the I6 AC
|
|
13
|
+
* ("16-bit PCM WAV is fine") — it is universally decodable by every FFmpeg
|
|
14
|
+
* build without an extra format flag, keeping the video-mux step's ffmpeg
|
|
15
|
+
* invocation ordinary and portable.
|
|
16
|
+
*/
|
|
17
|
+
export interface PcmToWavInput {
|
|
18
|
+
/** One `Float32Array` per channel, each sample in `[-1, 1]` (values outside
|
|
19
|
+
* that range are clamped, not thrown on — real synthesis can transiently
|
|
20
|
+
* clip). All channels must have equal length. */
|
|
21
|
+
readonly channelData: readonly Float32Array[];
|
|
22
|
+
readonly sampleRate: number;
|
|
23
|
+
}
|
|
24
|
+
/** Encode `input` as a complete little-endian, 16-bit-PCM, interleaved
|
|
25
|
+
* RIFF/WAVE file (44-byte canonical header + data chunk). Throws on an
|
|
26
|
+
* empty/mismatched channel set rather than silently producing a malformed
|
|
27
|
+
* file — this module's own contribution to the "fail loudly, never a
|
|
28
|
+
* silent no-op" convention `runtime/render-control.ts` documents. */
|
|
29
|
+
export declare function encodeWav16(input: PcmToWavInput): Uint8Array;
|
|
30
|
+
/** RMS + peak over all channels/samples — the same "non-trivial audio, not
|
|
31
|
+
* an all-zero buffer" sanity check `tone-audio-main.ts`'s fixture computes,
|
|
32
|
+
* factored out here so both that fixture and the render-audio harness can
|
|
33
|
+
* share one implementation instead of drifting copies. */
|
|
34
|
+
export declare function pcmStats(channelData: readonly Float32Array[]): {
|
|
35
|
+
rms: number;
|
|
36
|
+
peak: number;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=wav-encode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wav-encode.d.ts","sourceRoot":"","sources":["../../src/audio/wav-encode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,aAAa;IAC5B;;sDAEkD;IAClD,QAAQ,CAAC,WAAW,EAAE,SAAS,YAAY,EAAE,CAAC;IAC9C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAeD;;;;sEAIsE;AACtE,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAwD5D;AAED;;;2DAG2D;AAC3D,wBAAgB,QAAQ,CAAC,WAAW,EAAE,SAAS,YAAY,EAAE,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAa5F"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure PCM -> 16-bit WAV encoder (spec §15 I6 "Encode and Mux", audio half).
|
|
3
|
+
* This module takes already-rendered Float32 channel data (e.g.
|
|
4
|
+
* `AudioBuffer.getChannelData(n)` from a `Tone.Offline` render,
|
|
5
|
+
* `audio/tone-offline-render.ts`) and produces a standard little-endian,
|
|
6
|
+
* 16-bit-PCM, interleaved RIFF/WAVE file as raw bytes — no
|
|
7
|
+
* `AudioBuffer`/`AudioContext` dependency, so this runs equally in a browser
|
|
8
|
+
* render-mode page (`runtime/render-audio-control.ts`) and in plain Node (this
|
|
9
|
+
* module's own `packages/engine/test/audio/wav-encode.test.ts`, no Playwright
|
|
10
|
+
* needed).
|
|
11
|
+
*
|
|
12
|
+
* 16-bit PCM (not 32-bit float) is the deliberate choice named by the I6 AC
|
|
13
|
+
* ("16-bit PCM WAV is fine") — it is universally decodable by every FFmpeg
|
|
14
|
+
* build without an extra format flag, keeping the video-mux step's ffmpeg
|
|
15
|
+
* invocation ordinary and portable.
|
|
16
|
+
*/
|
|
17
|
+
const BYTES_PER_SAMPLE = 2; // 16-bit PCM
|
|
18
|
+
const WAV_HEADER_BYTES = 44;
|
|
19
|
+
function clamp(value, lo, hi) {
|
|
20
|
+
return Math.min(hi, Math.max(lo, value));
|
|
21
|
+
}
|
|
22
|
+
function writeAsciiString(view, offset, text) {
|
|
23
|
+
for (let i = 0; i < text.length; i++) {
|
|
24
|
+
view.setUint8(offset + i, text.charCodeAt(i));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Encode `input` as a complete little-endian, 16-bit-PCM, interleaved
|
|
28
|
+
* RIFF/WAVE file (44-byte canonical header + data chunk). Throws on an
|
|
29
|
+
* empty/mismatched channel set rather than silently producing a malformed
|
|
30
|
+
* file — this module's own contribution to the "fail loudly, never a
|
|
31
|
+
* silent no-op" convention `runtime/render-control.ts` documents. */
|
|
32
|
+
export function encodeWav16(input) {
|
|
33
|
+
const { channelData, sampleRate } = input;
|
|
34
|
+
const numChannels = channelData.length;
|
|
35
|
+
if (numChannels === 0) {
|
|
36
|
+
throw new Error('[wav-encode] channelData must contain at least one channel');
|
|
37
|
+
}
|
|
38
|
+
if (!Number.isFinite(sampleRate) || sampleRate <= 0) {
|
|
39
|
+
throw new Error(`[wav-encode] sampleRate must be a finite number > 0, got ${sampleRate}`);
|
|
40
|
+
}
|
|
41
|
+
const numFrames = channelData[0]?.length ?? 0;
|
|
42
|
+
for (let ch = 0; ch < numChannels; ch++) {
|
|
43
|
+
const len = channelData[ch]?.length ?? -1;
|
|
44
|
+
if (len !== numFrames) {
|
|
45
|
+
throw new Error(`[wav-encode] channel ${ch} has length ${len}, expected ${numFrames} (all channels must match)`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const blockAlign = numChannels * BYTES_PER_SAMPLE;
|
|
49
|
+
const byteRate = sampleRate * blockAlign;
|
|
50
|
+
const dataSize = numFrames * blockAlign;
|
|
51
|
+
const buffer = new ArrayBuffer(WAV_HEADER_BYTES + dataSize);
|
|
52
|
+
const view = new DataView(buffer);
|
|
53
|
+
// RIFF chunk descriptor
|
|
54
|
+
writeAsciiString(view, 0, 'RIFF');
|
|
55
|
+
view.setUint32(4, 36 + dataSize, true);
|
|
56
|
+
writeAsciiString(view, 8, 'WAVE');
|
|
57
|
+
// fmt subchunk (PCM)
|
|
58
|
+
writeAsciiString(view, 12, 'fmt ');
|
|
59
|
+
view.setUint32(16, 16, true); // subchunk size for PCM
|
|
60
|
+
view.setUint16(20, 1, true); // audio format 1 = PCM
|
|
61
|
+
view.setUint16(22, numChannels, true);
|
|
62
|
+
view.setUint32(24, sampleRate, true);
|
|
63
|
+
view.setUint32(28, byteRate, true);
|
|
64
|
+
view.setUint16(32, blockAlign, true);
|
|
65
|
+
view.setUint16(34, BYTES_PER_SAMPLE * 8, true); // bits per sample
|
|
66
|
+
// data subchunk
|
|
67
|
+
writeAsciiString(view, 36, 'data');
|
|
68
|
+
view.setUint32(40, dataSize, true);
|
|
69
|
+
let offset = WAV_HEADER_BYTES;
|
|
70
|
+
for (let i = 0; i < numFrames; i++) {
|
|
71
|
+
for (let ch = 0; ch < numChannels; ch++) {
|
|
72
|
+
const sample = clamp(channelData[ch]?.[i] ?? 0, -1, 1);
|
|
73
|
+
const intSample = Math.round(sample < 0 ? sample * 0x8000 : sample * 0x7fff);
|
|
74
|
+
view.setInt16(offset, intSample, true);
|
|
75
|
+
offset += BYTES_PER_SAMPLE;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return new Uint8Array(buffer);
|
|
79
|
+
}
|
|
80
|
+
/** RMS + peak over all channels/samples — the same "non-trivial audio, not
|
|
81
|
+
* an all-zero buffer" sanity check `tone-audio-main.ts`'s fixture computes,
|
|
82
|
+
* factored out here so both that fixture and the render-audio harness can
|
|
83
|
+
* share one implementation instead of drifting copies. */
|
|
84
|
+
export function pcmStats(channelData) {
|
|
85
|
+
let sumSquares = 0;
|
|
86
|
+
let peak = 0;
|
|
87
|
+
let count = 0;
|
|
88
|
+
for (const data of channelData) {
|
|
89
|
+
for (let i = 0; i < data.length; i++) {
|
|
90
|
+
const v = data[i] ?? 0;
|
|
91
|
+
sumSquares += v * v;
|
|
92
|
+
peak = Math.max(peak, Math.abs(v));
|
|
93
|
+
count++;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return { rms: count > 0 ? Math.sqrt(sumSquares / count) : 0, peak };
|
|
97
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@engine/canvas-react` — the React context that carries a canvas world's
|
|
3
|
+
* engine runtime into its `@pixi/react` tree: the world's `GameContext`, read
|
|
4
|
+
* with {@link useGameContext}.
|
|
5
|
+
*
|
|
6
|
+
* The bridge value is built by `createPixiReactAdapter`'s `mount()`
|
|
7
|
+
* (./pixi-react-adapter.tsx), whose `update(dt)` runs this world's phases under
|
|
8
|
+
* the HOST loop — so registered systems tick in engine phase order, pause
|
|
9
|
+
* included (no update while the world is frozen).
|
|
10
|
+
*
|
|
11
|
+
* Behavior in a canvas world is components + hooks: `useGameContext` reaches
|
|
12
|
+
* engine services, `@pixi/react`'s own `useTick` is the per-frame hook, and
|
|
13
|
+
* `useApplication` is the door to the live `Application`.
|
|
14
|
+
*/
|
|
15
|
+
import type { GameContext } from '../runtime/types';
|
|
16
|
+
export interface EngineBridgeValue {
|
|
17
|
+
/** This root's `GameContext` — `input`, `debug`, `random`, `clock`, `game`,
|
|
18
|
+
* `roots`, `systems`, `registerSystemAdapter`. Present so ordinary
|
|
19
|
+
* components can reach engine services with a HOOK (see
|
|
20
|
+
* {@link useGameContext}). */
|
|
21
|
+
readonly ctx?: GameContext | undefined;
|
|
22
|
+
}
|
|
23
|
+
export declare const EngineBridge: import("react").Context<EngineBridgeValue | null>;
|
|
24
|
+
/**
|
|
25
|
+
* This canvas root's `GameContext`, for use inside any component in the tree.
|
|
26
|
+
*
|
|
27
|
+
* An ordinary component does what a model would write:
|
|
28
|
+
*
|
|
29
|
+
* ```tsx
|
|
30
|
+
* function Player({ speed = 220 }) {
|
|
31
|
+
* const { input } = useGameContext();
|
|
32
|
+
* const ref = useRef<Sprite>(null);
|
|
33
|
+
* useTick(({ deltaMS }) => {
|
|
34
|
+
* if (input.isPressed('move_right')) ref.current!.x += speed * (deltaMS / 1000);
|
|
35
|
+
* });
|
|
36
|
+
* return <pixiSprite ref={ref} texture={Texture.WHITE} />;
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* Throws when called outside a canvas root mounted by
|
|
41
|
+
* `createPixiReactAdapter` — absent context is a wiring bug, and a silent
|
|
42
|
+
* `null` would surface as a mystery `undefined` deep in a tick callback.
|
|
43
|
+
*/
|
|
44
|
+
export declare function useGameContext(): GameContext;
|
|
45
|
+
//# sourceMappingURL=engine-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-bridge.d.ts","sourceRoot":"","sources":["../../src/canvas-react/engine-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,WAAW,iBAAiB;IAChC;;;mCAG+B;IAC/B,QAAQ,CAAC,GAAG,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACxC;AAED,eAAO,MAAM,YAAY,mDAAgD,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAU5C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@engine/canvas-react` — the React context that carries a canvas world's
|
|
3
|
+
* engine runtime into its `@pixi/react` tree: the world's `GameContext`, read
|
|
4
|
+
* with {@link useGameContext}.
|
|
5
|
+
*
|
|
6
|
+
* The bridge value is built by `createPixiReactAdapter`'s `mount()`
|
|
7
|
+
* (./pixi-react-adapter.tsx), whose `update(dt)` runs this world's phases under
|
|
8
|
+
* the HOST loop — so registered systems tick in engine phase order, pause
|
|
9
|
+
* included (no update while the world is frozen).
|
|
10
|
+
*
|
|
11
|
+
* Behavior in a canvas world is components + hooks: `useGameContext` reaches
|
|
12
|
+
* engine services, `@pixi/react`'s own `useTick` is the per-frame hook, and
|
|
13
|
+
* `useApplication` is the door to the live `Application`.
|
|
14
|
+
*/
|
|
15
|
+
import { createContext, useContext } from 'react';
|
|
16
|
+
export const EngineBridge = createContext(null);
|
|
17
|
+
/**
|
|
18
|
+
* This canvas root's `GameContext`, for use inside any component in the tree.
|
|
19
|
+
*
|
|
20
|
+
* An ordinary component does what a model would write:
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* function Player({ speed = 220 }) {
|
|
24
|
+
* const { input } = useGameContext();
|
|
25
|
+
* const ref = useRef<Sprite>(null);
|
|
26
|
+
* useTick(({ deltaMS }) => {
|
|
27
|
+
* if (input.isPressed('move_right')) ref.current!.x += speed * (deltaMS / 1000);
|
|
28
|
+
* });
|
|
29
|
+
* return <pixiSprite ref={ref} texture={Texture.WHITE} />;
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* Throws when called outside a canvas root mounted by
|
|
34
|
+
* `createPixiReactAdapter` — absent context is a wiring bug, and a silent
|
|
35
|
+
* `null` would surface as a mystery `undefined` deep in a tick callback.
|
|
36
|
+
*/
|
|
37
|
+
export function useGameContext() {
|
|
38
|
+
const bridge = useContext(EngineBridge);
|
|
39
|
+
if (!bridge?.ctx) {
|
|
40
|
+
throw new Error('useGameContext(): no engine root context. This hook only works inside a canvas ' +
|
|
41
|
+
'root mounted by createPixiReactAdapter (@engine/canvas-react) — check that the ' +
|
|
42
|
+
'component is rendered inside your world entry, not in a standalone <Application>.');
|
|
43
|
+
}
|
|
44
|
+
return bridge.ctx;
|
|
45
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* canvas-react — the `@pixi/react` lane for vgai's canvas surface
|
|
3
|
+
* (`@engine/canvas-react`).
|
|
4
|
+
*
|
|
5
|
+
* The canvas surface is source-as-truth: a canvas root's document IS its
|
|
6
|
+
* TSX world file, exactly as a three root's document is its R3F source. This
|
|
7
|
+
* module is the peer of `world3d-react/` — same seam, same shape, Pixi instead
|
|
8
|
+
* of three — and the peer of `pixi/`, which holds what the host needs to mount
|
|
9
|
+
* and inspect a PixiJS game it did NOT write.
|
|
10
|
+
*
|
|
11
|
+
* The engine CORE never imports this (enforced by
|
|
12
|
+
* `packages/engine/test/react-core-import-ban.test.ts` — this directory is an
|
|
13
|
+
* allowed react-importing entry alongside `react/` and `world3d-react/`, and
|
|
14
|
+
* core files may not import it), so a three-only bundle never pays for react
|
|
15
|
+
* or the Pixi reconciler.
|
|
16
|
+
*
|
|
17
|
+
* Surface:
|
|
18
|
+
* - `createPixiReactAdapter({ id, content })` — mount a `@pixi/react` tree as
|
|
19
|
+
* a first-party `surface: "canvas"` root under the host's gated loop.
|
|
20
|
+
* - `pixiReactRootFactory` / `resolveCanvasEntryAdapter` — what a canvas entry
|
|
21
|
+
* module MEANS: a default-exported component (or an explicit `adapter`).
|
|
22
|
+
* - `PixiPrimitive` / `adoptNow` — the canvas surface's `<primitive object={…}>`:
|
|
23
|
+
* render a container the game already owns, and place a spawn in the
|
|
24
|
+
* display tree ahead of the commit that renders it.
|
|
25
|
+
* - `useGameContext()` — this root's `GameContext` (`input`, `debug`,
|
|
26
|
+
* `random`, `clock`, `game`, `roots`) from inside any component in the tree.
|
|
27
|
+
* Behavior in a canvas world is components + hooks, never a class under a
|
|
28
|
+
* string key.
|
|
29
|
+
* - `EngineBridge` / `EngineBridgeValue` — the context contract, exported for
|
|
30
|
+
* adopters building their own bridge.
|
|
31
|
+
*
|
|
32
|
+
* The Pixi runtime itself is NOT re-exported here. A component reaches the live
|
|
33
|
+
* `Application` (and therefore `stage`, `renderer`, `ticker`) with
|
|
34
|
+
* `@pixi/react`'s own `useApplication()`, ticks with its `useTick()`, and loads
|
|
35
|
+
* assets with Pixi's own `Assets` — the library's API, not a second one.
|
|
36
|
+
*/
|
|
37
|
+
export { EngineBridge, type EngineBridgeValue, useGameContext } from './engine-bridge';
|
|
38
|
+
export { adoptNow, PixiPrimitive, type PixiPrimitiveProps } from './pixi-primitive';
|
|
39
|
+
export { type CreatePixiReactAdapterOptions, createPixiReactAdapter, } from './pixi-react-adapter';
|
|
40
|
+
export { pixiReactRootFactory, resolveCanvasEntryAdapter } from './pixi-react-root-factory';
|
|
41
|
+
export { type CanvasRootContextOptions, type CanvasRootRuntime, createCanvasRootContext, DEFAULT_INPUT_MAP_PATH, } from './world-context';
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/canvas-react/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,KAAK,6BAA6B,EAClC,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC5F,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* canvas-react — the `@pixi/react` lane for vgai's canvas surface
|
|
3
|
+
* (`@engine/canvas-react`).
|
|
4
|
+
*
|
|
5
|
+
* The canvas surface is source-as-truth: a canvas root's document IS its
|
|
6
|
+
* TSX world file, exactly as a three root's document is its R3F source. This
|
|
7
|
+
* module is the peer of `world3d-react/` — same seam, same shape, Pixi instead
|
|
8
|
+
* of three — and the peer of `pixi/`, which holds what the host needs to mount
|
|
9
|
+
* and inspect a PixiJS game it did NOT write.
|
|
10
|
+
*
|
|
11
|
+
* The engine CORE never imports this (enforced by
|
|
12
|
+
* `packages/engine/test/react-core-import-ban.test.ts` — this directory is an
|
|
13
|
+
* allowed react-importing entry alongside `react/` and `world3d-react/`, and
|
|
14
|
+
* core files may not import it), so a three-only bundle never pays for react
|
|
15
|
+
* or the Pixi reconciler.
|
|
16
|
+
*
|
|
17
|
+
* Surface:
|
|
18
|
+
* - `createPixiReactAdapter({ id, content })` — mount a `@pixi/react` tree as
|
|
19
|
+
* a first-party `surface: "canvas"` root under the host's gated loop.
|
|
20
|
+
* - `pixiReactRootFactory` / `resolveCanvasEntryAdapter` — what a canvas entry
|
|
21
|
+
* module MEANS: a default-exported component (or an explicit `adapter`).
|
|
22
|
+
* - `PixiPrimitive` / `adoptNow` — the canvas surface's `<primitive object={…}>`:
|
|
23
|
+
* render a container the game already owns, and place a spawn in the
|
|
24
|
+
* display tree ahead of the commit that renders it.
|
|
25
|
+
* - `useGameContext()` — this root's `GameContext` (`input`, `debug`,
|
|
26
|
+
* `random`, `clock`, `game`, `roots`) from inside any component in the tree.
|
|
27
|
+
* Behavior in a canvas world is components + hooks, never a class under a
|
|
28
|
+
* string key.
|
|
29
|
+
* - `EngineBridge` / `EngineBridgeValue` — the context contract, exported for
|
|
30
|
+
* adopters building their own bridge.
|
|
31
|
+
*
|
|
32
|
+
* The Pixi runtime itself is NOT re-exported here. A component reaches the live
|
|
33
|
+
* `Application` (and therefore `stage`, `renderer`, `ticker`) with
|
|
34
|
+
* `@pixi/react`'s own `useApplication()`, ticks with its `useTick()`, and loads
|
|
35
|
+
* assets with Pixi's own `Assets` — the library's API, not a second one.
|
|
36
|
+
*/
|
|
37
|
+
export { EngineBridge, useGameContext } from './engine-bridge';
|
|
38
|
+
export { adoptNow, PixiPrimitive } from './pixi-primitive';
|
|
39
|
+
export { createPixiReactAdapter, } from './pixi-react-adapter';
|
|
40
|
+
export { pixiReactRootFactory, resolveCanvasEntryAdapter } from './pixi-react-root-factory';
|
|
41
|
+
export { createCanvasRootContext, DEFAULT_INPUT_MAP_PATH, } from './world-context';
|