@vgai/engine 0.5.21 → 0.5.23
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 +6 -3
- package/dist/adapter/adapter-module.d.ts.map +1 -1
- package/dist/adapter/adapter-module.js +2 -4
- package/dist/adapter/adapter-surface.d.ts +1 -1
- package/dist/adapter/adapter-surface.js +1 -1
- package/dist/adapter/authoring.d.ts +19 -21
- package/dist/adapter/authoring.d.ts.map +1 -1
- package/dist/adapter/authoring.js +2 -2
- package/dist/adapter/binding.d.ts +341 -0
- package/dist/adapter/binding.d.ts.map +1 -0
- package/dist/adapter/binding.js +148 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -1
- package/dist/adapter/colyseus-networking-adapter.js +23 -4
- package/dist/adapter/entrypoint-selection-readers.d.ts +24 -0
- package/dist/adapter/entrypoint-selection-readers.d.ts.map +1 -0
- package/dist/adapter/entrypoint-selection-readers.js +63 -0
- package/dist/adapter/entrypoint-selection-source.d.ts.map +1 -1
- package/dist/adapter/entrypoint-selection-source.js +1 -44
- package/dist/adapter/finders/scenes-from-entrypoint-selection.d.ts.map +1 -1
- package/dist/adapter/finders/scenes-from-entrypoint-selection.js +1 -52
- package/dist/adapter/host-context.d.ts +46 -15
- package/dist/adapter/host-context.d.ts.map +1 -1
- package/dist/adapter/host-context.js +2 -9
- package/dist/adapter/index.d.ts +11 -12
- package/dist/adapter/index.d.ts.map +1 -1
- package/dist/adapter/index.js +9 -10
- package/dist/adapter/ingest/game-contract.d.ts +0 -3
- package/dist/adapter/ingest/game-contract.d.ts.map +1 -1
- package/dist/adapter/ingest/game-contract.js +0 -3
- package/dist/adapter/ingest/scene-capture.d.ts +19 -23
- package/dist/adapter/ingest/scene-capture.d.ts.map +1 -1
- package/dist/adapter/ingest/scene-capture.js +143 -17
- package/dist/adapter/ingest/visible-capture-window.d.ts +34 -0
- package/dist/adapter/ingest/visible-capture-window.d.ts.map +1 -1
- package/dist/adapter/manifest-interpreter.d.ts +59 -0
- package/dist/adapter/manifest-interpreter.d.ts.map +1 -0
- package/dist/adapter/manifest-interpreter.js +50 -0
- package/dist/adapter/native-debug-module.d.ts +71 -3
- package/dist/adapter/native-debug-module.d.ts.map +1 -1
- package/dist/adapter/native-debug-module.js +146 -10
- package/dist/adapter/rapier-physics-adapter.d.ts +31 -1
- package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -1
- package/dist/adapter/rapier-physics-adapter.js +50 -36
- package/dist/adapter/renderer-config.d.ts +3 -3
- package/dist/adapter/renderer-config.js +3 -3
- package/dist/adapter/root-adapter.d.ts +7 -7
- package/dist/adapter/root-adapter.js +4 -4
- package/dist/adapter/system-adapter.d.ts +45 -7
- package/dist/adapter/system-adapter.d.ts.map +1 -1
- package/dist/adapter/system-seam-contract.d.ts +3 -3
- package/dist/adapter/system-seam-contract.js +3 -3
- package/dist/adapter/system-slot.d.ts +168 -0
- package/dist/adapter/system-slot.d.ts.map +1 -0
- package/dist/adapter/system-slot.js +229 -0
- package/dist/adapter/transform.d.ts +11 -1
- package/dist/adapter/transform.d.ts.map +1 -1
- package/dist/ai/navigation.d.ts +17 -1
- package/dist/ai/navigation.d.ts.map +1 -1
- package/dist/ai/navigation.js +26 -5
- package/dist/animation/anim-graph-types.d.ts +11 -3
- package/dist/animation/anim-graph-types.d.ts.map +1 -1
- package/dist/animation/theatre-clock-binding.d.ts +4 -4
- package/dist/animation/theatre-clock-binding.js +4 -4
- package/dist/animation/xstate-animation-binding.d.ts.map +1 -1
- package/dist/animation/xstate-animation-binding.js +2 -2
- package/dist/animation/xstate-animation-meta.d.ts +13 -0
- package/dist/animation/xstate-animation-meta.d.ts.map +1 -1
- package/dist/animation/xstate-animation-meta.js +14 -0
- package/dist/asset-formats/index.d.ts +4 -7
- package/dist/asset-formats/index.d.ts.map +1 -1
- package/dist/asset-formats/index.js +4 -7
- package/dist/asset-formats/render-env.d.ts +5 -8
- package/dist/asset-formats/render-env.d.ts.map +1 -1
- package/dist/asset-formats/render-env.js +3 -6
- package/dist/asset-parse-error.d.ts +2 -5
- package/dist/asset-parse-error.d.ts.map +1 -1
- package/dist/asset-parse-error.js +2 -5
- package/dist/audio/bus-mixer.d.ts +101 -0
- package/dist/audio/bus-mixer.d.ts.map +1 -0
- package/dist/audio/bus-mixer.js +115 -0
- package/dist/canvas-react/index.d.ts +5 -12
- package/dist/canvas-react/index.d.ts.map +1 -1
- package/dist/canvas-react/index.js +5 -12
- package/dist/canvas-react/pixi-react-root-factory.d.ts +34 -21
- package/dist/canvas-react/pixi-react-root-factory.d.ts.map +1 -1
- package/dist/canvas-react/pixi-react-root-factory.js +274 -36
- package/dist/core/countdown-timer.d.ts +118 -0
- package/dist/core/countdown-timer.d.ts.map +1 -0
- package/dist/core/countdown-timer.js +137 -0
- package/dist/core/deferred-commands.d.ts +127 -0
- package/dist/core/deferred-commands.d.ts.map +1 -0
- package/dist/core/deferred-commands.js +132 -0
- package/dist/core/frame-pacing.d.ts +1 -1
- package/dist/core/frame-pacing.js +2 -2
- package/dist/core/game-loop.d.ts +1 -3
- package/dist/core/game-loop.d.ts.map +1 -1
- package/dist/core/game-loop.js +1 -3
- package/dist/core/seeded-random.d.ts +1 -1
- package/dist/core/sim-clock.d.ts +19 -8
- package/dist/core/sim-clock.d.ts.map +1 -1
- package/dist/core/sim-clock.js +18 -7
- package/dist/core/types.d.ts +1 -3
- package/dist/core/types.d.ts.map +1 -1
- package/dist/defaults.d.ts +6 -14
- package/dist/defaults.d.ts.map +1 -1
- package/dist/defaults.js +6 -14
- package/dist/dev/instruments.d.ts +38 -11
- package/dist/dev/instruments.d.ts.map +1 -1
- package/dist/dev/instruments.js +81 -11
- package/dist/dev/register-render-vitals.d.ts +1 -4
- package/dist/dev/register-render-vitals.d.ts.map +1 -1
- package/dist/dev/register-render-vitals.js +1 -4
- package/dist/dev/render-debug-adapter.d.ts +2 -3
- package/dist/dev/render-debug-adapter.d.ts.map +1 -1
- package/dist/dev/render-debug-adapter.js +2 -3
- package/dist/dev/render-vitals.d.ts +3 -3
- package/dist/dev/render-vitals.js +3 -3
- package/dist/dev/webgl-frame-capture.d.ts +1 -1
- package/dist/dev/webgl-frame-capture.js +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -4
- package/dist/input/host-pointer.d.ts +122 -0
- package/dist/input/host-pointer.d.ts.map +1 -0
- package/dist/input/host-pointer.js +160 -0
- package/dist/input/input-manager.d.ts +33 -5
- package/dist/input/input-manager.d.ts.map +1 -1
- package/dist/input/input-manager.js +48 -13
- package/dist/input/rebind-controller.d.ts.map +1 -1
- package/dist/input/rebind-controller.js +6 -8
- package/dist/input/schema.d.ts.map +1 -1
- package/dist/input/schema.js +56 -28
- package/dist/manifest/filename.d.ts.map +1 -1
- package/dist/manifest/filename.js +8 -12
- package/dist/manifest/load.d.ts +10 -10
- package/dist/manifest/load.d.ts.map +1 -1
- package/dist/manifest/load.js +9 -6
- package/dist/manifest/schema.d.ts +17 -21
- package/dist/manifest/schema.d.ts.map +1 -1
- package/dist/manifest/schema.js +45 -35
- package/dist/physics/collider-dimensions.d.ts +8 -12
- package/dist/physics/collider-dimensions.d.ts.map +1 -1
- package/dist/physics/collider-dimensions.js +8 -12
- package/dist/pixi/scene-capture.d.ts +11 -13
- package/dist/pixi/scene-capture.d.ts.map +1 -1
- package/dist/react/world-state.d.ts +1 -1
- package/dist/react/world-state.d.ts.map +1 -1
- package/dist/render/directional-shadow-fit.d.ts +88 -0
- package/dist/render/directional-shadow-fit.d.ts.map +1 -0
- package/dist/render/directional-shadow-fit.js +133 -0
- package/dist/render/environment-capture.d.ts +68 -0
- package/dist/render/environment-capture.d.ts.map +1 -0
- package/dist/render/environment-capture.js +90 -0
- package/dist/render/ibl-override-material.d.ts +97 -0
- package/dist/render/ibl-override-material.d.ts.map +1 -0
- package/dist/render/ibl-override-material.js +114 -0
- package/dist/render/light-camera-factory.d.ts +5 -7
- package/dist/render/light-camera-factory.d.ts.map +1 -1
- package/dist/render/light-camera-factory.js +8 -11
- package/dist/render/material-factory.js +1 -1
- package/dist/render/render-batch-system.d.ts.map +1 -1
- package/dist/render/render-features.d.ts +17 -6
- package/dist/render/render-features.d.ts.map +1 -1
- package/dist/render/render-features.js +0 -28
- package/dist/runtime/create-runtime.d.ts +34 -25
- package/dist/runtime/create-runtime.d.ts.map +1 -1
- package/dist/runtime/create-runtime.js +218 -93
- package/dist/runtime/debug-registry.d.ts +77 -8
- package/dist/runtime/debug-registry.d.ts.map +1 -1
- package/dist/runtime/debug-registry.js +3 -3
- package/dist/runtime/dev-build.d.ts +2 -2
- package/dist/runtime/dev-build.js +2 -2
- package/dist/runtime/game-input-seams.d.ts +51 -0
- package/dist/runtime/game-input-seams.d.ts.map +1 -0
- package/dist/runtime/game-input-seams.js +86 -0
- package/dist/runtime/game.d.ts +104 -40
- package/dist/runtime/game.d.ts.map +1 -1
- package/dist/runtime/game.js +119 -61
- package/dist/runtime/mount-game.d.ts +0 -16
- package/dist/runtime/mount-game.d.ts.map +1 -1
- package/dist/runtime/mount-game.js +26 -41
- package/dist/runtime/mount-manifest.d.ts +22 -14
- package/dist/runtime/mount-manifest.d.ts.map +1 -1
- package/dist/runtime/mount-manifest.js +22 -20
- package/dist/runtime/playtest.d.ts +22 -0
- package/dist/runtime/playtest.d.ts.map +1 -0
- package/dist/runtime/playtest.js +12 -0
- package/dist/runtime/state-bridge.d.ts +2 -3
- package/dist/runtime/state-bridge.d.ts.map +1 -1
- package/dist/runtime/state-bridge.js +1 -0
- package/dist/setup/setup-audio.d.ts +12 -0
- package/dist/setup/setup-audio.d.ts.map +1 -1
- package/dist/setup/setup-audio.js +9 -10
- package/dist/setup/setup-renderer.d.ts +2 -25
- package/dist/setup/setup-renderer.d.ts.map +1 -1
- package/dist/setup/setup-renderer.js +2 -31
- package/dist/world3d-react/index.d.ts +15 -25
- package/dist/world3d-react/index.d.ts.map +1 -1
- package/dist/world3d-react/index.js +15 -25
- package/dist/world3d-react/r3f-root-factory.d.ts +28 -34
- package/dist/world3d-react/r3f-root-factory.d.ts.map +1 -1
- package/dist/world3d-react/r3f-root-factory.js +403 -57
- package/dist/world3d-react/rapier-physics-bridge.d.ts +30 -17
- package/dist/world3d-react/rapier-physics-bridge.d.ts.map +1 -1
- package/dist/world3d-react/rapier-physics-bridge.js +143 -58
- package/package.json +1 -1
- package/schemas/engine-capabilities.json +16 -14
- package/schemas/vgai-project.schema.json +35 -26
- package/src/adapter/adapter-module.ts +2 -4
- package/src/adapter/adapter-surface.ts +1 -1
- package/src/adapter/authoring.ts +19 -21
- package/src/adapter/binding.ts +468 -0
- package/src/adapter/colyseus-networking-adapter.ts +20 -5
- package/src/adapter/entrypoint-selection-readers.ts +66 -0
- package/src/adapter/entrypoint-selection-source.ts +1 -40
- package/src/adapter/finders/scenes-from-entrypoint-selection.ts +1 -48
- package/src/adapter/host-context.ts +45 -15
- package/src/adapter/index.ts +23 -11
- package/src/adapter/ingest/game-contract.ts +0 -3
- package/src/adapter/ingest/scene-capture.ts +190 -39
- package/src/adapter/ingest/visible-capture-window.ts +35 -0
- package/src/adapter/manifest-interpreter.ts +64 -0
- package/src/adapter/native-debug-module.ts +248 -15
- package/src/adapter/rapier-physics-adapter.ts +76 -20
- package/src/adapter/renderer-config.ts +3 -3
- package/src/adapter/root-adapter.ts +7 -7
- package/src/adapter/system-adapter.ts +43 -8
- package/src/adapter/system-seam-contract.ts +3 -3
- package/src/adapter/system-slot.ts +291 -0
- package/src/adapter/transform.ts +18 -1
- package/src/ai/navigation.ts +30 -3
- package/src/animation/anim-graph-types.ts +11 -3
- package/src/animation/theatre-clock-binding.ts +4 -4
- package/src/animation/xstate-animation-binding.ts +2 -2
- package/src/animation/xstate-animation-meta.ts +16 -0
- package/src/asset-formats/index.ts +4 -7
- package/src/asset-formats/render-env.ts +3 -6
- package/src/asset-parse-error.ts +2 -5
- package/src/audio/bus-mixer.ts +161 -0
- package/src/canvas-react/index.ts +5 -21
- package/src/canvas-react/pixi-react-root-factory.tsx +301 -39
- package/src/core/countdown-timer.ts +188 -0
- package/src/core/deferred-commands.ts +174 -0
- package/src/core/frame-pacing.ts +2 -2
- package/src/core/game-loop.ts +1 -3
- package/src/core/seeded-random.ts +1 -1
- package/src/core/sim-clock.ts +19 -8
- package/src/core/types.ts +1 -3
- package/src/defaults.ts +6 -14
- package/src/dev/instruments.ts +108 -11
- package/src/dev/register-render-vitals.ts +1 -4
- package/src/dev/render-debug-adapter.ts +2 -3
- package/src/dev/render-vitals.ts +3 -3
- package/src/dev/webgl-frame-capture.ts +1 -1
- package/src/index.ts +2 -5
- package/src/input/host-pointer.ts +230 -0
- package/src/input/input-manager.ts +49 -13
- package/src/input/input-types.ts +1 -1
- package/src/input/rebind-controller.ts +6 -8
- package/src/input/schema.ts +216 -188
- package/src/manifest/filename.ts +8 -12
- package/src/manifest/load.ts +17 -13
- package/src/manifest/schema.ts +55 -47
- package/src/physics/collider-dimensions.ts +8 -12
- package/src/pixi/scene-capture.ts +12 -15
- package/src/react/world-state.tsx +1 -1
- package/src/render/directional-shadow-fit.ts +156 -0
- package/src/render/environment-capture.ts +102 -0
- package/src/render/ibl-override-material.ts +170 -0
- package/src/render/light-camera-factory.ts +8 -11
- package/src/render/material-factory.ts +1 -1
- package/src/render/render-batch-system.ts +14 -6
- package/src/render/render-features.ts +17 -35
- package/src/runtime/create-runtime.ts +270 -108
- package/src/runtime/debug-registry.ts +84 -8
- package/src/runtime/dev-build.ts +2 -2
- package/src/runtime/game-input-seams.ts +108 -0
- package/src/runtime/game.ts +231 -85
- package/src/runtime/mount-game.ts +31 -57
- package/src/runtime/mount-manifest.ts +47 -36
- package/src/runtime/playtest.ts +22 -0
- package/src/runtime/state-bridge.ts +3 -3
- package/src/setup/setup-audio.ts +21 -11
- package/src/setup/setup-renderer.ts +2 -61
- package/src/world3d-react/index.ts +15 -31
- package/src/world3d-react/r3f-root-factory.tsx +451 -60
- package/src/world3d-react/rapier-physics-bridge.tsx +154 -58
- package/dist/adapter/setup-three-root-adapter.d.ts +0 -86
- package/dist/adapter/setup-three-root-adapter.d.ts.map +0 -1
- package/dist/adapter/setup-three-root-adapter.js +0 -908
- package/dist/animation/clip-map.d.ts +0 -12
- package/dist/animation/clip-map.d.ts.map +0 -1
- package/dist/animation/clip-map.js +0 -31
- package/dist/asset-registry.d.ts +0 -38
- package/dist/asset-registry.d.ts.map +0 -1
- package/dist/asset-registry.js +0 -66
- package/dist/canvas-react/engine-bridge.d.ts +0 -45
- package/dist/canvas-react/engine-bridge.d.ts.map +0 -1
- package/dist/canvas-react/engine-bridge.js +0 -45
- package/dist/canvas-react/pixi-react-adapter.d.ts +0 -77
- package/dist/canvas-react/pixi-react-adapter.d.ts.map +0 -1
- package/dist/canvas-react/pixi-react-adapter.js +0 -294
- package/dist/canvas-react/world-context.d.ts +0 -98
- package/dist/canvas-react/world-context.d.ts.map +0 -1
- package/dist/canvas-react/world-context.js +0 -173
- package/dist/dev/debug-draw.d.ts +0 -24
- package/dist/dev/debug-draw.d.ts.map +0 -1
- package/dist/dev/debug-draw.js +0 -73
- package/dist/render/auto-batcher.d.ts +0 -34
- package/dist/render/auto-batcher.d.ts.map +0 -1
- package/dist/render/auto-batcher.js +0 -140
- package/dist/render/lod.d.ts +0 -13
- package/dist/render/lod.d.ts.map +0 -1
- package/dist/render/lod.js +0 -16
- package/dist/runtime/types.d.ts +0 -303
- package/dist/runtime/types.d.ts.map +0 -1
- package/dist/runtime/types.js +0 -1
- package/dist/world3d-react/engine-bridge.d.ts +0 -47
- package/dist/world3d-react/engine-bridge.d.ts.map +0 -1
- package/dist/world3d-react/engine-bridge.js +0 -73
- package/dist/world3d-react/r3f-adapter.d.ts +0 -58
- package/dist/world3d-react/r3f-adapter.d.ts.map +0 -1
- package/dist/world3d-react/r3f-adapter.js +0 -634
- package/dist/world3d-react/world-context.d.ts +0 -182
- package/dist/world3d-react/world-context.d.ts.map +0 -1
- package/dist/world3d-react/world-context.js +0 -235
- package/src/adapter/setup-three-root-adapter.ts +0 -1032
- package/src/animation/clip-map.ts +0 -34
- package/src/asset-registry.ts +0 -89
- package/src/canvas-react/engine-bridge.ts +0 -59
- package/src/canvas-react/pixi-react-adapter.tsx +0 -356
- package/src/canvas-react/world-context.ts +0 -253
- package/src/dev/debug-draw.ts +0 -80
- package/src/render/auto-batcher.ts +0 -168
- package/src/render/lod.ts +0 -17
- package/src/runtime/types.ts +0 -328
- package/src/world3d-react/engine-bridge.ts +0 -86
- package/src/world3d-react/r3f-adapter.tsx +0 -717
- package/src/world3d-react/world-context.ts +0 -358
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// The standalone manifest-mount helper: an ENGINE-side generalization of
|
|
2
2
|
// `examples/tri-world/src/main.ts`'s hand-built `RootMountSpec[]`.
|
|
3
3
|
//
|
|
4
|
-
// `resolveAllRoots`/`
|
|
5
|
-
//
|
|
4
|
+
// `resolveAllRoots`/`resolveRootBinding` (`packages/editor/src/
|
|
5
|
+
// binding-resolver.ts`) already do this translation for the EDITOR, but they
|
|
6
6
|
// are Vite-coupled by construction (`/@fs/` dynamic imports of project files
|
|
7
7
|
// through the dev server, §0.1/§0.5 of the design doc) — unusable from a
|
|
8
8
|
// plain static build. This module mirrors their per-kind dispatch
|
|
@@ -17,15 +17,12 @@
|
|
|
17
17
|
// type-only import): this file never value-imports
|
|
18
18
|
// `pixi.js`, `react`, or `react-dom` — a
|
|
19
19
|
// canvas or react world's adapter is ALWAYS supplied already-constructed via
|
|
20
|
-
// `entries[id].adapter` (the caller's own module graph built it)
|
|
21
|
-
//
|
|
22
|
-
// `SetupThreeRootAdapter` are already unconditional dependencies of every
|
|
23
|
-
// caller of `createGameRuntime`, so wrapping a `setup` with
|
|
24
|
-
// `fromSetup` here adds no NEW bundle weight — only pixi/react are avoided.
|
|
20
|
+
// `entries[id].adapter` (the caller's own module graph built it), so no
|
|
21
|
+
// surface's library is pulled into a game that has no world on it.
|
|
25
22
|
import { assertNever } from '../adapter/adapter-surface';
|
|
23
|
+
import { declaredRoots } from '../adapter/manifest-interpreter';
|
|
26
24
|
// Value-imported from the implementer's OWN path, not the type-only
|
|
27
25
|
// `../adapter` barrel (P-6).
|
|
28
|
-
import { fromSetup } from '../adapter/setup-three-root-adapter';
|
|
29
26
|
import { loadGameManifest, } from '../manifest/load';
|
|
30
27
|
import { createGameRuntime } from './create-runtime';
|
|
31
28
|
import { maybeInstallDebugBridge } from './debug-bridge';
|
|
@@ -103,8 +100,8 @@ export function resolveManifest(raw) {
|
|
|
103
100
|
return loadGameManifest(raw);
|
|
104
101
|
}
|
|
105
102
|
// ---------------------------------------------------------------------------
|
|
106
|
-
// Per-kind entry -> adapter resolution (mirrors `
|
|
107
|
-
// per-identity dispatch, `packages/editor/src/
|
|
103
|
+
// Per-kind entry -> adapter resolution (mirrors `resolveRootBinding`'s
|
|
104
|
+
// per-identity dispatch, `packages/editor/src/binding-resolver.ts`)
|
|
108
105
|
// ---------------------------------------------------------------------------
|
|
109
106
|
function resolveThreeAdapter(world, entry) {
|
|
110
107
|
if (entry?.adapter)
|
|
@@ -124,17 +121,15 @@ function resolveThreeAdapter(world, entry) {
|
|
|
124
121
|
}
|
|
125
122
|
// type === 'default'
|
|
126
123
|
if (world.entry !== undefined) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
return fromSetup(world.id, entry.setup);
|
|
124
|
+
throw new Error(`mountManifestRoots: world "${world.id}" (three) declares \`entry\` "${world.entry}" ` +
|
|
125
|
+
`— supply entries["${world.id}"] = { kind: 'three', adapter } (for a default-exported ` +
|
|
126
|
+
'world, build it with `resolveR3FEntryAdapter(entryModule, worldId)` from ' +
|
|
127
|
+
'`@vgai/engine/world3d-react`). Got ' +
|
|
128
|
+
`${entry === undefined ? 'no entry at all' : 'an entry with no `adapter`'}.`);
|
|
134
129
|
}
|
|
135
130
|
// Unreachable in practice: `load.ts`'s `checkAdapterSceneEntryRules` requires
|
|
136
131
|
// `entry` for every 'default' THREE adapter world at manifest-load time (and
|
|
137
|
-
// rejects
|
|
132
|
+
// rejects any other content declaration on one outright).
|
|
138
133
|
throw new Error(`mountManifestRoots: world "${world.id}" is default-three with no \`entry\` — this ` +
|
|
139
134
|
'should have been rejected by manifest validation.');
|
|
140
135
|
}
|
|
@@ -166,6 +161,12 @@ function buildRootMountSpec(world, entry) {
|
|
|
166
161
|
id: world.id,
|
|
167
162
|
zOrder: world.zOrder,
|
|
168
163
|
pausable: world.pausable,
|
|
164
|
+
// `root` is this file's own resolved manifest record; the rest — the
|
|
165
|
+
// parsed `vgai.adapter.ts`, the entry namespace, the entry's declared
|
|
166
|
+
// debug/systems bindings — only the caller who loaded the entry can know.
|
|
167
|
+
...(entry?.declaration === undefined
|
|
168
|
+
? {}
|
|
169
|
+
: { declaration: { root: world, ...entry.declaration } }),
|
|
169
170
|
};
|
|
170
171
|
// `entry`'s `kind` is guaranteed to agree with `world.kind` past the guard
|
|
171
172
|
// above (or `entry` is `undefined`) — TS can't narrow a `Record` lookup
|
|
@@ -209,11 +210,12 @@ function buildRootMountSpec(world, entry) {
|
|
|
209
210
|
*/
|
|
210
211
|
export async function mountManifestRoots(opts) {
|
|
211
212
|
const manifest = resolveManifest(opts.manifest);
|
|
212
|
-
|
|
213
|
+
const mountPlan = declaredRoots(manifest);
|
|
214
|
+
if (mountPlan.length === 0) {
|
|
213
215
|
throw new Error('mountManifestRoots: manifest declares no roots — nothing to mount.');
|
|
214
216
|
}
|
|
215
217
|
const entries = opts.entries ?? {};
|
|
216
|
-
const roots =
|
|
218
|
+
const roots = mountPlan.map((world) => buildRootMountSpec(world, entries[world.id]));
|
|
217
219
|
// D15 (T-D15.1) — resolved BEFORE `createGameRuntime` (which constructs the
|
|
218
220
|
// Game, and therefore `ctx.random`, before any world's `mount()`/`setup()`
|
|
219
221
|
// runs — see `createGame`'s own doc comment): the seed must be baked in at
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHO IS PLAYING, and under what identity — the host's own declaration for one
|
|
3
|
+
* private play run or coordinated team test.
|
|
4
|
+
*
|
|
5
|
+
* Its own module because it is a PUBLISHED path: a project's Colyseus
|
|
6
|
+
* networking adapter (the `colyseus` capability, copied into every game) names
|
|
7
|
+
* this type, so it must live somewhere that survives. The engine never joins a
|
|
8
|
+
* room and never couples this authoring identity to a networking library —
|
|
9
|
+
* games may pass `roomKey` as a Colyseus filter/join option, and that is the
|
|
10
|
+
* whole of the coupling.
|
|
11
|
+
*/
|
|
12
|
+
/** Host-supplied identity for one private play run or coordinated team test.
|
|
13
|
+
* Games may pass `roomKey` as a Colyseus filter/join option; the engine never
|
|
14
|
+
* joins a room or couples this authoring identity to a networking library. */
|
|
15
|
+
export interface PlaytestContext {
|
|
16
|
+
readonly mode: 'private' | 'team';
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly roomKey: string;
|
|
19
|
+
readonly revision: number | null;
|
|
20
|
+
readonly participantId: string | null;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=playtest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playtest.d.ts","sourceRoot":"","sources":["../../src/runtime/playtest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;8EAE8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHO IS PLAYING, and under what identity — the host's own declaration for one
|
|
3
|
+
* private play run or coordinated team test.
|
|
4
|
+
*
|
|
5
|
+
* Its own module because it is a PUBLISHED path: a project's Colyseus
|
|
6
|
+
* networking adapter (the `colyseus` capability, copied into every game) names
|
|
7
|
+
* this type, so it must live somewhere that survives. The engine never joins a
|
|
8
|
+
* room and never couples this authoring identity to a networking library —
|
|
9
|
+
* games may pass `roomKey` as a Colyseus filter/join option, and that is the
|
|
10
|
+
* whole of the coupling.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
@@ -46,9 +46,8 @@ export interface GameStateBridge {
|
|
|
46
46
|
export interface GameStateBridgeInternal extends GameStateBridge {
|
|
47
47
|
/** Bump `frameVersion` by one and notify every current subscriber, in
|
|
48
48
|
* subscription order. Subscriber errors are isolated (per-subscriber
|
|
49
|
-
* try/catch, loud `console.error`, never swallowed silently)
|
|
50
|
-
*
|
|
51
|
-
* `update()` calls: one offending subscriber must not stop its siblings
|
|
49
|
+
* try/catch, loud `console.error`, never swallowed silently): one
|
|
50
|
+
* offending subscriber must not stop its siblings
|
|
52
51
|
* from being notified, and must not break the frame loop. */
|
|
53
52
|
bump(): void;
|
|
54
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-bridge.d.ts","sourceRoot":"","sources":["../../src/runtime/state-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B;;;;kEAI8D;IAC9D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;6EACyE;IACzE,SAAS,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC5C;AAED;;;;;mEAKmE;AACnE,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D
|
|
1
|
+
{"version":3,"file":"state-bridge.d.ts","sourceRoot":"","sources":["../../src/runtime/state-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B;;;;kEAI8D;IAC9D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;6EACyE;IACzE,SAAS,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC5C;AAED;;;;;mEAKmE;AACnE,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D;;;;kEAI8D;IAC9D,IAAI,IAAI,IAAI,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,uBAAuB,CA+B3D"}
|
|
@@ -54,6 +54,7 @@ export function createStateBridge() {
|
|
|
54
54
|
onFrame();
|
|
55
55
|
}
|
|
56
56
|
catch (err) {
|
|
57
|
+
// biome-ignore lint/suspicious/noConsole: a throwing subscriber must not take the notify loop down, and the console (captured by the editor session ledger) is the engine runtime's one report channel.
|
|
57
58
|
console.error('[state-bridge] subscriber threw:', err);
|
|
58
59
|
}
|
|
59
60
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
+
import { type AudioBusMixer } from '../audio/bus-mixer';
|
|
2
3
|
export interface AudioContext {
|
|
3
4
|
listener: THREE.AudioListener;
|
|
4
5
|
masterGain: GainNode;
|
|
@@ -7,6 +8,17 @@ export interface AudioContext {
|
|
|
7
8
|
sfx: GainNode;
|
|
8
9
|
voice: GainNode;
|
|
9
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* The named-bus mixer the three below are buses OF (`../audio/bus-mixer.ts`).
|
|
13
|
+
*
|
|
14
|
+
* `buses` is a fixed struct because those three names are the ones the engine
|
|
15
|
+
* itself routes; a game with an `ambience`, a `ui` or a per-character bus asks
|
|
16
|
+
* the mixer for it by name — `audio.mixer.bus('ambience', 'master')` mints it
|
|
17
|
+
* under the master gain, `audio.mixer.setDb('ambience', -6)` sets it in
|
|
18
|
+
* decibels — and `audio.mixer.disconnect()` is the ONE teardown for all of
|
|
19
|
+
* them, the three struct members included.
|
|
20
|
+
*/
|
|
21
|
+
mixer: AudioBusMixer;
|
|
10
22
|
/** Call this on first user interaction (click/key) to resume audio context */
|
|
11
23
|
resume: () => void;
|
|
12
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-audio.d.ts","sourceRoot":"","sources":["../../src/setup/setup-audio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"setup-audio.d.ts","sourceRoot":"","sources":["../../src/setup/setup-audio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,oBAAoB,CAAC;AAE7E,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC;IAC9B,UAAU,EAAE,QAAQ,CAAC;IACrB,KAAK,EAAE;QACL,KAAK,EAAE,QAAQ,CAAC;QAChB,GAAG,EAAE,QAAQ,CAAC;QACd,KAAK,EAAE,QAAQ,CAAC;KACjB,CAAC;IACF;;;;;;;;;OASG;IACH,KAAK,EAAE,aAAa,CAAC;IACrB,8EAA8E;IAC9E,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAKD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,YAAY,CAkC7D"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
+
import { createAudioBusMixer } from '../audio/bus-mixer';
|
|
3
|
+
/** The bus every other bus routes into, and the node `masterGain` is. */
|
|
4
|
+
const MASTER_BUS = 'master';
|
|
2
5
|
/**
|
|
3
6
|
* Creates the audio listener and bus hierarchy.
|
|
4
7
|
*
|
|
@@ -9,21 +12,16 @@ export function setupAudio(camera) {
|
|
|
9
12
|
const listener = new THREE.AudioListener();
|
|
10
13
|
camera.add(listener);
|
|
11
14
|
const ctx = listener.context;
|
|
12
|
-
const
|
|
13
|
-
masterGain.
|
|
15
|
+
const mixer = createAudioBusMixer({ context: ctx, destination: ctx.destination });
|
|
16
|
+
const masterGain = mixer.bus(MASTER_BUS);
|
|
14
17
|
// Route the Three.js listener through masterGain so that THREE.Audio /
|
|
15
18
|
// THREE.PositionalAudio objects are also silenced by the mute button.
|
|
16
19
|
listener.gain.disconnect();
|
|
17
20
|
listener.gain.connect(masterGain);
|
|
18
|
-
const musicGain =
|
|
21
|
+
const musicGain = mixer.bus('music', MASTER_BUS);
|
|
19
22
|
musicGain.gain.value = 0.7;
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
sfxGain.gain.value = 1.0;
|
|
23
|
-
sfxGain.connect(masterGain);
|
|
24
|
-
const voiceGain = ctx.createGain();
|
|
25
|
-
voiceGain.gain.value = 1.0;
|
|
26
|
-
voiceGain.connect(masterGain);
|
|
23
|
+
const sfxGain = mixer.bus('sfx', MASTER_BUS);
|
|
24
|
+
const voiceGain = mixer.bus('voice', MASTER_BUS);
|
|
27
25
|
return {
|
|
28
26
|
listener,
|
|
29
27
|
masterGain,
|
|
@@ -32,6 +30,7 @@ export function setupAudio(camera) {
|
|
|
32
30
|
sfx: sfxGain,
|
|
33
31
|
voice: voiceGain,
|
|
34
32
|
},
|
|
33
|
+
mixer,
|
|
35
34
|
resume() {
|
|
36
35
|
if (ctx.state === 'suspended') {
|
|
37
36
|
ctx.resume();
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import { EffectComposer } from 'postprocessing';
|
|
1
|
+
import { type EffectComposer } from 'postprocessing';
|
|
2
2
|
import * as THREE from 'three';
|
|
3
3
|
import type { RenderEnvironment } from '../asset-formats/render-env';
|
|
4
4
|
import { type RenderScope } from '../render/render-settings';
|
|
5
|
-
export interface RendererContext {
|
|
6
|
-
renderer: THREE.WebGLRenderer;
|
|
7
|
-
scene: THREE.Scene;
|
|
8
|
-
camera: THREE.PerspectiveCamera;
|
|
9
|
-
composer: EffectComposer;
|
|
10
|
-
}
|
|
11
5
|
/**
|
|
12
6
|
* Apply the live renderer-level render settings (shadows, resolution scale) from
|
|
13
7
|
* the resolved cascade. `antialias`/`backend` are reload-only (renderer re-init)
|
|
@@ -22,7 +16,7 @@ export declare function applyRendererSettings(renderer: THREE.WebGLRenderer, ren
|
|
|
22
16
|
/**
|
|
23
17
|
* Create ONLY the WebGL renderer. The HOST owns the renderer (see
|
|
24
18
|
* `ThreeHostContext.renderer`); the game/adapter owns the scene/camera/composer it
|
|
25
|
-
* renders into.
|
|
19
|
+
* renders into.
|
|
26
20
|
*
|
|
27
21
|
* `rendering` is the scene-level render scope (`env.rendering`); it seeds the
|
|
28
22
|
* reload-only `antialias` option at construction and the live shadow/resolution
|
|
@@ -39,23 +33,6 @@ export declare function createHostRenderer(canvas: HTMLCanvasElement, width?: nu
|
|
|
39
33
|
alpha?: boolean;
|
|
40
34
|
preserveDrawingBuffer?: boolean;
|
|
41
35
|
}): THREE.WebGLRenderer;
|
|
42
|
-
/**
|
|
43
|
-
* Create the scene, camera, and postprocessing composer that a first-party game
|
|
44
|
-
* renders into, given a host-provided renderer. The GPU-only `composer` is
|
|
45
|
-
* created here; a headless host (no GPU) skips this entirely.
|
|
46
|
-
*/
|
|
47
|
-
export declare function createSceneView(renderer: THREE.WebGLRenderer, width?: number, height?: number): {
|
|
48
|
-
scene: THREE.Scene;
|
|
49
|
-
camera: THREE.PerspectiveCamera;
|
|
50
|
-
composer: EffectComposer;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Creates the Three.js renderer, scene, camera, and postprocessing pipeline.
|
|
54
|
-
*
|
|
55
|
-
* This is direct Three.js setup — no abstraction. Edit freely. (Now a thin
|
|
56
|
-
* combination of {@link createHostRenderer} + {@link createSceneView}.)
|
|
57
|
-
*/
|
|
58
|
-
export declare function setupRenderer(canvas: HTMLCanvasElement, width?: number, height?: number): RendererContext;
|
|
59
36
|
/**
|
|
60
37
|
* Rebuild composer passes from scene environment settings.
|
|
61
38
|
* Scenes without toneMapping default to ACES (the runtime default).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-renderer.d.ts","sourceRoot":"","sources":["../../src/setup/setup-renderer.ts"],"names":[],"mappings":"AAGA,OAAO,EAQL,cAAc,
|
|
1
|
+
{"version":3,"file":"setup-renderer.d.ts","sourceRoot":"","sources":["../../src/setup/setup-renderer.ts"],"names":[],"mappings":"AAGA,OAAO,EAQL,KAAK,cAAc,EAoBpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,2BAA2B,CAAC;AAEpF;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,KAAK,CAAC,aAAa,EAC7B,SAAS,CAAC,EAAE,WAAW,EACvB,cAAc,SAAuC,GACpD,IAAI,CAKN;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,iBAAiB,EACzB,KAAK,SAAoB,EACzB,MAAM,SAAqB,EAC3B,SAAS,CAAC,EAAE,WAAW,EACvB,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1D,KAAK,CAAC,aAAa,CAwBrB;AAkBD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,KAAK,CAAC,aAAa,EAC7B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,GAAG,CAAC,EAAE,iBAAiB,EACvB,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,EACvC,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GACjC,IAAI,CAsVN;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,KAAK,CAAC,aAAa,EAC7B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,GAAG,CAAC,EAAE,iBAAiB,EACvB,OAAO,CAAC,EAAE;IACR,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxC,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACpC,GACA,IAAI,CAeN"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="../types-n8ao.d.ts" />
|
|
2
2
|
import { N8AOPostPass } from 'n8ao';
|
|
3
|
-
import { BloomEffect, BrightnessContrastEffect, ChromaticAberrationEffect, ColorDepthEffect, DepthOfFieldEffect, DotScreenEffect,
|
|
3
|
+
import { BloomEffect, BrightnessContrastEffect, ChromaticAberrationEffect, ColorDepthEffect, DepthOfFieldEffect, DotScreenEffect, EffectPass, GlitchEffect, GodRaysEffect, GridEffect, HueSaturationEffect, LensDistortionEffect, NoiseEffect, NormalPass, OutlineEffect, PixelationEffect, RenderPass, ScanlineEffect, SepiaEffect, ShockWaveEffect, SMAAEffect, SMAAPreset, SSAOEffect, TiltShiftEffect, VignetteEffect, } from 'postprocessing';
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { MotionBlurEffect, SSGIEffect, SSREffect, VelocityDepthNormalPass, } from '../../vendor/realism-effects/dist/index.js';
|
|
6
6
|
import { DEFAULTS } from '../defaults';
|
|
@@ -25,7 +25,7 @@ export function applyRendererSettings(renderer, rendering, basePixelRatio = Math
|
|
|
25
25
|
/**
|
|
26
26
|
* Create ONLY the WebGL renderer. The HOST owns the renderer (see
|
|
27
27
|
* `ThreeHostContext.renderer`); the game/adapter owns the scene/camera/composer it
|
|
28
|
-
* renders into.
|
|
28
|
+
* renders into.
|
|
29
29
|
*
|
|
30
30
|
* `rendering` is the scene-level render scope (`env.rendering`); it seeds the
|
|
31
31
|
* reload-only `antialias` option at construction and the live shadow/resolution
|
|
@@ -63,35 +63,6 @@ export function createHostRenderer(canvas, width = window.innerWidth, height = w
|
|
|
63
63
|
detectKtx2Support(renderer);
|
|
64
64
|
return renderer;
|
|
65
65
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Create the scene, camera, and postprocessing composer that a first-party game
|
|
68
|
-
* renders into, given a host-provided renderer. The GPU-only `composer` is
|
|
69
|
-
* created here; a headless host (no GPU) skips this entirely.
|
|
70
|
-
*/
|
|
71
|
-
export function createSceneView(renderer, width = window.innerWidth, height = window.innerHeight) {
|
|
72
|
-
const safeWidth = Math.max(1, width);
|
|
73
|
-
const safeHeight = Math.max(1, height);
|
|
74
|
-
const scene = new THREE.Scene();
|
|
75
|
-
scene.background = new THREE.Color(0x1a1a2e);
|
|
76
|
-
const camera = new THREE.PerspectiveCamera(DEFAULTS.camera.fov, safeWidth / safeHeight, DEFAULTS.camera.near, DEFAULTS.camera.far);
|
|
77
|
-
camera.position.set(0, 5, 10);
|
|
78
|
-
camera.lookAt(0, 0, 0);
|
|
79
|
-
const composer = new EffectComposer(renderer);
|
|
80
|
-
composer.addPass(new RenderPass(scene, camera));
|
|
81
|
-
composer.addPass(new EffectPass(camera, new BloomEffect({ luminanceThreshold: DEFAULTS.postProcessing.bloom.luminanceThreshold })));
|
|
82
|
-
return { scene, camera, composer };
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Creates the Three.js renderer, scene, camera, and postprocessing pipeline.
|
|
86
|
-
*
|
|
87
|
-
* This is direct Three.js setup — no abstraction. Edit freely. (Now a thin
|
|
88
|
-
* combination of {@link createHostRenderer} + {@link createSceneView}.)
|
|
89
|
-
*/
|
|
90
|
-
export function setupRenderer(canvas, width = window.innerWidth, height = window.innerHeight) {
|
|
91
|
-
const renderer = createHostRenderer(canvas, width, height);
|
|
92
|
-
const { scene, camera, composer } = createSceneView(renderer, width, height);
|
|
93
|
-
return { renderer, scene, camera, composer };
|
|
94
|
-
}
|
|
95
66
|
const toneMappingModes = {
|
|
96
67
|
none: THREE.NoToneMapping,
|
|
97
68
|
linear: THREE.LinearToneMapping,
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
* world3d-react — the react-three-fiber bridge for vgai's three surface
|
|
3
3
|
* (`@engine/world3d-react`).
|
|
4
4
|
*
|
|
5
|
-
* An OPT-IN module,
|
|
6
|
-
*
|
|
7
|
-
* decision D24 — R3F TSX is the blessed three.js authoring path). Mirrors how
|
|
8
|
-
* `pixi/` is the PixiJS surface's opt-in home: a peer surface module the engine
|
|
9
|
-
* CORE never imports (enforced by
|
|
5
|
+
* An OPT-IN module, mirroring how `pixi/` is the PixiJS surface's opt-in home:
|
|
6
|
+
* a peer surface module the engine CORE never imports (enforced by
|
|
10
7
|
* `packages/engine/test/react-core-import-ban.test.ts` — this directory is an
|
|
11
8
|
* allowed react-importing entry alongside `react/`, and core files may not
|
|
12
9
|
* import it).
|
|
@@ -14,34 +11,27 @@
|
|
|
14
11
|
* Peer contract: an importing PROJECT already depends on `react`,
|
|
15
12
|
* `@react-three/fiber`, and `three` (fiber's three must be deduped to the
|
|
16
13
|
* host's single instance — `resolve.dedupe: ['three', 'react', 'react-dom']`
|
|
17
|
-
* in the project's Vite config
|
|
18
|
-
*
|
|
19
|
-
*
|
|
14
|
+
* in the project's Vite config). The engine package deliberately declares no
|
|
15
|
+
* hard dependency on fiber: only projects that already mount through fiber
|
|
16
|
+
* ever import this module.
|
|
20
17
|
*
|
|
21
18
|
* Surface:
|
|
22
|
-
* - `
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* does not build are absent from that type — see its doc comment for what
|
|
29
|
-
* to use instead.
|
|
30
|
-
* - `EngineBridge` / `EngineBridgeValue` — the context contract, exported
|
|
31
|
-
* for advanced adopters building their own bridge.
|
|
19
|
+
* - `r3fRootFactory` / `resolveR3FEntryAdapter` — what a three entry module
|
|
20
|
+
* MEANS: a default-exported component (`export default function World()`),
|
|
21
|
+
* mounted as a first-party `kind: "three"` world under the host's gated
|
|
22
|
+
* loop. The world's vgai surface is its entry module's static exports
|
|
23
|
+
* (`export { debug, systems } from './commands'`), connected by the host
|
|
24
|
+
* at mount.
|
|
32
25
|
*
|
|
33
26
|
* Deliberately NOT re-exported here: `<RapierPhysicsBridge>`
|
|
34
|
-
* (`@engine/world3d-react/rapier-physics-bridge`), which
|
|
35
|
-
* world's `@react-three/rapier` physics
|
|
36
|
-
* `
|
|
37
|
-
* editor's transform coordination can see it. It imports
|
|
27
|
+
* (`@engine/world3d-react/rapier-physics-bridge`), which publishes an R3F
|
|
28
|
+
* world's `@react-three/rapier` physics to the module slot the entry's
|
|
29
|
+
* `systems.physics` declaration forwards — so the colliders instrument and
|
|
30
|
+
* the editor's transform coordination can see it. It imports
|
|
38
31
|
* `@react-three/rapier`, and only a world that already depends on that library
|
|
39
32
|
* should pull it into its graph; a deep import keeps this barrel's peer
|
|
40
33
|
* contract to `react`/`@react-three/fiber`/`three` alone.
|
|
41
34
|
*/
|
|
42
35
|
export { applyWorldRendererConfig, type WorldOutputColorSpace, type WorldRendererConfig, type WorldToneMapping, } from '../adapter/renderer-config';
|
|
43
|
-
export { EngineBridge, type EngineBridgeValue, useGameContext } from './engine-bridge';
|
|
44
|
-
export { type CreateR3FAdapterOptions, createR3FAdapter } from './r3f-adapter';
|
|
45
36
|
export { r3fRootFactory, resolveR3FEntryAdapter } from './r3f-root-factory';
|
|
46
|
-
export { createR3FRootContext, DEFAULT_INPUT_MAP_PATH, type R3FGameContext, type R3FRootContextOptions, type R3FRootRuntime, } from './world-context';
|
|
47
37
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/world3d-react/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/world3d-react/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EACL,wBAAwB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
* world3d-react — the react-three-fiber bridge for vgai's three surface
|
|
3
3
|
* (`@engine/world3d-react`).
|
|
4
4
|
*
|
|
5
|
-
* An OPT-IN module,
|
|
6
|
-
*
|
|
7
|
-
* decision D24 — R3F TSX is the blessed three.js authoring path). Mirrors how
|
|
8
|
-
* `pixi/` is the PixiJS surface's opt-in home: a peer surface module the engine
|
|
9
|
-
* CORE never imports (enforced by
|
|
5
|
+
* An OPT-IN module, mirroring how `pixi/` is the PixiJS surface's opt-in home:
|
|
6
|
+
* a peer surface module the engine CORE never imports (enforced by
|
|
10
7
|
* `packages/engine/test/react-core-import-ban.test.ts` — this directory is an
|
|
11
8
|
* allowed react-importing entry alongside `react/`, and core files may not
|
|
12
9
|
* import it).
|
|
@@ -14,33 +11,26 @@
|
|
|
14
11
|
* Peer contract: an importing PROJECT already depends on `react`,
|
|
15
12
|
* `@react-three/fiber`, and `three` (fiber's three must be deduped to the
|
|
16
13
|
* host's single instance — `resolve.dedupe: ['three', 'react', 'react-dom']`
|
|
17
|
-
* in the project's Vite config
|
|
18
|
-
*
|
|
19
|
-
*
|
|
14
|
+
* in the project's Vite config). The engine package deliberately declares no
|
|
15
|
+
* hard dependency on fiber: only projects that already mount through fiber
|
|
16
|
+
* ever import this module.
|
|
20
17
|
*
|
|
21
18
|
* Surface:
|
|
22
|
-
* - `
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* does not build are absent from that type — see its doc comment for what
|
|
29
|
-
* to use instead.
|
|
30
|
-
* - `EngineBridge` / `EngineBridgeValue` — the context contract, exported
|
|
31
|
-
* for advanced adopters building their own bridge.
|
|
19
|
+
* - `r3fRootFactory` / `resolveR3FEntryAdapter` — what a three entry module
|
|
20
|
+
* MEANS: a default-exported component (`export default function World()`),
|
|
21
|
+
* mounted as a first-party `kind: "three"` world under the host's gated
|
|
22
|
+
* loop. The world's vgai surface is its entry module's static exports
|
|
23
|
+
* (`export { debug, systems } from './commands'`), connected by the host
|
|
24
|
+
* at mount.
|
|
32
25
|
*
|
|
33
26
|
* Deliberately NOT re-exported here: `<RapierPhysicsBridge>`
|
|
34
|
-
* (`@engine/world3d-react/rapier-physics-bridge`), which
|
|
35
|
-
* world's `@react-three/rapier` physics
|
|
36
|
-
* `
|
|
37
|
-
* editor's transform coordination can see it. It imports
|
|
27
|
+
* (`@engine/world3d-react/rapier-physics-bridge`), which publishes an R3F
|
|
28
|
+
* world's `@react-three/rapier` physics to the module slot the entry's
|
|
29
|
+
* `systems.physics` declaration forwards — so the colliders instrument and
|
|
30
|
+
* the editor's transform coordination can see it. It imports
|
|
38
31
|
* `@react-three/rapier`, and only a world that already depends on that library
|
|
39
32
|
* should pull it into its graph; a deep import keeps this barrel's peer
|
|
40
33
|
* contract to `react`/`@react-three/fiber`/`three` alone.
|
|
41
34
|
*/
|
|
42
35
|
export { applyWorldRendererConfig, } from '../adapter/renderer-config';
|
|
43
|
-
export { EngineBridge, useGameContext } from './engine-bridge';
|
|
44
|
-
export { createR3FAdapter } from './r3f-adapter';
|
|
45
36
|
export { r3fRootFactory, resolveR3FEntryAdapter } from './r3f-root-factory';
|
|
46
|
-
export { createR3FRootContext, DEFAULT_INPUT_MAP_PATH, } from './world-context';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `r3fRootFactory` — mount a `three` root whose entry module DEFAULT-EXPORTS a
|
|
3
|
-
* React component.
|
|
4
|
-
*
|
|
5
|
-
* The idiomatic-shape fix (D26). A model asked for an R3F world writes:
|
|
3
|
+
* React component. This is the ONE first-party three mount:
|
|
6
4
|
*
|
|
7
5
|
* ```tsx
|
|
8
6
|
* export default function World() {
|
|
@@ -10,32 +8,33 @@
|
|
|
10
8
|
* }
|
|
11
9
|
* ```
|
|
12
10
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `entryModule.default` and wraps it. This is the same contract for three
|
|
21
|
-
* roots, so both surfaces answer "what do I export?" the same way.
|
|
11
|
+
* The world is an ordinary R3F app. Everything vgai-shaped stays at the entry
|
|
12
|
+
* module's STATIC surface (`export { debug, systems } from './commands'`) and
|
|
13
|
+
* on the host's side of the seam; no vgai runtime context ever enters the
|
|
14
|
+
* React tree. The host controls Fiber's `frameloop: 'never'` scheduler, wires
|
|
15
|
+
* the game-scoped input seams from outside (`../runtime/game-input-seams.ts`),
|
|
16
|
+
* and installs `WorldProvider` off the Game handle so the lib-legal react
|
|
17
|
+
* doors (`useWorldState`, `useOptionalGame`, `useDebugProvider`) resolve.
|
|
22
18
|
*
|
|
23
19
|
* ## Why this is NOT in `mount-game.ts`
|
|
24
20
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* ##
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
21
|
+
* The adapter registry module is deliberately dependency-free beyond `three`
|
|
22
|
+
* (already an unconditional engine dependency). `@react-three/fiber` is NOT —
|
|
23
|
+
* it is the PROJECT's dependency, and `world3d-react` is the opt-in module
|
|
24
|
+
* that owns it. Putting this factory beside the registry would make R3F
|
|
25
|
+
* unconditional for every game, including ones with no React at all; instead
|
|
26
|
+
* each project's `main.ts` registers it (`registerAdapter('three',
|
|
27
|
+
* r3fRootFactory)`).
|
|
28
|
+
*
|
|
29
|
+
* ## The mount mechanics (fiber v9, host-gated)
|
|
30
|
+
*
|
|
31
|
+
* three.js identity: this module never imports `three` itself for scene
|
|
32
|
+
* objects — fiber's internal `import * as THREE from 'three'` must resolve to
|
|
33
|
+
* the SAME instance the engine's `ThreeHostContext.three` points at, which the
|
|
34
|
+
* importing project guarantees via its Vite
|
|
35
|
+
* `resolve.dedupe: ['three', 'react', 'react-dom']`.
|
|
37
36
|
*/
|
|
38
|
-
import type { RootAdapter } from '../adapter
|
|
37
|
+
import type { RootAdapter } from '../adapter';
|
|
39
38
|
import type { AdapterSurfaceFactory } from '../runtime/mount-game';
|
|
40
39
|
/**
|
|
41
40
|
* What a three entry module MEANS, in one place.
|
|
@@ -43,20 +42,15 @@ import type { AdapterSurfaceFactory } from '../runtime/mount-game';
|
|
|
43
42
|
* Two callers need this answer and must never disagree about it: the runtime
|
|
44
43
|
* mount ({@link r3fRootFactory}, below) and the EDITOR's design session
|
|
45
44
|
* (`packages/editor/src/authoring/r3f-design-session.ts`), which design-mounts
|
|
46
|
-
* the same entry so edit mode authors the live fiber scene.
|
|
47
|
-
* runtime knew about the default-export shape, the converted starter played
|
|
48
|
-
* fine under `npm run game` and edit mode showed "(no scene loaded)".
|
|
45
|
+
* the same entry so edit mode authors the live fiber scene.
|
|
49
46
|
*
|
|
50
|
-
* Returns `null` when the module
|
|
51
|
-
* to do about that (the factory throws, the design
|
|
52
|
-
* and leaves existing paths alone).
|
|
47
|
+
* Returns `null` when the module has no default-exported component — the
|
|
48
|
+
* callers differ on what to do about that (the factory throws, the design
|
|
49
|
+
* session declines the world and leaves existing paths alone).
|
|
53
50
|
*/
|
|
54
51
|
export declare function resolveR3FEntryAdapter(entryModule: unknown, rootId: string): RootAdapter | null;
|
|
55
52
|
/**
|
|
56
53
|
* Register with `registerAdapter('three', r3fRootFactory)`.
|
|
57
|
-
*
|
|
58
|
-
* Resolution order mirrors `defaultThreeAdapterFactory`'s (explicit adapter
|
|
59
|
-
* wins) and then accepts the default-exported component.
|
|
60
54
|
*/
|
|
61
55
|
export declare const r3fRootFactory: AdapterSurfaceFactory;
|
|
62
56
|
//# sourceMappingURL=r3f-root-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"r3f-root-factory.d.ts","sourceRoot":"","sources":["../../src/world3d-react/r3f-root-factory.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"r3f-root-factory.d.ts","sourceRoot":"","sources":["../../src/world3d-react/r3f-root-factory.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAWH,OAAO,KAAK,EAAoB,WAAW,EAAoB,MAAM,YAAY,CAAC;AAelF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAsZnE;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAI/F;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,qBAO5B,CAAC"}
|