@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,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render settings — the tone-mapping / post-processing / render-feature scope
|
|
3
|
+
* the engine's renderer setup reads (`setup/setup-renderer.ts`).
|
|
4
|
+
*
|
|
5
|
+
* This used to be the `environment` block of the retired `.vscn.json` scene
|
|
6
|
+
* format (WO-8). The format is gone; these three scopes stayed because
|
|
7
|
+
* `setup-renderer.ts` genuinely reads every field and builds the
|
|
8
|
+
* postprocessing chain from them. Everything that was `.vscn`-only (`skybox`,
|
|
9
|
+
* `fog`, `ambient`, `background`, `envMapIntensity`, `navigation`, `physics`)
|
|
10
|
+
* went with the format.
|
|
11
|
+
*/
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { buildRenderingZod } from '../render/render-features';
|
|
14
|
+
export const ToneMappingDescriptorSchema = z
|
|
15
|
+
.object({
|
|
16
|
+
mode: z
|
|
17
|
+
.enum(['none', 'linear', 'reinhard', 'cineon', 'aces', 'agx'])
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('Tone mapping operator'),
|
|
20
|
+
exposure: z.number().optional().describe('Exposure level'),
|
|
21
|
+
})
|
|
22
|
+
.describe('Tone mapping configuration');
|
|
23
|
+
export const PostProcessingDescriptorSchema = z
|
|
24
|
+
.object({
|
|
25
|
+
// ── Bloom & Vignette ──────────────────────────────────────────────────
|
|
26
|
+
bloom: z
|
|
27
|
+
.object({
|
|
28
|
+
enabled: z.boolean().optional().describe('Enable bloom effect'),
|
|
29
|
+
intensity: z.number().optional().describe('Bloom intensity multiplier'),
|
|
30
|
+
luminanceThreshold: z.number().optional().describe('Minimum luminance to trigger bloom'),
|
|
31
|
+
luminanceSmoothing: z
|
|
32
|
+
.number()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('Smoothing applied to luminance threshold'),
|
|
35
|
+
})
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('Bloom glow effect'),
|
|
38
|
+
vignette: z
|
|
39
|
+
.object({
|
|
40
|
+
enabled: z.boolean().optional().describe('Enable vignette effect'),
|
|
41
|
+
darkness: z.number().optional().describe('Vignette darkness intensity'),
|
|
42
|
+
offset: z.number().optional().describe('Vignette offset from center'),
|
|
43
|
+
})
|
|
44
|
+
.optional()
|
|
45
|
+
.describe('Screen-edge darkening effect'),
|
|
46
|
+
// ── Color adjustments ─────────────────────────────────────────────────
|
|
47
|
+
brightnessContrast: z
|
|
48
|
+
.object({
|
|
49
|
+
enabled: z.boolean().optional().describe('Enable brightness/contrast adjustment'),
|
|
50
|
+
brightness: z.number().optional().describe('Brightness adjustment (-1 to 1)'),
|
|
51
|
+
contrast: z.number().optional().describe('Contrast adjustment (-1 to 1)'),
|
|
52
|
+
})
|
|
53
|
+
.optional()
|
|
54
|
+
.describe('Brightness and contrast color adjustment'),
|
|
55
|
+
hueSaturation: z
|
|
56
|
+
.object({
|
|
57
|
+
enabled: z.boolean().optional().describe('Enable hue/saturation adjustment'),
|
|
58
|
+
hue: z.number().optional().describe('Hue rotation in radians'),
|
|
59
|
+
saturation: z.number().optional().describe('Saturation adjustment (-1 to 1)'),
|
|
60
|
+
})
|
|
61
|
+
.optional()
|
|
62
|
+
.describe('Hue rotation and saturation color adjustment'),
|
|
63
|
+
sepia: z
|
|
64
|
+
.object({
|
|
65
|
+
enabled: z.boolean().optional().describe('Enable sepia tone'),
|
|
66
|
+
intensity: z.number().optional().describe('Sepia effect intensity (0 to 1)'),
|
|
67
|
+
})
|
|
68
|
+
.optional()
|
|
69
|
+
.describe('Warm sepia tone for vintage photograph look'),
|
|
70
|
+
colorDepth: z
|
|
71
|
+
.object({
|
|
72
|
+
enabled: z.boolean().optional().describe('Enable color depth reduction'),
|
|
73
|
+
bits: z.number().optional().describe('Number of color bits per channel (1–16)'),
|
|
74
|
+
})
|
|
75
|
+
.optional()
|
|
76
|
+
.describe('Reduce color bit depth for posterized/banded look'),
|
|
77
|
+
// ── Lens effects ──────────────────────────────────────────────────────
|
|
78
|
+
chromaticAberration: z
|
|
79
|
+
.object({
|
|
80
|
+
enabled: z.boolean().optional().describe('Enable chromatic aberration'),
|
|
81
|
+
offsetX: z.number().optional().describe('Horizontal color fringe offset'),
|
|
82
|
+
offsetY: z.number().optional().describe('Vertical color fringe offset'),
|
|
83
|
+
radialModulation: z.boolean().optional().describe('Increase effect toward screen edges'),
|
|
84
|
+
modulationOffset: z.number().optional().describe('Radial modulation offset from center'),
|
|
85
|
+
})
|
|
86
|
+
.optional()
|
|
87
|
+
.describe('Lens chromatic aberration (color fringing at screen edges)'),
|
|
88
|
+
lensDistortion: z
|
|
89
|
+
.object({
|
|
90
|
+
enabled: z.boolean().optional().describe('Enable lens distortion'),
|
|
91
|
+
distortionX: z.number().optional().describe('Horizontal barrel/pincushion distortion'),
|
|
92
|
+
distortionY: z.number().optional().describe('Vertical barrel/pincushion distortion'),
|
|
93
|
+
focalLengthX: z.number().optional().describe('Horizontal focal length'),
|
|
94
|
+
focalLengthY: z.number().optional().describe('Vertical focal length'),
|
|
95
|
+
skew: z.number().optional().describe('Lens skew angle'),
|
|
96
|
+
})
|
|
97
|
+
.optional()
|
|
98
|
+
.describe('Barrel/pincushion lens distortion'),
|
|
99
|
+
depthOfField: z
|
|
100
|
+
.object({
|
|
101
|
+
enabled: z.boolean().optional().describe('Enable depth of field'),
|
|
102
|
+
worldFocusDistance: z.number().optional().describe('Focus distance in world units'),
|
|
103
|
+
worldFocusRange: z.number().optional().describe('Focus range in world units'),
|
|
104
|
+
bokehScale: z.number().optional().describe('Bokeh blur scale'),
|
|
105
|
+
focalLength: z.number().optional().describe('Camera focal length in mm'),
|
|
106
|
+
})
|
|
107
|
+
.optional()
|
|
108
|
+
.describe('Physically-based depth of field with bokeh blur'),
|
|
109
|
+
tiltShift: z
|
|
110
|
+
.object({
|
|
111
|
+
enabled: z.boolean().optional().describe('Enable tilt-shift effect'),
|
|
112
|
+
offset: z.number().optional().describe('Focus band offset from center'),
|
|
113
|
+
rotation: z.number().optional().describe('Focus band rotation in radians'),
|
|
114
|
+
focusArea: z.number().optional().describe('Focus band width (0–1)'),
|
|
115
|
+
feather: z.number().optional().describe('Blur falloff smoothness'),
|
|
116
|
+
})
|
|
117
|
+
.optional()
|
|
118
|
+
.describe('Tilt-shift miniature-world blur effect'),
|
|
119
|
+
// ── Film / retro ──────────────────────────────────────────────────────
|
|
120
|
+
noise: z
|
|
121
|
+
.object({
|
|
122
|
+
enabled: z.boolean().optional().describe('Enable film grain noise'),
|
|
123
|
+
premultiply: z
|
|
124
|
+
.boolean()
|
|
125
|
+
.optional()
|
|
126
|
+
.describe('Multiply noise with input color instead of adding'),
|
|
127
|
+
})
|
|
128
|
+
.optional()
|
|
129
|
+
.describe('Random per-pixel noise overlay (film grain)'),
|
|
130
|
+
scanline: z
|
|
131
|
+
.object({
|
|
132
|
+
enabled: z.boolean().optional().describe('Enable scanline overlay'),
|
|
133
|
+
density: z.number().optional().describe('Number of scanlines across screen height'),
|
|
134
|
+
})
|
|
135
|
+
.optional()
|
|
136
|
+
.describe('Horizontal scanline overlay (CRT monitor look)'),
|
|
137
|
+
dotScreen: z
|
|
138
|
+
.object({
|
|
139
|
+
enabled: z.boolean().optional().describe('Enable dot screen halftone'),
|
|
140
|
+
angle: z.number().optional().describe('Pattern angle in radians'),
|
|
141
|
+
scale: z.number().optional().describe('Pattern dot scale'),
|
|
142
|
+
})
|
|
143
|
+
.optional()
|
|
144
|
+
.describe('Halftone dot pattern (newspaper/comic look)'),
|
|
145
|
+
grid: z
|
|
146
|
+
.object({
|
|
147
|
+
enabled: z.boolean().optional().describe('Enable grid overlay'),
|
|
148
|
+
scale: z.number().optional().describe('Grid cell scale'),
|
|
149
|
+
lineWidth: z.number().optional().describe('Grid line width'),
|
|
150
|
+
})
|
|
151
|
+
.optional()
|
|
152
|
+
.describe('Visible grid pattern overlay'),
|
|
153
|
+
pixelation: z
|
|
154
|
+
.object({
|
|
155
|
+
enabled: z.boolean().optional().describe('Enable pixelation'),
|
|
156
|
+
granularity: z.number().optional().describe('Pixel size (higher = more pixelated)'),
|
|
157
|
+
})
|
|
158
|
+
.optional()
|
|
159
|
+
.describe('Reduce resolution for pixel-art / mosaic effect'),
|
|
160
|
+
glitch: z
|
|
161
|
+
.object({
|
|
162
|
+
enabled: z.boolean().optional().describe('Enable digital glitch effect'),
|
|
163
|
+
delayX: z.number().optional().describe('Minimum delay between glitches (seconds)'),
|
|
164
|
+
delayY: z.number().optional().describe('Maximum delay between glitches (seconds)'),
|
|
165
|
+
durationX: z.number().optional().describe('Minimum glitch duration (seconds)'),
|
|
166
|
+
durationY: z.number().optional().describe('Maximum glitch duration (seconds)'),
|
|
167
|
+
strengthX: z.number().optional().describe('Minimum glitch strength'),
|
|
168
|
+
strengthY: z.number().optional().describe('Maximum glitch strength'),
|
|
169
|
+
columns: z.number().optional().describe('Number of glitch columns'),
|
|
170
|
+
ratio: z.number().optional().describe('Glitch ratio (0–1)'),
|
|
171
|
+
})
|
|
172
|
+
.optional()
|
|
173
|
+
.describe('Random digital glitch artifacts (block displacement, color shifting)'),
|
|
174
|
+
// ── Distortion ────────────────────────────────────────────────────────
|
|
175
|
+
shockWave: z
|
|
176
|
+
.object({
|
|
177
|
+
enabled: z.boolean().optional().describe('Enable shock wave distortion'),
|
|
178
|
+
speed: z.number().optional().describe('Wave propagation speed'),
|
|
179
|
+
maxRadius: z.number().optional().describe('Maximum wave radius'),
|
|
180
|
+
waveSize: z.number().optional().describe('Width of the distortion wave'),
|
|
181
|
+
amplitude: z.number().optional().describe('Distortion strength'),
|
|
182
|
+
positionX: z.number().optional().describe('Wave origin X in world space'),
|
|
183
|
+
positionY: z.number().optional().describe('Wave origin Y in world space'),
|
|
184
|
+
positionZ: z.number().optional().describe('Wave origin Z in world space'),
|
|
185
|
+
})
|
|
186
|
+
.optional()
|
|
187
|
+
.describe('Expanding spherical distortion wave from a point'),
|
|
188
|
+
// ── Anti-aliasing ─────────────────────────────────────────────────────
|
|
189
|
+
smaa: z
|
|
190
|
+
.object({
|
|
191
|
+
enabled: z.boolean().optional().describe('Enable SMAA anti-aliasing'),
|
|
192
|
+
preset: z
|
|
193
|
+
.enum(['low', 'medium', 'high', 'ultra'])
|
|
194
|
+
.optional()
|
|
195
|
+
.describe('Quality preset (higher = better quality, more cost)'),
|
|
196
|
+
})
|
|
197
|
+
.optional()
|
|
198
|
+
.describe('Subpixel Morphological Anti-Aliasing'),
|
|
199
|
+
// ── Ambient occlusion ─────────────────────────────────────────────────
|
|
200
|
+
ssao: z
|
|
201
|
+
.object({
|
|
202
|
+
enabled: z.boolean().optional().describe('Enable screen-space ambient occlusion'),
|
|
203
|
+
radius: z.number().optional().describe('Occlusion sampling radius'),
|
|
204
|
+
intensity: z.number().optional().describe('Occlusion intensity multiplier'),
|
|
205
|
+
bias: z.number().optional().describe('Depth bias to reduce self-occlusion artifacts'),
|
|
206
|
+
samples: z.number().optional().describe('Number of occlusion samples per pixel'),
|
|
207
|
+
rings: z.number().optional().describe('Number of spiral sample rings'),
|
|
208
|
+
fade: z.number().optional().describe('Distance at which occlusion fades out'),
|
|
209
|
+
color: z.string().optional().describe('Occlusion tint color as CSS hex'),
|
|
210
|
+
})
|
|
211
|
+
.optional()
|
|
212
|
+
.describe('Screen-space ambient occlusion (darken creases and crevices)'),
|
|
213
|
+
n8ao: z
|
|
214
|
+
.object({
|
|
215
|
+
enabled: z.boolean().optional().describe('Enable N8AO ambient occlusion'),
|
|
216
|
+
aoSamples: z.number().optional().describe('Number of AO samples (default 16)'),
|
|
217
|
+
aoRadius: z.number().optional().describe('AO sampling radius in world units'),
|
|
218
|
+
intensity: z.number().optional().describe('AO intensity multiplier'),
|
|
219
|
+
denoiseSamples: z.number().optional().describe('Number of denoise samples'),
|
|
220
|
+
denoiseRadius: z.number().optional().describe('Denoise blur radius'),
|
|
221
|
+
distanceFalloff: z.number().optional().describe('AO distance falloff'),
|
|
222
|
+
screenSpaceRadius: z
|
|
223
|
+
.boolean()
|
|
224
|
+
.optional()
|
|
225
|
+
.describe('Use screen-space radius instead of world-space'),
|
|
226
|
+
color: z.string().optional().describe('AO tint color as CSS hex'),
|
|
227
|
+
halfRes: z.boolean().optional().describe('Render AO at half resolution for performance'),
|
|
228
|
+
})
|
|
229
|
+
.optional()
|
|
230
|
+
.describe('High-quality ambient occlusion (N8AO — alternative to SSAO)'),
|
|
231
|
+
// ── Entity-referencing effects ────────────────────────────────────────
|
|
232
|
+
godRays: z
|
|
233
|
+
.object({
|
|
234
|
+
enabled: z.boolean().optional().describe('Enable god rays'),
|
|
235
|
+
sourceEntity: z.string().optional().describe('Entity ID of the light source mesh'),
|
|
236
|
+
density: z.number().optional().describe('Ray density'),
|
|
237
|
+
decay: z.number().optional().describe('Ray intensity decay along distance'),
|
|
238
|
+
weight: z.number().optional().describe('Ray weight / brightness'),
|
|
239
|
+
exposure: z.number().optional().describe('Overall god ray exposure'),
|
|
240
|
+
samples: z.number().optional().describe('Number of ray-march samples'),
|
|
241
|
+
})
|
|
242
|
+
.optional()
|
|
243
|
+
.describe('Volumetric light shafts from a light source entity'),
|
|
244
|
+
outline: z
|
|
245
|
+
.object({
|
|
246
|
+
enabled: z.boolean().optional().describe('Enable outline effect'),
|
|
247
|
+
tags: z.array(z.string()).optional().describe('Entity tags to outline'),
|
|
248
|
+
edgeStrength: z.number().optional().describe('Outline edge thickness / strength'),
|
|
249
|
+
pulseSpeed: z.number().optional().describe('Outline pulse animation speed (0 = no pulse)'),
|
|
250
|
+
visibleEdgeColor: z.string().optional().describe('Color of visible edges as CSS hex'),
|
|
251
|
+
hiddenEdgeColor: z
|
|
252
|
+
.string()
|
|
253
|
+
.optional()
|
|
254
|
+
.describe('Color of hidden/occluded edges as CSS hex'),
|
|
255
|
+
xRay: z.boolean().optional().describe('Show outline through occluding objects'),
|
|
256
|
+
})
|
|
257
|
+
.optional()
|
|
258
|
+
.describe('Highlight entities matching tags with colored outlines'),
|
|
259
|
+
// ── Screen-space reflections & GI (realism-effects) ───────────────────
|
|
260
|
+
ssr: z
|
|
261
|
+
.object({
|
|
262
|
+
enabled: z.boolean().optional().describe('Enable screen-space reflections'),
|
|
263
|
+
intensity: z.number().optional().describe('Reflection intensity'),
|
|
264
|
+
exponent: z.number().optional().describe('Reflection falloff exponent'),
|
|
265
|
+
distance: z.number().optional().describe('Maximum reflection ray distance'),
|
|
266
|
+
thickness: z.number().optional().describe('Depth thickness for hit testing'),
|
|
267
|
+
maxRoughness: z.number().optional().describe('Maximum roughness for reflections (0–1)'),
|
|
268
|
+
})
|
|
269
|
+
.optional()
|
|
270
|
+
.describe('Screen-space reflections for reflective/glossy surfaces'),
|
|
271
|
+
ssgi: z
|
|
272
|
+
.object({
|
|
273
|
+
enabled: z.boolean().optional().describe('Enable screen-space global illumination'),
|
|
274
|
+
intensity: z.number().optional().describe('Indirect light intensity'),
|
|
275
|
+
distance: z.number().optional().describe('Maximum GI ray distance'),
|
|
276
|
+
thickness: z.number().optional().describe('Depth thickness for hit testing'),
|
|
277
|
+
maxRoughness: z.number().optional().describe('Maximum roughness for GI (0–1)'),
|
|
278
|
+
})
|
|
279
|
+
.optional()
|
|
280
|
+
.describe('Screen-space global illumination (indirect lighting bounce)'),
|
|
281
|
+
motionBlur: z
|
|
282
|
+
.object({
|
|
283
|
+
enabled: z.boolean().optional().describe('Enable motion blur'),
|
|
284
|
+
intensity: z.number().optional().describe('Motion blur intensity'),
|
|
285
|
+
jitter: z.number().optional().describe('Sample jitter amount'),
|
|
286
|
+
samples: z.number().optional().describe('Number of blur samples'),
|
|
287
|
+
})
|
|
288
|
+
.optional()
|
|
289
|
+
.describe('Per-object motion blur from camera and object movement'),
|
|
290
|
+
})
|
|
291
|
+
.describe('Post-processing effects');
|
|
292
|
+
export const RenderEnvironmentSchema = z
|
|
293
|
+
.object({
|
|
294
|
+
toneMapping: ToneMappingDescriptorSchema.optional().describe('Tone mapping configuration'),
|
|
295
|
+
postProcessing: PostProcessingDescriptorSchema.optional().describe('Post-processing effects (bloom, vignette, SSAO, SSR, ...)'),
|
|
296
|
+
rendering: buildRenderingZod()
|
|
297
|
+
.optional()
|
|
298
|
+
.describe('Render feature toggles (auto-batching, culling, LOD, shadows, etc.). Omit a field to inherit the engine default. Derived from the render-feature registry.'),
|
|
299
|
+
})
|
|
300
|
+
.describe('Renderer-level settings read by setup/setup-renderer.ts');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const Vec3Schema: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
3
|
+
export declare const QuatSchema: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
|
|
4
|
+
export type Vec3 = z.infer<typeof Vec3Schema>;
|
|
5
|
+
export type Quat = z.infer<typeof QuatSchema>;
|
|
6
|
+
export declare const TransformSchema: z.ZodObject<{
|
|
7
|
+
position: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
8
|
+
rotation: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
9
|
+
scale: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type Transform = z.infer<typeof TransformSchema>;
|
|
12
|
+
//# sourceMappingURL=tuples.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tuples.d.ts","sourceRoot":"","sources":["../../src/asset-formats/tuples.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU,2DAEc,CAAC;AACtC,eAAO,MAAM,UAAU,wEAEkB,CAAC;AAE1C,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE9C,eAAO,MAAM,eAAe;;;;iBAM4B,CAAC;AAEzD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const Vec3Schema = z
|
|
3
|
+
.tuple([z.number(), z.number(), z.number()])
|
|
4
|
+
.describe('3D vector as [x, y, z]');
|
|
5
|
+
export const QuatSchema = z
|
|
6
|
+
.tuple([z.number(), z.number(), z.number(), z.number()])
|
|
7
|
+
.describe('Quaternion as [x, y, z, w]');
|
|
8
|
+
export const TransformSchema = z
|
|
9
|
+
.object({
|
|
10
|
+
position: Vec3Schema.optional().describe('World-space position [x, y, z]'),
|
|
11
|
+
rotation: QuatSchema.optional().describe('Rotation quaternion [x, y, z, w]'),
|
|
12
|
+
scale: Vec3Schema.optional().describe('Scale factor per axis [x, y, z]. Defaults to [1, 1, 1]'),
|
|
13
|
+
})
|
|
14
|
+
.describe('Local transform relative to parent entity');
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical GLTF / texture load + cache layer (A2). (Formerly also hosted the
|
|
3
|
+
* `.animgraph.json` loader — removed by E5; see
|
|
4
|
+
* packages/engine/src/animation/xstate-animation-binding.ts.)
|
|
5
|
+
*
|
|
6
|
+
* ONE place that owns the URL-keyed caches and the clone-safety contract, shared
|
|
7
|
+
* by BOTH the engine runtime (scene-loader, create-runtime) AND the editor
|
|
8
|
+
* (entity-factory, scene-sync). Previously this logic was duplicated across six
|
|
9
|
+
* sites with three separate GLTF caches and four GLTFLoader instances, so fixes
|
|
10
|
+
* (DRACO wiring, the `__sharedGeometry` clone-safety tag, skybox handling) did
|
|
11
|
+
* not propagate. Everything funnels through the shared loaders in `../loader`
|
|
12
|
+
* (`gltfLoader` is DRACO-wired — CB2 — and `textureLoader` shares the engine
|
|
13
|
+
* LoadingManager / asset-prefix rewrite).
|
|
14
|
+
*
|
|
15
|
+
* Cache lifetime / P1.8: these caches are intentionally module-level and persist
|
|
16
|
+
* ACROSS hot-reloads / scene switches (they are NOT cleared on every scene load).
|
|
17
|
+
* This is deliberate: (1) it makes repeated Play→Stop→Play cheap, and (2) it
|
|
18
|
+
* underpins the `__sharedGeometry` contract from P0.2 — GLTF clones share the
|
|
19
|
+
* cached source geometry, so clearing mid-session would orphan live clones. The
|
|
20
|
+
* caches are keyed by URL, so loading the SAME asset N times is bounded (one
|
|
21
|
+
* entry per distinct URL, not per load). They are released only on full runtime
|
|
22
|
+
* teardown via {@link clearAssetCaches}.
|
|
23
|
+
*/
|
|
24
|
+
import type { SplatMesh } from '@sparkjsdev/spark';
|
|
25
|
+
import * as THREE from 'three';
|
|
26
|
+
/** Load (and cache) a texture via the shared, prefix-aware TextureLoader. */
|
|
27
|
+
export declare function loadTexture(url: string): THREE.Texture;
|
|
28
|
+
/**
|
|
29
|
+
* Load a GLTF/GLB and return a fresh, disposal-safe clone (+ the source's
|
|
30
|
+
* animation clips). DRACO decoding is handled by the shared `gltfLoader`.
|
|
31
|
+
*
|
|
32
|
+
* Clone-safety contract (P0.2 — load-bearing, tested):
|
|
33
|
+
* `SkeletonUtils.clone` shares geometry AND materials with the cached source.
|
|
34
|
+
* We give each clone its OWN materials (so scene cleanup can dispose them
|
|
35
|
+
* without corrupting the cache) and tag every mesh `userData.__sharedGeometry`
|
|
36
|
+
* so cleanup (engine create-runtime fullCleanup + editor scene-sync
|
|
37
|
+
* disposeObject3D) skips disposing the shared geometry buffers.
|
|
38
|
+
*/
|
|
39
|
+
export declare function loadGLTF(url: string): Promise<{
|
|
40
|
+
scene: THREE.Group;
|
|
41
|
+
animations: THREE.AnimationClip[];
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Load one native Gaussian-splat asset as Spark's own Object3D.
|
|
45
|
+
*
|
|
46
|
+
* The URL cache stores immutable source bytes, not a live SplatMesh: every scene
|
|
47
|
+
* entity needs its own transformable/disposable Object3D, while repeated uses of
|
|
48
|
+
* the same SPZ must not download the multi-megabyte source more than once.
|
|
49
|
+
* Spark stays a lazy chunk so games without splats do not pay its bundle cost.
|
|
50
|
+
*/
|
|
51
|
+
export declare function loadSplat(url: string, providedBytes?: Uint8Array): Promise<SplatMesh>;
|
|
52
|
+
/**
|
|
53
|
+
* Resolve a single named node inside an already-loaded glTF scene graph (F4,
|
|
54
|
+
* `mesh.node`). Pure and headlessly testable — no fetch, no cache lookups;
|
|
55
|
+
* callers pass the `scene` they already got from {@link loadGLTF}.
|
|
56
|
+
*
|
|
57
|
+
* The returned node is the SAME object (and shares the SAME geometry) as
|
|
58
|
+
* found in `scene` — nothing is cloned or copied out. `scene` is already a
|
|
59
|
+
* fresh `SkeletonUtils.clone()` per {@link loadGLTF}'s clone-safety contract,
|
|
60
|
+
* so mutating/detaching the returned node is safe.
|
|
61
|
+
*
|
|
62
|
+
* Atomic-subtree guard: a `SkinnedMesh` cannot be lifted out of its armature
|
|
63
|
+
* (its skeleton/bind matrices reference sibling bone nodes elsewhere in the
|
|
64
|
+
* hierarchy), so resolving a node that IS a SkinnedMesh, or that CONTAINS one,
|
|
65
|
+
* throws a loud `AssetParseError` instead of silently producing broken skinning.
|
|
66
|
+
*/
|
|
67
|
+
export declare function resolveGltfNode(scene: THREE.Object3D, nodeName: string, src: string): THREE.Object3D;
|
|
68
|
+
/**
|
|
69
|
+
* Clear the module-level GLTF / texture caches. Call on full runtime teardown
|
|
70
|
+
* (create-runtime fullCleanup / hot-reload) to release cached GPU resources
|
|
71
|
+
* and avoid leaking across editor Play sessions. See the lifetime note at the
|
|
72
|
+
* top of this file for why these are NOT cleared per scene load.
|
|
73
|
+
*
|
|
74
|
+
* NOTE: the IBL/skybox env-map cache lives in scene-loader (it needs a
|
|
75
|
+
* WebGLRenderer for PMREM); scene-loader's `clearAssetCaches` wraps this and
|
|
76
|
+
* also clears that env cache.
|
|
77
|
+
*/
|
|
78
|
+
export declare function clearAssetCaches(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Drop the cached entry for ONE asset URL after its bytes changed on disk
|
|
81
|
+
* (editor asset-optimization write-back — W4a). Existing clones keep their
|
|
82
|
+
* shared geometry alive (the cache entry only owns the lookup, not the
|
|
83
|
+
* buffers), and the next `loadGLTF`/`loadTexture` for this URL re-fetches the
|
|
84
|
+
* rewritten file instead of serving stale bytes.
|
|
85
|
+
*/
|
|
86
|
+
export declare function invalidateCachedAsset(url: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* Test-only: current sizes of the module-level caches. Used by the P1.8 headless
|
|
89
|
+
* test to assert caches stay bounded (one entry per distinct asset URL) across
|
|
90
|
+
* repeated loads of the same scene, rather than growing per load.
|
|
91
|
+
*/
|
|
92
|
+
export declare function assetCacheSizes(): {
|
|
93
|
+
textures: number;
|
|
94
|
+
gltf: number;
|
|
95
|
+
splat: number;
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=asset-loaders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-loaders.d.ts","sourceRoot":"","sources":["../src/asset-loaders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,CAMtD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IAAC,UAAU,EAAE,KAAK,CAAC,aAAa,EAAE,CAAA;CAAE,CAAC,CAyBpE;AAED;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAiD3F;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,KAAK,CAAC,QAAQ,EACrB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV,KAAK,CAAC,QAAQ,CAuChB;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAIvC;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAGvD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAEnF"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical GLTF / texture load + cache layer (A2). (Formerly also hosted the
|
|
3
|
+
* `.animgraph.json` loader — removed by E5; see
|
|
4
|
+
* packages/engine/src/animation/xstate-animation-binding.ts.)
|
|
5
|
+
*
|
|
6
|
+
* ONE place that owns the URL-keyed caches and the clone-safety contract, shared
|
|
7
|
+
* by BOTH the engine runtime (scene-loader, create-runtime) AND the editor
|
|
8
|
+
* (entity-factory, scene-sync). Previously this logic was duplicated across six
|
|
9
|
+
* sites with three separate GLTF caches and four GLTFLoader instances, so fixes
|
|
10
|
+
* (DRACO wiring, the `__sharedGeometry` clone-safety tag, skybox handling) did
|
|
11
|
+
* not propagate. Everything funnels through the shared loaders in `../loader`
|
|
12
|
+
* (`gltfLoader` is DRACO-wired — CB2 — and `textureLoader` shares the engine
|
|
13
|
+
* LoadingManager / asset-prefix rewrite).
|
|
14
|
+
*
|
|
15
|
+
* Cache lifetime / P1.8: these caches are intentionally module-level and persist
|
|
16
|
+
* ACROSS hot-reloads / scene switches (they are NOT cleared on every scene load).
|
|
17
|
+
* This is deliberate: (1) it makes repeated Play→Stop→Play cheap, and (2) it
|
|
18
|
+
* underpins the `__sharedGeometry` contract from P0.2 — GLTF clones share the
|
|
19
|
+
* cached source geometry, so clearing mid-session would orphan live clones. The
|
|
20
|
+
* caches are keyed by URL, so loading the SAME asset N times is bounded (one
|
|
21
|
+
* entry per distinct URL, not per load). They are released only on full runtime
|
|
22
|
+
* teardown via {@link clearAssetCaches}.
|
|
23
|
+
*/
|
|
24
|
+
import * as THREE from 'three';
|
|
25
|
+
import * as SkeletonUtils from 'three/addons/utils/SkeletonUtils.js';
|
|
26
|
+
import { AssetParseError } from './asset-parse-error';
|
|
27
|
+
import { setUserData } from './ecs/user-data';
|
|
28
|
+
import { gltfLoader, resolveUrl, textureLoader } from './loader';
|
|
29
|
+
const textureCache = new Map();
|
|
30
|
+
const gltfCache = new Map();
|
|
31
|
+
const splatBytesCache = new Map();
|
|
32
|
+
/** Load (and cache) a texture via the shared, prefix-aware TextureLoader. */
|
|
33
|
+
export function loadTexture(url) {
|
|
34
|
+
const cached = textureCache.get(url);
|
|
35
|
+
if (cached)
|
|
36
|
+
return cached;
|
|
37
|
+
const tex = textureLoader.load(url);
|
|
38
|
+
textureCache.set(url, tex);
|
|
39
|
+
return tex;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Load a GLTF/GLB and return a fresh, disposal-safe clone (+ the source's
|
|
43
|
+
* animation clips). DRACO decoding is handled by the shared `gltfLoader`.
|
|
44
|
+
*
|
|
45
|
+
* Clone-safety contract (P0.2 — load-bearing, tested):
|
|
46
|
+
* `SkeletonUtils.clone` shares geometry AND materials with the cached source.
|
|
47
|
+
* We give each clone its OWN materials (so scene cleanup can dispose them
|
|
48
|
+
* without corrupting the cache) and tag every mesh `userData.__sharedGeometry`
|
|
49
|
+
* so cleanup (engine create-runtime fullCleanup + editor scene-sync
|
|
50
|
+
* disposeObject3D) skips disposing the shared geometry buffers.
|
|
51
|
+
*/
|
|
52
|
+
export function loadGLTF(url) {
|
|
53
|
+
let cached = gltfCache.get(url);
|
|
54
|
+
if (!cached) {
|
|
55
|
+
cached = new Promise((resolve, reject) => {
|
|
56
|
+
gltfLoader.load(url, (gltf) => resolve({ scene: gltf.scene, animations: gltf.animations }), undefined, (err) => reject(err));
|
|
57
|
+
});
|
|
58
|
+
gltfCache.set(url, cached);
|
|
59
|
+
}
|
|
60
|
+
return cached.then((entry) => {
|
|
61
|
+
const scene = SkeletonUtils.clone(entry.scene);
|
|
62
|
+
scene.traverse((child) => {
|
|
63
|
+
if (child instanceof THREE.Mesh) {
|
|
64
|
+
child.material = Array.isArray(child.material)
|
|
65
|
+
? child.material.map((m) => m.clone())
|
|
66
|
+
: child.material.clone();
|
|
67
|
+
setUserData(child, '__sharedGeometry', true);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return { scene, animations: entry.animations };
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Load one native Gaussian-splat asset as Spark's own Object3D.
|
|
75
|
+
*
|
|
76
|
+
* The URL cache stores immutable source bytes, not a live SplatMesh: every scene
|
|
77
|
+
* entity needs its own transformable/disposable Object3D, while repeated uses of
|
|
78
|
+
* the same SPZ must not download the multi-megabyte source more than once.
|
|
79
|
+
* Spark stays a lazy chunk so games without splats do not pay its bundle cost.
|
|
80
|
+
*/
|
|
81
|
+
export async function loadSplat(url, providedBytes) {
|
|
82
|
+
let bytes = splatBytesCache.get(url);
|
|
83
|
+
if (!bytes && providedBytes) {
|
|
84
|
+
bytes = Promise.resolve(providedBytes);
|
|
85
|
+
splatBytesCache.set(url, bytes);
|
|
86
|
+
}
|
|
87
|
+
if (!bytes) {
|
|
88
|
+
bytes = fetch(resolveUrl(url)).then(async (response) => {
|
|
89
|
+
if (!response.ok) {
|
|
90
|
+
throw new Error(`Failed to load Gaussian splat: ${url} (${response.status} ${response.statusText})`);
|
|
91
|
+
}
|
|
92
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
93
|
+
});
|
|
94
|
+
splatBytesCache.set(url, bytes);
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
const [{ SplatMesh }, fileBytes] = await Promise.all([import('@sparkjsdev/spark'), bytes]);
|
|
98
|
+
const mesh = new SplatMesh({ fileBytes, fileName: url, raycastable: true });
|
|
99
|
+
await mesh.initialized;
|
|
100
|
+
setUserData(mesh, 'gaussianSplat', { src: url, numSplats: mesh.numSplats });
|
|
101
|
+
const bounds = mesh.getBoundingBox();
|
|
102
|
+
if (!bounds.isEmpty()) {
|
|
103
|
+
// Three's generic Box3.setFromObject only understands geometry-bearing
|
|
104
|
+
// Object3Ds. Spark intentionally renders without THREE.BufferGeometry,
|
|
105
|
+
// so give editor/runtime framing a hidden, non-pickable bounds proxy.
|
|
106
|
+
// It is infrastructure, never authored hierarchy or rendered content.
|
|
107
|
+
// Include a framing margin. This proxy is consumed by generic editor
|
|
108
|
+
// focus/selection bounds, while inspectors continue to report Spark's
|
|
109
|
+
// exact Gaussian bounds directly.
|
|
110
|
+
const size = bounds.getSize(new THREE.Vector3()).multiplyScalar(1.5);
|
|
111
|
+
const center = bounds.getCenter(new THREE.Vector3());
|
|
112
|
+
const proxy = new THREE.Mesh(new THREE.BoxGeometry(size.x, size.y, size.z));
|
|
113
|
+
proxy.name = '__vgai_splat_bounds';
|
|
114
|
+
proxy.position.copy(center);
|
|
115
|
+
proxy.visible = false;
|
|
116
|
+
proxy.raycast = () => { };
|
|
117
|
+
setUserData(proxy, 'engineInternal', true);
|
|
118
|
+
mesh.add(proxy);
|
|
119
|
+
}
|
|
120
|
+
return mesh;
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
// A failed fetch must be retryable after the source is repaired or the
|
|
124
|
+
// network recovers; successful source bytes remain cached across instances.
|
|
125
|
+
splatBytesCache.delete(url);
|
|
126
|
+
throw error;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Resolve a single named node inside an already-loaded glTF scene graph (F4,
|
|
131
|
+
* `mesh.node`). Pure and headlessly testable — no fetch, no cache lookups;
|
|
132
|
+
* callers pass the `scene` they already got from {@link loadGLTF}.
|
|
133
|
+
*
|
|
134
|
+
* The returned node is the SAME object (and shares the SAME geometry) as
|
|
135
|
+
* found in `scene` — nothing is cloned or copied out. `scene` is already a
|
|
136
|
+
* fresh `SkeletonUtils.clone()` per {@link loadGLTF}'s clone-safety contract,
|
|
137
|
+
* so mutating/detaching the returned node is safe.
|
|
138
|
+
*
|
|
139
|
+
* Atomic-subtree guard: a `SkinnedMesh` cannot be lifted out of its armature
|
|
140
|
+
* (its skeleton/bind matrices reference sibling bone nodes elsewhere in the
|
|
141
|
+
* hierarchy), so resolving a node that IS a SkinnedMesh, or that CONTAINS one,
|
|
142
|
+
* throws a loud `AssetParseError` instead of silently producing broken skinning.
|
|
143
|
+
*/
|
|
144
|
+
export function resolveGltfNode(scene, nodeName, src) {
|
|
145
|
+
const node = scene.getObjectByName(nodeName);
|
|
146
|
+
if (!node) {
|
|
147
|
+
throw new AssetParseError([
|
|
148
|
+
{
|
|
149
|
+
code: 'custom',
|
|
150
|
+
path: ['mesh', 'node'],
|
|
151
|
+
message: `glTF "${src}" has no node named "${nodeName}" (getObjectByName found nothing)`,
|
|
152
|
+
},
|
|
153
|
+
], src);
|
|
154
|
+
}
|
|
155
|
+
const isSkinned = (o) => o.isSkinnedMesh;
|
|
156
|
+
let containsSkinned = isSkinned(node);
|
|
157
|
+
if (!containsSkinned) {
|
|
158
|
+
node.traverse((child) => {
|
|
159
|
+
if (isSkinned(child))
|
|
160
|
+
containsSkinned = true;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
if (containsSkinned) {
|
|
164
|
+
throw new AssetParseError([
|
|
165
|
+
{
|
|
166
|
+
code: 'custom',
|
|
167
|
+
path: ['mesh', 'node'],
|
|
168
|
+
message: `glTF "${src}" node "${nodeName}" is (or contains) a SkinnedMesh — a skinned mesh ` +
|
|
169
|
+
'cannot be lifted out of its armature (atomic-subtree rule). Reference the whole ' +
|
|
170
|
+
'file instead of a `node`, or bake/export a non-skinned sub-asset.',
|
|
171
|
+
},
|
|
172
|
+
], src);
|
|
173
|
+
}
|
|
174
|
+
return node;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Clear the module-level GLTF / texture caches. Call on full runtime teardown
|
|
178
|
+
* (create-runtime fullCleanup / hot-reload) to release cached GPU resources
|
|
179
|
+
* and avoid leaking across editor Play sessions. See the lifetime note at the
|
|
180
|
+
* top of this file for why these are NOT cleared per scene load.
|
|
181
|
+
*
|
|
182
|
+
* NOTE: the IBL/skybox env-map cache lives in scene-loader (it needs a
|
|
183
|
+
* WebGLRenderer for PMREM); scene-loader's `clearAssetCaches` wraps this and
|
|
184
|
+
* also clears that env cache.
|
|
185
|
+
*/
|
|
186
|
+
export function clearAssetCaches() {
|
|
187
|
+
textureCache.clear();
|
|
188
|
+
gltfCache.clear();
|
|
189
|
+
splatBytesCache.clear();
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Drop the cached entry for ONE asset URL after its bytes changed on disk
|
|
193
|
+
* (editor asset-optimization write-back — W4a). Existing clones keep their
|
|
194
|
+
* shared geometry alive (the cache entry only owns the lookup, not the
|
|
195
|
+
* buffers), and the next `loadGLTF`/`loadTexture` for this URL re-fetches the
|
|
196
|
+
* rewritten file instead of serving stale bytes.
|
|
197
|
+
*/
|
|
198
|
+
export function invalidateCachedAsset(url) {
|
|
199
|
+
textureCache.delete(url);
|
|
200
|
+
gltfCache.delete(url);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Test-only: current sizes of the module-level caches. Used by the P1.8 headless
|
|
204
|
+
* test to assert caches stay bounded (one entry per distinct asset URL) across
|
|
205
|
+
* repeated loads of the same scene, rather than growing per load.
|
|
206
|
+
*/
|
|
207
|
+
export function assetCacheSizes() {
|
|
208
|
+
return { textures: textureCache.size, gltf: gltfCache.size, splat: splatBytesCache.size };
|
|
209
|
+
}
|