@vgai/engine 0.5.4 → 0.5.6
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/runtime/mount-game.ts +6 -0
- package/src/runtime/unexported-game-trap.ts +82 -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,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical `WorldProvider`/`useGame`/`useWorldState`/`useRootObservation`
|
|
3
|
+
* entry for React adapter roots. Also home to `useDebugProvider` and
|
|
4
|
+
* `useDebugCommand`/`useDebugEmit`, the React-facing debug seam.
|
|
5
|
+
*
|
|
6
|
+
* This is a SEPARATE, react-value-importing module under
|
|
7
|
+
* `packages/engine/src/react/` — colocated per the "colocate the
|
|
8
|
+
* react-facing hooks with the HUD seam, not the react-free core" rule, just now living IN the engine package rather than only in the
|
|
9
|
+
* project template. It is imported by NOTHING in the engine core import
|
|
10
|
+
* graph (`packages/engine/src/` outside this `react/` directory) — that
|
|
11
|
+
* invariant is proved by `packages/engine/test/react-core-import-ban.test.ts`
|
|
12
|
+
* (AC-F1).
|
|
13
|
+
*
|
|
14
|
+
* Every host and game imports this one module, so provider and hooks share
|
|
15
|
+
* one `createContext()` identity. The engine core outside `src/react/`
|
|
16
|
+
* remains React-free, enforced by `react-core-import-ban.test.ts`.
|
|
17
|
+
*/
|
|
18
|
+
import { type PropsWithChildren } from 'react';
|
|
19
|
+
import type { z } from 'zod';
|
|
20
|
+
import type { RootStateObserver } from '../adapter';
|
|
21
|
+
import { type Equals, shallow } from '../runtime/frame-selector-cache';
|
|
22
|
+
import type { Game } from '../runtime/game';
|
|
23
|
+
import type { DebugCommandArgs } from '../runtime/types';
|
|
24
|
+
/** Re-exported for convenience — the opt-in equality for selectors that
|
|
25
|
+
* return a fresh object/array/tuple every call (default is `Object.is`). */
|
|
26
|
+
export { shallow };
|
|
27
|
+
/** Provide the `Game` to `useWorldState`/`useGame` for everything mounted
|
|
28
|
+
* beneath it. Adapter-root hosts install this provider automatically — see the module doc
|
|
29
|
+
* comment above for the context-identity rule this hook family depends on.
|
|
30
|
+
*
|
|
31
|
+
* Props use `PropsWithChildren` (children optional in the TYPE, not
|
|
32
|
+
* runtime-optional in practice — you always want children mounted under
|
|
33
|
+
* the provider) rather than a bare `{ children: ReactNode }` field: a
|
|
34
|
+
* required `children` in `P` makes TS's `createElement<P>(type, props?:
|
|
35
|
+
* Attributes & P, ...children)` overload reject the plain 3-arg call
|
|
36
|
+
* `React.createElement(WorldProvider, { game }, child)` (no JSX transform,
|
|
37
|
+
* e.g. a `.ts` main composing a sibling `.tsx` HUD) with "Property
|
|
38
|
+
* 'children' is missing" even though the 3rd arg supplies it — issue #97.
|
|
39
|
+
* Making `children` optional in the type lets that overload resolve; the
|
|
40
|
+
* rest-arg children are still wired through to `children` at runtime by
|
|
41
|
+
* React itself, unchanged. See `test/game-state-create-element-types.test.tsx`. */
|
|
42
|
+
export declare function WorldProvider({ game, children }: PropsWithChildren<{
|
|
43
|
+
game: Game;
|
|
44
|
+
}>): import("react").JSX.Element;
|
|
45
|
+
/** Read the `Game` provided by the nearest `WorldProvider`. Throws
|
|
46
|
+
* descriptively when called outside one — matching the repo's loud-failure
|
|
47
|
+
* habit rather than silently returning `null`. */
|
|
48
|
+
export declare function useGame(): Game;
|
|
49
|
+
/**
|
|
50
|
+
* Subscribe to a selected slice of game state. Re-renders only when the
|
|
51
|
+
* selected value changes: the selector re-runs at most once per completed
|
|
52
|
+
* frame (`game.state.frameVersion`), and `equals` (default `Object.is`; pass
|
|
53
|
+
* {@link shallow} for tuples/objects) gates whether the fresh result
|
|
54
|
+
* actually counts as a change.
|
|
55
|
+
*
|
|
56
|
+
* `selector` reads the live graph (e.g.
|
|
57
|
+
* `g => g.world('main')?.threeScene().getObjectByName('Hero')?.position.y`)
|
|
58
|
+
* at post-frame quiescence — no
|
|
59
|
+
* copies. A selector that returns a fresh object every call must pass
|
|
60
|
+
* `shallow` (or an equivalent `equals`), or it will re-render every frame.
|
|
61
|
+
*
|
|
62
|
+
* Note: `equals` is captured once, when this hook first mounts (in the
|
|
63
|
+
* per-instance cache created below) — pass a stable function (module-level
|
|
64
|
+
* `shallow`/`Object.is`, or a value that doesn't change across renders),
|
|
65
|
+
* not a fresh inline arrow every render.
|
|
66
|
+
*/
|
|
67
|
+
export declare function useWorldState<T>(selector: (game: Game) => T, equals?: Equals<T>): T;
|
|
68
|
+
/**
|
|
69
|
+
* Pure, react-free lookup for the `useRootObservation` hook below — factored
|
|
70
|
+
* out so the hook body stays a thin `useSyncExternalStore` wrapper. Throws
|
|
71
|
+
* descriptively (loud, not `undefined`-forever) when `worldId` doesn't name a
|
|
72
|
+
* registered world, or that world's mount has no `observe`
|
|
73
|
+
* (`RootStateObserver`, `@engine/adapter`) — matching the `Game.registerRoot`
|
|
74
|
+
* "no state bridge" report (`runtime/game.ts`) this is the react-side half of.
|
|
75
|
+
*/
|
|
76
|
+
export declare function requireRootObserver(game: Game, worldId: string): RootStateObserver;
|
|
77
|
+
/**
|
|
78
|
+
* Subscribe to a selected slice of a FOREIGN (non-first-party) world's
|
|
79
|
+
* observed state — the ingested-world counterpart of `useWorldState` above;
|
|
80
|
+
* both are sugar over the same subscribe/snapshot shape, so a react HUD reads
|
|
81
|
+
* native and ingested sources through one mental model.
|
|
82
|
+
*
|
|
83
|
+
* `selector` runs over that world's `snapshot()` — NOT the `Game` — since a
|
|
84
|
+
* foreign world exposes no first-party state. Re-renders only when the
|
|
85
|
+
* selected value changes (`equals`, default `Object.is`; pass {@link shallow}
|
|
86
|
+
* for tuples/objects returned fresh every call).
|
|
87
|
+
*
|
|
88
|
+
* Cadence note: unlike `useWorldState`, this does NOT key its cache off
|
|
89
|
+
* `game.state.frameVersion` — a foreign/self-driven world may notify on its
|
|
90
|
+
* OWN rAF cadence, unrelated to our frame timing (§4's "consumers must not
|
|
91
|
+
* assume our frame timing"). Instead this keeps a local version counter,
|
|
92
|
+
* bumped once per `onChange` notification from the observer itself.
|
|
93
|
+
*
|
|
94
|
+
* Throws (loud, not a silently-undefined subscription) if `worldId` isn't
|
|
95
|
+
* registered, or its mount has no `observe` — see `requireRootObserver`.
|
|
96
|
+
*/
|
|
97
|
+
export declare function useRootObservation<T>(worldId: string, selector: (snapshot: unknown) => T, equals?: Equals<T>): T;
|
|
98
|
+
/**
|
|
99
|
+
* The debug seam's react-world registration door (Task 1.5): react roots
|
|
100
|
+
* have no `setup()`/ `ctx.debug` of their own, so this hook registers a
|
|
101
|
+
* named state provider into the SAME game-scoped registry every root's
|
|
102
|
+
* `ctx.debug` feeds (`getDebugRegistry(game)`, `runtime/debug-registry.ts`),
|
|
103
|
+
* readable through `game.systemAdapters.debug.state(name)` exactly like a
|
|
104
|
+
* `ctx.debug.registerStateProvider` call.
|
|
105
|
+
*
|
|
106
|
+
* Registers ONCE per mount (keyed on `name`) and unregisters on unmount —
|
|
107
|
+
* silently, like hot-reload's `strip()`. Re-renders never re-register or
|
|
108
|
+
* re-warn: `fn` is kept in a ref updated every render, so the registered
|
|
109
|
+
* closure always calls the CURRENT `fn` without touching the registry.
|
|
110
|
+
* Outside a `<WorldProvider>` (or against a bare test `Game` built without a
|
|
111
|
+
* registry) this is an inert no-op — it never throws, matching the "no seam
|
|
112
|
+
* without a consumer" degrade every optional `ctx.*` surface follows.
|
|
113
|
+
*/
|
|
114
|
+
export declare function useDebugProvider(name: string, fn: () => unknown, opts?: {
|
|
115
|
+
tier?: 'observable' | 'assisted';
|
|
116
|
+
}): void;
|
|
117
|
+
/**
|
|
118
|
+
* The command-side counterpart of {@link useDebugProvider} — registers an
|
|
119
|
+
* invokable debug command into the same game-scoped registry, readable
|
|
120
|
+
* through `game.systemAdapters.debug.commands()`/`invoke(name, args)`.
|
|
121
|
+
*
|
|
122
|
+
* Same mount/unmount/ref-latest contract as {@link useDebugProvider}: `spec`
|
|
123
|
+
* (description/args/locus) is captured at registration time, `fn` always
|
|
124
|
+
* calls through to the latest render's closure via a ref, and the hook is an
|
|
125
|
+
* inert no-op with no `<WorldProvider>` in scope.
|
|
126
|
+
*
|
|
127
|
+
* Generic over the declared `args` Zod tuple, same as
|
|
128
|
+
* `DebugCtxSurface.registerCommand` ({@link DebugCommandArgs}, dry-run
|
|
129
|
+
* finding — ledger): declaring `args: z.tuple([z.number(), z.string()])`
|
|
130
|
+
* types `fn`'s parameters as `(n: number, s: string) => ...` with no
|
|
131
|
+
* `unknown[]` cast; omitting `args` keeps `fn` typed `(...args: unknown[])
|
|
132
|
+
* => ...` as before.
|
|
133
|
+
*/
|
|
134
|
+
export declare function useDebugCommand<T extends z.ZodTuple | undefined = undefined>(name: string, spec: {
|
|
135
|
+
description?: string;
|
|
136
|
+
args?: T;
|
|
137
|
+
locus?: 'client' | 'server';
|
|
138
|
+
}, fn: (...args: DebugCommandArgs<T>) => unknown | Promise<unknown>): void;
|
|
139
|
+
/**
|
|
140
|
+
* The event-side counterpart of {@link useDebugProvider} and
|
|
141
|
+
* {@link useDebugCommand}. Returns a stable callback that writes a
|
|
142
|
+
* tick-stamped event to the game-scoped debug flight recorder:
|
|
143
|
+
*
|
|
144
|
+
* ```tsx
|
|
145
|
+
* const emit = useDebugEmit();
|
|
146
|
+
* emit('score-changed', { score });
|
|
147
|
+
* ```
|
|
148
|
+
*
|
|
149
|
+
* It is an inert no-op outside a `<WorldProvider>`, matching the optional
|
|
150
|
+
* behavior of the other React debug hooks. Games never need to import the
|
|
151
|
+
* debug registry or know its internal React provenance id.
|
|
152
|
+
*/
|
|
153
|
+
export declare function useDebugEmit(): (event: string, detail?: unknown) => void;
|
|
154
|
+
//# sourceMappingURL=world-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world-state.d.ts","sourceRoot":"","sources":["../../src/react/world-state.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAEL,KAAK,iBAAiB,EAMvB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EAA4B,KAAK,MAAM,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AACjG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;6EAC6E;AAC7E,OAAO,EAAE,OAAO,EAAE,CAAC;AAInB;;;;;;;;;;;;;;oFAcoF;AACpF,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,+BAElF;AAED;;mDAEmD;AACnD,wBAAgB,OAAO,IAAI,IAAI,CAQ9B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,EAAE,MAAM,GAAE,MAAM,CAAC,CAAC,CAAa,GAAG,CAAC,CAW9F;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAiBlF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,CAAC,EAClC,MAAM,GAAE,MAAM,CAAC,CAAC,CAAa,GAC5B,CAAC,CAoBH;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,OAAO,EACjB,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;CAAE,GAC1C,IAAI,CAaN;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,GAAG,SAAS,GAAG,SAAS,EAC1E,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;CAAE,EACrE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAC/D,IAAI,CAeN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CASxE"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical `WorldProvider`/`useGame`/`useWorldState`/`useRootObservation`
|
|
4
|
+
* entry for React adapter roots. Also home to `useDebugProvider` and
|
|
5
|
+
* `useDebugCommand`/`useDebugEmit`, the React-facing debug seam.
|
|
6
|
+
*
|
|
7
|
+
* This is a SEPARATE, react-value-importing module under
|
|
8
|
+
* `packages/engine/src/react/` — colocated per the "colocate the
|
|
9
|
+
* react-facing hooks with the HUD seam, not the react-free core" rule, just now living IN the engine package rather than only in the
|
|
10
|
+
* project template. It is imported by NOTHING in the engine core import
|
|
11
|
+
* graph (`packages/engine/src/` outside this `react/` directory) — that
|
|
12
|
+
* invariant is proved by `packages/engine/test/react-core-import-ban.test.ts`
|
|
13
|
+
* (AC-F1).
|
|
14
|
+
*
|
|
15
|
+
* Every host and game imports this one module, so provider and hooks share
|
|
16
|
+
* one `createContext()` identity. The engine core outside `src/react/`
|
|
17
|
+
* remains React-free, enforced by `react-core-import-ban.test.ts`.
|
|
18
|
+
*/
|
|
19
|
+
import { createContext, useCallback, useContext, useEffect, useRef, useSyncExternalStore, } from 'react';
|
|
20
|
+
import { getDebugRegistry } from '../runtime/debug-registry';
|
|
21
|
+
import { createFrameSelectorCache, shallow } from '../runtime/frame-selector-cache';
|
|
22
|
+
/** Re-exported for convenience — the opt-in equality for selectors that
|
|
23
|
+
* return a fresh object/array/tuple every call (default is `Object.is`). */
|
|
24
|
+
export { shallow };
|
|
25
|
+
const GameContext = createContext(null);
|
|
26
|
+
/** Provide the `Game` to `useWorldState`/`useGame` for everything mounted
|
|
27
|
+
* beneath it. Adapter-root hosts install this provider automatically — see the module doc
|
|
28
|
+
* comment above for the context-identity rule this hook family depends on.
|
|
29
|
+
*
|
|
30
|
+
* Props use `PropsWithChildren` (children optional in the TYPE, not
|
|
31
|
+
* runtime-optional in practice — you always want children mounted under
|
|
32
|
+
* the provider) rather than a bare `{ children: ReactNode }` field: a
|
|
33
|
+
* required `children` in `P` makes TS's `createElement<P>(type, props?:
|
|
34
|
+
* Attributes & P, ...children)` overload reject the plain 3-arg call
|
|
35
|
+
* `React.createElement(WorldProvider, { game }, child)` (no JSX transform,
|
|
36
|
+
* e.g. a `.ts` main composing a sibling `.tsx` HUD) with "Property
|
|
37
|
+
* 'children' is missing" even though the 3rd arg supplies it — issue #97.
|
|
38
|
+
* Making `children` optional in the type lets that overload resolve; the
|
|
39
|
+
* rest-arg children are still wired through to `children` at runtime by
|
|
40
|
+
* React itself, unchanged. See `test/game-state-create-element-types.test.tsx`. */
|
|
41
|
+
export function WorldProvider({ game, children }) {
|
|
42
|
+
return _jsx(GameContext.Provider, { value: game, children: children });
|
|
43
|
+
}
|
|
44
|
+
/** Read the `Game` provided by the nearest `WorldProvider`. Throws
|
|
45
|
+
* descriptively when called outside one — matching the repo's loud-failure
|
|
46
|
+
* habit rather than silently returning `null`. */
|
|
47
|
+
export function useGame() {
|
|
48
|
+
const game = useContext(GameContext);
|
|
49
|
+
if (!game) {
|
|
50
|
+
throw new Error('useGame: no Game in context — wrap this component in <WorldProvider game={ctx.game!}>.');
|
|
51
|
+
}
|
|
52
|
+
return game;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Subscribe to a selected slice of game state. Re-renders only when the
|
|
56
|
+
* selected value changes: the selector re-runs at most once per completed
|
|
57
|
+
* frame (`game.state.frameVersion`), and `equals` (default `Object.is`; pass
|
|
58
|
+
* {@link shallow} for tuples/objects) gates whether the fresh result
|
|
59
|
+
* actually counts as a change.
|
|
60
|
+
*
|
|
61
|
+
* `selector` reads the live graph (e.g.
|
|
62
|
+
* `g => g.world('main')?.threeScene().getObjectByName('Hero')?.position.y`)
|
|
63
|
+
* at post-frame quiescence — no
|
|
64
|
+
* copies. A selector that returns a fresh object every call must pass
|
|
65
|
+
* `shallow` (or an equivalent `equals`), or it will re-render every frame.
|
|
66
|
+
*
|
|
67
|
+
* Note: `equals` is captured once, when this hook first mounts (in the
|
|
68
|
+
* per-instance cache created below) — pass a stable function (module-level
|
|
69
|
+
* `shallow`/`Object.is`, or a value that doesn't change across renders),
|
|
70
|
+
* not a fresh inline arrow every render.
|
|
71
|
+
*/
|
|
72
|
+
export function useWorldState(selector, equals = Object.is) {
|
|
73
|
+
const game = useGame();
|
|
74
|
+
const cacheRef = useRef(null);
|
|
75
|
+
if (cacheRef.current === null) {
|
|
76
|
+
cacheRef.current = createFrameSelectorCache(equals);
|
|
77
|
+
}
|
|
78
|
+
return useSyncExternalStore((onStoreChange) => game.state.subscribe(onStoreChange), () => cacheRef.current.get(game.state.frameVersion, () => selector(game)));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Pure, react-free lookup for the `useRootObservation` hook below — factored
|
|
82
|
+
* out so the hook body stays a thin `useSyncExternalStore` wrapper. Throws
|
|
83
|
+
* descriptively (loud, not `undefined`-forever) when `worldId` doesn't name a
|
|
84
|
+
* registered world, or that world's mount has no `observe`
|
|
85
|
+
* (`RootStateObserver`, `@engine/adapter`) — matching the `Game.registerRoot`
|
|
86
|
+
* "no state bridge" report (`runtime/game.ts`) this is the react-side half of.
|
|
87
|
+
*/
|
|
88
|
+
export function requireRootObserver(game, worldId) {
|
|
89
|
+
const world = game.world(worldId);
|
|
90
|
+
if (!world) {
|
|
91
|
+
throw new Error(`useRootObservation: no world registered with id "${worldId}" — check game.roots for the ` +
|
|
92
|
+
'ids actually registered.');
|
|
93
|
+
}
|
|
94
|
+
const observer = world.mounted.observe;
|
|
95
|
+
if (!observer) {
|
|
96
|
+
throw new Error(`useRootObservation: world "${worldId}" (kind: ${world.kind}, adapter: "${world.adapter.id}") ` +
|
|
97
|
+
'has no state bridge — its mount has no `observe` (RootStateObserver). This world cannot ' +
|
|
98
|
+
'be observed from React.');
|
|
99
|
+
}
|
|
100
|
+
return observer;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Subscribe to a selected slice of a FOREIGN (non-first-party) world's
|
|
104
|
+
* observed state — the ingested-world counterpart of `useWorldState` above;
|
|
105
|
+
* both are sugar over the same subscribe/snapshot shape, so a react HUD reads
|
|
106
|
+
* native and ingested sources through one mental model.
|
|
107
|
+
*
|
|
108
|
+
* `selector` runs over that world's `snapshot()` — NOT the `Game` — since a
|
|
109
|
+
* foreign world exposes no first-party state. Re-renders only when the
|
|
110
|
+
* selected value changes (`equals`, default `Object.is`; pass {@link shallow}
|
|
111
|
+
* for tuples/objects returned fresh every call).
|
|
112
|
+
*
|
|
113
|
+
* Cadence note: unlike `useWorldState`, this does NOT key its cache off
|
|
114
|
+
* `game.state.frameVersion` — a foreign/self-driven world may notify on its
|
|
115
|
+
* OWN rAF cadence, unrelated to our frame timing (§4's "consumers must not
|
|
116
|
+
* assume our frame timing"). Instead this keeps a local version counter,
|
|
117
|
+
* bumped once per `onChange` notification from the observer itself.
|
|
118
|
+
*
|
|
119
|
+
* Throws (loud, not a silently-undefined subscription) if `worldId` isn't
|
|
120
|
+
* registered, or its mount has no `observe` — see `requireRootObserver`.
|
|
121
|
+
*/
|
|
122
|
+
export function useRootObservation(worldId, selector, equals = Object.is) {
|
|
123
|
+
const game = useGame();
|
|
124
|
+
const observer = requireRootObserver(game, worldId);
|
|
125
|
+
const cacheRef = useRef(null);
|
|
126
|
+
if (cacheRef.current === null) {
|
|
127
|
+
cacheRef.current = createFrameSelectorCache(equals);
|
|
128
|
+
}
|
|
129
|
+
// Local notification-version counter — see the cadence note above. A
|
|
130
|
+
// plain mutable ref (not React state): bumping it must not itself trigger
|
|
131
|
+
// a render, `useSyncExternalStore`'s `onStoreChange` is what does that.
|
|
132
|
+
const versionRef = useRef(0);
|
|
133
|
+
return useSyncExternalStore((onStoreChange) => observer.subscribe(() => {
|
|
134
|
+
versionRef.current++;
|
|
135
|
+
onStoreChange();
|
|
136
|
+
}), () => cacheRef.current.get(versionRef.current, () => selector(observer.snapshot())));
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The debug seam's react-world registration door (Task 1.5): react roots
|
|
140
|
+
* have no `setup()`/ `ctx.debug` of their own, so this hook registers a
|
|
141
|
+
* named state provider into the SAME game-scoped registry every root's
|
|
142
|
+
* `ctx.debug` feeds (`getDebugRegistry(game)`, `runtime/debug-registry.ts`),
|
|
143
|
+
* readable through `game.systemAdapters.debug.state(name)` exactly like a
|
|
144
|
+
* `ctx.debug.registerStateProvider` call.
|
|
145
|
+
*
|
|
146
|
+
* Registers ONCE per mount (keyed on `name`) and unregisters on unmount —
|
|
147
|
+
* silently, like hot-reload's `strip()`. Re-renders never re-register or
|
|
148
|
+
* re-warn: `fn` is kept in a ref updated every render, so the registered
|
|
149
|
+
* closure always calls the CURRENT `fn` without touching the registry.
|
|
150
|
+
* Outside a `<WorldProvider>` (or against a bare test `Game` built without a
|
|
151
|
+
* registry) this is an inert no-op — it never throws, matching the "no seam
|
|
152
|
+
* without a consumer" degrade every optional `ctx.*` surface follows.
|
|
153
|
+
*/
|
|
154
|
+
export function useDebugProvider(name, fn, opts) {
|
|
155
|
+
const game = useContext(GameContext);
|
|
156
|
+
const fnRef = useRef(fn);
|
|
157
|
+
fnRef.current = fn;
|
|
158
|
+
const tier = opts?.tier;
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
const registry = game && getDebugRegistry(game);
|
|
161
|
+
if (!registry)
|
|
162
|
+
return;
|
|
163
|
+
return registry.registerReactProvider(name, () => fnRef.current(), { tier });
|
|
164
|
+
// `tier` is deliberately NOT a dep (same reasoning as `useDebugCommand`'s
|
|
165
|
+
// `spec`) — captured once at mount, so it never forces re-registration.
|
|
166
|
+
}, [game, name]);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The command-side counterpart of {@link useDebugProvider} — registers an
|
|
170
|
+
* invokable debug command into the same game-scoped registry, readable
|
|
171
|
+
* through `game.systemAdapters.debug.commands()`/`invoke(name, args)`.
|
|
172
|
+
*
|
|
173
|
+
* Same mount/unmount/ref-latest contract as {@link useDebugProvider}: `spec`
|
|
174
|
+
* (description/args/locus) is captured at registration time, `fn` always
|
|
175
|
+
* calls through to the latest render's closure via a ref, and the hook is an
|
|
176
|
+
* inert no-op with no `<WorldProvider>` in scope.
|
|
177
|
+
*
|
|
178
|
+
* Generic over the declared `args` Zod tuple, same as
|
|
179
|
+
* `DebugCtxSurface.registerCommand` ({@link DebugCommandArgs}, dry-run
|
|
180
|
+
* finding — ledger): declaring `args: z.tuple([z.number(), z.string()])`
|
|
181
|
+
* types `fn`'s parameters as `(n: number, s: string) => ...` with no
|
|
182
|
+
* `unknown[]` cast; omitting `args` keeps `fn` typed `(...args: unknown[])
|
|
183
|
+
* => ...` as before.
|
|
184
|
+
*/
|
|
185
|
+
export function useDebugCommand(name, spec, fn) {
|
|
186
|
+
const game = useContext(GameContext);
|
|
187
|
+
const fnRef = useRef(fn);
|
|
188
|
+
fnRef.current = fn;
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
const registry = game && getDebugRegistry(game);
|
|
191
|
+
if (!registry)
|
|
192
|
+
return;
|
|
193
|
+
return registry.registerReactCommand(name, spec, (...args) => fnRef.current(...args));
|
|
194
|
+
// `spec` is deliberately NOT a dep (like `equals` above) — captured once
|
|
195
|
+
// at mount, so a fresh inline object literal every render never forces
|
|
196
|
+
// re-registration.
|
|
197
|
+
}, [game, name]);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* The event-side counterpart of {@link useDebugProvider} and
|
|
201
|
+
* {@link useDebugCommand}. Returns a stable callback that writes a
|
|
202
|
+
* tick-stamped event to the game-scoped debug flight recorder:
|
|
203
|
+
*
|
|
204
|
+
* ```tsx
|
|
205
|
+
* const emit = useDebugEmit();
|
|
206
|
+
* emit('score-changed', { score });
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* It is an inert no-op outside a `<WorldProvider>`, matching the optional
|
|
210
|
+
* behavior of the other React debug hooks. Games never need to import the
|
|
211
|
+
* debug registry or know its internal React provenance id.
|
|
212
|
+
*/
|
|
213
|
+
export function useDebugEmit() {
|
|
214
|
+
const game = useContext(GameContext);
|
|
215
|
+
return useCallback((event, detail) => {
|
|
216
|
+
if (!game)
|
|
217
|
+
return;
|
|
218
|
+
getDebugRegistry(game)?.emitReact(event, detail);
|
|
219
|
+
}, [game]);
|
|
220
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export declare class AutoBatcher {
|
|
3
|
+
/** Root the batcher owns under the scene (instanced meshes when on, entities when off). */
|
|
4
|
+
readonly root: THREE.Group<THREE.Object3DEventMap>;
|
|
5
|
+
private entities;
|
|
6
|
+
private batches;
|
|
7
|
+
private enabled;
|
|
8
|
+
/** Indices of entities whose transform changed since last sync. */
|
|
9
|
+
private dirty;
|
|
10
|
+
private touchedBatches;
|
|
11
|
+
private indexOf;
|
|
12
|
+
private optOut;
|
|
13
|
+
private batchOf;
|
|
14
|
+
private membersOf;
|
|
15
|
+
constructor(parent: THREE.Object3D, enabled?: boolean);
|
|
16
|
+
/** Register an entity (a Mesh) as the logical handle. Call build() after adding. */
|
|
17
|
+
add(entity: THREE.Mesh, optOut?: boolean): void;
|
|
18
|
+
/** Mark an entity moved this frame (dirty-tracking input). */
|
|
19
|
+
markMoved(entity: THREE.Mesh): void;
|
|
20
|
+
/** (Re)build the render representation for the current enabled state. */
|
|
21
|
+
build(): void;
|
|
22
|
+
/** Apply the dirty set to the instance buffers. Cheap when few moved. */
|
|
23
|
+
sync(): void;
|
|
24
|
+
/** Live toggle: rebuilds the representation (one-time cost, not per-frame). */
|
|
25
|
+
setEnabled(on: boolean): void;
|
|
26
|
+
isEnabled(): boolean;
|
|
27
|
+
/** Map a raycast hit on a batch back to the logical entity (editor/gameplay picking). */
|
|
28
|
+
resolvePick(intersection: THREE.Intersection): THREE.Mesh | null;
|
|
29
|
+
/** Per-frame draw-call count this batcher contributes (for stats). */
|
|
30
|
+
get drawCallCount(): number;
|
|
31
|
+
private get optOutCount();
|
|
32
|
+
private clearRoot;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=auto-batcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-batcher.d.ts","sourceRoot":"","sources":["../../src/render/auto-batcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgC/B,qBAAa,WAAW;IACtB,2FAA2F;IAC3F,QAAQ,CAAC,IAAI,sCAAqB;IAElC,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,OAAO,CAAU;IACzB,mEAAmE;IACnE,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,cAAc,CAAoB;IAG1C,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,OAAO,CAAkE;IACjF,OAAO,CAAC,SAAS,CAAoD;gBAEzD,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,OAAO,UAAO;IAMlD,oFAAoF;IACpF,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,UAAQ,GAAG,IAAI;IAM7C,8DAA8D;IAC9D,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,GAAG,IAAI;IAKnC,yEAAyE;IACzE,KAAK,IAAI,IAAI;IAuCb,yEAAyE;IACzE,IAAI,IAAI,IAAI;IAmBZ,+EAA+E;IAC/E,UAAU,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI;IAM7B,SAAS,IAAI,OAAO;IAIpB,yFAAyF;IACzF,WAAW,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,IAAI,GAAG,IAAI;IAShE,sEAAsE;IACtE,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,OAAO,KAAK,WAAW,GAItB;IAED,OAAO,CAAC,SAAS;CAOlB"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
const SIG = (m) => {
|
|
3
|
+
const mat = Array.isArray(m.material) ? m.material[0] : m.material;
|
|
4
|
+
return `${m.geometry.uuid}|${mat.uuid}`;
|
|
5
|
+
};
|
|
6
|
+
export class AutoBatcher {
|
|
7
|
+
/** Root the batcher owns under the scene (instanced meshes when on, entities when off). */
|
|
8
|
+
root = new THREE.Group();
|
|
9
|
+
entities = [];
|
|
10
|
+
batches = new Map();
|
|
11
|
+
enabled;
|
|
12
|
+
/** Indices of entities whose transform changed since last sync. */
|
|
13
|
+
dirty = new Set();
|
|
14
|
+
touchedBatches = new Set();
|
|
15
|
+
// Per-mesh bookkeeping is kept in WeakMaps, NOT on userData (the typed userData
|
|
16
|
+
// registry is reserved for documented engine keys — see user-data.ts).
|
|
17
|
+
indexOf = new WeakMap();
|
|
18
|
+
optOut = new WeakSet();
|
|
19
|
+
batchOf = new WeakMap();
|
|
20
|
+
membersOf = new WeakMap();
|
|
21
|
+
constructor(parent, enabled = true) {
|
|
22
|
+
this.enabled = enabled;
|
|
23
|
+
this.root.name = 'AutoBatcher';
|
|
24
|
+
parent.add(this.root);
|
|
25
|
+
}
|
|
26
|
+
/** Register an entity (a Mesh) as the logical handle. Call build() after adding. */
|
|
27
|
+
add(entity, optOut = false) {
|
|
28
|
+
this.indexOf.set(entity, this.entities.length);
|
|
29
|
+
if (optOut)
|
|
30
|
+
this.optOut.add(entity);
|
|
31
|
+
this.entities.push(entity);
|
|
32
|
+
}
|
|
33
|
+
/** Mark an entity moved this frame (dirty-tracking input). */
|
|
34
|
+
markMoved(entity) {
|
|
35
|
+
const i = this.indexOf.get(entity);
|
|
36
|
+
if (i !== undefined)
|
|
37
|
+
this.dirty.add(i);
|
|
38
|
+
}
|
|
39
|
+
/** (Re)build the render representation for the current enabled state. */
|
|
40
|
+
build() {
|
|
41
|
+
this.clearRoot();
|
|
42
|
+
this.batches.clear();
|
|
43
|
+
if (!this.enabled) {
|
|
44
|
+
for (const e of this.entities)
|
|
45
|
+
this.root.add(e);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const m = new THREE.Matrix4();
|
|
49
|
+
// group eligible entities; opt-outs render individually
|
|
50
|
+
const groups = new Map();
|
|
51
|
+
for (const e of this.entities) {
|
|
52
|
+
if (this.optOut.has(e)) {
|
|
53
|
+
this.root.add(e);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const key = SIG(e);
|
|
57
|
+
const arr = groups.get(key) ?? [];
|
|
58
|
+
arr.push(e);
|
|
59
|
+
groups.set(key, arr);
|
|
60
|
+
}
|
|
61
|
+
for (const [key, members] of groups) {
|
|
62
|
+
const proto = members[0];
|
|
63
|
+
const mat = Array.isArray(proto.material) ? proto.material[0] : proto.material;
|
|
64
|
+
const inst = new THREE.InstancedMesh(proto.geometry, mat, members.length);
|
|
65
|
+
inst.frustumCulled = false;
|
|
66
|
+
for (let i = 0; i < members.length; i++) {
|
|
67
|
+
const e = members[i];
|
|
68
|
+
e.updateMatrix();
|
|
69
|
+
m.copy(e.matrix);
|
|
70
|
+
inst.setMatrixAt(i, m);
|
|
71
|
+
this.batchOf.set(e, { key, localIndex: i });
|
|
72
|
+
}
|
|
73
|
+
inst.instanceMatrix.needsUpdate = true;
|
|
74
|
+
this.membersOf.set(inst, members); // localIndex → entity (picking)
|
|
75
|
+
this.root.add(inst);
|
|
76
|
+
this.batches.set(key, { key, instanced: inst, members });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** Apply the dirty set to the instance buffers. Cheap when few moved. */
|
|
80
|
+
sync() {
|
|
81
|
+
if (!this.enabled)
|
|
82
|
+
return;
|
|
83
|
+
const m = new THREE.Matrix4();
|
|
84
|
+
this.touchedBatches.clear();
|
|
85
|
+
for (const i of this.dirty) {
|
|
86
|
+
const e = this.entities[i];
|
|
87
|
+
const info = this.batchOf.get(e);
|
|
88
|
+
if (!info)
|
|
89
|
+
continue; // opt-out or not batched
|
|
90
|
+
const batch = this.batches.get(info.key);
|
|
91
|
+
if (!batch)
|
|
92
|
+
continue;
|
|
93
|
+
e.updateMatrix();
|
|
94
|
+
m.copy(e.matrix);
|
|
95
|
+
batch.instanced.setMatrixAt(info.localIndex, m);
|
|
96
|
+
this.touchedBatches.add(batch);
|
|
97
|
+
}
|
|
98
|
+
for (const b of this.touchedBatches)
|
|
99
|
+
b.instanced.instanceMatrix.needsUpdate = true;
|
|
100
|
+
this.dirty.clear();
|
|
101
|
+
}
|
|
102
|
+
/** Live toggle: rebuilds the representation (one-time cost, not per-frame). */
|
|
103
|
+
setEnabled(on) {
|
|
104
|
+
if (on === this.enabled)
|
|
105
|
+
return;
|
|
106
|
+
this.enabled = on;
|
|
107
|
+
this.build();
|
|
108
|
+
}
|
|
109
|
+
isEnabled() {
|
|
110
|
+
return this.enabled;
|
|
111
|
+
}
|
|
112
|
+
/** Map a raycast hit on a batch back to the logical entity (editor/gameplay picking). */
|
|
113
|
+
resolvePick(intersection) {
|
|
114
|
+
const obj = intersection.object;
|
|
115
|
+
if (obj.isInstancedMesh && intersection.instanceId != null) {
|
|
116
|
+
const members = this.membersOf.get(obj);
|
|
117
|
+
return members?.[intersection.instanceId] ?? null;
|
|
118
|
+
}
|
|
119
|
+
return obj instanceof THREE.Mesh ? obj : null;
|
|
120
|
+
}
|
|
121
|
+
/** Per-frame draw-call count this batcher contributes (for stats). */
|
|
122
|
+
get drawCallCount() {
|
|
123
|
+
return this.enabled ? this.batches.size + this.optOutCount : this.entities.length;
|
|
124
|
+
}
|
|
125
|
+
get optOutCount() {
|
|
126
|
+
let n = 0;
|
|
127
|
+
for (const e of this.entities)
|
|
128
|
+
if (this.optOut.has(e))
|
|
129
|
+
n++;
|
|
130
|
+
return n;
|
|
131
|
+
}
|
|
132
|
+
clearRoot() {
|
|
133
|
+
for (let i = this.root.children.length - 1; i >= 0; i--) {
|
|
134
|
+
const c = this.root.children[i];
|
|
135
|
+
this.root.remove(c);
|
|
136
|
+
if (c.isInstancedMesh)
|
|
137
|
+
c.dispose();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { InstancesFile } from '../asset-formats/instances';
|
|
3
|
+
/** Build one native InstancedMesh from a parsed `.instances.json` tuple array. */
|
|
4
|
+
export declare function buildInstancedMeshFromTuples(geometry: THREE.BufferGeometry, material: THREE.Material, tuples: InstancesFile): THREE.InstancedMesh;
|
|
5
|
+
//# sourceMappingURL=instance-mesh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance-mesh.d.ts","sourceRoot":"","sources":["../../src/render/instance-mesh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,kFAAkF;AAClF,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,KAAK,CAAC,cAAc,EAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,MAAM,EAAE,aAAa,GACpB,KAAK,CAAC,aAAa,CAgBrB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
/** Build one native InstancedMesh from a parsed `.instances.json` tuple array. */
|
|
3
|
+
export function buildInstancedMeshFromTuples(geometry, material, tuples) {
|
|
4
|
+
const mesh = new THREE.InstancedMesh(geometry, material, tuples.length);
|
|
5
|
+
const position = new THREE.Vector3();
|
|
6
|
+
const quaternion = new THREE.Quaternion();
|
|
7
|
+
const scale = new THREE.Vector3();
|
|
8
|
+
const matrix = new THREE.Matrix4();
|
|
9
|
+
for (let index = 0; index < tuples.length; index += 1) {
|
|
10
|
+
const tuple = tuples[index];
|
|
11
|
+
position.set(tuple[0], tuple[1], tuple[2]);
|
|
12
|
+
quaternion.set(tuple[3], tuple[4], tuple[5], tuple[6]);
|
|
13
|
+
scale.set(tuple[7], tuple[8], tuple[9]);
|
|
14
|
+
matrix.compose(position, quaternion, scale);
|
|
15
|
+
mesh.setMatrixAt(index, matrix);
|
|
16
|
+
}
|
|
17
|
+
mesh.instanceMatrix.needsUpdate = true;
|
|
18
|
+
return mesh;
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared light + camera factory (T1.13 — DEFAULTS truth).
|
|
3
|
+
*
|
|
4
|
+
* `createLight`/`createCamera` used to be duplicated verbatim between the
|
|
5
|
+
* runtime loader (`scene-loader.ts`) and the editor preview
|
|
6
|
+
* (`entity-factory.ts`) — both hardcoded the same fallback literals (color
|
|
7
|
+
* '#ffffff', fov 60, near 0.1, far 1000, etc.) that happened to agree with
|
|
8
|
+
* `DEFAULTS.light`/`DEFAULTS.camera` by luck rather than by reading them. Any
|
|
9
|
+
* edit to one copy (or to `DEFAULTS`) could silently diverge from the other.
|
|
10
|
+
*
|
|
11
|
+
* This module is now the ONE place that builds a `THREE.Light`/`THREE.Camera`
|
|
12
|
+
* from a `LightDescriptor`/`CameraDescriptor` descriptor, reading its fallbacks from
|
|
13
|
+
* `DEFAULTS` (the single source of truth for scene default values — see
|
|
14
|
+
* `defaults.ts`). Both the loader and the editor import it, so they
|
|
15
|
+
* can no longer disagree.
|
|
16
|
+
*/
|
|
17
|
+
import * as THREE from 'three';
|
|
18
|
+
import type { CameraDescriptor } from '../asset-formats/camera';
|
|
19
|
+
import type { LightDescriptor } from '../asset-formats/light';
|
|
20
|
+
/** Build a Three.js light from a `LightDescriptor` descriptor. */
|
|
21
|
+
export declare function createLight(def: LightDescriptor): THREE.Light;
|
|
22
|
+
/** Build a Three.js camera from a `CameraDescriptor` descriptor. */
|
|
23
|
+
export declare function createCamera(def: CameraDescriptor): THREE.Camera;
|
|
24
|
+
//# sourceMappingURL=light-camera-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"light-camera-factory.d.ts","sourceRoot":"","sources":["../../src/render/light-camera-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAK9D,kEAAkE;AAClE,wBAAgB,WAAW,CAAC,GAAG,EAAE,eAAe,GAAG,KAAK,CAAC,KAAK,CA8C7D;AAED,oEAAoE;AACpE,wBAAgB,YAAY,CAAC,GAAG,EAAE,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAoBhE"}
|