@threenative/core 0.3.3 → 0.3.5
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/capabilities.json +2019 -59
- package/dist/{assets-CYKk2WTu.d.ts → assets-CqvE429w.d.ts} +45 -3
- package/dist/{audio-7i3Xl0l3.d.ts → audio-DIJE5HTr.d.ts} +43 -3
- package/dist/{canvas-layer-C1SnMoJ-.d.ts → canvas-layer-C1-5CviZ.d.ts} +5 -1
- package/dist/{game-D_6r-k4Y.d.ts → game-Bj8G1wmD.d.ts} +242 -17
- package/dist/hot.d.ts +5 -5
- package/dist/index.d.ts +1131 -105
- package/dist/index.js +15201 -4782
- package/dist/model-lod-BDAUYgsS.d.ts +197 -0
- package/dist/playtest.d.ts +6 -4
- package/dist/playtest.js +84 -11
- package/dist/react-css.d.ts +62 -0
- package/dist/react-css.js +591 -0
- package/dist/react.d.ts +2 -2
- package/dist/{renderer-Cy4qeBOA.d.ts → renderer-9yEo9hPa.d.ts} +676 -21
- package/dist/terrain-jobs-worker.d.ts +2 -0
- package/dist/terrain-jobs-worker.js +130 -0
- package/dist/ui-layer.d.ts +5 -3
- package/dist/ui-layer.js +59 -8
- package/dist/world.d.ts +1596 -17
- package/dist/world.js +17035 -521
- package/gpl/fixtures/make_world_fixture.py +184 -0
- package/gpl/recipes/_common.py +11 -0
- package/gpl/recipes/decimate.py +11 -5
- package/gpl/recipes/export_world.py +699 -0
- package/mcp/blender-server.mjs +61 -4
- package/mcp/blender.mjs +3 -4
- package/mcp/engine-server.mjs +55 -21
- package/mcp/servers.mjs +4 -4
- package/package.json +15 -9
- package/patches/three@0.185.1-prd269-upgrade.patch +22418 -0
- package/patches/three@0.185.1.patch +8246 -389
- package/scripts/apply-three-patch.mjs +123 -41
- package/src/animation-blend.ts +264 -0
- package/src/animation-composition.ts +362 -0
- package/src/animation-layers.ts +260 -0
- package/src/animation-root-motion.ts +283 -0
- package/src/animation.ts +896 -0
- package/src/assets.ts +1303 -0
- package/src/atmosphere/index.ts +335 -0
- package/src/atmosphere/luts.ts +298 -0
- package/src/atmosphere/params.ts +323 -0
- package/src/audio.ts +912 -0
- package/src/billboard.ts +124 -0
- package/src/bone-lengths.ts +157 -0
- package/src/camera-shake.ts +116 -0
- package/src/canvas-layer.ts +47 -0
- package/src/clip-audit.ts +401 -0
- package/src/clustered-batch.ts +492 -0
- package/src/clustered-mesh.ts +638 -0
- package/src/compute-driven.ts +176 -0
- package/src/compute-timing.ts +318 -0
- package/src/config.ts +593 -0
- package/src/debug.ts +82 -0
- package/src/engine-render-hook.ts +25 -0
- package/src/entities.ts +79 -0
- package/src/entity-snapshot.ts +53 -0
- package/src/flight.ts +683 -0
- package/src/fluid-field.ts +748 -0
- package/src/fluid-particles.ts +1253 -0
- package/src/frame-budget.ts +1368 -0
- package/src/game.ts +2390 -0
- package/src/geometry-capture.ts +1098 -0
- package/src/gpu-class.ts +160 -0
- package/src/gpu-frame-observation.ts +424 -0
- package/src/gpu-readback.ts +143 -0
- package/src/gpu-scene-bvh.ts +464 -0
- package/src/grounding.ts +100 -0
- package/src/hot.ts +161 -0
- package/src/import-meta.d.ts +13 -0
- package/src/index.ts +1536 -0
- package/src/input.ts +690 -0
- package/src/instanced-batch-lod.ts +283 -0
- package/src/instanced-batch.ts +274 -0
- package/src/interpolation.ts +129 -0
- package/src/launch-diagnostics.ts +161 -0
- package/src/loop.ts +564 -0
- package/src/matrix-world.ts +245 -0
- package/src/merge-parts.ts +812 -0
- package/src/model-lod.ts +1315 -0
- package/src/net-protocol.ts +333 -0
- package/src/net-session.ts +477 -0
- package/src/net.ts +80 -0
- package/src/ocean/fft.ts +72 -0
- package/src/ocean/spectral.ts +728 -0
- package/src/particle-significance.ts +102 -0
- package/src/particles.ts +648 -0
- package/src/path-follow.ts +175 -0
- package/src/picking.ts +250 -0
- package/src/pipeline-census.ts +1566 -0
- package/src/platform.ts +210 -0
- package/src/playtest.ts +839 -0
- package/src/pointer-events.ts +411 -0
- package/src/pose-measure.ts +435 -0
- package/src/profiling/FrameCounters.ts +231 -0
- package/src/profiling/Spans.ts +548 -0
- package/src/profiling/opacity-convention.ts +21 -0
- package/src/profiling/render-list-validate.ts +175 -0
- package/src/profiling/render-trap-audit.ts +84 -0
- package/src/profiling/scene-warning.ts +190 -0
- package/src/profiling/span-probes.ts +191 -0
- package/src/profiling/unlit-foliage-warning.ts +149 -0
- package/src/projection-apply.ts +1529 -0
- package/src/projection-marker.ts +142 -0
- package/src/projection-plan.ts +1258 -0
- package/src/projection-skinned.ts +419 -0
- package/src/projection-stability.ts +409 -0
- package/src/projection-uniform.ts +328 -0
- package/src/random.ts +41 -0
- package/src/react-css.ts +604 -0
- package/src/react-glyphs.ts +114 -0
- package/src/react-host.ts +576 -0
- package/src/react-layout.ts +265 -0
- package/src/react.ts +60 -0
- package/src/render/alpha-antialiasing.ts +159 -0
- package/src/render/batched-velocity.ts +126 -0
- package/src/render/chain.ts +1021 -0
- package/src/render/daylight.ts +189 -0
- package/src/render/depth-pyramid.ts +596 -0
- package/src/render/foliage-alpha.ts +166 -0
- package/src/render/material-key.ts +60 -0
- package/src/render/mesh-pool.ts +144 -0
- package/src/render/probe-volume.ts +1668 -0
- package/src/render/resolution-subrect.ts +253 -0
- package/src/render/velocity.ts +442 -0
- package/src/render/virtual-shadow-pages.ts +827 -0
- package/src/render/virtual-shadow-partial.ts +174 -0
- package/src/render/virtual-shadow.ts +3330 -0
- package/src/render/world-impostor-surface.ts +722 -0
- package/src/render/world-impostor.ts +558 -0
- package/src/render-camera-cull.ts +441 -0
- package/src/render-pass-budget.ts +501 -0
- package/src/renderProjection.ts +758 -0
- package/src/renderer-config.ts +127 -0
- package/src/renderer.ts +1847 -0
- package/src/replay-protocol.ts +85 -0
- package/src/replay.ts +205 -0
- package/src/resolution-scaler.ts +819 -0
- package/src/rig-preparation.ts +271 -0
- package/src/ripple-field.ts +432 -0
- package/src/scale.ts +109 -0
- package/src/scene.ts +239 -0
- package/src/schedule.ts +155 -0
- package/src/skeletal-mesh.ts +61 -0
- package/src/skeleton.ts +100 -0
- package/src/snow-field.ts +744 -0
- package/src/softbody-topology.ts +269 -0
- package/src/softbody.ts +516 -0
- package/src/sprite-animator.ts +222 -0
- package/src/startup-readiness.ts +386 -0
- package/src/state.ts +66 -0
- package/src/static-transform.ts +274 -0
- package/src/storage-buffer.ts +253 -0
- package/src/streaming.ts +308 -0
- package/src/target-fps.ts +92 -0
- package/src/terrain-jobs-worker.ts +17 -0
- package/src/terrain-jobs.ts +353 -0
- package/src/textures.ts +39 -0
- package/src/tracers.ts +237 -0
- package/src/ui-bridge.ts +368 -0
- package/src/ui-hit-regions.ts +380 -0
- package/src/ui-layer.ts +83 -0
- package/src/ui-state.ts +220 -0
- package/src/version.ts +2 -0
- package/src/viewport.ts +253 -0
- package/src/warmup.ts +1357 -0
- package/src/water-surface.ts +384 -0
- package/src/wave-field.ts +524 -0
- package/src/world-capabilities.ts +131 -0
- package/src/world-cell-proxy.ts +392 -0
- package/src/world-cells.ts +10564 -0
- package/src/world-gpu-scene.ts +3354 -0
- package/src/world-heightmap.ts +82 -0
- package/src/world-package.ts +469 -0
- package/src/world-passes.ts +582 -0
- package/src/world-region.ts +17 -0
- package/src/world-terrain-splat.ts +564 -0
- package/src/world-tiles.ts +3826 -0
- package/src/world-topology.ts +370 -0
- package/src/world-validate.ts +48 -0
- package/src/world.ts +805 -0
- package/dist/gpu-readback-CMklJs6r.d.ts +0 -112
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { IThreeNativeConfig } from "./config.js";
|
|
2
|
+
import type { MatrixWorldMode } from "./matrix-world.js";
|
|
3
|
+
import type { PlatformOS } from "./platform.js";
|
|
4
|
+
import { RESOLUTION_SCALER } from "./resolution-scaler.js";
|
|
5
|
+
|
|
6
|
+
type RendererConfig = NonNullable<IThreeNativeConfig["renderer"]>;
|
|
7
|
+
|
|
8
|
+
/** How the active drawing-buffer scale was arrived at, reported beside every fps number. */
|
|
9
|
+
export type ScaleSource = "pinned" | "auto";
|
|
10
|
+
|
|
11
|
+
export interface IResolvedScale {
|
|
12
|
+
readonly resolutionScale: number;
|
|
13
|
+
readonly scaleSource: ScaleSource;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Where an `"auto"` scale starts before the controller has seen a frame-budget window. */
|
|
17
|
+
export const AUTO_SCALE_START = 1;
|
|
18
|
+
|
|
19
|
+
function requireScale(
|
|
20
|
+
value: number | "auto" | undefined,
|
|
21
|
+
key: string,
|
|
22
|
+
): number | "auto" | undefined {
|
|
23
|
+
if (value === undefined || value === "auto") return value;
|
|
24
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0 || value > 1)
|
|
25
|
+
throw new Error(
|
|
26
|
+
`${key} must be "auto" or a number within (0, 1], received ${JSON.stringify(value)}.`,
|
|
27
|
+
);
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The one place a configured scale becomes a number the renderer can apply, and the one place
|
|
33
|
+
* that says whether the game chose it or the engine did.
|
|
34
|
+
*
|
|
35
|
+
* Validation lives here rather than in the renderer because the renderer only ever sees the
|
|
36
|
+
* resolved number: a game that writes `renderer.android.resolutionScale: 2` has to be told which
|
|
37
|
+
* key it got wrong, not that some scale somewhere was out of range.
|
|
38
|
+
*/
|
|
39
|
+
export function resolveRendererScaleSetting(
|
|
40
|
+
config: RendererConfig | undefined,
|
|
41
|
+
fallback: number | undefined,
|
|
42
|
+
os: PlatformOS,
|
|
43
|
+
): IResolvedScale {
|
|
44
|
+
const android = requireScale(
|
|
45
|
+
config?.android?.resolutionScale,
|
|
46
|
+
"renderer.android.resolutionScale",
|
|
47
|
+
);
|
|
48
|
+
const portable = requireScale(config?.resolutionScale, "renderer.resolutionScale");
|
|
49
|
+
const selected = os === "android" && android !== undefined ? android : (portable ?? fallback);
|
|
50
|
+
// Silence is "auto", not a pin. The engine measures the frame budget where the scale is used, so
|
|
51
|
+
// a game that named nothing gets the loop that holds it; a pinned full-resolution buffer on a
|
|
52
|
+
// HiDPI desktop is 4x MSAA over 4527x2207 until the GPU device is lost, and asking a game to
|
|
53
|
+
// write the key to avoid it is a constant it has to revisit later. A number still pins, and an
|
|
54
|
+
// explicit "auto" is still the same answer it always was.
|
|
55
|
+
if (selected === "auto" || selected === undefined)
|
|
56
|
+
return { resolutionScale: AUTO_SCALE_START, scaleSource: "auto" };
|
|
57
|
+
return {
|
|
58
|
+
resolutionScale: requireScale(selected, "renderer.resolutionScale") as number,
|
|
59
|
+
scaleSource: "pinned",
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The lowest rung a platform's scaler may take, or `undefined` for the whole ladder.
|
|
65
|
+
*
|
|
66
|
+
* Android and iOS keep every rung: those rungs are what the device arm measured, and a phone buys
|
|
67
|
+
* the pixels back in ways a desktop does not. Everything else stops at
|
|
68
|
+
* `RESOLUTION_SCALER.desktopFloorScale`, because a desktop with nothing reconstructing the frame
|
|
69
|
+
* from fewer pixels turns the bottom of that ladder into blocky mush rather than a faster frame.
|
|
70
|
+
* A desktop whose render chain does reconstruct it lifts the floor itself, per step.
|
|
71
|
+
*/
|
|
72
|
+
export function resolvePlatformResolutionFloor(os: PlatformOS): number | undefined {
|
|
73
|
+
return os === "android" || os === "ios" ? undefined : RESOLUTION_SCALER.desktopFloorScale;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The one place `renderer.matrixWorld` becomes the walk the frame runs.
|
|
78
|
+
*
|
|
79
|
+
* Validated here rather than inside the pass for the same reason the scale is: the pass only ever
|
|
80
|
+
* sees a resolved mode, so a game that wrote a typo has to be told which key it got wrong.
|
|
81
|
+
*/
|
|
82
|
+
export function resolveMatrixWorldMode(
|
|
83
|
+
config: RendererConfig | undefined,
|
|
84
|
+
fallback: MatrixWorldMode = "visible",
|
|
85
|
+
): MatrixWorldMode {
|
|
86
|
+
const value = config?.matrixWorld;
|
|
87
|
+
if (value === undefined) return fallback;
|
|
88
|
+
if (value === "visible" || value === "all") return value;
|
|
89
|
+
throw new Error(
|
|
90
|
+
`renderer.matrixWorld must be "visible" or "all", received ${JSON.stringify(value)}.`,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Internal config-to-renderer seam for multisampling, resolved exactly as the scale is.
|
|
96
|
+
*
|
|
97
|
+
* Separate from the scale resolver rather than folded into one call because the two values have
|
|
98
|
+
* different types and different fallbacks, and a combined resolver would have to invent a shape
|
|
99
|
+
* for "this platform overrides one of them".
|
|
100
|
+
*/
|
|
101
|
+
export function resolveRendererAntialias(
|
|
102
|
+
config: RendererConfig | undefined,
|
|
103
|
+
fallback: boolean | undefined,
|
|
104
|
+
os: PlatformOS,
|
|
105
|
+
): boolean | undefined {
|
|
106
|
+
if (os === "android" && config?.android?.antialias !== undefined) {
|
|
107
|
+
return config.android.antialias;
|
|
108
|
+
}
|
|
109
|
+
return config?.antialias ?? fallback;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The same seam for alpha antialiasing, which spends the samples `antialias` buys rather than
|
|
114
|
+
* buying any of its own. Resolved separately because a platform can want one without the other:
|
|
115
|
+
* a phone that dropped to a single-sampled surface has no coverage mask to hand a cutout, and a
|
|
116
|
+
* game after a hard-edged look wants the samples on its geometry and not on its foliage.
|
|
117
|
+
*/
|
|
118
|
+
export function resolveRendererAlphaAntialiasing(
|
|
119
|
+
config: RendererConfig | undefined,
|
|
120
|
+
fallback: boolean | undefined,
|
|
121
|
+
os: PlatformOS,
|
|
122
|
+
): boolean | undefined {
|
|
123
|
+
if (os === "android" && config?.android?.alphaAntialiasing !== undefined) {
|
|
124
|
+
return config.android.alphaAntialiasing;
|
|
125
|
+
}
|
|
126
|
+
return config?.alphaAntialiasing ?? fallback;
|
|
127
|
+
}
|