@vgai/engine 0.2.0 → 0.3.0
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/README.md +3 -1
- package/dist/adapter/authoring.d.ts +404 -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 +43 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -0
- package/dist/adapter/colyseus-networking-adapter.js +38 -0
- package/dist/adapter/first-party-systems.d.ts +38 -0
- package/dist/adapter/first-party-systems.d.ts.map +1 -0
- package/dist/adapter/first-party-systems.js +77 -0
- package/dist/adapter/game-adapter.d.ts +133 -0
- package/dist/adapter/game-adapter.d.ts.map +1 -0
- package/dist/adapter/game-adapter.js +10 -0
- package/dist/adapter/host-context.d.ts +73 -0
- package/dist/adapter/host-context.d.ts.map +1 -0
- package/dist/adapter/host-context.js +16 -0
- package/dist/adapter/index.d.ts +22 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/index.js +15 -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/overlay-applier.d.ts +118 -0
- package/dist/adapter/ingest/overlay-applier.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-applier.js +132 -0
- package/dist/adapter/ingest/overlay-apply.d.ts +60 -0
- package/dist/adapter/ingest/overlay-apply.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-apply.js +101 -0
- package/dist/adapter/ingest/overlay-file.d.ts +79 -0
- package/dist/adapter/ingest/overlay-file.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-file.js +66 -0
- package/dist/adapter/ingest/overlay-report.d.ts +113 -0
- package/dist/adapter/ingest/overlay-report.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-report.js +103 -0
- package/dist/adapter/ingest/scene-capture.d.ts +97 -0
- package/dist/adapter/ingest/scene-capture.d.ts.map +1 -0
- package/dist/adapter/ingest/scene-capture.js +248 -0
- package/dist/adapter/ingest/upstream-pin.d.ts +47 -0
- package/dist/adapter/ingest/upstream-pin.d.ts.map +1 -0
- package/dist/adapter/ingest/upstream-pin.js +50 -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 +12 -0
- package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -0
- package/dist/adapter/rapier-physics-adapter.js +46 -0
- package/dist/adapter/system-adapter.d.ts +133 -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/adapter/vgai-scene-game-adapter.d.ts +116 -0
- package/dist/adapter/vgai-scene-game-adapter.d.ts.map +1 -0
- package/dist/adapter/vgai-scene-game-adapter.js +714 -0
- package/dist/adapter/world-kind.d.ts +30 -0
- package/dist/adapter/world-kind.d.ts.map +1 -0
- package/dist/adapter/world-kind.js +18 -0
- package/dist/ai/navigation.d.ts +64 -0
- package/dist/ai/navigation.d.ts.map +1 -0
- package/dist/ai/navigation.js +133 -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 +250 -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 +37 -0
- package/dist/animation/gsap-registration.d.ts +119 -0
- package/dist/animation/gsap-registration.d.ts.map +1 -0
- package/dist/animation/gsap-registration.js +92 -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 +242 -0
- package/dist/animation/theatre-director.d.ts.map +1 -0
- package/dist/animation/theatre-director.js +235 -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 +111 -0
- package/dist/animation/xstate-animation-binding.d.ts.map +1 -0
- package/dist/animation/xstate-animation-binding.js +307 -0
- package/dist/animation/xstate-animation-meta.d.ts +228 -0
- package/dist/animation/xstate-animation-meta.d.ts.map +1 -0
- package/dist/animation/xstate-animation-meta.js +221 -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/index.d.ts +4 -0
- package/dist/audio/index.d.ts.map +1 -0
- package/dist/audio/index.js +24 -0
- package/dist/audio/tone-clock-binding.d.ts +75 -0
- package/dist/audio/tone-clock-binding.d.ts.map +1 -0
- package/dist/audio/tone-clock-binding.js +29 -0
- package/dist/audio/tone-context.d.ts +114 -0
- package/dist/audio/tone-context.d.ts.map +1 -0
- package/dist/audio/tone-context.js +39 -0
- package/dist/audio/tone-offline-render.d.ts +90 -0
- package/dist/audio/tone-offline-render.d.ts.map +1 -0
- package/dist/audio/tone-offline-render.js +56 -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/core/game-loop.d.ts +21 -0
- package/dist/core/game-loop.d.ts.map +1 -0
- package/dist/core/game-loop.js +130 -0
- package/dist/core/system-runner.d.ts +120 -0
- package/dist/core/system-runner.d.ts.map +1 -0
- package/dist/core/system-runner.js +286 -0
- package/dist/core/types.d.ts +58 -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 +110 -0
- package/dist/data/data-check-core.d.ts.map +1 -0
- package/dist/data/data-check-core.js +178 -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/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/logger.d.ts +30 -0
- package/dist/dev/logger.d.ts.map +1 -0
- package/dist/dev/logger.js +90 -0
- package/dist/ecs/component-manager.d.ts +189 -0
- package/dist/ecs/component-manager.d.ts.map +1 -0
- package/dist/ecs/component-manager.js +676 -0
- package/dist/ecs/game-component.d.ts +97 -0
- package/dist/ecs/game-component.d.ts.map +1 -0
- package/dist/ecs/game-component.js +80 -0
- package/dist/ecs/hmr-swap-report.d.ts +53 -0
- package/dist/ecs/hmr-swap-report.d.ts.map +1 -0
- package/dist/ecs/hmr-swap-report.js +55 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/input/input-manager.d.ts +596 -0
- package/dist/input/input-manager.d.ts.map +1 -0
- package/dist/input/input-manager.js +1564 -0
- package/dist/input/input-types.d.ts +171 -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 +43 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +59 -0
- package/dist/manifest/index.d.ts +5 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +8 -0
- package/dist/manifest/load-file.d.ts +4 -0
- package/dist/manifest/load-file.d.ts.map +1 -0
- package/dist/manifest/load-file.js +14 -0
- package/dist/manifest/load.d.ts +117 -0
- package/dist/manifest/load.d.ts.map +1 -0
- package/dist/manifest/load.js +255 -0
- package/dist/manifest/schema.d.ts +173 -0
- package/dist/manifest/schema.d.ts.map +1 -0
- package/dist/manifest/schema.js +302 -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/physics/trigger-dispatch.d.ts +24 -0
- package/dist/physics/trigger-dispatch.d.ts.map +1 -0
- package/dist/physics/trigger-dispatch.js +80 -0
- package/dist/react/game-state.d.ts +105 -0
- package/dist/react/game-state.d.ts.map +1 -0
- package/dist/react/game-state.js +144 -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 +96 -0
- package/dist/react/use-selection.d.ts +75 -0
- package/dist/react/use-selection.d.ts.map +1 -0
- package/dist/react/use-selection.js +90 -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/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 +230 -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 +36 -0
- package/dist/render/render-settings.d.ts.map +1 -0
- package/dist/render/render-settings.js +51 -0
- package/dist/runtime/create-runtime.d.ts +280 -0
- package/dist/runtime/create-runtime.d.ts.map +1 -0
- package/dist/runtime/create-runtime.js +795 -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 +433 -0
- package/dist/runtime/game.d.ts.map +1 -0
- package/dist/runtime/game.js +569 -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 +129 -0
- package/dist/runtime/mount-game.d.ts.map +1 -0
- package/dist/runtime/mount-game.js +152 -0
- package/dist/runtime/mount-manifest.d.ts +119 -0
- package/dist/runtime/mount-manifest.d.ts.map +1 -0
- package/dist/runtime/mount-manifest.js +204 -0
- package/dist/runtime/render-audio-control.d.ts +110 -0
- package/dist/runtime/render-audio-control.d.ts.map +1 -0
- package/dist/runtime/render-audio-control.js +111 -0
- package/dist/runtime/render-control.d.ts +291 -0
- package/dist/runtime/render-control.d.ts.map +1 -0
- package/dist/runtime/render-control.js +264 -0
- package/dist/runtime/render-seed.d.ts +57 -0
- package/dist/runtime/render-seed.d.ts.map +1 -0
- package/dist/runtime/render-seed.js +74 -0
- package/dist/runtime/scene-ui-bridge.d.ts +69 -0
- package/dist/runtime/scene-ui-bridge.d.ts.map +1 -0
- package/dist/runtime/scene-ui-bridge.js +23 -0
- package/dist/runtime/scene-ui-data.d.ts +13 -0
- package/dist/runtime/scene-ui-data.d.ts.map +1 -0
- package/dist/runtime/scene-ui-data.js +92 -0
- package/dist/runtime/state-bridge.d.ts +47 -0
- package/dist/runtime/state-bridge.d.ts.map +1 -0
- package/dist/runtime/state-bridge.js +53 -0
- package/dist/runtime/types.d.ts +179 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +1 -0
- package/dist/scene/asset-loaders.d.ts +79 -0
- package/dist/scene/asset-loaders.d.ts.map +1 -0
- package/dist/scene/asset-loaders.js +141 -0
- package/dist/scene/asset-paths.d.ts +11 -0
- package/dist/scene/asset-paths.d.ts.map +1 -0
- package/dist/scene/asset-paths.js +108 -0
- package/dist/scene/asset-ref-check.d.ts +88 -0
- package/dist/scene/asset-ref-check.d.ts.map +1 -0
- package/dist/scene/asset-ref-check.js +214 -0
- package/dist/scene/asset-registry.d.ts +30 -0
- package/dist/scene/asset-registry.d.ts.map +1 -0
- package/dist/scene/asset-registry.js +50 -0
- package/dist/scene/collider-dimensions.d.ts +63 -0
- package/dist/scene/collider-dimensions.d.ts.map +1 -0
- package/dist/scene/collider-dimensions.js +98 -0
- package/dist/scene/component-registry.d.ts +17 -0
- package/dist/scene/component-registry.d.ts.map +1 -0
- package/dist/scene/component-registry.js +28 -0
- package/dist/scene/defaults.d.ts +252 -0
- package/dist/scene/defaults.d.ts.map +1 -0
- package/dist/scene/defaults.js +151 -0
- package/dist/scene/geometries/index.d.ts +8 -0
- package/dist/scene/geometries/index.d.ts.map +1 -0
- package/dist/scene/geometries/index.js +7 -0
- package/dist/scene/geometries/terrain.d.ts +2 -0
- package/dist/scene/geometries/terrain.d.ts.map +1 -0
- package/dist/scene/geometries/terrain.js +37 -0
- package/dist/scene/geometry-registry.d.ts +24 -0
- package/dist/scene/geometry-registry.d.ts.map +1 -0
- package/dist/scene/geometry-registry.js +20 -0
- package/dist/scene/instance-registry.d.ts +36 -0
- package/dist/scene/instance-registry.d.ts.map +1 -0
- package/dist/scene/instance-registry.js +55 -0
- package/dist/scene/instancers/grid.d.ts +2 -0
- package/dist/scene/instancers/grid.d.ts.map +1 -0
- package/dist/scene/instancers/grid.js +36 -0
- package/dist/scene/instancers/index.d.ts +8 -0
- package/dist/scene/instancers/index.d.ts.map +1 -0
- package/dist/scene/instancers/index.js +7 -0
- package/dist/scene/light-camera-factory.d.ts +23 -0
- package/dist/scene/light-camera-factory.d.ts.map +1 -0
- package/dist/scene/light-camera-factory.js +68 -0
- package/dist/scene/material-factory.d.ts +17 -0
- package/dist/scene/material-factory.d.ts.map +1 -0
- package/dist/scene/material-factory.js +197 -0
- package/dist/scene/material-registry.d.ts +40 -0
- package/dist/scene/material-registry.d.ts.map +1 -0
- package/dist/scene/material-registry.js +44 -0
- package/dist/scene/materials/index.d.ts +8 -0
- package/dist/scene/materials/index.d.ts.map +1 -0
- package/dist/scene/materials/index.js +7 -0
- package/dist/scene/materials/water.d.ts +2 -0
- package/dist/scene/materials/water.d.ts.map +1 -0
- package/dist/scene/materials/water.js +54 -0
- package/dist/scene/parse.d.ts +23 -0
- package/dist/scene/parse.d.ts.map +1 -0
- package/dist/scene/parse.js +179 -0
- package/dist/scene/particles-factory.d.ts +33 -0
- package/dist/scene/particles-factory.d.ts.map +1 -0
- package/dist/scene/particles-factory.js +282 -0
- package/dist/scene/scene-apply.d.ts +109 -0
- package/dist/scene/scene-apply.d.ts.map +1 -0
- package/dist/scene/scene-apply.js +326 -0
- package/dist/scene/scene-diff-schema.d.ts +285 -0
- package/dist/scene/scene-diff-schema.d.ts.map +1 -0
- package/dist/scene/scene-diff-schema.js +92 -0
- package/dist/scene/scene-diff-types.d.ts +40 -0
- package/dist/scene/scene-diff-types.d.ts.map +1 -0
- package/dist/scene/scene-diff-types.js +14 -0
- package/dist/scene/scene-loader.d.ts +177 -0
- package/dist/scene/scene-loader.d.ts.map +1 -0
- package/dist/scene/scene-loader.js +1213 -0
- package/dist/scene/scene-query.d.ts +11 -0
- package/dist/scene/scene-query.d.ts.map +1 -0
- package/dist/scene/scene-query.js +63 -0
- package/dist/scene/scene-types.d.ts +10 -0
- package/dist/scene/scene-types.d.ts.map +1 -0
- package/dist/scene/scene-types.js +8 -0
- package/dist/scene/scene-version.d.ts +26 -0
- package/dist/scene/scene-version.d.ts.map +1 -0
- package/dist/scene/scene-version.js +34 -0
- package/dist/scene/schema/animation.d.ts +8 -0
- package/dist/scene/schema/animation.d.ts.map +1 -0
- package/dist/scene/schema/animation.js +42 -0
- package/dist/scene/schema/audio.d.ts +13 -0
- package/dist/scene/schema/audio.d.ts.map +1 -0
- package/dist/scene/schema/audio.js +22 -0
- package/dist/scene/schema/camera.d.ts +28 -0
- package/dist/scene/schema/camera.d.ts.map +1 -0
- package/dist/scene/schema/camera.js +17 -0
- package/dist/scene/schema/collider.d.ts +40 -0
- package/dist/scene/schema/collider.d.ts.map +1 -0
- package/dist/scene/schema/collider.js +55 -0
- package/dist/scene/schema/entity-ref.d.ts +31 -0
- package/dist/scene/schema/entity-ref.d.ts.map +1 -0
- package/dist/scene/schema/entity-ref.js +61 -0
- package/dist/scene/schema/entity.d.ts +1036 -0
- package/dist/scene/schema/entity.d.ts.map +1 -0
- package/dist/scene/schema/entity.js +153 -0
- package/dist/scene/schema/environment.d.ts +425 -0
- package/dist/scene/schema/environment.d.ts.map +1 -0
- package/dist/scene/schema/environment.js +357 -0
- package/dist/scene/schema/index.d.ts +39 -0
- package/dist/scene/schema/index.d.ts.map +1 -0
- package/dist/scene/schema/index.js +20 -0
- package/dist/scene/schema/instances.d.ts +14 -0
- package/dist/scene/schema/instances.d.ts.map +1 -0
- package/dist/scene/schema/instances.js +28 -0
- package/dist/scene/schema/joint.d.ts +23 -0
- package/dist/scene/schema/joint.d.ts.map +1 -0
- package/dist/scene/schema/joint.js +23 -0
- package/dist/scene/schema/light.d.ts +38 -0
- package/dist/scene/schema/light.d.ts.map +1 -0
- package/dist/scene/schema/light.js +26 -0
- package/dist/scene/schema/material.d.ts +199 -0
- package/dist/scene/schema/material.d.ts.map +1 -0
- package/dist/scene/schema/material.js +99 -0
- package/dist/scene/schema/mesh.d.ts +48 -0
- package/dist/scene/schema/mesh.d.ts.map +1 -0
- package/dist/scene/schema/mesh.js +82 -0
- package/dist/scene/schema/particles.d.ts +2178 -0
- package/dist/scene/schema/particles.d.ts.map +1 -0
- package/dist/scene/schema/particles.js +321 -0
- package/dist/scene/schema/physics.d.ts +56 -0
- package/dist/scene/schema/physics.d.ts.map +1 -0
- package/dist/scene/schema/physics.js +37 -0
- package/dist/scene/schema/scene-file.d.ts +304 -0
- package/dist/scene/schema/scene-file.d.ts.map +1 -0
- package/dist/scene/schema/scene-file.js +262 -0
- package/dist/scene/schema/shadow.d.ts +28 -0
- package/dist/scene/schema/shadow.d.ts.map +1 -0
- package/dist/scene/schema/shadow.js +20 -0
- package/dist/scene/schema/spline.d.ts +25 -0
- package/dist/scene/schema/spline.d.ts.map +1 -0
- package/dist/scene/schema/spline.js +15 -0
- package/dist/scene/schema/tuples.d.ts +12 -0
- package/dist/scene/schema/tuples.d.ts.map +1 -0
- package/dist/scene/schema/tuples.js +14 -0
- package/dist/scene/schema/ui.d.ts +880 -0
- package/dist/scene/schema/ui.d.ts.map +1 -0
- package/dist/scene/schema/ui.js +506 -0
- package/dist/scene/user-data.d.ts +171 -0
- package/dist/scene/user-data.d.ts.map +1 -0
- package/dist/scene/user-data.js +137 -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 +69 -0
- package/dist/setup/setup-renderer.d.ts.map +1 -0
- package/dist/setup/setup-renderer.js +363 -0
- package/dist/tools/define-tool.d.ts +105 -0
- package/dist/tools/define-tool.d.ts.map +1 -0
- package/dist/tools/define-tool.js +82 -0
- package/dist/world2d/authoring-2d.d.ts +76 -0
- package/dist/world2d/authoring-2d.d.ts.map +1 -0
- package/dist/world2d/authoring-2d.js +176 -0
- package/dist/world2d/capture-to-scene2d.d.ts +5 -0
- package/dist/world2d/capture-to-scene2d.d.ts.map +1 -0
- package/dist/world2d/capture-to-scene2d.js +49 -0
- package/dist/world2d/collision-2d.d.ts +52 -0
- package/dist/world2d/collision-2d.d.ts.map +1 -0
- package/dist/world2d/collision-2d.js +70 -0
- package/dist/world2d/components-2d.d.ts +47 -0
- package/dist/world2d/components-2d.d.ts.map +1 -0
- package/dist/world2d/components-2d.js +77 -0
- package/dist/world2d/index.d.ts +34 -0
- package/dist/world2d/index.d.ts.map +1 -0
- package/dist/world2d/index.js +32 -0
- package/dist/world2d/ingest-iframe-2d.d.ts +82 -0
- package/dist/world2d/ingest-iframe-2d.d.ts.map +1 -0
- package/dist/world2d/ingest-iframe-2d.js +166 -0
- package/dist/world2d/ingest2d.d.ts +97 -0
- package/dist/world2d/ingest2d.d.ts.map +1 -0
- package/dist/world2d/ingest2d.js +40 -0
- package/dist/world2d/physics2d-registry.d.ts +24 -0
- package/dist/world2d/physics2d-registry.d.ts.map +1 -0
- package/dist/world2d/physics2d-registry.js +38 -0
- package/dist/world2d/pixi-game-adapter.d.ts +107 -0
- package/dist/world2d/pixi-game-adapter.d.ts.map +1 -0
- package/dist/world2d/pixi-game-adapter.js +211 -0
- package/dist/world2d/pixi-surface.d.ts +39 -0
- package/dist/world2d/pixi-surface.d.ts.map +1 -0
- package/dist/world2d/pixi-surface.js +47 -0
- package/dist/world2d/scene-capture-2d.d.ts +43 -0
- package/dist/world2d/scene-capture-2d.d.ts.map +1 -0
- package/dist/world2d/scene-capture-2d.js +92 -0
- package/dist/world2d/scene2d-loader.d.ts +27 -0
- package/dist/world2d/scene2d-loader.d.ts.map +1 -0
- package/dist/world2d/scene2d-loader.js +274 -0
- package/dist/world2d/schema/entity2d.d.ts +102 -0
- package/dist/world2d/schema/entity2d.d.ts.map +1 -0
- package/dist/world2d/schema/entity2d.js +119 -0
- package/dist/world2d/schema/physics2d.d.ts +46 -0
- package/dist/world2d/schema/physics2d.d.ts.map +1 -0
- package/dist/world2d/schema/physics2d.js +45 -0
- package/dist/world2d/schema/sprite.d.ts +42 -0
- package/dist/world2d/schema/sprite.d.ts.map +1 -0
- package/dist/world2d/schema/sprite.js +63 -0
- package/dist/world2d/schema/tilemap.d.ts +15 -0
- package/dist/world2d/schema/tilemap.d.ts.map +1 -0
- package/dist/world2d/schema/tilemap.js +19 -0
- package/dist/world2d/schema/tuples2d.d.ts +20 -0
- package/dist/world2d/schema/tuples2d.d.ts.map +1 -0
- package/dist/world2d/schema/tuples2d.js +19 -0
- package/dist/world2d/system-adapters-2d.d.ts +16 -0
- package/dist/world2d/system-adapters-2d.d.ts.map +1 -0
- package/dist/world2d/system-adapters-2d.js +37 -0
- package/dist/world2d/transform-writer-2d.d.ts +16 -0
- package/dist/world2d/transform-writer-2d.d.ts.map +1 -0
- package/dist/world2d/transform-writer-2d.js +22 -0
- package/dist/world2d/types.d.ts +53 -0
- package/dist/world2d/types.d.ts.map +1 -0
- package/dist/world2d/types.js +1 -0
- package/package.json +18 -4
- package/src/adapter/authoring.ts +10 -0
- package/src/adapter/first-party-systems.ts +23 -34
- package/src/adapter/index.ts +1 -3
- package/src/adapter/system-adapter.ts +15 -22
- package/src/adapter/vgai-scene-game-adapter.ts +5 -14
- package/src/animation/anim-graph-types.ts +12 -43
- package/src/animation/animation-clock.ts +479 -0
- package/src/animation/camera-ownership.ts +467 -0
- package/src/animation/cinematic-cues.ts +451 -0
- package/src/animation/clip-map.ts +41 -0
- package/src/animation/gsap-registration.ts +184 -0
- package/src/animation/theatre-clock-binding.ts +111 -0
- package/src/animation/theatre-director.ts +347 -0
- package/src/animation/theatre-object-binding.ts +661 -0
- package/src/animation/xstate-animation-binding.ts +398 -0
- package/src/animation/xstate-animation-meta.ts +282 -0
- package/src/audio/index.ts +39 -7
- package/src/audio/tone-clock-binding.ts +98 -0
- package/src/audio/tone-context.ts +129 -0
- package/src/audio/tone-offline-render.ts +167 -0
- package/src/audio/wav-encode.ts +119 -0
- package/src/core/game-loop.ts +17 -0
- package/src/core/types.ts +13 -0
- package/src/data/data-asset.ts +167 -0
- package/src/data/data-check-core.ts +242 -0
- package/src/data/data-ref.ts +145 -0
- package/src/data/vite-plugin-data.ts +290 -0
- package/src/index.ts +48 -0
- package/src/input/input-manager.ts +1206 -32
- package/src/input/input-types.ts +155 -3
- package/src/input/prompt-labels.ts +122 -0
- package/src/input/rebind-controller.ts +105 -0
- package/src/input/schema.ts +206 -52
- package/src/react/use-data.ts +114 -0
- package/src/react/use-selection.tsx +135 -0
- package/src/runtime/create-runtime.ts +30 -9
- package/src/runtime/render-audio-control.ts +168 -0
- package/src/runtime/render-control.ts +522 -0
- package/src/runtime/render-seed.ts +79 -0
- package/src/runtime/types.ts +0 -5
- package/src/scene/asset-loaders.ts +10 -36
- package/src/scene/asset-paths.ts +0 -2
- package/src/scene/asset-ref-check.ts +248 -0
- package/src/scene/parse.ts +133 -0
- package/src/scene/scene-loader.ts +81 -96
- package/src/scene/schema/animation.ts +30 -79
- package/src/scene/schema/entity.ts +20 -0
- package/src/scene/schema/index.ts +2 -12
- package/src/scene/user-data.ts +8 -9
- package/src/setup/setup-renderer.ts +9 -2
- package/src/tools/define-tool.ts +152 -0
- package/src/animation/anim-graph.ts +0 -406
- package/src/animation/anim-system.ts +0 -28
- package/src/animation/property-track.ts +0 -178
- package/src/animation/schema.ts +0 -204
- package/src/audio/ambient.ts +0 -300
- package/src/audio/impacts.ts +0 -212
- package/src/audio/movement.ts +0 -140
- package/src/audio/musical.ts +0 -200
- package/src/audio/ui-sounds.ts +0 -171
- package/src/audio/vehicle.ts +0 -235
- package/src/audio/weapons.ts +0 -152
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/** Single source of truth for all scene default values. */
|
|
2
|
+
export const DEFAULTS = {
|
|
3
|
+
transform: {
|
|
4
|
+
position: [0, 0, 0],
|
|
5
|
+
rotation: [0, 0, 0, 1],
|
|
6
|
+
scale: [1, 1, 1],
|
|
7
|
+
},
|
|
8
|
+
entity: {
|
|
9
|
+
visible: true,
|
|
10
|
+
locked: false,
|
|
11
|
+
pivot: [0, 0, 0],
|
|
12
|
+
},
|
|
13
|
+
material: {
|
|
14
|
+
type: 'standard',
|
|
15
|
+
color: '#888888',
|
|
16
|
+
metalness: 0,
|
|
17
|
+
roughness: 0.5,
|
|
18
|
+
emissive: '#000000',
|
|
19
|
+
emissiveIntensity: 0,
|
|
20
|
+
opacity: 1,
|
|
21
|
+
transparent: false,
|
|
22
|
+
side: 'front',
|
|
23
|
+
flatShading: false,
|
|
24
|
+
clearcoat: { clearcoat: 1, clearcoatRoughness: 0 },
|
|
25
|
+
transmission: { transmission: 1, ior: 1.5, thickness: 0.5 },
|
|
26
|
+
sheen: { sheen: 1, sheenColor: '#ffffff', sheenRoughness: 0.5 },
|
|
27
|
+
iridescence: {
|
|
28
|
+
iridescence: 1,
|
|
29
|
+
iridescenceIOR: 1.3,
|
|
30
|
+
iridescenceThicknessRange: [100, 400],
|
|
31
|
+
},
|
|
32
|
+
displacementScale: 1,
|
|
33
|
+
displacementBias: 0,
|
|
34
|
+
},
|
|
35
|
+
light: {
|
|
36
|
+
color: '#ffffff',
|
|
37
|
+
intensity: 1,
|
|
38
|
+
groundColor: '#000000',
|
|
39
|
+
distance: 0,
|
|
40
|
+
angle: Math.PI / 6,
|
|
41
|
+
penumbra: 0,
|
|
42
|
+
// three.js's own RectAreaLight constructor defaults (area lights only).
|
|
43
|
+
width: 10,
|
|
44
|
+
height: 10,
|
|
45
|
+
},
|
|
46
|
+
camera: {
|
|
47
|
+
fov: 60,
|
|
48
|
+
near: 0.1,
|
|
49
|
+
far: 1000,
|
|
50
|
+
orthoSize: 5,
|
|
51
|
+
width: 1920,
|
|
52
|
+
height: 1080,
|
|
53
|
+
},
|
|
54
|
+
audio: {
|
|
55
|
+
spatial: true,
|
|
56
|
+
volume: 1,
|
|
57
|
+
refDistance: 1,
|
|
58
|
+
rolloffFactor: 1,
|
|
59
|
+
maxDistance: 10000,
|
|
60
|
+
loop: false,
|
|
61
|
+
autoplay: false,
|
|
62
|
+
},
|
|
63
|
+
collider: {
|
|
64
|
+
cuboid: { halfExtents: [0.5, 0.5, 0.5] },
|
|
65
|
+
ball: { radius: 0.5 },
|
|
66
|
+
capsule: { radius: 0.25, halfHeight: 0.5 },
|
|
67
|
+
},
|
|
68
|
+
shadow: {
|
|
69
|
+
mapSize: 1024,
|
|
70
|
+
},
|
|
71
|
+
animation: {
|
|
72
|
+
loop: true,
|
|
73
|
+
},
|
|
74
|
+
fog: {
|
|
75
|
+
linear: { near: 1, far: 100 },
|
|
76
|
+
exponential: { density: 0.01 },
|
|
77
|
+
},
|
|
78
|
+
environment: {
|
|
79
|
+
envMapIntensity: 1.0,
|
|
80
|
+
},
|
|
81
|
+
toneMapping: {
|
|
82
|
+
// T1.13: the effective renderer default is ACES (see
|
|
83
|
+
// setup-renderer.ts's `createHostRenderer` + `applyScenePostProcessing`,
|
|
84
|
+
// which both hardcode `THREE.ACESFilmicToneMapping`/'aces' as the
|
|
85
|
+
// fallback when a scene omits `environment.toneMapping`) — NOT 'none'.
|
|
86
|
+
// This used to say 'none', silently disagreeing with the runtime and
|
|
87
|
+
// with the editor's Tone Mapping inspector dropdown.
|
|
88
|
+
mode: 'aces',
|
|
89
|
+
exposure: 1.0,
|
|
90
|
+
},
|
|
91
|
+
postProcessing: {
|
|
92
|
+
bloom: { intensity: 1.0, luminanceThreshold: 0.9, luminanceSmoothing: 0.025 },
|
|
93
|
+
vignette: { darkness: 0.5, offset: 0.5 },
|
|
94
|
+
brightnessContrast: { brightness: 0, contrast: 0 },
|
|
95
|
+
hueSaturation: { hue: 0, saturation: 0 },
|
|
96
|
+
sepia: { intensity: 1.0 },
|
|
97
|
+
colorDepth: { bits: 16 },
|
|
98
|
+
chromaticAberration: { offsetX: 0.002, offsetY: 0.002, modulationOffset: 0.15 },
|
|
99
|
+
lensDistortion: { distortionX: 0, distortionY: 0, focalLengthX: 1, focalLengthY: 1, skew: 0 },
|
|
100
|
+
depthOfField: { worldFocusDistance: 10, worldFocusRange: 5, bokehScale: 3, focalLength: 0.04 },
|
|
101
|
+
tiltShift: { offset: 0, rotation: 0, focusArea: 0.4, feather: 0.3 },
|
|
102
|
+
noise: { premultiply: false },
|
|
103
|
+
scanline: { density: 1.25 },
|
|
104
|
+
dotScreen: { angle: 1.57, scale: 1.0 },
|
|
105
|
+
grid: { scale: 1.0, lineWidth: 0.0 },
|
|
106
|
+
pixelation: { granularity: 6 },
|
|
107
|
+
glitch: {
|
|
108
|
+
delayX: 1.5,
|
|
109
|
+
delayY: 3.5,
|
|
110
|
+
durationX: 0.6,
|
|
111
|
+
durationY: 1.0,
|
|
112
|
+
strengthX: 0.3,
|
|
113
|
+
strengthY: 1.0,
|
|
114
|
+
columns: 0.05,
|
|
115
|
+
ratio: 0.85,
|
|
116
|
+
},
|
|
117
|
+
shockWave: { speed: 2, maxRadius: 1, waveSize: 0.2, amplitude: 0.05 },
|
|
118
|
+
smaa: { preset: 'high' },
|
|
119
|
+
ssao: { radius: 0.05, intensity: 2.0, bias: 0.025, samples: 16, rings: 7, fade: 0.01 },
|
|
120
|
+
n8ao: {
|
|
121
|
+
aoSamples: 16,
|
|
122
|
+
aoRadius: 5.0,
|
|
123
|
+
intensity: 5,
|
|
124
|
+
denoiseSamples: 8,
|
|
125
|
+
denoiseRadius: 12,
|
|
126
|
+
distanceFalloff: 1.0,
|
|
127
|
+
},
|
|
128
|
+
godRays: { density: 0.96, decay: 0.93, weight: 0.4, exposure: 0.6, samples: 60 },
|
|
129
|
+
outline: {
|
|
130
|
+
edgeStrength: 3,
|
|
131
|
+
pulseSpeed: 0,
|
|
132
|
+
visibleEdgeColor: '#ffffff',
|
|
133
|
+
hiddenEdgeColor: '#22090a',
|
|
134
|
+
},
|
|
135
|
+
ssr: { intensity: 1, exponent: 1, distance: 10, thickness: 10, maxRoughness: 1 },
|
|
136
|
+
ssgi: { intensity: 1, distance: 10, thickness: 10, maxRoughness: 1 },
|
|
137
|
+
motionBlur: { intensity: 1, jitter: 1, samples: 16 },
|
|
138
|
+
},
|
|
139
|
+
navigation: {
|
|
140
|
+
cellSize: 0.3,
|
|
141
|
+
cellHeight: 0.2,
|
|
142
|
+
walkableSlopeAngle: 45,
|
|
143
|
+
walkableHeight: 2,
|
|
144
|
+
walkableClimb: 1,
|
|
145
|
+
walkableRadius: 0.5,
|
|
146
|
+
maxEdgeLen: 12,
|
|
147
|
+
maxSimplificationError: 1.3,
|
|
148
|
+
minRegionArea: 8,
|
|
149
|
+
mergeRegionArea: 20,
|
|
150
|
+
},
|
|
151
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in geometry generators. Importing this module for its side effects
|
|
3
|
+
* registers the built-ins into the geometry registry. Both the runtime factory
|
|
4
|
+
* (scene-loader) and the editor factory (entity-factory) import it so generated
|
|
5
|
+
* meshes resolve on whichever side builds first.
|
|
6
|
+
*/
|
|
7
|
+
import './terrain';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scene/geometries/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,WAAW,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in geometry generators. Importing this module for its side effects
|
|
3
|
+
* registers the built-ins into the geometry registry. Both the runtime factory
|
|
4
|
+
* (scene-loader) and the editor factory (entity-factory) import it so generated
|
|
5
|
+
* meshes resolve on whichever side builds first.
|
|
6
|
+
*/
|
|
7
|
+
import './terrain';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terrain.d.ts","sourceRoot":"","sources":["../../../src/scene/geometries/terrain.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { registerGeometryGenerator } from '../geometry-registry';
|
|
3
|
+
/**
|
|
4
|
+
* Built-in "Terrain" geometry generator — a horizontal heightfield (XZ plane,
|
|
5
|
+
* height in +Y) displaced by a deterministic sum-of-sines, so it pairs with a
|
|
6
|
+
* `trimesh` collider for matching terrain physics. Proof material for roadmap #3.
|
|
7
|
+
*
|
|
8
|
+
* Params: width, depth (world size), segments (grid resolution per axis),
|
|
9
|
+
* amplitude (max height), frequency (wave scale). Deterministic — no Math.random.
|
|
10
|
+
*/
|
|
11
|
+
function heightAt(x, z, amplitude, frequency) {
|
|
12
|
+
return (amplitude *
|
|
13
|
+
(Math.sin(x * frequency) * 0.5 +
|
|
14
|
+
Math.cos(z * frequency * 1.3) * 0.3 +
|
|
15
|
+
Math.sin((x + z) * frequency * 0.5) * 0.2));
|
|
16
|
+
}
|
|
17
|
+
registerGeometryGenerator('Terrain', {
|
|
18
|
+
build(params) {
|
|
19
|
+
const width = params['width'] ?? 40;
|
|
20
|
+
const depth = params['depth'] ?? 40;
|
|
21
|
+
const segments = params['segments'] ?? 64;
|
|
22
|
+
const amplitude = params['amplitude'] ?? 3;
|
|
23
|
+
const frequency = params['frequency'] ?? 0.25;
|
|
24
|
+
const geo = new THREE.PlaneGeometry(width, depth, segments, segments);
|
|
25
|
+
// Lay the plane flat (XZ) with normal +Y, then displace Y by the heightfield.
|
|
26
|
+
geo.rotateX(-Math.PI / 2);
|
|
27
|
+
const pos = geo.attributes['position'];
|
|
28
|
+
for (let i = 0; i < pos.count; i++) {
|
|
29
|
+
const x = pos.getX(i);
|
|
30
|
+
const z = pos.getZ(i);
|
|
31
|
+
pos.setY(i, heightAt(x, z, amplitude, frequency));
|
|
32
|
+
}
|
|
33
|
+
pos.needsUpdate = true;
|
|
34
|
+
geo.computeVertexNormals();
|
|
35
|
+
return geo;
|
|
36
|
+
},
|
|
37
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* A geometry-generator definition. Registered by name and resolved when a scene
|
|
4
|
+
* mesh declares `{ generator: <name> }`. Mirrors the material/instancer registry
|
|
5
|
+
* pattern: the generation logic lives here in code, the authored params arrive as
|
|
6
|
+
* scene data.
|
|
7
|
+
*
|
|
8
|
+
* `build` returns a real THREE.BufferGeometry. Paired with a `trimesh` collider,
|
|
9
|
+
* the generated geometry also drives physics (e.g. terrain), so the visual and
|
|
10
|
+
* collision surfaces match exactly.
|
|
11
|
+
*/
|
|
12
|
+
export interface GeometryGeneratorDef {
|
|
13
|
+
build(params: Record<string, unknown>): THREE.BufferGeometry;
|
|
14
|
+
}
|
|
15
|
+
/** Register a geometry generator under `name`. */
|
|
16
|
+
export declare function registerGeometryGenerator(name: string, def: GeometryGeneratorDef): void;
|
|
17
|
+
/** Look up a registered geometry generator. */
|
|
18
|
+
export declare function getGeometryGenerator(name: string): GeometryGeneratorDef | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Build a procedural geometry by registered generator name. Throws if the
|
|
21
|
+
* generator is unknown (fail loud — same posture as the other registries).
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildGeneratedGeometry(name: string, params: Record<string, unknown>): THREE.BufferGeometry;
|
|
24
|
+
//# sourceMappingURL=geometry-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry-registry.d.ts","sourceRoot":"","sources":["../../src/scene/geometry-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC;;;;;;;;;GASG;AACH,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC;CAC9D;AAID,kDAAkD;AAClD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,oBAAoB,GAAG,IAAI,CAEvF;AAED,+CAA+C;AAC/C,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAEnF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,KAAK,CAAC,cAAc,CAMtB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const registry = new Map();
|
|
2
|
+
/** Register a geometry generator under `name`. */
|
|
3
|
+
export function registerGeometryGenerator(name, def) {
|
|
4
|
+
registry.set(name, def);
|
|
5
|
+
}
|
|
6
|
+
/** Look up a registered geometry generator. */
|
|
7
|
+
export function getGeometryGenerator(name) {
|
|
8
|
+
return registry.get(name);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Build a procedural geometry by registered generator name. Throws if the
|
|
12
|
+
* generator is unknown (fail loud — same posture as the other registries).
|
|
13
|
+
*/
|
|
14
|
+
export function buildGeneratedGeometry(name, params) {
|
|
15
|
+
const def = registry.get(name);
|
|
16
|
+
if (!def) {
|
|
17
|
+
throw new Error(`Geometry generator "${name}" not found in geometry registry`);
|
|
18
|
+
}
|
|
19
|
+
return def.build(params ?? {});
|
|
20
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { InstancesFile } from './schema/instances';
|
|
3
|
+
/**
|
|
4
|
+
* An instancer definition. Registered by name and resolved when a scene mesh
|
|
5
|
+
* declares `{ instancer: <name> }`. Mirrors the material-registry pattern: the
|
|
6
|
+
* generation logic lives here in code (the "behavior" half), the authored params
|
|
7
|
+
* arrive as scene data (the "data" half).
|
|
8
|
+
*
|
|
9
|
+
* `build` returns per-instance LOCAL transforms; the factory packs them into a
|
|
10
|
+
* single THREE.InstancedMesh, so N instances cost one draw call.
|
|
11
|
+
*/
|
|
12
|
+
export interface InstancerDef {
|
|
13
|
+
/** Produce per-instance local matrices from authored params. */
|
|
14
|
+
build(params: Record<string, unknown>): THREE.Matrix4[];
|
|
15
|
+
}
|
|
16
|
+
/** Register an instancer definition under `name`. */
|
|
17
|
+
export declare function registerInstancer(name: string, def: InstancerDef): void;
|
|
18
|
+
/** Look up a registered instancer. */
|
|
19
|
+
export declare function getInstancer(name: string): InstancerDef | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Build a THREE.InstancedMesh from a registered instancer. Throws if the
|
|
22
|
+
* instancer is unknown (fail loud — same posture as the component/material
|
|
23
|
+
* registries). One InstancedMesh = one draw call for all instances.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildInstancedMesh(geometry: THREE.BufferGeometry, material: THREE.Material, name: string, params: Record<string, unknown>): THREE.InstancedMesh;
|
|
26
|
+
/**
|
|
27
|
+
* Build a THREE.InstancedMesh directly from an already-parsed `.instances.json`
|
|
28
|
+
* tuple array (F3, docs/VSCN-STRUCTURAL-GAPS-DESIGN.md — the declarative,
|
|
29
|
+
* authored-data counterpart to `buildInstancedMesh`'s code-registered
|
|
30
|
+
* instancers). Each tuple is
|
|
31
|
+
* `[posX,posY,posZ, quatX,quatY,quatZ,quatW, scaleX,scaleY,scaleZ]`. Pure and
|
|
32
|
+
* synchronous (no fetch) so it's exercisable headlessly by both the scene
|
|
33
|
+
* loader (after it fetches+parses the asset) and unit tests.
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildInstancedMeshFromTuples(geometry: THREE.BufferGeometry, material: THREE.Material, tuples: InstancesFile): THREE.InstancedMesh;
|
|
36
|
+
//# sourceMappingURL=instance-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance-registry.d.ts","sourceRoot":"","sources":["../../src/scene/instance-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,gEAAgE;IAChE,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;CACzD;AAID,qDAAqD;AACrD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,GAAG,IAAI,CAEvE;AAED,sCAAsC;AACtC,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEnE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,KAAK,CAAC,cAAc,EAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,KAAK,CAAC,aAAa,CAarB;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,KAAK,CAAC,cAAc,EAC9B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,MAAM,EAAE,aAAa,GACpB,KAAK,CAAC,aAAa,CAgBrB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
const registry = new Map();
|
|
3
|
+
/** Register an instancer definition under `name`. */
|
|
4
|
+
export function registerInstancer(name, def) {
|
|
5
|
+
registry.set(name, def);
|
|
6
|
+
}
|
|
7
|
+
/** Look up a registered instancer. */
|
|
8
|
+
export function getInstancer(name) {
|
|
9
|
+
return registry.get(name);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Build a THREE.InstancedMesh from a registered instancer. Throws if the
|
|
13
|
+
* instancer is unknown (fail loud — same posture as the component/material
|
|
14
|
+
* registries). One InstancedMesh = one draw call for all instances.
|
|
15
|
+
*/
|
|
16
|
+
export function buildInstancedMesh(geometry, material, name, params) {
|
|
17
|
+
const def = registry.get(name);
|
|
18
|
+
if (!def) {
|
|
19
|
+
throw new Error(`Instancer "${name}" not found in instancer registry`);
|
|
20
|
+
}
|
|
21
|
+
const matrices = def.build(params ?? {});
|
|
22
|
+
const mesh = new THREE.InstancedMesh(geometry, material, matrices.length);
|
|
23
|
+
for (let i = 0; i < matrices.length; i++) {
|
|
24
|
+
mesh.setMatrixAt(i, matrices[i]);
|
|
25
|
+
}
|
|
26
|
+
mesh.instanceMatrix.needsUpdate = true;
|
|
27
|
+
mesh.userData['__instancer'] = name;
|
|
28
|
+
return mesh;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Build a THREE.InstancedMesh directly from an already-parsed `.instances.json`
|
|
32
|
+
* tuple array (F3, docs/VSCN-STRUCTURAL-GAPS-DESIGN.md — the declarative,
|
|
33
|
+
* authored-data counterpart to `buildInstancedMesh`'s code-registered
|
|
34
|
+
* instancers). Each tuple is
|
|
35
|
+
* `[posX,posY,posZ, quatX,quatY,quatZ,quatW, scaleX,scaleY,scaleZ]`. Pure and
|
|
36
|
+
* synchronous (no fetch) so it's exercisable headlessly by both the scene
|
|
37
|
+
* loader (after it fetches+parses the asset) and unit tests.
|
|
38
|
+
*/
|
|
39
|
+
export function buildInstancedMeshFromTuples(geometry, material, tuples) {
|
|
40
|
+
const mesh = new THREE.InstancedMesh(geometry, material, tuples.length);
|
|
41
|
+
const pos = new THREE.Vector3();
|
|
42
|
+
const quat = new THREE.Quaternion();
|
|
43
|
+
const scale = new THREE.Vector3();
|
|
44
|
+
const matrix = new THREE.Matrix4();
|
|
45
|
+
for (let i = 0; i < tuples.length; i++) {
|
|
46
|
+
const t = tuples[i];
|
|
47
|
+
pos.set(t[0], t[1], t[2]);
|
|
48
|
+
quat.set(t[3], t[4], t[5], t[6]);
|
|
49
|
+
scale.set(t[7], t[8], t[9]);
|
|
50
|
+
matrix.compose(pos, quat, scale);
|
|
51
|
+
mesh.setMatrixAt(i, matrix);
|
|
52
|
+
}
|
|
53
|
+
mesh.instanceMatrix.needsUpdate = true;
|
|
54
|
+
return mesh;
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../src/scene/instancers/grid.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { registerInstancer } from '../instance-registry';
|
|
3
|
+
/**
|
|
4
|
+
* Built-in "Grid" instancer — a countX × countZ grid of instances on the XZ
|
|
5
|
+
* plane, centred on the entity origin, with optional deterministic y-jitter.
|
|
6
|
+
* Proof material for roadmap #2 (first-class instancing): a 100×100 grid is
|
|
7
|
+
* 10,000 instances in one draw call.
|
|
8
|
+
*
|
|
9
|
+
* Determinism: uses a seeded LCG (not Math.random) so a scene renders the same
|
|
10
|
+
* layout every load — important for reproducible scenes and tests.
|
|
11
|
+
*/
|
|
12
|
+
registerInstancer('Grid', {
|
|
13
|
+
build(params) {
|
|
14
|
+
const countX = params['countX'] ?? 100;
|
|
15
|
+
const countZ = params['countZ'] ?? 100;
|
|
16
|
+
const spacing = params['spacing'] ?? 2;
|
|
17
|
+
const jitter = params['jitter'] ?? 0;
|
|
18
|
+
let seed = params['seed'] ?? 1;
|
|
19
|
+
const rand = () => {
|
|
20
|
+
seed = (seed * 1664525 + 1013904223) % 4294967296;
|
|
21
|
+
return seed / 4294967296;
|
|
22
|
+
};
|
|
23
|
+
const offX = ((countX - 1) * spacing) / 2;
|
|
24
|
+
const offZ = ((countZ - 1) * spacing) / 2;
|
|
25
|
+
const matrices = [];
|
|
26
|
+
const m = new THREE.Matrix4();
|
|
27
|
+
for (let x = 0; x < countX; x++) {
|
|
28
|
+
for (let z = 0; z < countZ; z++) {
|
|
29
|
+
const y = jitter ? (rand() - 0.5) * jitter : 0;
|
|
30
|
+
m.makeTranslation(x * spacing - offX, y, z * spacing - offZ);
|
|
31
|
+
matrices.push(m.clone());
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return matrices;
|
|
35
|
+
},
|
|
36
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in instancer definitions. Importing this module for its side effects
|
|
3
|
+
* registers the built-ins into the instancer registry. Both the runtime factory
|
|
4
|
+
* (scene-loader) and the editor factory (entity-factory) import it so instanced
|
|
5
|
+
* meshes resolve on whichever side builds first.
|
|
6
|
+
*/
|
|
7
|
+
import './grid';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scene/instancers/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,QAAQ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in instancer definitions. Importing this module for its side effects
|
|
3
|
+
* registers the built-ins into the instancer registry. Both the runtime factory
|
|
4
|
+
* (scene-loader) and the editor factory (entity-factory) import it so instanced
|
|
5
|
+
* meshes resolve on whichever side builds first.
|
|
6
|
+
*/
|
|
7
|
+
import './grid';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared light + camera factory (T1.13 — DEFAULTS truth).
|
|
3
|
+
*
|
|
4
|
+
* `createLight`/`createCamera` used to be duplicated verbatim between the
|
|
5
|
+
* runtime loader (`scene-loader.ts`) and the editor preview
|
|
6
|
+
* (`entity-factory.ts`) — both hardcoded the same fallback literals (color
|
|
7
|
+
* '#ffffff', fov 60, near 0.1, far 1000, etc.) that happened to agree with
|
|
8
|
+
* `DEFAULTS.light`/`DEFAULTS.camera` by luck rather than by reading them. Any
|
|
9
|
+
* edit to one copy (or to `DEFAULTS`) could silently diverge from the other.
|
|
10
|
+
*
|
|
11
|
+
* This module is now the ONE place that builds a `THREE.Light`/`THREE.Camera`
|
|
12
|
+
* from a `SceneLight`/`SceneCamera` descriptor, reading its fallbacks from
|
|
13
|
+
* `DEFAULTS` (the single source of truth for scene default values — see
|
|
14
|
+
* `scene/defaults.ts`). Both the loader and the editor import it, so they
|
|
15
|
+
* can no longer disagree.
|
|
16
|
+
*/
|
|
17
|
+
import * as THREE from 'three';
|
|
18
|
+
import type { SceneCamera, SceneLight } from './scene-types';
|
|
19
|
+
/** Build a Three.js light from a `SceneLight` descriptor. */
|
|
20
|
+
export declare function createLight(def: SceneLight): THREE.Light;
|
|
21
|
+
/** Build a Three.js camera from a `SceneCamera` descriptor. */
|
|
22
|
+
export declare function createCamera(def: SceneCamera): THREE.Camera;
|
|
23
|
+
//# sourceMappingURL=light-camera-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"light-camera-factory.d.ts","sourceRoot":"","sources":["../../src/scene/light-camera-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI7D,6DAA6D;AAC7D,wBAAgB,WAAW,CAAC,GAAG,EAAE,UAAU,GAAG,KAAK,CAAC,KAAK,CAsCxD;AAED,+DAA+D;AAC/D,wBAAgB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,KAAK,CAAC,MAAM,CAoB3D"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared light + camera factory (T1.13 — DEFAULTS truth).
|
|
3
|
+
*
|
|
4
|
+
* `createLight`/`createCamera` used to be duplicated verbatim between the
|
|
5
|
+
* runtime loader (`scene-loader.ts`) and the editor preview
|
|
6
|
+
* (`entity-factory.ts`) — both hardcoded the same fallback literals (color
|
|
7
|
+
* '#ffffff', fov 60, near 0.1, far 1000, etc.) that happened to agree with
|
|
8
|
+
* `DEFAULTS.light`/`DEFAULTS.camera` by luck rather than by reading them. Any
|
|
9
|
+
* edit to one copy (or to `DEFAULTS`) could silently diverge from the other.
|
|
10
|
+
*
|
|
11
|
+
* This module is now the ONE place that builds a `THREE.Light`/`THREE.Camera`
|
|
12
|
+
* from a `SceneLight`/`SceneCamera` descriptor, reading its fallbacks from
|
|
13
|
+
* `DEFAULTS` (the single source of truth for scene default values — see
|
|
14
|
+
* `scene/defaults.ts`). Both the loader and the editor import it, so they
|
|
15
|
+
* can no longer disagree.
|
|
16
|
+
*/
|
|
17
|
+
import * as THREE from 'three';
|
|
18
|
+
// F2 (docs/VSCN-STRUCTURAL-GAPS-DESIGN.md) — area lights. `RectAreaLight`
|
|
19
|
+
// requires its LTC lookup-texture uniforms initialized once before the first
|
|
20
|
+
// instance is constructed; three.js ships that setup as an addon, not part
|
|
21
|
+
// of core. Imported via the `three/addons/*` alias (package.json `exports`:
|
|
22
|
+
// `"./addons/*": "./examples/jsm/*"` — the identical file as
|
|
23
|
+
// `three/examples/jsm/lights/RectAreaLightUniformsLib.js`) because a literal
|
|
24
|
+
// `/examples/` specifier trips `engine-host-no-game-imports.test.ts`'s
|
|
25
|
+
// game/editor-example guard (a same-substring false positive against this
|
|
26
|
+
// repo's OWN `packages/editor/template/src/examples/` convention, unrelated
|
|
27
|
+
// to three.js's addon folder naming).
|
|
28
|
+
import { RectAreaLightUniformsLib } from 'three/addons/lights/RectAreaLightUniformsLib.js';
|
|
29
|
+
import { DEFAULTS } from './defaults';
|
|
30
|
+
let rectAreaLightUniformsInitialized = false;
|
|
31
|
+
/** Build a Three.js light from a `SceneLight` descriptor. */
|
|
32
|
+
export function createLight(def) {
|
|
33
|
+
const d = DEFAULTS.light;
|
|
34
|
+
const color = def.color ?? d.color;
|
|
35
|
+
const intensity = def.intensity ?? d.intensity;
|
|
36
|
+
switch (def.type) {
|
|
37
|
+
case 'directional':
|
|
38
|
+
return new THREE.DirectionalLight(color, intensity);
|
|
39
|
+
case 'point':
|
|
40
|
+
return new THREE.PointLight(color, intensity, def.distance ?? d.distance);
|
|
41
|
+
case 'spot':
|
|
42
|
+
return new THREE.SpotLight(color, intensity, def.distance ?? d.distance, def.angle ?? d.angle, def.penumbra ?? d.penumbra);
|
|
43
|
+
case 'hemisphere':
|
|
44
|
+
return new THREE.HemisphereLight(color, def.groundColor ?? d.groundColor, intensity);
|
|
45
|
+
case 'area': {
|
|
46
|
+
// No shadow map is ever wired for this light (RectAreaLight does not
|
|
47
|
+
// support shadows in three.js — see the honesty note on the schema
|
|
48
|
+
// field's .describe(); degrade loudly, not silently).
|
|
49
|
+
if (!rectAreaLightUniformsInitialized) {
|
|
50
|
+
RectAreaLightUniformsLib.init();
|
|
51
|
+
rectAreaLightUniformsInitialized = true;
|
|
52
|
+
}
|
|
53
|
+
return new THREE.RectAreaLight(color, intensity, def.width ?? d.width, def.height ?? d.height);
|
|
54
|
+
}
|
|
55
|
+
default:
|
|
56
|
+
return new THREE.DirectionalLight(color, intensity);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** Build a Three.js camera from a `SceneCamera` descriptor. */
|
|
60
|
+
export function createCamera(def) {
|
|
61
|
+
const d = DEFAULTS.camera;
|
|
62
|
+
const aspect = (def.width ?? d.width) / (def.height ?? d.height);
|
|
63
|
+
if (def.type === 'orthographic') {
|
|
64
|
+
const size = def.orthoSize ?? d.orthoSize;
|
|
65
|
+
return new THREE.OrthographicCamera(-size * aspect, size * aspect, size, -size, def.near ?? d.near, def.far ?? d.far);
|
|
66
|
+
}
|
|
67
|
+
return new THREE.PerspectiveCamera(def.fov ?? d.fov, aspect, def.near ?? d.near, def.far ?? d.far);
|
|
68
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { SceneMaterial, SceneMesh } from './scene-types';
|
|
3
|
+
/**
|
|
4
|
+
* Single source of truth for turning a `SceneMesh` / `SceneMaterial` descriptor
|
|
5
|
+
* into Three.js geometry/material. Both the runtime scene-loader and the editor's
|
|
6
|
+
* entity-factory import these, so the editor preview renders exactly what the game
|
|
7
|
+
* renders (the WYSIWYG guarantee in ARCHITECTURE.md). Previously these were
|
|
8
|
+
* copy-pasted in two places and had to be hand-synced — any new material feature
|
|
9
|
+
* added to one and not the other silently broke that guarantee.
|
|
10
|
+
*
|
|
11
|
+
* Callers must have imported the side-effect registration modules
|
|
12
|
+
* (`./geometries`, `./materials`, plus any custom defs) so `buildGeneratedGeometry`
|
|
13
|
+
* and `buildCustomMaterial` resolve their registries.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createGeometry(mesh: SceneMesh): THREE.BufferGeometry;
|
|
16
|
+
export declare function createMaterial(mat?: SceneMaterial): THREE.Material;
|
|
17
|
+
//# sourceMappingURL=material-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"material-factory.d.ts","sourceRoot":"","sources":["../../src/scene/material-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE9D;;;;;;;;;;;GAWG;AAEH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,KAAK,CAAC,cAAc,CAwBpE;AAGD,wBAAgB,cAAc,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,KAAK,CAAC,QAAQ,CAmKlE"}
|