@threenative/core 0.3.6 → 0.3.9
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 -5
- package/capabilities.json +739 -50
- package/dist/{assets-CqvE429w.d.ts → assets-YUbXa3-Y.d.ts} +101 -2
- package/dist/{canvas-layer-C1-5CviZ.d.ts → canvas-layer-vCtanIeB.d.ts} +1 -1
- package/dist/{game-Jz4Fdoeb.d.ts → game-cb99J-YE.d.ts} +100 -31
- package/dist/hot.d.ts +4 -4
- package/dist/hot.js +23 -5
- package/dist/index.d.ts +1742 -29
- package/dist/index.js +22443 -12423
- package/dist/{model-lod-BDAUYgsS.d.ts → model-lod-CTpZ6imz.d.ts} +1 -1
- package/dist/net.js +39 -12
- package/dist/playtest.d.ts +4 -4
- package/dist/playtest.js +48 -9
- package/dist/react-css.js +23 -0
- package/dist/react.d.ts +2 -2
- package/dist/{renderer-9yEo9hPa.d.ts → renderer-rZm0hVqq.d.ts} +178 -5
- package/dist/ui-layer.d.ts +11 -2
- package/dist/ui-layer.js +76 -4
- package/dist/worker.d.ts +36 -0
- package/dist/worker.js +1088 -0
- package/dist/world.d.ts +11 -3
- package/dist/world.js +1117 -197
- package/mcp/animation-server.mjs +265 -0
- package/mcp/animation.mjs +22 -0
- package/mcp/call.mjs +105 -0
- package/mcp/devtools.mjs +5 -0
- package/mcp/engine-server.mjs +713 -37
- package/mcp/launch.mjs +3 -2
- package/mcp/servers.d.mts +2 -0
- package/mcp/servers.mjs +33 -8
- package/package.json +12 -8
- package/patches/three@0.185.1-prd269-upgrade.patch +308 -0
- package/patches/three@0.185.1.patch +481 -272
- package/src/animation-packet-state.ts +88 -0
- package/src/animation-pose-packet.ts +537 -0
- package/src/animation.ts +779 -31
- package/src/asset-cache.ts +719 -0
- package/src/assets.ts +521 -152
- package/src/audio.ts +29 -3
- package/src/auto-batch.ts +792 -0
- package/src/config.ts +2 -0
- package/src/frame-budget.ts +268 -2
- package/src/game.ts +525 -105
- package/src/grounding.ts +7 -6
- package/src/hot.ts +19 -5
- package/src/index.ts +381 -6
- package/src/input.ts +21 -2
- package/src/interpolation.ts +19 -1
- package/src/launch-diagnostics.ts +7 -2
- package/src/look/ao-multibounce.ts +29 -0
- package/src/look/ao-reach.ts +39 -0
- package/src/look/auto-exposure.ts +264 -0
- package/src/look/default-tone-mapping.ts +44 -0
- package/src/look/exposure-graph.ts +208 -0
- package/src/look/exposure-readback.ts +97 -0
- package/src/look/exposure-settings.ts +132 -0
- package/src/look/filmic-tone-mapping.ts +852 -0
- package/src/look/gi-registry.ts +55 -0
- package/src/look/local-exposure.ts +507 -0
- package/src/look/look-diagnostics.ts +24 -0
- package/src/look/motion-blur.ts +42 -0
- package/src/look/quality.ts +309 -0
- package/src/look/reflection-trace.ts +344 -0
- package/src/look/unreal-bloom.ts +295 -0
- package/src/look/vignette.ts +14 -0
- package/src/look/world-environment.ts +2033 -0
- package/src/loop.ts +25 -1
- package/src/merge-parts.ts +25 -10
- package/src/model-lod.ts +14 -0
- package/src/net-session.ts +58 -14
- package/src/ocean/spectral.ts +41 -7
- package/src/picking.ts +72 -5
- package/src/platform.ts +29 -1
- package/src/playtest.ts +54 -8
- package/src/profiling/FrameCounters.ts +166 -5
- package/src/profiling/FrameStages.ts +289 -0
- package/src/profiling/Spans.ts +39 -25
- package/src/profiling/debug-telemetry.ts +312 -0
- package/src/profiling/scene-warning.ts +42 -6
- package/src/projection-apply.ts +11 -3
- package/src/projection-content.ts +189 -0
- package/src/projection-marker.ts +6 -2
- package/src/projection-plan.ts +279 -28
- package/src/projection-skinned.ts +620 -5
- package/src/projection-stability.ts +16 -0
- package/src/projection-uniform.ts +5 -1
- package/src/quiet-markers.ts +56 -0
- package/src/render/budget-ladder.ts +256 -0
- package/src/render/chain.ts +89 -7
- package/src/render/exposure-units.ts +59 -0
- package/src/render/frame-time-budget.ts +162 -0
- package/src/render/gi-budget.ts +231 -0
- package/src/render/gi-visualize.ts +49 -0
- package/src/render/material-key.ts +1 -0
- package/src/render/probe-volume.ts +196 -36
- package/src/render/rough-diffuse.ts +177 -0
- package/src/render/scene-trace.ts +532 -0
- package/src/render/shadow-filter-budget.ts +237 -0
- package/src/render/sky-capture.ts +194 -0
- package/src/render/soft-shadow.ts +607 -0
- package/src/render/surface-cache.ts +418 -0
- package/src/render/traced-reflections.ts +408 -0
- package/src/render/two-sided-foliage.ts +120 -0
- package/src/render/virtual-shadow-pages.ts +112 -12
- package/src/render/virtual-shadow.ts +386 -38
- package/src/render-camera-cull.ts +536 -31
- package/src/render-pass-budget.ts +140 -22
- package/src/renderProjection.ts +65 -9
- package/src/renderer-config.ts +3 -2
- package/src/renderer.ts +289 -14
- package/src/resolution-scaler.ts +65 -7
- package/src/skeletal-mesh.ts +4 -0
- package/src/snow-field.ts +46 -0
- package/src/softbody.ts +6 -5
- package/src/startup-offscreen-bytes.ts +168 -0
- package/src/startup-readiness.ts +137 -2
- package/src/ui-bridge.ts +38 -0
- package/src/ui-hit-regions.ts +6 -2
- package/src/ui-layer.ts +1 -0
- package/src/ui-state.ts +32 -3
- package/src/version.ts +1 -1
- package/src/viewport.ts +8 -5
- package/src/warmup.ts +76 -10
- package/src/worker-audio.ts +579 -0
- package/src/worker.ts +842 -0
- package/src/world-cells.ts +4 -1
- package/gpl/LICENSE.GPL +0 -117
- package/gpl/convert.py +0 -192
- package/gpl/fixtures/make_world_fixture.py +0 -184
- package/gpl/recipes/_common.py +0 -180
- package/gpl/recipes/bake_ao.py +0 -111
- package/gpl/recipes/decimate.py +0 -70
- package/gpl/recipes/export_world.py +0 -699
- package/gpl/recipes/retarget.py +0 -131
- package/gpl/recipes/unwrap.py +0 -71
- package/mcp/blender-server.mjs +0 -689
- package/mcp/blender.mjs +0 -26
package/src/audio.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
AudioListener,
|
|
3
|
+
Object3D,
|
|
4
|
+
PositionalAudio,
|
|
5
|
+
Audio as ThreeAudio,
|
|
6
|
+
AudioContext as ThreeAudioContext,
|
|
7
|
+
type Vector3,
|
|
8
|
+
} from "three";
|
|
9
|
+
import { hostGestureTarget, hostWindow } from "./platform.js";
|
|
2
10
|
|
|
3
11
|
/**
|
|
4
12
|
* Bus-level dynamics compression, every value the game's.
|
|
@@ -225,6 +233,19 @@ type PooledVoice = {
|
|
|
225
233
|
positional: boolean;
|
|
226
234
|
};
|
|
227
235
|
|
|
236
|
+
/**
|
|
237
|
+
* three's `AudioContext.getContext()` reads `window.AudioContext`. A worker has no `window`: its host
|
|
238
|
+
* installs `globalThis.AudioContext` instead, so a game on the three.js engine adopts that one.
|
|
239
|
+
*/
|
|
240
|
+
function adoptWorkerAudioContext(): void {
|
|
241
|
+
if (hostWindow() !== undefined || typeof globalThis.AudioContext !== "function") return;
|
|
242
|
+
try {
|
|
243
|
+
ThreeAudioContext.getContext();
|
|
244
|
+
} catch {
|
|
245
|
+
ThreeAudioContext.setContext(new globalThis.AudioContext());
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
228
249
|
export class AudioBus {
|
|
229
250
|
readonly listener: AudioListener;
|
|
230
251
|
#camera: Object3D;
|
|
@@ -253,9 +274,10 @@ export class AudioBus {
|
|
|
253
274
|
throw new RangeError("maxVoices must be a positive integer.");
|
|
254
275
|
this.#maxVoices = maxVoices;
|
|
255
276
|
this.#camera = options.camera;
|
|
277
|
+
if (options.listener === undefined) adoptWorkerAudioContext();
|
|
256
278
|
this.listener = options.listener ?? new AudioListener();
|
|
257
279
|
if (options.compressor !== undefined) this.#installCompressor(options.compressor);
|
|
258
|
-
const source = options.source ??
|
|
280
|
+
const source = options.source ?? hostGestureTarget;
|
|
259
281
|
this.#gestureTarget = options.gestureTarget ?? source();
|
|
260
282
|
this.setCamera(options.camera);
|
|
261
283
|
this.#gesture = () => {
|
|
@@ -697,7 +719,11 @@ export class AudioBus {
|
|
|
697
719
|
#retire(entry: PooledVoice): void {
|
|
698
720
|
const voice = entry.voice;
|
|
699
721
|
try {
|
|
700
|
-
|
|
722
|
+
// Always stop, not only while playing: a paused voice was stopped at the node level but
|
|
723
|
+
// three still holds its playback progress, and the next cue on this pooled voice would
|
|
724
|
+
// otherwise start at that offset. `stop()` resets progress before it touches the source,
|
|
725
|
+
// so a source that is already stopped is harmless here.
|
|
726
|
+
voice.stop();
|
|
701
727
|
} catch {}
|
|
702
728
|
this.#voices.delete(voice);
|
|
703
729
|
// Out of whatever scene graph it was parented into. Skipping this is the whole bug: the
|