@threenative/core 0.3.5 → 0.3.8
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-Bj8G1wmD.d.ts → game-cb99J-YE.d.ts} +112 -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 +22445 -12411
- 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 +59 -10
- 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 +544 -106
- 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 +40 -6
- 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 +69 -12
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Camera, Object3D, Mesh, BufferGeometry } from 'three';
|
|
2
|
-
import { I as IRendererLike, a as IFrameBudgetWindow, b as IFrameBudgetSimulation } from './renderer-
|
|
2
|
+
import { I as IRendererLike, a as IFrameBudgetWindow, b as IFrameBudgetSimulation } from './renderer-rZm0hVqq.js';
|
|
3
3
|
|
|
4
4
|
/** One simulation that can yield its compute work. */
|
|
5
5
|
interface IBudgetCandidate {
|
package/dist/net.js
CHANGED
|
@@ -267,6 +267,12 @@ async function openConnection(url, normalized) {
|
|
|
267
267
|
});
|
|
268
268
|
try {
|
|
269
269
|
await Promise.race([Promise.resolve(transport.ready), deadline, cancelled]);
|
|
270
|
+
} catch (error) {
|
|
271
|
+
try {
|
|
272
|
+
transport.close();
|
|
273
|
+
} catch {
|
|
274
|
+
}
|
|
275
|
+
throw error;
|
|
270
276
|
} finally {
|
|
271
277
|
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
272
278
|
normalized.signal?.removeEventListener("abort", onAbort);
|
|
@@ -276,11 +282,24 @@ async function openConnection(url, normalized) {
|
|
|
276
282
|
}
|
|
277
283
|
async function establishSession(transport, normalized) {
|
|
278
284
|
const abort = new AbortController();
|
|
279
|
-
|
|
285
|
+
let timedOut = false;
|
|
286
|
+
const timer = setTimeout(() => {
|
|
287
|
+
timedOut = true;
|
|
288
|
+
abort.abort();
|
|
289
|
+
}, normalized.connectTimeoutMs);
|
|
290
|
+
const onCallerAbort = () => abort.abort();
|
|
291
|
+
normalized.signal?.addEventListener("abort", onCallerAbort, { once: true });
|
|
292
|
+
const interrupted = new Promise((_, reject) => {
|
|
293
|
+
const fail = () => reject(new Error("TN_NET_INTERRUPTED: establishment aborted"));
|
|
294
|
+
if (abort.signal.aborted) fail();
|
|
295
|
+
else abort.signal.addEventListener("abort", fail, { once: true });
|
|
296
|
+
});
|
|
297
|
+
interrupted.catch(() => void 0);
|
|
298
|
+
const bounded = (operation) => Promise.race([Promise.resolve(operation), interrupted]);
|
|
280
299
|
const readers = [];
|
|
281
300
|
const writers = [];
|
|
282
301
|
try {
|
|
283
|
-
const controlStream = await
|
|
302
|
+
const controlStream = await bounded(transport.createBidirectionalStream());
|
|
284
303
|
writers.push(controlStream.writable);
|
|
285
304
|
const controlReader = new FrameReader(controlStream.readable, MAX_HELLO_BYTES);
|
|
286
305
|
readers.push(controlReader);
|
|
@@ -299,7 +318,7 @@ async function establishSession(transport, normalized) {
|
|
|
299
318
|
);
|
|
300
319
|
if (helloPayload.length > MAX_HELLO_BYTES)
|
|
301
320
|
throw invalidArgument("handshake payload exceeds 4096 bytes");
|
|
302
|
-
await writeAll(controlStream.writable, encodeFrame(KIND_HELLO, 0, helloPayload));
|
|
321
|
+
await bounded(writeAll(controlStream.writable, encodeFrame(KIND_HELLO, 0, helloPayload)));
|
|
303
322
|
const welcomeFrame = await controlReader.nextFrame(abort.signal);
|
|
304
323
|
if (welcomeFrame.kind !== KIND_WELCOME || welcomeFrame.channel !== 0)
|
|
305
324
|
throw new Error("TN_NET_PROTOCOL: expected WELCOME");
|
|
@@ -323,11 +342,13 @@ async function establishSession(transport, normalized) {
|
|
|
323
342
|
const reliableReaders = /* @__PURE__ */ new Map();
|
|
324
343
|
const reliableWriters = /* @__PURE__ */ new Map();
|
|
325
344
|
for (const channelId of reliableIds) {
|
|
326
|
-
const stream = await
|
|
345
|
+
const stream = await bounded(transport.createBidirectionalStream());
|
|
327
346
|
writers.push(stream.writable);
|
|
328
347
|
const reader = new FrameReader(stream.readable, messageLimit);
|
|
329
348
|
readers.push(reader);
|
|
330
|
-
await
|
|
349
|
+
await bounded(
|
|
350
|
+
writeAll(stream.writable, encodeFrame(KIND_BIND, channelId, new Uint8Array(0)))
|
|
351
|
+
);
|
|
331
352
|
const bound = await reader.nextFrame(abort.signal);
|
|
332
353
|
if (bound.kind !== KIND_BOUND || bound.channel !== channelId)
|
|
333
354
|
throw new Error("TN_NET_PROTOCOL: expected BOUND");
|
|
@@ -336,6 +357,7 @@ async function establishSession(transport, normalized) {
|
|
|
336
357
|
reliableWriters.set(channelId, stream.writable);
|
|
337
358
|
}
|
|
338
359
|
clearTimeout(timer);
|
|
360
|
+
normalized.signal?.removeEventListener("abort", onCallerAbort);
|
|
339
361
|
return createConnection({
|
|
340
362
|
transport,
|
|
341
363
|
channelById: new Map(normalized.channels.map((channel) => [channel.id, channel.delivery])),
|
|
@@ -350,9 +372,13 @@ async function establishSession(transport, normalized) {
|
|
|
350
372
|
});
|
|
351
373
|
} catch (error) {
|
|
352
374
|
clearTimeout(timer);
|
|
375
|
+
normalized.signal?.removeEventListener("abort", onCallerAbort);
|
|
353
376
|
abort.abort();
|
|
354
377
|
for (const reader of readers) {
|
|
355
|
-
await
|
|
378
|
+
await Promise.race([
|
|
379
|
+
reader.cancel(error).catch(() => void 0),
|
|
380
|
+
new Promise((resolve) => setTimeout(resolve, 50))
|
|
381
|
+
]);
|
|
356
382
|
reader.release();
|
|
357
383
|
}
|
|
358
384
|
try {
|
|
@@ -360,6 +386,7 @@ async function establishSession(transport, normalized) {
|
|
|
360
386
|
} catch {
|
|
361
387
|
}
|
|
362
388
|
if (normalized.signal?.aborted) throw new Error("TN_NET_CANCELLED: aborted");
|
|
389
|
+
if (timedOut) throw new Error("TN_NET_TIMEOUT: connect timed out");
|
|
363
390
|
if (error instanceof Error && error.message.startsWith("TN_NET_")) throw error;
|
|
364
391
|
if (error instanceof Error) throw new Error(`TN_NET_PROTOCOL: ${error.message}`);
|
|
365
392
|
throw new Error("TN_NET_UNAVAILABLE: handshake failed");
|
|
@@ -408,7 +435,6 @@ function createConnection(established) {
|
|
|
408
435
|
const enqueueReceived = (channel, data) => {
|
|
409
436
|
const delivery = established.channelById.get(channel);
|
|
410
437
|
if (delivery === "reliable-ordered") {
|
|
411
|
-
if (queuedReliableBytesReceived + data.length > established.maxQueuedReliableBytes) return;
|
|
412
438
|
queuedReliableBytesReceived += data.length;
|
|
413
439
|
receiveQueue.push({ channel, data });
|
|
414
440
|
return;
|
|
@@ -434,14 +460,15 @@ function createConnection(established) {
|
|
|
434
460
|
try {
|
|
435
461
|
for (; ; ) {
|
|
436
462
|
if (state !== "connected") return;
|
|
437
|
-
if (queuedReliableBytesReceived >= established.maxQueuedReliableBytes) {
|
|
438
|
-
await new Promise((resolve) => setTimeout(resolve, 5));
|
|
439
|
-
continue;
|
|
440
|
-
}
|
|
441
463
|
const frame = await reader.nextFrame();
|
|
442
464
|
if (frame.kind !== KIND_DATA || frame.channel !== channelId)
|
|
443
465
|
throw new Error("TN_NET_PROTOCOL: wrong stream frame");
|
|
444
|
-
|
|
466
|
+
const payload = frame.payload.slice();
|
|
467
|
+
while (state === "connected" && queuedReliableBytesReceived + payload.length > established.maxQueuedReliableBytes) {
|
|
468
|
+
await new Promise((resolve) => setTimeout(resolve, 5));
|
|
469
|
+
}
|
|
470
|
+
if (state !== "connected") return;
|
|
471
|
+
enqueueReceived(frame.channel, payload);
|
|
445
472
|
}
|
|
446
473
|
} catch {
|
|
447
474
|
if (state === "connected") markDisconnected("transport error");
|
package/dist/playtest.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { JsonValue, JsonPrimitive } from '@threenative/playtest/protocol';
|
|
2
2
|
export { PLAYTEST_CLOCK_GLOBAL } from '@threenative/playtest/protocol';
|
|
3
|
-
import { a as IGamePluginHooks } from './game-
|
|
4
|
-
import './assets-
|
|
3
|
+
import { a as IGamePluginHooks } from './game-cb99J-YE.js';
|
|
4
|
+
import './assets-YUbXa3-Y.js';
|
|
5
5
|
import 'three';
|
|
6
|
-
import './renderer-
|
|
6
|
+
import './renderer-rZm0hVqq.js';
|
|
7
7
|
import 'three/webgpu';
|
|
8
|
-
import './canvas-layer-
|
|
8
|
+
import './canvas-layer-vCtanIeB.js';
|
|
9
9
|
import 'zustand/vanilla';
|
|
10
10
|
|
|
11
11
|
/**
|
package/dist/playtest.js
CHANGED
|
@@ -43,11 +43,16 @@ new Vector3();
|
|
|
43
43
|
new Vector3();
|
|
44
44
|
|
|
45
45
|
// src/version.ts
|
|
46
|
-
var CORE_VERSION = "0.3.
|
|
46
|
+
var CORE_VERSION = "0.3.8";
|
|
47
47
|
|
|
48
48
|
// src/pipeline-census.ts
|
|
49
49
|
var PIPELINE_CENSUS_CAPABILITY = "runtime.pipelineCensus";
|
|
50
50
|
|
|
51
|
+
// src/profiling/FrameCounters.ts
|
|
52
|
+
function discardEngineCountsSinceLastFrame(host = globalThis) {
|
|
53
|
+
host.__tnEngineCounterRebase?.();
|
|
54
|
+
}
|
|
55
|
+
|
|
51
56
|
// src/render/chain.ts
|
|
52
57
|
var REPORT_KEY = /* @__PURE__ */ Symbol.for("threenative.renderChain.report");
|
|
53
58
|
function storedReport(target) {
|
|
@@ -112,7 +117,17 @@ function playtest(options = {}) {
|
|
|
112
117
|
// The live clock has to be driven by the host's own frame pump, so a live run's `advance`
|
|
113
118
|
// waits the span of wall time the count names and reports the ticks that pump ran.
|
|
114
119
|
...runtime === void 0 ? {} : {
|
|
115
|
-
fixedStep: (ticks, options2) =>
|
|
120
|
+
fixedStep: async (ticks, options2) => {
|
|
121
|
+
await runtime.sceneTransition?.();
|
|
122
|
+
if (clockMode === "wall-clock" && liveAdvance !== void 0)
|
|
123
|
+
return liveAdvance(ticks);
|
|
124
|
+
let ran = runtime.fixedStep(ticks, options2);
|
|
125
|
+
while (ran > 0 && ran < ticks) {
|
|
126
|
+
await runtime.sceneTransition?.();
|
|
127
|
+
ran += runtime.fixedStep(ticks - ran, options2);
|
|
128
|
+
}
|
|
129
|
+
return ran;
|
|
130
|
+
},
|
|
116
131
|
tick: runtime.tick
|
|
117
132
|
},
|
|
118
133
|
...runtime?.runtimeDiagnosticsSeries === void 0 ? {} : { runtimeDiagnosticsSeries: runtime.runtimeDiagnosticsSeries },
|
|
@@ -146,9 +161,14 @@ function playtest(options = {}) {
|
|
|
146
161
|
progress: ctx.startup.progress,
|
|
147
162
|
...ctx.startup.warmup === void 0 ? {} : { warmup: ctx.startup.warmup },
|
|
148
163
|
...runtime?.startupCompileSettled === void 0 ? {} : { compileSettled: runtime.startupCompileSettled() },
|
|
164
|
+
...runtime?.startupRevealed === void 0 ? {} : { revealed: runtime.startupRevealed() },
|
|
149
165
|
// Wall-clock milestones, so a scenario asserts startup time as an observation instead
|
|
150
166
|
// of reading it off a console marker after the fact.
|
|
151
|
-
...runtime?.startupTimeline === void 0 ? {} : { timeline: runtime.startupTimeline() }
|
|
167
|
+
...runtime?.startupTimeline === void 0 ? {} : { timeline: runtime.startupTimeline() },
|
|
168
|
+
// What the reveal waited for that the spawn camera does not show, once the reveal ran.
|
|
169
|
+
...((offscreen) => offscreen === void 0 ? {} : {
|
|
170
|
+
offscreenBytes: { ...offscreen, top: offscreen.top.map((file) => ({ ...file })) }
|
|
171
|
+
})(runtime?.startupOffscreenBytes?.())
|
|
152
172
|
})
|
|
153
173
|
};
|
|
154
174
|
const installation = installThreePlaytestBridge(bridgeOptions);
|
|
@@ -194,7 +214,12 @@ function playtest(options = {}) {
|
|
|
194
214
|
if (!wallClock) runtime?.freezeClock?.();
|
|
195
215
|
}
|
|
196
216
|
dispose = installation.dispose;
|
|
197
|
-
attached = holdUntilAttached(
|
|
217
|
+
attached = holdUntilAttached(
|
|
218
|
+
installation.bridge,
|
|
219
|
+
options,
|
|
220
|
+
() => startSceneEntered,
|
|
221
|
+
runtime?.startSceneLoaded
|
|
222
|
+
);
|
|
198
223
|
const cleanup = () => {
|
|
199
224
|
if (!clockDisposed && clockRuntime?._setClockMode !== void 0)
|
|
200
225
|
clockControl._setClockMode("fixed-step");
|
|
@@ -248,7 +273,7 @@ function runnerAnnounced() {
|
|
|
248
273
|
const host = globalThis;
|
|
249
274
|
return host[PLAYTEST_RUNNER_EXPECTED_GLOBAL] === true || host.TN_PLAYTEST_ENDPOINT !== void 0;
|
|
250
275
|
}
|
|
251
|
-
function holdUntilAttached(bridge, options, startSceneEntered) {
|
|
276
|
+
function holdUntilAttached(bridge, options, startSceneEntered, startSceneLoaded) {
|
|
252
277
|
if (!shouldHoldUntilAttached(options)) return void 0;
|
|
253
278
|
const timeoutMs = options.attachTimeoutMs ?? PLAYTEST_ATTACH_TIMEOUT_MS;
|
|
254
279
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
@@ -282,6 +307,7 @@ function holdUntilAttached(bridge, options, startSceneEntered) {
|
|
|
282
307
|
if (applySetup !== void 0) {
|
|
283
308
|
bridge.applySetup = async (request) => {
|
|
284
309
|
try {
|
|
310
|
+
await startSceneLoaded?.();
|
|
285
311
|
const confirmation = await applySetup(request);
|
|
286
312
|
release();
|
|
287
313
|
return confirmation;
|
|
@@ -304,9 +330,15 @@ function installRuntimeChannels(bridge, runtime) {
|
|
|
304
330
|
(description) => addRuntimeCapabilities(description, runtime?.observations.contributions() ?? [])
|
|
305
331
|
);
|
|
306
332
|
const sample = bridge.sample;
|
|
307
|
-
bridge.sample = (request) => Promise.resolve(sample(request)).then(
|
|
308
|
-
|
|
309
|
-
|
|
333
|
+
bridge.sample = (request) => Promise.resolve(sample(request)).then(async (snapshot) => {
|
|
334
|
+
const observed = await addRuntimeObservations(
|
|
335
|
+
snapshot,
|
|
336
|
+
request,
|
|
337
|
+
runtime?.observations.contributions() ?? []
|
|
338
|
+
);
|
|
339
|
+
discardEngineCountsSinceLastFrame();
|
|
340
|
+
return observed;
|
|
341
|
+
});
|
|
310
342
|
}
|
|
311
343
|
function addRuntimeCapabilities(description, contributions) {
|
|
312
344
|
const capabilities = [...description.capabilities];
|
|
@@ -355,7 +387,8 @@ function bridgeEntities(ctx) {
|
|
|
355
387
|
}
|
|
356
388
|
function entityObject(entity) {
|
|
357
389
|
if (entity instanceof Object3D) return entity;
|
|
358
|
-
const
|
|
390
|
+
const roots = entity;
|
|
391
|
+
const candidate = roots?.mesh ?? roots?.object ?? roots?.group;
|
|
359
392
|
return candidate instanceof Object3D ? candidate : void 0;
|
|
360
393
|
}
|
|
361
394
|
function gameplayObservations(ctx, contactHistory, seed, replayRuntime, watcher) {
|
|
@@ -400,6 +433,7 @@ function strideObservation(value) {
|
|
|
400
433
|
return {
|
|
401
434
|
clipGroundSpeed: report.clipGroundSpeed,
|
|
402
435
|
groundSpeed: report.groundSpeed,
|
|
436
|
+
...typeof report.inPlace === "boolean" ? { inPlace: report.inPlace } : {},
|
|
403
437
|
overridden: report.overridden,
|
|
404
438
|
rate: report.rate,
|
|
405
439
|
synced: report.synced
|
|
@@ -490,7 +524,7 @@ function objectGraphValues(root) {
|
|
|
490
524
|
if (value === null || typeof value !== "object" || visited.has(value)) return;
|
|
491
525
|
visited.add(value);
|
|
492
526
|
values.push(value);
|
|
493
|
-
if (depth >= 4 || value instanceof Object3D) return;
|
|
527
|
+
if (depth >= 4 || value instanceof Object3D || ArrayBuffer.isView(value)) return;
|
|
494
528
|
for (const child of Object.values(value)) visit(child, depth + 1);
|
|
495
529
|
};
|
|
496
530
|
visit(root, 0);
|
|
@@ -527,12 +561,27 @@ function stateResources(ctx, runtime) {
|
|
|
527
561
|
// Where every asset was actually served from, on every target and not only in a browser
|
|
528
562
|
// console log: a game whose manifest never loaded runs on the uncompiled source directory
|
|
529
563
|
// and looks healthy, and without this nothing observable says so.
|
|
564
|
+
["assetCache", assetCacheReport(ctx.assets)],
|
|
530
565
|
["assets", assetResolutions(ctx.assets)],
|
|
531
566
|
...runtime?.frameCounts === void 0 ? [] : [["__threenativeFrameCounts", runtime.frameCounts()]]
|
|
532
567
|
]);
|
|
533
568
|
}
|
|
534
569
|
};
|
|
535
570
|
}
|
|
571
|
+
function assetCacheReport(assets) {
|
|
572
|
+
const cache = assets.cache;
|
|
573
|
+
return {
|
|
574
|
+
enabled: cache.enabled,
|
|
575
|
+
persisted: cache.persisted,
|
|
576
|
+
hits: cache.hits,
|
|
577
|
+
misses: cache.misses,
|
|
578
|
+
bytesOnDisk: cache.bytesOnDisk,
|
|
579
|
+
bytesTotal: cache.bytesTotal,
|
|
580
|
+
filling: cache.filling,
|
|
581
|
+
backgroundFill: cache.backgroundFill,
|
|
582
|
+
...cache.reason === void 0 ? {} : { reason: cache.reason }
|
|
583
|
+
};
|
|
584
|
+
}
|
|
536
585
|
function assetResolutions(assets) {
|
|
537
586
|
const nested = {};
|
|
538
587
|
for (const [logical, record] of assets.resolved) {
|
package/dist/react-css.js
CHANGED
|
@@ -117,12 +117,35 @@ function installInbound(scope, key, deliver) {
|
|
|
117
117
|
if (installed.receivers.size === 0 && scope[key] === installed.dispatch) scope[key] = void 0;
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
+
var LOOPBACK_KEY = "__tnUiLoopback";
|
|
121
|
+
function installLoopback(scope) {
|
|
122
|
+
const search = scope.location?.search;
|
|
123
|
+
if (typeof search !== "string" || new URLSearchParams(search).get("tnUiLoopback") !== "1") return;
|
|
124
|
+
if (scope[LOOPBACK_KEY] !== void 0) return;
|
|
125
|
+
const { port1: gamePort, port2: uiPort } = new MessageChannel();
|
|
126
|
+
const receive = (key) => (event) => scope[key]?.(event.data);
|
|
127
|
+
gamePort.onmessage = receive(UI_BRIDGE_GLOBALS.gameReceive);
|
|
128
|
+
uiPort.onmessage = receive(UI_BRIDGE_GLOBALS.uiReceive);
|
|
129
|
+
scope[UI_BRIDGE_GLOBALS.gamePost] = (frame) => gamePort.postMessage(frame);
|
|
130
|
+
scope[UI_BRIDGE_GLOBALS.uiHost] = { postMessage: (frame) => uiPort.postMessage(frame) };
|
|
131
|
+
scope.__tnUiOverlayAttached = () => true;
|
|
132
|
+
scope[LOOPBACK_KEY] = {
|
|
133
|
+
close() {
|
|
134
|
+
gamePort.close();
|
|
135
|
+
uiPort.close();
|
|
136
|
+
for (const key of [UI_BRIDGE_GLOBALS.gamePost, UI_BRIDGE_GLOBALS.uiHost, LOOPBACK_KEY])
|
|
137
|
+
scope[key] = void 0;
|
|
138
|
+
scope.__tnUiOverlayAttached = void 0;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
120
142
|
function connectUiBridge(options) {
|
|
121
143
|
const { end } = options;
|
|
122
144
|
if (end !== "game" && end !== "ui") {
|
|
123
145
|
throw new Error(`TN_UI_BRIDGE_END_INVALID: expected 'game' or 'ui', got '${String(end)}'.`);
|
|
124
146
|
}
|
|
125
147
|
const scope = options.scope ?? globalThis;
|
|
148
|
+
installLoopback(scope);
|
|
126
149
|
const listeners = /* @__PURE__ */ new Set();
|
|
127
150
|
const deliver = (frame) => {
|
|
128
151
|
const message = parseFrame(frame);
|
package/dist/react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { C as CanvasLayer } from './canvas-layer-
|
|
2
|
+
import { C as CanvasLayer } from './canvas-layer-vCtanIeB.js';
|
|
3
3
|
import 'three';
|
|
4
|
-
import './renderer-
|
|
4
|
+
import './renderer-rZm0hVqq.js';
|
|
5
5
|
import 'three/webgpu';
|
|
6
6
|
|
|
7
7
|
/**
|