@threenative/core 0.3.12 → 0.3.15
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 +1 -1
- package/capabilities.json +1047 -44
- package/dist/{assets-YUbXa3-Y.d.ts → assets-CfMKnOsK.d.ts} +78 -1
- package/dist/{canvas-layer-CWuFRT7G.d.ts → canvas-layer-G7ttVy7y.d.ts} +1 -1
- package/dist/{chunk-7UUT3TY5.js → chunk-2GPHICV6.js} +1 -1
- package/dist/{chunk-GMHATRPW.js → chunk-GEMQJBY4.js} +1650 -383
- package/dist/{chunk-VAZM36TV.js → chunk-H4J6IAJE.js} +17 -10
- package/dist/{chunk-5O73CDMR.js → chunk-QAMSM3Z5.js} +415 -27
- package/dist/{chunk-2Z44XSI2.js → chunk-QAQHYOWY.js} +3 -7
- package/dist/{chunk-DBELTTTM.js → chunk-U4YHUKKL.js} +1 -1
- package/dist/{chunk-OKXUCASC.js → chunk-VBBYWGAT.js} +3 -4
- package/dist/chunk-VP43GIWW.js +18 -0
- package/dist/{chunk-N5LRP4BR.js → chunk-VQRPEOKY.js} +66 -3
- package/dist/{chunk-6KLNISRJ.js → chunk-XDTZ4QMO.js} +11 -4
- package/dist/default-tone-mapping-GgKPTiBP.d.ts +4 -0
- package/dist/{game-D7pAzZUY.d.ts → game-k8K3hZai.d.ts} +72 -8
- package/dist/hot.d.ts +5 -4
- package/dist/hot.js +5 -8
- package/dist/index.d.ts +871 -1018
- package/dist/index.js +4786 -1631
- package/dist/{model-lod-B6BMqS1r.d.ts → model-lod-DPTzeCcD.d.ts} +4 -2
- package/dist/playtest.d.ts +5 -4
- package/dist/playtest.js +6 -5
- package/dist/quality-BADStsTn.d.ts +868 -0
- package/dist/react.d.ts +3 -2
- package/dist/render-environment.d.ts +170 -0
- package/dist/render-environment.js +352 -0
- package/dist/{renderer-DvFVoAgj.d.ts → renderer-BtOSseYf.d.ts} +29 -31
- package/dist/spells/index.js +1 -1
- package/dist/ui-layer.js +3 -2
- package/dist/worker.js +12 -5
- package/dist/world.d.ts +280 -16
- package/dist/world.js +1529 -642
- package/mcp/animation-server.mjs +1 -1
- package/mcp/engine-server.mjs +135 -11
- package/mcp/servers.mjs +4 -4
- package/package.json +10 -6
- package/scripts/ensure-mcp.mjs +6 -1
- package/src/animation-batch.ts +193 -0
- package/src/animation-layers.ts +7 -3
- package/src/animation.ts +209 -29
- package/src/asset-cache.ts +3 -3
- package/src/asset-memo.ts +202 -0
- package/src/assets.ts +436 -131
- package/src/auto-batch.ts +190 -44
- package/src/clustered-batch.ts +146 -3
- package/src/clustered-mesh.ts +548 -20
- package/src/compute-driven.ts +1 -1
- package/src/config.ts +8 -0
- package/src/debug.ts +119 -22
- package/src/dev-global.ts +54 -0
- package/src/displaced-surface.ts +428 -0
- package/src/engine-hooks.ts +37 -0
- package/src/frame-budget.ts +35 -3
- package/src/game-boot-phase.ts +269 -0
- package/src/game-dev-tools.ts +7 -14
- package/src/game-frame-loop.ts +45 -82
- package/src/game-startup.ts +145 -70
- package/src/game-ui.ts +84 -0
- package/src/game.ts +168 -552
- package/src/gamepad-mappings.ts +269 -0
- package/src/generated/console-markers.ts +14 -0
- package/src/geometry-capture.ts +28 -4
- package/src/gpu-readings.ts +98 -0
- package/src/gpu-scene-bvh.ts +149 -36
- package/src/grass-field.ts +628 -0
- package/src/hot.ts +4 -7
- package/src/index.ts +227 -8
- package/src/input.ts +237 -25
- package/src/instanced-batch-lod.ts +3 -8
- package/src/interpolation.ts +171 -40
- package/src/look/ao-admission.ts +4 -3
- package/src/look/auto-exposure.ts +5 -16
- package/src/look/default-tone-mapping.ts +41 -5
- package/src/look/local-exposure.ts +2 -7
- package/src/look/quad-pass.ts +21 -0
- package/src/look/quality.ts +4 -0
- package/src/look/unreal-bloom.ts +4 -13
- package/src/look/world-environment.ts +58 -115
- package/src/merge-parts.ts +20 -24
- package/src/model-lod.ts +97 -14
- package/src/particle-significance.ts +12 -0
- package/src/particles.ts +19 -10
- package/src/platform.ts +23 -4
- package/src/profiling/FrameStages.ts +5 -6
- package/src/profiling/Spans.ts +3 -17
- package/src/profiling/debug-telemetry.ts +2 -6
- package/src/profiling/render-list-validate.ts +6 -15
- package/src/projection-marker.ts +2 -1
- package/src/quiet-markers.ts +3 -10
- package/src/render/cpu-bvh.ts +100 -0
- package/src/render/depth-pyramid.ts +6 -14
- package/src/render/environment/environmentContribution.ts +202 -0
- package/src/render/environment/environmentRadiance.ts +44 -0
- package/src/render/environment/environmentSampleCache.ts +56 -0
- package/src/render/environment/environmentSampling.ts +201 -0
- package/src/render/environment/environmentSnapshot.ts +71 -0
- package/src/render/environment/gate.ts +57 -0
- package/src/render/material-key.ts +21 -1
- package/src/render/mesh-pool.ts +3 -19
- package/src/render/probe-trace.ts +872 -0
- package/src/render/probe-volume.ts +780 -34
- package/src/render/radiance-cache.ts +17 -0
- package/src/render/screen-probe-gather.ts +303 -0
- package/src/render/short-range-ao.ts +274 -0
- package/src/render/virtual-shadow-partial.ts +13 -0
- package/src/render/virtual-shadow.ts +18 -16
- package/src/render/world-impostor-surface.ts +207 -9
- package/src/render/world-impostor.ts +5 -2
- package/src/render-camera-cull.ts +105 -4
- package/src/render-environment.ts +41 -0
- package/src/renderer-config.ts +36 -0
- package/src/renderer-facts.ts +37 -0
- package/src/renderer.ts +78 -32
- package/src/resolution-scaler.ts +3 -2
- package/src/scatter-field.ts +496 -0
- package/src/scene-entry-inspectors.ts +61 -0
- package/src/snow-field.ts +1 -0
- package/src/startup-offscreen-bytes.ts +84 -0
- package/src/state.ts +16 -3
- package/src/static-transform.ts +100 -25
- package/src/streamed-textures.ts +112 -0
- package/src/streaming.ts +68 -4
- package/src/texture-streaming.ts +331 -0
- package/src/tile-ring.ts +294 -0
- package/src/version.ts +1 -1
- package/src/warmup.ts +15 -2
- package/src/worker.ts +12 -2
- package/src/world-bundle-safety.ts +55 -10
- package/src/world-cell-batches.ts +166 -200
- package/src/world-cell-chunks.ts +3 -7
- package/src/world-cell-data.ts +7 -0
- package/src/world-cell-impostors.ts +20 -8
- package/src/world-cell-models.ts +36 -8
- package/src/world-cell-options.ts +2 -14
- package/src/world-cell-placements.ts +194 -90
- package/src/world-cell-prewarm.ts +39 -4
- package/src/world-cell-records.ts +401 -0
- package/src/world-cell-render-bundles.ts +2 -2
- package/src/world-cell-render-gpu-dress.ts +17 -19
- package/src/world-cell-render-main-cull.ts +73 -17
- package/src/world-cell-render-util.ts +18 -5
- package/src/world-cell-render.ts +13 -5
- package/src/world-cell-residency.ts +15 -6
- package/src/world-cell-stale.ts +238 -0
- package/src/world-cells.ts +23 -6
- package/src/world-gpu-flags.ts +18 -50
- package/src/world-gpu-reference.ts +22 -8
- package/src/world-gpu-scene.ts +44 -24
- package/src/world-gpu-shadow.ts +21 -8
- package/src/world-gpu-types.ts +41 -13
- package/src/world-load-limiter.ts +5 -0
- package/src/world-model-sections.ts +80 -0
- package/src/world-river-ribbon.ts +273 -0
- package/src/world-root-frame.ts +39 -0
- package/src/world-shore-field.ts +91 -0
- package/src/world-static-pose.ts +163 -0
- package/src/world-surface-sampler.ts +48 -0
- package/src/world-terrain-splat.ts +10 -18
- package/src/world-tile-budget.ts +4 -11
- package/src/world-tiles.ts +79 -12
- package/src/world-validate.ts +6 -14
- package/src/world-warm.ts +51 -0
- package/src/world-water-bodies.ts +113 -3
- package/src/world.ts +13 -0
|
@@ -1,15 +1,11 @@
|
|
|
1
|
+
import { readLaunchFlag } from './chunk-VQRPEOKY.js';
|
|
2
|
+
|
|
1
3
|
// src/quiet-markers.ts
|
|
2
4
|
var LOG_FLAG = "TN_LOG";
|
|
3
5
|
var BROWSER_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:", "file:"]);
|
|
4
6
|
var restore;
|
|
5
|
-
var isOn = (value) => value === true || typeof value === "string" && value !== "" && value !== "0" && value !== "false";
|
|
6
7
|
function markerLogRequested() {
|
|
7
|
-
|
|
8
|
-
if (isOn(host.process?.env?.[LOG_FLAG])) return true;
|
|
9
|
-
const query = globalThis.location?.search;
|
|
10
|
-
if (typeof query === "string" && /[?&]tnLog=(?!0(?:&|$))(?!false(?:&|$))[^&]/u.test(query))
|
|
11
|
-
return true;
|
|
12
|
-
return isOn(globalThis.__THREENATIVE_LOG__);
|
|
8
|
+
return readLaunchFlag({ environment: LOG_FLAG, global: "__THREENATIVE_LOG__", query: "tnLog" });
|
|
13
9
|
}
|
|
14
10
|
function installQuietMarkers() {
|
|
15
11
|
const protocol = globalThis.location?.protocol;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hostGestureTarget, hostWindow } from './chunk-
|
|
1
|
+
import { hostGestureTarget, hostWindow } from './chunk-XDTZ4QMO.js';
|
|
2
2
|
import { AudioListener, Object3D, Audio, PositionalAudio, AudioContext } from 'three';
|
|
3
3
|
|
|
4
4
|
var AUDIO_STATE = /* @__PURE__ */ Symbol.for("threenative.audio.runtime");
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { debugRequested, countDebug, isContentScaled } from './chunk-
|
|
1
|
+
import { debugRequested, countDebug, isContentScaled } from './chunk-VQRPEOKY.js';
|
|
2
2
|
import { mrt, velocity, output, context } from 'three/tsl';
|
|
3
3
|
import { BatchedMesh, DataTexture } from 'three';
|
|
4
4
|
|
|
5
|
+
// src/version.ts
|
|
6
|
+
var CORE_VERSION = "0.3.15";
|
|
5
7
|
var THREE_NATIVE_BATCHED_VELOCITY_PATCH = "threeNativeBatchedVelocityPatch";
|
|
6
8
|
function isBatchedMeshVelocityPatched() {
|
|
7
9
|
return Reflect.get(BatchedMesh, THREE_NATIVE_BATCHED_VELOCITY_PATCH) === true;
|
|
@@ -333,9 +335,6 @@ function copyInto(target, source) {
|
|
|
333
335
|
return target;
|
|
334
336
|
}
|
|
335
337
|
|
|
336
|
-
// src/version.ts
|
|
337
|
-
var CORE_VERSION = "0.3.12";
|
|
338
|
-
|
|
339
338
|
// src/pipeline-census.ts
|
|
340
339
|
var PIPELINE_CENSUS_VERSION = 1;
|
|
341
340
|
var PIPELINE_CENSUS_CAPABILITY = "runtime.pipelineCensus";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/dev-global.ts
|
|
2
|
+
var DEV_GLOBAL_KEY = "__THREENATIVE__";
|
|
3
|
+
function devGlobal(scope) {
|
|
4
|
+
const value = scope?.[DEV_GLOBAL_KEY];
|
|
5
|
+
return typeof value === "object" && value !== null ? value : void 0;
|
|
6
|
+
}
|
|
7
|
+
function publishDevGlobal(name, value, scope) {
|
|
8
|
+
const host = scope;
|
|
9
|
+
if (host === void 0) return;
|
|
10
|
+
const current = devGlobal(scope);
|
|
11
|
+
if (current !== void 0) {
|
|
12
|
+
current[name] = value;
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
host[DEV_GLOBAL_KEY] = { [name]: value };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { DEV_GLOBAL_KEY, devGlobal, publishDevGlobal };
|
|
@@ -1,3 +1,67 @@
|
|
|
1
|
+
import { devGlobal, publishDevGlobal } from './chunk-VP43GIWW.js';
|
|
2
|
+
|
|
3
|
+
// src/debug.ts
|
|
4
|
+
function envName(name) {
|
|
5
|
+
return `TN_DEBUG_${name.replace(/([a-z0-9])([A-Z])/gu, "$1_$2").toUpperCase()}`;
|
|
6
|
+
}
|
|
7
|
+
function readLaunchSeams(spec, search) {
|
|
8
|
+
const values = [];
|
|
9
|
+
if (spec.environment.length > 0) {
|
|
10
|
+
const env = envValue(spec.environment);
|
|
11
|
+
if (env !== void 0 && env !== "") values.push(env);
|
|
12
|
+
}
|
|
13
|
+
const query = search ?? globalThis.location?.search;
|
|
14
|
+
if (typeof query === "string") {
|
|
15
|
+
const fromQuery = new URLSearchParams(query).get(spec.query);
|
|
16
|
+
if (fromQuery !== null) values.push(fromQuery);
|
|
17
|
+
}
|
|
18
|
+
if (spec.global !== void 0) {
|
|
19
|
+
const fromGlobal = globalThis[spec.global];
|
|
20
|
+
if (typeof fromGlobal === "string") values.push(fromGlobal);
|
|
21
|
+
else if (typeof fromGlobal === "number") values.push(String(fromGlobal));
|
|
22
|
+
else if (typeof fromGlobal === "boolean") values.push(fromGlobal ? "true" : "false");
|
|
23
|
+
}
|
|
24
|
+
return values;
|
|
25
|
+
}
|
|
26
|
+
function isOff(value) {
|
|
27
|
+
return value === "0" || value === "false";
|
|
28
|
+
}
|
|
29
|
+
function readLaunchFlag(spec, askedFor = "on", search) {
|
|
30
|
+
const values = readLaunchSeams(spec, search);
|
|
31
|
+
return askedFor === "off" ? values.some((value) => isOff(value)) : values.some((value) => !isOff(value));
|
|
32
|
+
}
|
|
33
|
+
function readLaunchValue(spec) {
|
|
34
|
+
return readLaunchSeams(spec)[0];
|
|
35
|
+
}
|
|
36
|
+
function readLaunchValues(spec) {
|
|
37
|
+
return readLaunchSeams(spec);
|
|
38
|
+
}
|
|
39
|
+
function envValue(name) {
|
|
40
|
+
const scope = globalThis;
|
|
41
|
+
if (typeof scope !== "object" || scope === null || !("process" in scope)) return void 0;
|
|
42
|
+
const hostProcess = scope.process;
|
|
43
|
+
if (typeof hostProcess !== "object" || hostProcess === null || !("env" in hostProcess))
|
|
44
|
+
return void 0;
|
|
45
|
+
const env = hostProcess.env;
|
|
46
|
+
if (typeof env !== "object" || env === null) return void 0;
|
|
47
|
+
const value = env[name];
|
|
48
|
+
return typeof value === "string" ? value : void 0;
|
|
49
|
+
}
|
|
50
|
+
function debugFlag(name) {
|
|
51
|
+
return readLaunchFlag({ environment: envName(name), query: name });
|
|
52
|
+
}
|
|
53
|
+
function debugValue(name) {
|
|
54
|
+
return readLaunchValue({ environment: envName(name), query: name });
|
|
55
|
+
}
|
|
56
|
+
function exposeDebug(name, value) {
|
|
57
|
+
const isDev = import.meta.env?.DEV === true;
|
|
58
|
+
if (!isDev) return;
|
|
59
|
+
const tools = devGlobal(globalThis) ?? {};
|
|
60
|
+
const debug = tools.debug ?? {};
|
|
61
|
+
debug[name] = value;
|
|
62
|
+
publishDevGlobal("debug", debug, globalThis);
|
|
63
|
+
}
|
|
64
|
+
|
|
1
65
|
// src/profiling/debug-telemetry.ts
|
|
2
66
|
var CONTENT_SCALED_LIMIT = 10;
|
|
3
67
|
function isContentScaled(name) {
|
|
@@ -5,8 +69,7 @@ function isContentScaled(name) {
|
|
|
5
69
|
}
|
|
6
70
|
var DEBUG_GLOBAL = "__THREENATIVE_DEBUG__";
|
|
7
71
|
function debugRequested() {
|
|
8
|
-
|
|
9
|
-
return host.process?.env?.TN_DEBUG === "1" || globalThis[DEBUG_GLOBAL] === true || /[?&]tnDebug=1(?:&|$)/u.test(globalThis.location?.search ?? "");
|
|
72
|
+
return readLaunchFlag({ environment: "TN_DEBUG", global: DEBUG_GLOBAL, query: "tnDebug" });
|
|
10
73
|
}
|
|
11
74
|
function countDebug(name, value, area, caller, unit = "count") {
|
|
12
75
|
if (!Number.isFinite(value) || value < 0)
|
|
@@ -217,4 +280,4 @@ function debugHotCalls(window) {
|
|
|
217
280
|
return calls.length === 0 ? void 0 : `TN_HOT_CALL:${JSON.stringify({ window: window.window, intervalMs: interval, calls })}`;
|
|
218
281
|
}
|
|
219
282
|
|
|
220
|
-
export { countDebug, debugHotCalls, debugRequested, formatDebugReport, isContentScaled, measureDebug, observeDebugGc };
|
|
283
|
+
export { countDebug, debugFlag, debugHotCalls, debugRequested, debugValue, exposeDebug, formatDebugReport, isContentScaled, measureDebug, observeDebugGc, readLaunchFlag, readLaunchValue, readLaunchValues };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/platform.ts
|
|
2
2
|
var DESKTOP_OS = /* @__PURE__ */ new Set(["linux", "macos", "windows"]);
|
|
3
3
|
var MOBILE_OS = /* @__PURE__ */ new Set(["android", "ios"]);
|
|
4
|
+
var CONSOLE_OS = /* @__PURE__ */ new Set(["ps4"]);
|
|
4
5
|
function isRecord(value) {
|
|
5
6
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
7
|
}
|
|
@@ -19,16 +20,16 @@ function nativePlatform(source) {
|
|
|
19
20
|
const formFactor = descriptor.formFactor;
|
|
20
21
|
const maxTouchPoints = descriptor.maxTouchPoints;
|
|
21
22
|
if (runtime !== "native") invalidNativePlatform("runtime must be native");
|
|
22
|
-
if (os !== "android" && os !== "ios" && os !== "linux" && os !== "macos" && os !== "windows" && os !== "unknown") {
|
|
23
|
+
if (os !== "android" && os !== "ios" && os !== "linux" && os !== "macos" && os !== "windows" && os !== "ps4" && os !== "unknown") {
|
|
23
24
|
invalidNativePlatform("os is unknown");
|
|
24
25
|
}
|
|
25
|
-
if (formFactor !== "mobile" && formFactor !== "desktop" && formFactor !== "unknown") {
|
|
26
|
+
if (formFactor !== "mobile" && formFactor !== "desktop" && formFactor !== "console" && formFactor !== "unknown") {
|
|
26
27
|
invalidNativePlatform("formFactor is unknown");
|
|
27
28
|
}
|
|
28
29
|
if (!Number.isInteger(maxTouchPoints) || maxTouchPoints < 0) {
|
|
29
30
|
invalidNativePlatform("maxTouchPoints must be a non-negative integer");
|
|
30
31
|
}
|
|
31
|
-
const expectedFormFactor = MOBILE_OS.has(os) ? "mobile" : DESKTOP_OS.has(os) ? "desktop" : "unknown";
|
|
32
|
+
const expectedFormFactor = MOBILE_OS.has(os) ? "mobile" : DESKTOP_OS.has(os) ? "desktop" : CONSOLE_OS.has(os) ? "console" : "unknown";
|
|
32
33
|
if (formFactor !== expectedFormFactor) {
|
|
33
34
|
invalidNativePlatform("os and formFactor disagree");
|
|
34
35
|
}
|
|
@@ -134,6 +135,12 @@ function isNative() {
|
|
|
134
135
|
function isMobile() {
|
|
135
136
|
return getPlatform().formFactor === "mobile";
|
|
136
137
|
}
|
|
138
|
+
function isConsole() {
|
|
139
|
+
return getPlatform().formFactor === "console";
|
|
140
|
+
}
|
|
141
|
+
function isPs4() {
|
|
142
|
+
return getPlatform().os === "ps4";
|
|
143
|
+
}
|
|
137
144
|
function isTouchscreenAvailable() {
|
|
138
145
|
return getPlatform().maxTouchPoints > 0;
|
|
139
146
|
}
|
|
@@ -150,4 +157,4 @@ function hostResizeObserver() {
|
|
|
150
157
|
return typeof ResizeObserver === "undefined" ? void 0 : ResizeObserver;
|
|
151
158
|
}
|
|
152
159
|
|
|
153
|
-
export { getPlatform, hostDocument, hostGestureTarget, hostResizeObserver, hostWindow, isMobile, isNative, isTouchscreenAvailable, isWeb };
|
|
160
|
+
export { getPlatform, hostDocument, hostGestureTarget, hostResizeObserver, hostWindow, isConsole, isMobile, isNative, isPs4, isTouchscreenAvailable, isWeb };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as IAssetLoader, a as IAssetLoaderOptions } from './assets-
|
|
2
|
-
import { F as FramePassKind, c as IRenderPassSample, d as IFramePhaseSample, e as
|
|
1
|
+
import { I as IAssetLoader, a as IAssetLoaderOptions } from './assets-CfMKnOsK.js';
|
|
2
|
+
import { F as FramePassKind, c as IRenderPassSample, d as IFramePhaseSample, e as IRendererOptions, f as IPipelineCensus, I as IRendererLike, a as IFrameBudgetWindow, g as IFrameBudgetOptions } from './renderer-BtOSseYf.js';
|
|
3
3
|
import { Vector2, Vector3, Object3D, Camera, Intersection, Scene as Scene$1 } from 'three';
|
|
4
|
-
import { V as Viewport, C as CanvasLayer, I as IViewportOptions } from './canvas-layer-
|
|
4
|
+
import { V as Viewport, C as CanvasLayer, I as IViewportOptions } from './canvas-layer-G7ttVy7y.js';
|
|
5
5
|
import { StoreApi } from 'zustand/vanilla';
|
|
6
6
|
|
|
7
7
|
type EntitySnapshot = Record<string, Record<string, unknown> & {
|
|
@@ -349,6 +349,14 @@ interface IThreeNativeConfig {
|
|
|
349
349
|
readonly orientation?: ThreeNativeOrientation;
|
|
350
350
|
readonly fullscreen?: boolean;
|
|
351
351
|
readonly keepScreenOn?: boolean;
|
|
352
|
+
/**
|
|
353
|
+
* CPU priority of a shipped native game (PRD-859). `"game"`, the default, raises the game, render
|
|
354
|
+
* and present threads above other programs and lowers the game's own background work (shader
|
|
355
|
+
* compiles, workers, the HUD processes), through the route each OS allows without admin rights.
|
|
356
|
+
* `"normal"` keeps the OS default. The player reports what the OS applied on its
|
|
357
|
+
* `TN_PROCESS_PRIORITY` line. The browser owns scheduling, so a web build ignores it.
|
|
358
|
+
*/
|
|
359
|
+
readonly priority?: "game" | "normal";
|
|
352
360
|
/**
|
|
353
361
|
* Maximum native presentation rate in frames per second. Left out, it follows the display's own
|
|
354
362
|
* refresh rate capped at 120 on desktop and web, and stays 60 on mobile where the ceiling is
|
|
@@ -838,8 +846,24 @@ interface IInputGamepad {
|
|
|
838
846
|
readonly buttons: readonly {
|
|
839
847
|
readonly pressed: boolean;
|
|
840
848
|
}[];
|
|
849
|
+
/** The browser's device name, which carries the vendor:product an unmapped pad is looked up by. */
|
|
850
|
+
readonly id?: string;
|
|
851
|
+
/**
|
|
852
|
+
* `"standard"` when the pad already uses the W3C standard layout, and `""` when the browser does
|
|
853
|
+
* not know the device. A source with no `mapping` at all is standard by construction: the owned
|
|
854
|
+
* native host builds standard pads, and so does a fixture.
|
|
855
|
+
*/
|
|
856
|
+
readonly mapping?: string;
|
|
841
857
|
}
|
|
842
858
|
type InputPlatformSource = () => readonly (IInputGamepad | null)[];
|
|
859
|
+
interface IInputMapOptions {
|
|
860
|
+
/**
|
|
861
|
+
* Radial dead zone for both sticks, `0`..`1`. Default `0.2`, the stock Enhanced Input dead zone
|
|
862
|
+
* (`UInputModifierDeadZone`, `LowerThreshold = 0.2`, `EDeadZoneType::Radial`). A stick inside it
|
|
863
|
+
* reads zero, one outside it is rescaled so full tilt is still `1`. `0` publishes raw axes.
|
|
864
|
+
*/
|
|
865
|
+
readonly gamepadDeadZone?: number;
|
|
866
|
+
}
|
|
843
867
|
interface IRawInputPointer {
|
|
844
868
|
readonly id: number;
|
|
845
869
|
buttons: number;
|
|
@@ -880,7 +904,13 @@ declare function captureMouse(target: EventTarget): Promise<void> | undefined;
|
|
|
880
904
|
declare class InputMap {
|
|
881
905
|
#private;
|
|
882
906
|
readonly raw: IRawInputState;
|
|
883
|
-
|
|
907
|
+
/**
|
|
908
|
+
* Radial dead zone for both sticks; `0` publishes the raw axes. Read on every tick, so a game may
|
|
909
|
+
* change it while running, and a value that is not a finite number from 0 through 1 reads as raw
|
|
910
|
+
* axes. `defineGame({ gamepadDeadZone })` sets the starting value and refuses one it cannot honour.
|
|
911
|
+
*/
|
|
912
|
+
gamepadDeadZone: number;
|
|
913
|
+
constructor(bindings?: InputBindings, target?: EventTarget, pointerTarget?: EventTarget, source?: InputPlatformSource, contextMenu?: ContextMenuPolicy, options?: IInputMapOptions);
|
|
884
914
|
/**
|
|
885
915
|
* Returns a 2D action vector where +y is up. On a conventional XZ ground plane whose
|
|
886
916
|
* forward direction is -z, map `vector.y` to `-z`. This differs from Godot's
|
|
@@ -897,7 +927,11 @@ declare class InputMap {
|
|
|
897
927
|
* a third pointer is ignored and a changing pair starts a new gesture without a jump.
|
|
898
928
|
*/
|
|
899
929
|
axis(name: string): number;
|
|
900
|
-
/**
|
|
930
|
+
/**
|
|
931
|
+
* Request pointer capture explicitly from a named game gesture. Relative bindings request it on
|
|
932
|
+
* canvas click by default. A refused lock — an unfocused window, an untrusted gesture — leaves
|
|
933
|
+
* `raw.pointer.captured` false and warns once as `TN_POINTER_LOCK_REFUSED:`, never a rejection.
|
|
934
|
+
*/
|
|
901
935
|
captureMouse(): void;
|
|
902
936
|
/** Release pointer capture. A browser refusal remains an unhandled rejection. */
|
|
903
937
|
releaseMouse(): void;
|
|
@@ -938,6 +972,18 @@ interface IRandom {
|
|
|
938
972
|
}
|
|
939
973
|
declare function createRandom(seed?: number): IRandom;
|
|
940
974
|
|
|
975
|
+
type RendererConfig = NonNullable<IThreeNativeConfig["renderer"]>;
|
|
976
|
+
/**
|
|
977
|
+
* What `defineGame({ renderer })` accepts: the project's portable renderer config (`threenative.config.ts`
|
|
978
|
+
* `renderer`, including its `android` block and `"auto"` scale) beside the live renderer options.
|
|
979
|
+
*
|
|
980
|
+
* One key for both. `defineGame` once took the portable config as `render` and the live options as
|
|
981
|
+
* `renderer`, so a game wrote `render: config.renderer` beside a second `renderer:` and the
|
|
982
|
+
* antialias and scale resolvers each fell back from one to the other. The scale is the one field
|
|
983
|
+
* the two disagreed on, and the portable form (a number or `"auto"`) is the superset.
|
|
984
|
+
*/
|
|
985
|
+
type GameRendererConfig = Omit<IRendererOptions, "resolutionScale" | "scaleSource"> & RendererConfig;
|
|
986
|
+
|
|
941
987
|
interface IRaycastOptions {
|
|
942
988
|
/** Screen point in canvas pixels. Mutually exclusive with `origin` and `direction`. */
|
|
943
989
|
readonly screen?: Vector2;
|
|
@@ -1695,6 +1741,12 @@ interface IGameConfig<TState extends Record<string, unknown> = Record<string, un
|
|
|
1695
1741
|
* the browser menu over its canvas.
|
|
1696
1742
|
*/
|
|
1697
1743
|
readonly contextMenu?: ContextMenuPolicy;
|
|
1744
|
+
/**
|
|
1745
|
+
* Radial dead zone for both controller sticks, `0`..`1`. Default `0.2`, the stock Enhanced Input
|
|
1746
|
+
* value, so a worn stick resting at `0.08` reads zero instead of walking the character. A stick
|
|
1747
|
+
* past the zone is rescaled so full tilt is still `1`. Pass `0` to read raw axes.
|
|
1748
|
+
*/
|
|
1749
|
+
readonly gamepadDeadZone?: number;
|
|
1698
1750
|
/**
|
|
1699
1751
|
* Per-frame cost attribution, on by default. Every `reportEvery` presented frames the game
|
|
1700
1752
|
* prints one `TN_FRAME_BUDGET` line naming where the frame went — present wait, simulation,
|
|
@@ -1756,8 +1808,20 @@ interface IGameConfig<TState extends Record<string, unknown> = Record<string, un
|
|
|
1756
1808
|
* 60 fps default rather than a scaler with no target.
|
|
1757
1809
|
*/
|
|
1758
1810
|
readonly display?: NonNullable<IThreeNativeConfig["display"]>;
|
|
1759
|
-
|
|
1760
|
-
|
|
1811
|
+
/**
|
|
1812
|
+
* The project's renderer settings: `config.renderer` from `threenative.config.ts` beside the live
|
|
1813
|
+
* renderer options, as one key.
|
|
1814
|
+
*
|
|
1815
|
+
* `render` once carried the portable half, so a game wrote `render: config.renderer` beside a
|
|
1816
|
+
* second `renderer:` and the antialias and scale resolvers each fell back from one to the other.
|
|
1817
|
+
* The keys are one now; `render` is adopted onto this one and reported as renamed.
|
|
1818
|
+
*/
|
|
1819
|
+
readonly renderer?: GameRendererConfig;
|
|
1820
|
+
/**
|
|
1821
|
+
* @deprecated The retired name for {@link renderer}, adopted onto it and reported. Move the object
|
|
1822
|
+
* to `renderer` with no other change.
|
|
1823
|
+
*/
|
|
1824
|
+
readonly render?: GameRendererConfig;
|
|
1761
1825
|
readonly seed?: number;
|
|
1762
1826
|
readonly scenes: Record<string, SceneConstructor<TState, TPhysics>>;
|
|
1763
1827
|
/**
|
|
@@ -1840,4 +1904,4 @@ interface IGame<TState extends Record<string, unknown> = Record<string, unknown>
|
|
|
1840
1904
|
}
|
|
1841
1905
|
declare function defineGame<TState extends Record<string, unknown>, TPhysics = undefined>(config: IGameConfig<TState, TPhysics>): IGame<TState, TPhysics>;
|
|
1842
1906
|
|
|
1843
|
-
export { type
|
|
1907
|
+
export { type IWarmUpOptions as $, type AfterPhysicsCallback as A, type IPointerState as B, type ContextMenuPolicy as C, type IRandom as D, type EntitySnapshot as E, type IRawInputPointer as F, GEOMETRY_ASSET_KEY as G, type IRawInputPointerEdge as H, type IGame as I, type IRawInputState as J, type IRaycastOptions as K, type IScenePickerOptions as L, type IThreeNativeAudioConfig as M, type IThreeNativeAudioLoop as N, type IThreeNativeAudioOverride as O, type IThreeNativeAudioSpectrum as P, type IThreeNativeBootSplash as Q, type IThreeNativeConfig as R, type IThreeNativeIconVariants as S, type IThreeNativeLodConfig as T, type IThreeNativeLodGenerationConfig as U, type IThreeNativeLodOverride as V, type IThreeNativeLodRuntimeConfig as W, type IThreeNativeTexturesConfig as X, type ITweenOptions as Y, type IWarmUpCacheOptions as Z, type IWarmUpObservation as _, type IGamePluginHooks as a, type IWarmUpProgress as a0, type IWarmUpRenderer as a1, type IWarmUpReport as a2, type InputBindings as a3, InputMap as a4, type InputPlatformSource as a5, type PointerEvent3DListener as a6, type PointerEvent3DType as a7, PointerEvents3D as a8, Scene as a9, type SceneFrame as aa, ScenePicker as ab, type ScheduleHandle as ac, Scheduler as ad, type ThreeNativeBackgroundMode as ae, type ThreeNativeLodMinTrianglesScope as af, type ThreeNativeLodPreset as ag, type ThreeNativeOrientation as ah, type ThreeNativeUiRenderer as ai, type WarmUpCacheStatus as aj, type WarmUpObservationStatus as ak, afterPhysics as al, captureMouse as am, createRandom as an, defineGame as ao, warmUpScene as ap, type IGeometryCaptureRequest as b, type IGeometryCaptureReport as c, type IGamePluginRuntime as d, GEOMETRY_CAPTURE_DEFAULT_LIMIT as e, GEOMETRY_CAPTURE_MAX_LIMIT as f, GEOMETRY_CAPTURE_SORTS as g, GEOMETRY_CAPTURE_TIMEOUT_MS as h, GEOMETRY_CAPTURE_WALK_CAP as i, type GeometryCaptureSort as j, type ICtx as k, type IGameObservationContribution as l, type IGameObservationSampleRequest as m, type IGamePlatformSource as n, type IGeometryCaptureAsset as o, type IGeometryCaptureMesh as p, type IGeometryCapturePass as q, type IGeometryCaptureRow as r, type IInputAction as s, type IInputGamepad as t, type IInputMapOptions as u, type IPointerDragHandle as v, type IPointerEvent3D as w, type IPointerEvents3D as x, type IPointerEvents3DOptions as y, type IPointerEvents3DPicker as z };
|
package/dist/hot.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { a as audioRuntimeSnapshot } from './audio-DIJE5HTr.js';
|
|
2
|
-
import { I as IGame } from './game-
|
|
2
|
+
import { I as IGame } from './game-k8K3hZai.js';
|
|
3
3
|
import 'three';
|
|
4
|
-
import './assets-
|
|
5
|
-
import './renderer-
|
|
4
|
+
import './assets-CfMKnOsK.js';
|
|
5
|
+
import './renderer-BtOSseYf.js';
|
|
6
6
|
import 'three/webgpu';
|
|
7
|
-
import './
|
|
7
|
+
import './default-tone-mapping-GgKPTiBP.js';
|
|
8
|
+
import './canvas-layer-G7ttVy7y.js';
|
|
8
9
|
import 'zustand/vanilla';
|
|
9
10
|
|
|
10
11
|
interface IHotDiagnostics {
|
package/dist/hot.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { audioRuntimeSnapshot } from './chunk-
|
|
2
|
-
import { hostWindow, hostDocument } from './chunk-
|
|
1
|
+
import { audioRuntimeSnapshot } from './chunk-U4YHUKKL.js';
|
|
2
|
+
import { hostWindow, hostDocument } from './chunk-XDTZ4QMO.js';
|
|
3
|
+
import { publishDevGlobal, devGlobal } from './chunk-VP43GIWW.js';
|
|
3
4
|
|
|
4
5
|
// src/hot.ts
|
|
5
6
|
var isDev = import.meta.env?.DEV === true;
|
|
@@ -22,12 +23,8 @@ function acceptHotUpdate(game, hot) {
|
|
|
22
23
|
}
|
|
23
24
|
const page = hostWindow();
|
|
24
25
|
if (isDev && page !== void 0) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
...host.__THREENATIVE__,
|
|
28
|
-
hot: () => diagnostics(game, reloads),
|
|
29
|
-
snapshot: host.__THREENATIVE__?.snapshot ?? (() => ({}))
|
|
30
|
-
};
|
|
26
|
+
publishDevGlobal("hot", () => diagnostics(game, reloads), page);
|
|
27
|
+
if (devGlobal(page)?.snapshot === void 0) publishDevGlobal("snapshot", () => ({}), page);
|
|
31
28
|
}
|
|
32
29
|
let disposed = false;
|
|
33
30
|
hot.dispose((data) => {
|