@threenative/core 0.3.4 → 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 +1505 -79
- package/dist/{audio-7i3Xl0l3.d.ts → audio-DIJE5HTr.d.ts} +43 -3
- package/dist/{canvas-layer-DDmC_VVF.d.ts → canvas-layer-C1-5CviZ.d.ts} +5 -1
- package/dist/{game-CljaDv4D.d.ts → game-Bj8G1wmD.d.ts} +102 -11
- package/dist/hot.d.ts +4 -4
- package/dist/index.d.ts +712 -118
- package/dist/index.js +12423 -4955
- package/dist/{gpu-readback-CqJEfWNQ.d.ts → model-lod-BDAUYgsS.d.ts} +80 -5
- package/dist/playtest.d.ts +6 -10
- package/dist/playtest.js +47 -24
- 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-CfsS2hxi.d.ts → renderer-9yEo9hPa.d.ts} +489 -22
- package/dist/terrain-jobs-worker.d.ts +2 -0
- package/dist/terrain-jobs-worker.js +130 -0
- package/dist/ui-layer.js +59 -8
- package/dist/world.d.ts +766 -73
- package/dist/world.js +9307 -3543
- package/gpl/recipes/export_world.py +18 -1
- package/mcp/blender-server.mjs +7 -4
- package/mcp/blender.mjs +3 -4
- package/mcp/engine-server.mjs +2 -2
- 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 +6594 -700
- package/scripts/apply-three-patch.mjs +62 -4
- 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
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { IMatrixWorldReport } from "./matrix-world.js";
|
|
2
|
+
import type { IRenderCameraCullReport } from "./render-camera-cull.js";
|
|
3
|
+
import type { IRenderProjectionReport, ProjectionExactReason } from "./renderProjection.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The per-window projection line.
|
|
7
|
+
*
|
|
8
|
+
* `TN_RENDER_PROJECTION` announces the verdict once, when it is first reached — the right shape
|
|
9
|
+
* for "did the optimizer engage", and the wrong one for "what is it still leaving on the table
|
|
10
|
+
* while the game runs". This marker is emitted on every frame-budget window instead, so a run
|
|
11
|
+
* produces a series rather than a single sentence, and it carries the one thing the projection
|
|
12
|
+
* cannot know on its own: how many draws the renderer was actually handed.
|
|
13
|
+
*/
|
|
14
|
+
export const PROJECTION_MARKER = "TN_PROJECTION";
|
|
15
|
+
|
|
16
|
+
export interface IProjectionWindowJson {
|
|
17
|
+
/**
|
|
18
|
+
* Draw calls the renderer counted, or absent when nothing measured them.
|
|
19
|
+
*
|
|
20
|
+
* **Not comparable to `drawsPlanned` one-for-one.** The plan counts colour-pass draws; this
|
|
21
|
+
* counts every pass the renderer made, so a scene whose light casts shadows walks its objects
|
|
22
|
+
* twice and reads about double. Measured on the shooter template: 52 planned, 116 actual, on a
|
|
23
|
+
* frame where the projection had declined and folded nothing at all.
|
|
24
|
+
*/
|
|
25
|
+
readonly drawsActual?: number;
|
|
26
|
+
/** One per batch plus one per exact-lane object; the plan, which WebGPU need not honour. */
|
|
27
|
+
readonly drawsPlanned: number;
|
|
28
|
+
readonly exact: Partial<Record<ProjectionExactReason, number>>;
|
|
29
|
+
readonly exactObjects: number;
|
|
30
|
+
/** Who batched the frame: the host renderer, or core's JS mirror. */
|
|
31
|
+
readonly path?: IRenderProjectionReport["path"];
|
|
32
|
+
readonly projecting: boolean;
|
|
33
|
+
readonly reason?: string;
|
|
34
|
+
readonly reasonCode: string;
|
|
35
|
+
readonly sourceRenderables: number;
|
|
36
|
+
/**
|
|
37
|
+
* What the projection spent reconciling, straight from the report.
|
|
38
|
+
*
|
|
39
|
+
* `lastReconcileMs` is this window's last frame — the per-frame attribution term the perf loop
|
|
40
|
+
* reads. `reconcileMs` is the run's running total and `maxReconcileMs` its worst frame. Carried
|
|
41
|
+
* per window rather than once, because reconcile is paid per frame, not at startup.
|
|
42
|
+
*/
|
|
43
|
+
readonly timings?: IRenderProjectionReport["timings"];
|
|
44
|
+
/**
|
|
45
|
+
* The projected-size gate's own count for this window.
|
|
46
|
+
*
|
|
47
|
+
* Present whenever the engine ran the gate, whether it is enabled or the game declined it — a
|
|
48
|
+
* silent cull is one nobody can tell is working. `culled` is what the render camera could not
|
|
49
|
+
* resolve and the frame did not submit; a game that marked objects with `alwaysRender` reads its
|
|
50
|
+
* overrides in `exemptMarked`.
|
|
51
|
+
*/
|
|
52
|
+
readonly cull?: {
|
|
53
|
+
readonly enabled: boolean;
|
|
54
|
+
readonly cameraResolved: boolean;
|
|
55
|
+
readonly thresholdPixels: number;
|
|
56
|
+
readonly considered: number;
|
|
57
|
+
readonly culled: number;
|
|
58
|
+
readonly exemptCameraAttached: number;
|
|
59
|
+
readonly exemptMarked: number;
|
|
60
|
+
readonly exemptShadowCasters: number;
|
|
61
|
+
readonly exemptWithoutBounds: number;
|
|
62
|
+
readonly exemptDynamicBounds: number;
|
|
63
|
+
readonly exemptFrustumCulled: number;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The world-matrix walk's own count for this window.
|
|
67
|
+
*
|
|
68
|
+
* `mode` is the resolved `renderer.matrixWorld` and `visited` is the nodes the engine walked on
|
|
69
|
+
* the last world-render frame, summed over the authored scene and any projection mirror. Present
|
|
70
|
+
* whenever the engine ran the walk — turning the default off with `"all"` does not turn its
|
|
71
|
+
* measurement off, and the two numbers side by side are the cost the convention removed.
|
|
72
|
+
*/
|
|
73
|
+
readonly matrixWorld?: {
|
|
74
|
+
readonly mode: string;
|
|
75
|
+
readonly visited: number;
|
|
76
|
+
};
|
|
77
|
+
readonly window: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Orders the exact lane by how many draws each reason costs.
|
|
82
|
+
*
|
|
83
|
+
* This is the whole point of the marker: the next thing worth folding is whichever reason is at
|
|
84
|
+
* the top of this list in a game that is actually slow, and picking it any other way is picking it
|
|
85
|
+
* by intuition — which has been wrong twice here.
|
|
86
|
+
*/
|
|
87
|
+
export function rankExactReasons(
|
|
88
|
+
exact: Partial<Record<ProjectionExactReason, number>>,
|
|
89
|
+
): { count: number; reason: string }[] {
|
|
90
|
+
return Object.entries(exact)
|
|
91
|
+
.filter(([, count]) => typeof count === "number" && count > 0)
|
|
92
|
+
.map(([reason, count]) => ({ count: count as number, reason }))
|
|
93
|
+
.sort((left, right) => right.count - left.count || (left.reason < right.reason ? -1 : 1));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Builds the line. Emitted on a declined frame too, with its reason code — a decline is the most
|
|
98
|
+
* useful line in the log, and suppressing it is how "it did nothing" gets read as "it had nothing
|
|
99
|
+
* to do".
|
|
100
|
+
*/
|
|
101
|
+
export function formatProjectionWindow(
|
|
102
|
+
report: IRenderProjectionReport,
|
|
103
|
+
window: number,
|
|
104
|
+
drawsActual: number | undefined,
|
|
105
|
+
cull?: IRenderCameraCullReport,
|
|
106
|
+
matrixWorld?: IMatrixWorldReport,
|
|
107
|
+
): string {
|
|
108
|
+
const payload: IProjectionWindowJson = {
|
|
109
|
+
...(drawsActual === undefined ? {} : { drawsActual }),
|
|
110
|
+
...(cull === undefined
|
|
111
|
+
? {}
|
|
112
|
+
: {
|
|
113
|
+
cull: {
|
|
114
|
+
enabled: cull.enabled,
|
|
115
|
+
cameraResolved: cull.cameraResolved,
|
|
116
|
+
thresholdPixels: cull.thresholdPixels,
|
|
117
|
+
considered: cull.considered,
|
|
118
|
+
culled: cull.culled,
|
|
119
|
+
exemptCameraAttached: cull.exemptCameraAttached,
|
|
120
|
+
exemptMarked: cull.exemptMarked,
|
|
121
|
+
exemptShadowCasters: cull.exemptShadowCasters,
|
|
122
|
+
exemptWithoutBounds: cull.exemptWithoutBounds,
|
|
123
|
+
exemptDynamicBounds: cull.exemptDynamicBounds,
|
|
124
|
+
exemptFrustumCulled: cull.exemptFrustumCulled,
|
|
125
|
+
},
|
|
126
|
+
}),
|
|
127
|
+
drawsPlanned: report.drawsPlanned,
|
|
128
|
+
exact: report.exact,
|
|
129
|
+
exactObjects: report.exactObjects,
|
|
130
|
+
...(matrixWorld === undefined
|
|
131
|
+
? {}
|
|
132
|
+
: { matrixWorld: { mode: matrixWorld.mode, visited: matrixWorld.visited } }),
|
|
133
|
+
path: report.path,
|
|
134
|
+
projecting: report.projecting,
|
|
135
|
+
...(report.reason === undefined ? {} : { reason: report.reason }),
|
|
136
|
+
reasonCode: report.reasonCode,
|
|
137
|
+
sourceRenderables: report.sourceRenderables,
|
|
138
|
+
timings: report.timings,
|
|
139
|
+
window,
|
|
140
|
+
};
|
|
141
|
+
return `${PROJECTION_MARKER}:${JSON.stringify(payload)}`;
|
|
142
|
+
}
|