@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,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared world-scale collider dimension math (T1.2).
|
|
3
|
+
*
|
|
4
|
+
* Rapier colliders have no notion of a parent Object3D's `scale` — a body's
|
|
5
|
+
* shape is defined in absolute world units at creation time. Three.js meshes,
|
|
6
|
+
* by contrast, scale visually for free via the normal Object3D hierarchy. To
|
|
7
|
+
* keep the physical collider matching what's on screen, the LOADER must bake
|
|
8
|
+
* the entity's composed WORLD scale (self × every transformed ancestor — see
|
|
9
|
+
* T1.1's world-transform composition) into the collider's dimensions at
|
|
10
|
+
* creation time.
|
|
11
|
+
*
|
|
12
|
+
* This is the ONE place that does that math, so both the runtime loader
|
|
13
|
+
* (scene-loader.ts `createPhysicsBody`) and the editor's collider gizmo
|
|
14
|
+
* (gizmo-registry.ts) agree on exactly the same numbers — previously the
|
|
15
|
+
* editor gizmo only rendered the entity's own live Object3D scale (via normal
|
|
16
|
+
* Three.js parenting) while the Rapier body ignored scale entirely, so the
|
|
17
|
+
* two silently agreed by coincidence for uniform scale and disagreed for
|
|
18
|
+
* everything else.
|
|
19
|
+
*
|
|
20
|
+
* Round colliders (ball/capsule) can only represent a uniform radius — Rapier
|
|
21
|
+
* has no ellipsoid/elliptical-capsule shape. A non-uniform world scale on a
|
|
22
|
+
* round collider's round axes throws a loud error naming the entity, rather
|
|
23
|
+
* than silently simulating (or rendering) the wrong shape.
|
|
24
|
+
*/
|
|
25
|
+
import type { ColliderDescriptor } from '../asset-formats/collider';
|
|
26
|
+
export interface ColliderWorldDimensions {
|
|
27
|
+
/** cuboid only: per-axis half-extents, world scale applied. */
|
|
28
|
+
halfExtents?: [number, number, number];
|
|
29
|
+
/** ball/capsule only: radius, world scale applied (uniform axes required). */
|
|
30
|
+
radius?: number;
|
|
31
|
+
/** capsule only: half-height along the capsule's axis, world scale applied. */
|
|
32
|
+
halfHeight?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Compute a collider's WORLD-space dimensions given the entity's composed
|
|
36
|
+
* world scale (self × ancestors, per-axis, in the entity's own local frame —
|
|
37
|
+
* X/Y/Z order matches `SceneEntity.transform.scale`).
|
|
38
|
+
*
|
|
39
|
+
* @param collider - the entity's authored (unscaled) collider definition.
|
|
40
|
+
* @param worldScale - composed world scale `[x, y, z]`.
|
|
41
|
+
* @param entityLabel - human-readable entity identifier, used only in thrown
|
|
42
|
+
* error messages (loud-failure naming, never silently wrong).
|
|
43
|
+
* @throws if a ball/capsule collider's round cross-section axes have a
|
|
44
|
+
* non-uniform world scale (beyond {@link UNIFORM_SCALE_EPSILON}).
|
|
45
|
+
*/
|
|
46
|
+
export declare function computeColliderWorldDimensions(collider: ColliderDescriptor, worldScale: readonly [number, number, number], entityLabel: string): ColliderWorldDimensions;
|
|
47
|
+
/**
|
|
48
|
+
* Compute a collider's WORLD-scaled translation offset (sibling to
|
|
49
|
+
* {@link computeColliderWorldDimensions}, same input contract).
|
|
50
|
+
*
|
|
51
|
+
* Rapier's `ColliderDesc.setTranslation` is a raw physics-engine offset with no
|
|
52
|
+
* notion of a parent Object3D's scale — like dimensions, an authored `offset`
|
|
53
|
+
* (in the entity's own local units) must be scaled per-axis by the entity's
|
|
54
|
+
* composed world scale before being handed to Rapier, or the collider's center
|
|
55
|
+
* silently drifts away from its visual anchor point under any non-1 scale.
|
|
56
|
+
* Applies to every collider type (including trimesh, which is otherwise not
|
|
57
|
+
* handled by {@link computeColliderWorldDimensions}).
|
|
58
|
+
*
|
|
59
|
+
* Returns `undefined` when no offset is authored, mirroring the `if (col.offset)`
|
|
60
|
+
* guard call sites already use.
|
|
61
|
+
*/
|
|
62
|
+
export declare function computeColliderWorldOffset(offset: readonly [number, number, number] | undefined, worldScale: readonly [number, number, number]): [number, number, number] | undefined;
|
|
63
|
+
//# sourceMappingURL=collider-dimensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collider-dimensions.d.ts","sourceRoot":"","sources":["../../src/physics/collider-dimensions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAMpE,MAAM,WAAW,uBAAuB;IACtC,+DAA+D;IAC/D,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,kBAAkB,EAC5B,UAAU,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAC7C,WAAW,EAAE,MAAM,GAClB,uBAAuB,CA4CzB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EACrD,UAAU,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAC5C,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAItC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared world-scale collider dimension math (T1.2).
|
|
3
|
+
*
|
|
4
|
+
* Rapier colliders have no notion of a parent Object3D's `scale` — a body's
|
|
5
|
+
* shape is defined in absolute world units at creation time. Three.js meshes,
|
|
6
|
+
* by contrast, scale visually for free via the normal Object3D hierarchy. To
|
|
7
|
+
* keep the physical collider matching what's on screen, the LOADER must bake
|
|
8
|
+
* the entity's composed WORLD scale (self × every transformed ancestor — see
|
|
9
|
+
* T1.1's world-transform composition) into the collider's dimensions at
|
|
10
|
+
* creation time.
|
|
11
|
+
*
|
|
12
|
+
* This is the ONE place that does that math, so both the runtime loader
|
|
13
|
+
* (scene-loader.ts `createPhysicsBody`) and the editor's collider gizmo
|
|
14
|
+
* (gizmo-registry.ts) agree on exactly the same numbers — previously the
|
|
15
|
+
* editor gizmo only rendered the entity's own live Object3D scale (via normal
|
|
16
|
+
* Three.js parenting) while the Rapier body ignored scale entirely, so the
|
|
17
|
+
* two silently agreed by coincidence for uniform scale and disagreed for
|
|
18
|
+
* everything else.
|
|
19
|
+
*
|
|
20
|
+
* Round colliders (ball/capsule) can only represent a uniform radius — Rapier
|
|
21
|
+
* has no ellipsoid/elliptical-capsule shape. A non-uniform world scale on a
|
|
22
|
+
* round collider's round axes throws a loud error naming the entity, rather
|
|
23
|
+
* than silently simulating (or rendering) the wrong shape.
|
|
24
|
+
*/
|
|
25
|
+
import { DEFAULTS } from '../defaults';
|
|
26
|
+
/** Axes are considered "uniform enough" within this tolerance (float error only). */
|
|
27
|
+
const UNIFORM_SCALE_EPSILON = 1e-4;
|
|
28
|
+
/**
|
|
29
|
+
* Compute a collider's WORLD-space dimensions given the entity's composed
|
|
30
|
+
* world scale (self × ancestors, per-axis, in the entity's own local frame —
|
|
31
|
+
* X/Y/Z order matches `SceneEntity.transform.scale`).
|
|
32
|
+
*
|
|
33
|
+
* @param collider - the entity's authored (unscaled) collider definition.
|
|
34
|
+
* @param worldScale - composed world scale `[x, y, z]`.
|
|
35
|
+
* @param entityLabel - human-readable entity identifier, used only in thrown
|
|
36
|
+
* error messages (loud-failure naming, never silently wrong).
|
|
37
|
+
* @throws if a ball/capsule collider's round cross-section axes have a
|
|
38
|
+
* non-uniform world scale (beyond {@link UNIFORM_SCALE_EPSILON}).
|
|
39
|
+
*/
|
|
40
|
+
export function computeColliderWorldDimensions(collider, worldScale, entityLabel) {
|
|
41
|
+
const [sx, sy, sz] = worldScale;
|
|
42
|
+
switch (collider.type) {
|
|
43
|
+
case 'cuboid': {
|
|
44
|
+
const he = collider.halfExtents ?? DEFAULTS.collider.cuboid.halfExtents;
|
|
45
|
+
return { halfExtents: [he[0] * sx, he[1] * sy, he[2] * sz] };
|
|
46
|
+
}
|
|
47
|
+
case 'ball': {
|
|
48
|
+
if (Math.abs(sx - sy) > UNIFORM_SCALE_EPSILON ||
|
|
49
|
+
Math.abs(sy - sz) > UNIFORM_SCALE_EPSILON ||
|
|
50
|
+
Math.abs(sx - sz) > UNIFORM_SCALE_EPSILON) {
|
|
51
|
+
throw new Error(`Entity "${entityLabel}" has a "ball" collider under a non-uniform world scale ` +
|
|
52
|
+
`[${sx}, ${sy}, ${sz}]. Rapier ball colliders are always perfect spheres — a ` +
|
|
53
|
+
`non-uniform scale cannot be represented and would silently simulate the wrong ` +
|
|
54
|
+
`shape. Use a uniform scale on this entity (and every transformed ancestor), or ` +
|
|
55
|
+
`switch to a "cuboid" collider.`);
|
|
56
|
+
}
|
|
57
|
+
const radius = collider.radius ?? DEFAULTS.collider.ball.radius;
|
|
58
|
+
return { radius: radius * sx };
|
|
59
|
+
}
|
|
60
|
+
case 'capsule': {
|
|
61
|
+
// Rapier capsules run their half-height along the local Y axis, with a
|
|
62
|
+
// circular cross-section in the XZ plane — so only X/Z need to match.
|
|
63
|
+
if (Math.abs(sx - sz) > UNIFORM_SCALE_EPSILON) {
|
|
64
|
+
throw new Error(`Entity "${entityLabel}" has a "capsule" collider whose X/Z world scale differs ` +
|
|
65
|
+
`(x=${sx}, z=${sz}). Rapier capsule colliders have a circular cross-section — a ` +
|
|
66
|
+
`non-uniform X/Z scale cannot be represented and would silently simulate the ` +
|
|
67
|
+
`wrong shape. Use a uniform X/Z scale on this entity (and every transformed ` +
|
|
68
|
+
`ancestor), or switch to a "cuboid" collider.`);
|
|
69
|
+
}
|
|
70
|
+
const radius = collider.radius ?? DEFAULTS.collider.capsule.radius;
|
|
71
|
+
const halfHeight = collider.halfHeight ?? DEFAULTS.collider.capsule.halfHeight;
|
|
72
|
+
return { radius: radius * sx, halfHeight: halfHeight * sy };
|
|
73
|
+
}
|
|
74
|
+
default:
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Compute a collider's WORLD-scaled translation offset (sibling to
|
|
80
|
+
* {@link computeColliderWorldDimensions}, same input contract).
|
|
81
|
+
*
|
|
82
|
+
* Rapier's `ColliderDesc.setTranslation` is a raw physics-engine offset with no
|
|
83
|
+
* notion of a parent Object3D's scale — like dimensions, an authored `offset`
|
|
84
|
+
* (in the entity's own local units) must be scaled per-axis by the entity's
|
|
85
|
+
* composed world scale before being handed to Rapier, or the collider's center
|
|
86
|
+
* silently drifts away from its visual anchor point under any non-1 scale.
|
|
87
|
+
* Applies to every collider type (including trimesh, which is otherwise not
|
|
88
|
+
* handled by {@link computeColliderWorldDimensions}).
|
|
89
|
+
*
|
|
90
|
+
* Returns `undefined` when no offset is authored, mirroring the `if (col.offset)`
|
|
91
|
+
* guard call sites already use.
|
|
92
|
+
*/
|
|
93
|
+
export function computeColliderWorldOffset(offset, worldScale) {
|
|
94
|
+
if (!offset)
|
|
95
|
+
return undefined;
|
|
96
|
+
const [sx, sy, sz] = worldScale;
|
|
97
|
+
return [offset[0] * sx, offset[1] * sy, offset[2] * sz];
|
|
98
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type RAPIER from '@dimforge/rapier3d-compat';
|
|
2
|
+
/**
|
|
3
|
+
* Collision event handler.
|
|
4
|
+
* Called with the two collider handles and whether contact started or stopped.
|
|
5
|
+
*/
|
|
6
|
+
export type CollisionHandler = (handleA: number, handleB: number, started: boolean) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Drains the Rapier event queue each frame and dispatches collision events.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* const collisions = createCollisionSystem(rapierWorld, eventQueue);
|
|
12
|
+
* collisions.onCollision((a, b, started) => { ... });
|
|
13
|
+
* // In physics phase: rapierWorld.step(eventQueue);
|
|
14
|
+
* // In postPhysics: collisions.drain();
|
|
15
|
+
*/
|
|
16
|
+
export declare function createCollisionSystem(rapierWorld: RAPIER.World, eventQueue: RAPIER.EventQueue): {
|
|
17
|
+
/** Register a collision handler. */
|
|
18
|
+
onCollision(handler: CollisionHandler): void;
|
|
19
|
+
/** Remove a collision handler. */
|
|
20
|
+
offCollision(handler: CollisionHandler): void;
|
|
21
|
+
/**
|
|
22
|
+
* Drain the event queue and dispatch collision events.
|
|
23
|
+
* Call this in POST_PHYSICS phase, after rapierWorld.step(eventQueue).
|
|
24
|
+
*
|
|
25
|
+
* Events are buffered first, then handlers run *after* the drain callback
|
|
26
|
+
* returns. This is required: a handler that calls back into the Rapier world
|
|
27
|
+
* (e.g. trigger dispatch resolving a collider, or an `onTriggerEnter` that
|
|
28
|
+
* spawns/removes a body) would otherwise re-enter Rapier while it is still
|
|
29
|
+
* borrowed by `drainCollisionEvents`, throwing "recursive use of an object
|
|
30
|
+
* ... unsafe aliasing in rust".
|
|
31
|
+
*/
|
|
32
|
+
drain(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Look up the rigid body handle that owns a collider handle.
|
|
35
|
+
* To resolve a collider directly to its Object3D entity, use the physics
|
|
36
|
+
* registry's `getByColliderHandle` reverse index instead.
|
|
37
|
+
*/
|
|
38
|
+
getBodyHandleFromCollider(colliderHandle: number): number | undefined;
|
|
39
|
+
};
|
|
40
|
+
export type CollisionSystem = ReturnType<typeof createCollisionSystem>;
|
|
41
|
+
//# sourceMappingURL=collision-system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collision-system.d.ts","sourceRoot":"","sources":["../../src/physics/collision-system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAE5F;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU;IAI1F,oCAAoC;yBACf,gBAAgB;IAIrC,kCAAkC;0BACZ,gBAAgB;IAKtC;;;;;;;;;;OAUG;;IAkBH;;;;OAIG;8CACuC,MAAM,GAAG,MAAM,GAAG,SAAS;EAQxE;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drains the Rapier event queue each frame and dispatches collision events.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* const collisions = createCollisionSystem(rapierWorld, eventQueue);
|
|
6
|
+
* collisions.onCollision((a, b, started) => { ... });
|
|
7
|
+
* // In physics phase: rapierWorld.step(eventQueue);
|
|
8
|
+
* // In postPhysics: collisions.drain();
|
|
9
|
+
*/
|
|
10
|
+
export function createCollisionSystem(rapierWorld, eventQueue) {
|
|
11
|
+
const handlers = [];
|
|
12
|
+
return {
|
|
13
|
+
/** Register a collision handler. */
|
|
14
|
+
onCollision(handler) {
|
|
15
|
+
handlers.push(handler);
|
|
16
|
+
},
|
|
17
|
+
/** Remove a collision handler. */
|
|
18
|
+
offCollision(handler) {
|
|
19
|
+
const idx = handlers.indexOf(handler);
|
|
20
|
+
if (idx !== -1)
|
|
21
|
+
handlers.splice(idx, 1);
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* Drain the event queue and dispatch collision events.
|
|
25
|
+
* Call this in POST_PHYSICS phase, after rapierWorld.step(eventQueue).
|
|
26
|
+
*
|
|
27
|
+
* Events are buffered first, then handlers run *after* the drain callback
|
|
28
|
+
* returns. This is required: a handler that calls back into the Rapier world
|
|
29
|
+
* (e.g. trigger dispatch resolving a collider, or an `onTriggerEnter` that
|
|
30
|
+
* spawns/removes a body) would otherwise re-enter Rapier while it is still
|
|
31
|
+
* borrowed by `drainCollisionEvents`, throwing "recursive use of an object
|
|
32
|
+
* ... unsafe aliasing in rust".
|
|
33
|
+
*/
|
|
34
|
+
drain() {
|
|
35
|
+
const events = [];
|
|
36
|
+
eventQueue.drainCollisionEvents((handle1, handle2, started) => {
|
|
37
|
+
events.push([handle1, handle2, started]);
|
|
38
|
+
});
|
|
39
|
+
eventQueue.drainContactForceEvents((_event) => {
|
|
40
|
+
// Contact force events available for advanced use.
|
|
41
|
+
// Game code can subscribe to these by extending this system.
|
|
42
|
+
});
|
|
43
|
+
for (const [handle1, handle2, started] of events) {
|
|
44
|
+
for (let i = 0; i < handlers.length; i++) {
|
|
45
|
+
handlers[i](handle1, handle2, started);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* Look up the rigid body handle that owns a collider handle.
|
|
51
|
+
* To resolve a collider directly to its Object3D entity, use the physics
|
|
52
|
+
* registry's `getByColliderHandle` reverse index instead.
|
|
53
|
+
*/
|
|
54
|
+
getBodyHandleFromCollider(colliderHandle) {
|
|
55
|
+
const collider = rapierWorld.getCollider(colliderHandle);
|
|
56
|
+
if (!collider)
|
|
57
|
+
return undefined;
|
|
58
|
+
const body = collider.parent();
|
|
59
|
+
if (!body)
|
|
60
|
+
return undefined;
|
|
61
|
+
return body.handle;
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type RAPIER from '@dimforge/rapier3d-compat';
|
|
2
|
+
import type * as THREE from 'three';
|
|
3
|
+
/** The Rapier handles owned by a single Object3D entity. */
|
|
4
|
+
export interface PhysicsRefs {
|
|
5
|
+
body: RAPIER.RigidBody;
|
|
6
|
+
collider: RAPIER.Collider;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Maps Three.js Object3Ds to their Rapier bodies/colliders, and Rapier collider
|
|
10
|
+
* handles back to Object3Ds.
|
|
11
|
+
*
|
|
12
|
+
* Replaces the old bitecs RigidBodyRef/ColliderRef SoA components. Two indexes:
|
|
13
|
+
* - `Object3D → {body, collider}` for the postPhysics transform writer and for
|
|
14
|
+
* game code/editor to reach an entity's physics.
|
|
15
|
+
* - `colliderHandle → Object3D` reverse index for collision/trigger dispatch
|
|
16
|
+
* (Rapier collision events report collider handles).
|
|
17
|
+
*/
|
|
18
|
+
export declare function createPhysicsRegistry(): {
|
|
19
|
+
/** Register an Object3D's body + collider, indexing both directions. */
|
|
20
|
+
add(object3D: THREE.Object3D, body: RAPIER.RigidBody, collider: RAPIER.Collider): void;
|
|
21
|
+
/** Get the physics refs for an Object3D, if any. */
|
|
22
|
+
get(object3D: THREE.Object3D): PhysicsRefs | undefined;
|
|
23
|
+
/** Resolve a Rapier collider handle to the Object3D that owns it. */
|
|
24
|
+
getByColliderHandle(handle: number): THREE.Object3D | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Register a callback fired synchronously, just before an entry is torn
|
|
27
|
+
* down, for every `remove()` call (both indexes are still intact at call
|
|
28
|
+
* time). Used by trigger-dispatch (T1.12d) to flush any pending
|
|
29
|
+
* `onTriggerExit` for a sensor overlap involving this object before the
|
|
30
|
+
* collider handle becomes unresolvable — otherwise an entity despawned
|
|
31
|
+
* between the physical exit and the next `collisions.drain()` silently
|
|
32
|
+
* drops the exit callback on its still-live overlap partner.
|
|
33
|
+
*/
|
|
34
|
+
onRemove(listener: (object3D: THREE.Object3D, refs: PhysicsRefs) => void): void;
|
|
35
|
+
/** Remove an Object3D's entry from both indexes. */
|
|
36
|
+
remove(object3D: THREE.Object3D): void;
|
|
37
|
+
/** Iterate every (Object3D, refs) pair — used by the transform writer. */
|
|
38
|
+
entries(): IterableIterator<[THREE.Object3D, PhysicsRefs]>;
|
|
39
|
+
/** Number of registered physics entities. */
|
|
40
|
+
readonly size: number;
|
|
41
|
+
/** Clear both indexes (does not free Rapier bodies). */
|
|
42
|
+
clear(): void;
|
|
43
|
+
};
|
|
44
|
+
export type PhysicsRegistry = ReturnType<typeof createPhysicsRegistry>;
|
|
45
|
+
//# sourceMappingURL=physics-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physics-registry.d.ts","sourceRoot":"","sources":["../../src/physics/physics-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,4DAA4D;AAC5D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB;IAMjC,wEAAwE;kBAC1D,KAAK,CAAC,QAAQ,QAAQ,MAAM,CAAC,SAAS,YAAY,MAAM,CAAC,QAAQ,GAAG,IAAI;IAKtF,oDAAoD;kBACtC,KAAK,CAAC,QAAQ,GAAG,WAAW,GAAG,SAAS;IAItD,qEAAqE;gCACzC,MAAM,GAAG,KAAK,CAAC,QAAQ,GAAG,SAAS;IAI/D;;;;;;;;OAQG;uBACgB,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,KAAK,IAAI,GAAG,IAAI;IAI/E,oDAAoD;qBACnC,KAAK,CAAC,QAAQ,GAAG,IAAI;IAStC,0EAA0E;eAC/D,gBAAgB,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAI1D,6CAA6C;mBACjC,MAAM;IAIlB,wDAAwD;aAC/C,IAAI;EAKhB;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps Three.js Object3Ds to their Rapier bodies/colliders, and Rapier collider
|
|
3
|
+
* handles back to Object3Ds.
|
|
4
|
+
*
|
|
5
|
+
* Replaces the old bitecs RigidBodyRef/ColliderRef SoA components. Two indexes:
|
|
6
|
+
* - `Object3D → {body, collider}` for the postPhysics transform writer and for
|
|
7
|
+
* game code/editor to reach an entity's physics.
|
|
8
|
+
* - `colliderHandle → Object3D` reverse index for collision/trigger dispatch
|
|
9
|
+
* (Rapier collision events report collider handles).
|
|
10
|
+
*/
|
|
11
|
+
export function createPhysicsRegistry() {
|
|
12
|
+
const byObject = new Map();
|
|
13
|
+
const byColliderHandle = new Map();
|
|
14
|
+
const removeListeners = [];
|
|
15
|
+
return {
|
|
16
|
+
/** Register an Object3D's body + collider, indexing both directions. */
|
|
17
|
+
add(object3D, body, collider) {
|
|
18
|
+
byObject.set(object3D, { body, collider });
|
|
19
|
+
byColliderHandle.set(collider.handle, object3D);
|
|
20
|
+
},
|
|
21
|
+
/** Get the physics refs for an Object3D, if any. */
|
|
22
|
+
get(object3D) {
|
|
23
|
+
return byObject.get(object3D);
|
|
24
|
+
},
|
|
25
|
+
/** Resolve a Rapier collider handle to the Object3D that owns it. */
|
|
26
|
+
getByColliderHandle(handle) {
|
|
27
|
+
return byColliderHandle.get(handle);
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* Register a callback fired synchronously, just before an entry is torn
|
|
31
|
+
* down, for every `remove()` call (both indexes are still intact at call
|
|
32
|
+
* time). Used by trigger-dispatch (T1.12d) to flush any pending
|
|
33
|
+
* `onTriggerExit` for a sensor overlap involving this object before the
|
|
34
|
+
* collider handle becomes unresolvable — otherwise an entity despawned
|
|
35
|
+
* between the physical exit and the next `collisions.drain()` silently
|
|
36
|
+
* drops the exit callback on its still-live overlap partner.
|
|
37
|
+
*/
|
|
38
|
+
onRemove(listener) {
|
|
39
|
+
removeListeners.push(listener);
|
|
40
|
+
},
|
|
41
|
+
/** Remove an Object3D's entry from both indexes. */
|
|
42
|
+
remove(object3D) {
|
|
43
|
+
const refs = byObject.get(object3D);
|
|
44
|
+
if (refs) {
|
|
45
|
+
for (const listener of removeListeners)
|
|
46
|
+
listener(object3D, refs);
|
|
47
|
+
byColliderHandle.delete(refs.collider.handle);
|
|
48
|
+
}
|
|
49
|
+
byObject.delete(object3D);
|
|
50
|
+
},
|
|
51
|
+
/** Iterate every (Object3D, refs) pair — used by the transform writer. */
|
|
52
|
+
entries() {
|
|
53
|
+
return byObject.entries();
|
|
54
|
+
},
|
|
55
|
+
/** Number of registered physics entities. */
|
|
56
|
+
get size() {
|
|
57
|
+
return byObject.size;
|
|
58
|
+
},
|
|
59
|
+
/** Clear both indexes (does not free Rapier bodies). */
|
|
60
|
+
clear() {
|
|
61
|
+
byObject.clear();
|
|
62
|
+
byColliderHandle.clear();
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { PhysicsRegistry } from './physics-registry';
|
|
3
|
+
/**
|
|
4
|
+
* Build the single postPhysics transform writer.
|
|
5
|
+
*
|
|
6
|
+
* Replaces the old three-step path (physicsSyncSystem → ECS Position/Rotation →
|
|
7
|
+
* vnode-manager.syncTransforms). Rapier always reports world-space transforms, so
|
|
8
|
+
* for objects parented under something other than the scene root we convert the
|
|
9
|
+
* body's world position/rotation into the parent's local space (P1.5) — the old
|
|
10
|
+
* vnode path wrote world transforms as local and mis-placed parented children.
|
|
11
|
+
*
|
|
12
|
+
* Scale is left untouched: Rapier carries no scale, so the Object3D keeps its
|
|
13
|
+
* authored local scale.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createTransformWriter(physics: PhysicsRegistry, sceneRoot: THREE.Object3D): () => void;
|
|
16
|
+
//# sourceMappingURL=transform-writer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-writer.d.ts","sourceRoot":"","sources":["../../src/physics/transform-writer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAM1D;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,KAAK,CAAC,QAAQ,SACpD,IAAI,CAoBxC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
const _quat = new THREE.Quaternion();
|
|
3
|
+
const _parentInv = new THREE.Matrix4();
|
|
4
|
+
const _parentQuat = new THREE.Quaternion();
|
|
5
|
+
/**
|
|
6
|
+
* Build the single postPhysics transform writer.
|
|
7
|
+
*
|
|
8
|
+
* Replaces the old three-step path (physicsSyncSystem → ECS Position/Rotation →
|
|
9
|
+
* vnode-manager.syncTransforms). Rapier always reports world-space transforms, so
|
|
10
|
+
* for objects parented under something other than the scene root we convert the
|
|
11
|
+
* body's world position/rotation into the parent's local space (P1.5) — the old
|
|
12
|
+
* vnode path wrote world transforms as local and mis-placed parented children.
|
|
13
|
+
*
|
|
14
|
+
* Scale is left untouched: Rapier carries no scale, so the Object3D keeps its
|
|
15
|
+
* authored local scale.
|
|
16
|
+
*/
|
|
17
|
+
export function createTransformWriter(physics, sceneRoot) {
|
|
18
|
+
return function writeTransforms() {
|
|
19
|
+
for (const [object3D, { body }] of physics.entries()) {
|
|
20
|
+
const t = body.translation();
|
|
21
|
+
const r = body.rotation();
|
|
22
|
+
const parent = object3D.parent;
|
|
23
|
+
if (parent && parent !== sceneRoot) {
|
|
24
|
+
// World → local: position through the inverse parent world matrix,
|
|
25
|
+
// rotation through the inverse parent world quaternion.
|
|
26
|
+
parent.updateWorldMatrix(true, false);
|
|
27
|
+
_parentInv.copy(parent.matrixWorld).invert();
|
|
28
|
+
object3D.position.set(t.x, t.y, t.z).applyMatrix4(_parentInv);
|
|
29
|
+
parent.getWorldQuaternion(_parentQuat).invert();
|
|
30
|
+
object3D.quaternion.copy(_parentQuat.multiply(_quat.set(r.x, r.y, r.z, r.w)));
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
object3D.position.set(t.x, t.y, t.z);
|
|
34
|
+
object3D.quaternion.set(r.x, r.y, r.z, r.w);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { Container } from 'pixi.js';
|
|
2
|
+
/**
|
|
3
|
+
* AuthoringAdapter-2D — the Pixi analog of the editor AuthoringAdapter /
|
|
4
|
+
* LiveThreeAuthoringAdapter, implemented DIRECTLY over a live PixiJS display tree
|
|
5
|
+
* (no fabricated document — the anti-shim rule). Used by the editor to
|
|
6
|
+
* inspect + edit Pixi display-tree entities (first-party OR an ingested unmodified game),
|
|
7
|
+
* with stable structural-path ids so edits re-bind after the tree rebuilds.
|
|
8
|
+
*/
|
|
9
|
+
export interface EditorNode2D {
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
kind: 'sprite' | 'animatedsprite' | 'text' | 'container' | string;
|
|
13
|
+
parentId: string | null;
|
|
14
|
+
childIds: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface Transform2DValue {
|
|
17
|
+
position: [number, number];
|
|
18
|
+
rotation: number;
|
|
19
|
+
scale: [number, number];
|
|
20
|
+
}
|
|
21
|
+
export interface Property2D {
|
|
22
|
+
path: string;
|
|
23
|
+
label: string;
|
|
24
|
+
type: 'string' | 'number' | 'boolean' | 'vec2' | 'color';
|
|
25
|
+
value: unknown;
|
|
26
|
+
}
|
|
27
|
+
/** An in-memory edit overlay keyed by structural-path id (2D). */
|
|
28
|
+
export interface Override2D {
|
|
29
|
+
label?: string;
|
|
30
|
+
alpha?: number;
|
|
31
|
+
position?: [number, number];
|
|
32
|
+
rotation?: number;
|
|
33
|
+
scale?: [number, number];
|
|
34
|
+
tint?: number;
|
|
35
|
+
visible?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export type Overlay2D = Record<string, Override2D>;
|
|
38
|
+
export declare class AuthoringAdapter2D {
|
|
39
|
+
private readonly root;
|
|
40
|
+
private readonly byId;
|
|
41
|
+
private overlay;
|
|
42
|
+
private dirty;
|
|
43
|
+
constructor(root: Container, opts?: {
|
|
44
|
+
overlay?: Overlay2D;
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Walk the live tree assigning deterministic structural-path ids.
|
|
48
|
+
*
|
|
49
|
+
* Separate from {@link refresh} because the two are wanted at different rates: the ids have to be
|
|
50
|
+
* current whenever the tree is READ (a world that mounts its content asynchronously — a
|
|
51
|
+
* translated port waiting on its resources, anything behind Suspense — commits real nodes after
|
|
52
|
+
* the adapter was handed its root, and an unindexed node is one the hierarchy cannot name), while
|
|
53
|
+
* re-applying the edit overlay is a WRITE and must happen only when something asked for it.
|
|
54
|
+
*/
|
|
55
|
+
reindex(): {
|
|
56
|
+
count: number;
|
|
57
|
+
sprites: number;
|
|
58
|
+
};
|
|
59
|
+
/** {@link reindex}, then reapply every saved overlay edit to the live tree. */
|
|
60
|
+
refresh(): {
|
|
61
|
+
count: number;
|
|
62
|
+
sprites: number;
|
|
63
|
+
};
|
|
64
|
+
roots(): EditorNode2D[];
|
|
65
|
+
node(id: string): EditorNode2D | null;
|
|
66
|
+
displayObject(id: string): Container | null;
|
|
67
|
+
private toNode;
|
|
68
|
+
getTransform(id: string): Transform2DValue | null;
|
|
69
|
+
setTransform(id: string, t: Partial<Transform2DValue>): void;
|
|
70
|
+
properties(id: string): Property2D[];
|
|
71
|
+
set(id: string, path: string, value: unknown): void;
|
|
72
|
+
private applyOverride;
|
|
73
|
+
/**
|
|
74
|
+
* Re-apply a saved/external overlay onto the (already-walked) live tree, merging
|
|
75
|
+
* it into the in-memory overlay so a later `serializeOverlay()`/save preserves it
|
|
76
|
+
* and a later `refresh()` re-applies it again. Ids absent from the current tree
|
|
77
|
+
* are skipped (orphaned, not an error) — the 2D analog of
|
|
78
|
+
* `LiveThreeAuthoringAdapter.applyOverlay` (T3.2 slice 3). Used both for the initial
|
|
79
|
+
* reload (constructor `opts.overlay`) and for `PersistenceProvider.applyExternal`
|
|
80
|
+
* (re-apply a changed overlay file without a full remount).
|
|
81
|
+
*/
|
|
82
|
+
applyOverlay(overlay: Overlay2D): {
|
|
83
|
+
applied: number;
|
|
84
|
+
orphaned: number;
|
|
85
|
+
};
|
|
86
|
+
isDirty(): boolean;
|
|
87
|
+
serializeOverlay(): Overlay2D;
|
|
88
|
+
/** Replace, rather than merge, overlay state after an exact history restore. */
|
|
89
|
+
replaceOverlay(overlay: Overlay2D): void;
|
|
90
|
+
/** Clear the dirty flag after a successful save (mirrors LiveThreeAuthoringAdapter). */
|
|
91
|
+
markClean(): void;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=authoring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring.d.ts","sourceRoot":"","sources":["../../src/pixi/authoring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;GAMG;AAEH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,GAAG,gBAAgB,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAClE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IACzD,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,kEAAkE;AAClE,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AACD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAUnD,qBAAa,kBAAkB;IAM3B,OAAO,CAAC,QAAQ,CAAC,IAAI;IALvB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAgC;IACrD,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,KAAK,CAAS;gBAGH,IAAI,EAAE,SAAS,EAChC,IAAI,GAAE;QAAE,OAAO,CAAC,EAAE,SAAS,CAAA;KAAO;IAMpC;;;;;;;;OAQG;IACH,OAAO,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IAoB7C,+EAA+E;IAC/E,OAAO,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IAM7C,KAAK,IAAI,YAAY,EAAE;IAIvB,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI;IAKrC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAI3C,OAAO,CAAC,MAAM;IAYd,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAcjD,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI;IAe5D,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,EAAE;IAkBpC,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAYnD,OAAO,CAAC,aAAa;IAYrB;;;;;;;;OAQG;IACH,YAAY,CAAC,OAAO,EAAE,SAAS,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAevE,OAAO,IAAI,OAAO;IAGlB,gBAAgB,IAAI,SAAS;IAG7B,gFAAgF;IAChF,cAAc,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI;IAKxC,wFAAwF;IACxF,SAAS,IAAI,IAAI;CAGlB"}
|