@threenative/core 0.3.12 → 0.3.13
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 +746 -32
- 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-4SRAQFTU.js} +1 -1
- package/dist/{chunk-GMHATRPW.js → chunk-DIPIJICH.js} +1590 -375
- package/dist/{chunk-OKXUCASC.js → chunk-EEABDLUC.js} +3 -4
- package/dist/{chunk-5O73CDMR.js → chunk-EFWZWLPY.js} +62 -16
- package/dist/{chunk-N5LRP4BR.js → chunk-GYUZJQ7U.js} +63 -3
- package/dist/{chunk-VAZM36TV.js → chunk-H4J6IAJE.js} +17 -10
- package/dist/{chunk-2Z44XSI2.js → chunk-SV4QVUTQ.js} +3 -7
- package/dist/{chunk-DBELTTTM.js → chunk-U4YHUKKL.js} +1 -1
- package/dist/chunk-VP43GIWW.js +18 -0
- 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 +289 -1034
- package/dist/index.js +3096 -1305
- 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-BYqKGAwo.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 +269 -15
- package/dist/world.js +1372 -628
- package/mcp/animation-server.mjs +1 -1
- package/mcp/engine-server.mjs +105 -7
- package/mcp/servers.mjs +4 -4
- package/package.json +10 -6
- 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/compute-driven.ts +1 -1
- package/src/config.ts +8 -0
- package/src/debug.ts +103 -22
- package/src/dev-global.ts +54 -0
- package/src/engine-hooks.ts +37 -0
- package/src/frame-budget.ts +19 -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 +13 -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/hot.ts +4 -7
- package/src/index.ts +115 -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/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/virtual-shadow-partial.ts +13 -0
- package/src/render/virtual-shadow.ts +18 -16
- package/src/render/world-impostor-surface.ts +109 -6
- package/src/render/world-impostor.ts +5 -2
- package/src/render-camera-cull.ts +98 -3
- 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 +52 -28
- package/src/resolution-scaler.ts +3 -2
- package/src/scene-entry-inspectors.ts +61 -0
- package/src/snow-field.ts +1 -0
- package/src/startup-offscreen-bytes.ts +78 -0
- package/src/static-transform.ts +25 -19
- package/src/streamed-textures.ts +112 -0
- package/src/streaming.ts +68 -4
- package/src/texture-streaming.ts +331 -0
- package/src/version.ts +1 -1
- package/src/worker.ts +12 -2
- package/src/world-bundle-safety.ts +55 -10
- package/src/world-cell-batches.ts +162 -200
- package/src/world-cell-chunks.ts +3 -7
- package/src/world-cell-impostors.ts +20 -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 +13 -17
- package/src/world-cell-render-main-cull.ts +73 -17
- package/src/world-cell-render-util.ts +17 -4
- 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 +22 -5
- 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 +282 -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.ts +13 -0
package/dist/react.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { C as CanvasLayer } from './canvas-layer-
|
|
2
|
+
import { C as CanvasLayer } from './canvas-layer-G7ttVy7y.js';
|
|
3
3
|
import 'three';
|
|
4
|
-
import './renderer-
|
|
4
|
+
import './renderer-BtOSseYf.js';
|
|
5
5
|
import 'three/webgpu';
|
|
6
|
+
import './default-tone-mapping-GgKPTiBP.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Every character this glyph set can draw, for error messages and for the templates' AGENTS.md.
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { Scene, Color, Texture } from 'three';
|
|
2
|
+
import { Q as QualityTier } from './quality-BYqKGAwo.js';
|
|
3
|
+
import 'three/tsl';
|
|
4
|
+
import 'three/webgpu';
|
|
5
|
+
import './default-tone-mapping-GgKPTiBP.js';
|
|
6
|
+
|
|
7
|
+
interface IEnvironmentMeasurement {
|
|
8
|
+
readonly status: "measured" | "unknown";
|
|
9
|
+
readonly meanRadiance: number | null;
|
|
10
|
+
readonly meanRGB: readonly [number, number, number] | null;
|
|
11
|
+
readonly reason: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* CPU-readable equirectangular source radiance only; no DOM/canvas or invented JPEG mean.
|
|
15
|
+
* Rows are weighted by their exact spherical solid angle, rather than overweighting the poles.
|
|
16
|
+
* Arbitrary GPU/compressed/HTML/cube sources remain explicitly unknown until separately proven.
|
|
17
|
+
* @example const m = measureEnvironment(scene, 2048);
|
|
18
|
+
*/
|
|
19
|
+
declare function measureEnvironment(scene: Scene, maxSourceTexels: number): IEnvironmentMeasurement;
|
|
20
|
+
/**
|
|
21
|
+
* What a contribution report reads: the backlight's gains and the source-texel limit.
|
|
22
|
+
*
|
|
23
|
+
* Exported because `reportEnvironmentContribution` takes it — a public function with a private
|
|
24
|
+
* parameter type cannot be called from a game, which is how its example failed to compile.
|
|
25
|
+
*/
|
|
26
|
+
interface IContributionControls {
|
|
27
|
+
readonly darkThreshold: number;
|
|
28
|
+
readonly rimGain: number;
|
|
29
|
+
readonly fillGain: number;
|
|
30
|
+
readonly fillAdmitted: boolean;
|
|
31
|
+
readonly fillColor: Color;
|
|
32
|
+
readonly maxSourceTexels: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Overrides change the look, never whether its source contribution is measured/reported.
|
|
36
|
+
* @example
|
|
37
|
+
* reportEnvironmentContribution(scene, {
|
|
38
|
+
* darkThreshold: 0.02, fillAdmitted: true, fillColor: new Color(1, 1, 1), fillGain: 0.4,
|
|
39
|
+
* maxSourceTexels: 2048, rimGain: 0.6,
|
|
40
|
+
* });
|
|
41
|
+
*/
|
|
42
|
+
declare function reportEnvironmentContribution(scene: Scene, options: IContributionControls, measurement?: IEnvironmentMeasurement): {
|
|
43
|
+
scope: string;
|
|
44
|
+
environmentState: string;
|
|
45
|
+
ibl: string;
|
|
46
|
+
analyticFill: {
|
|
47
|
+
requestedGain: number;
|
|
48
|
+
admitted: boolean;
|
|
49
|
+
effectiveGain: number;
|
|
50
|
+
color: number[];
|
|
51
|
+
blackColorOverride: boolean;
|
|
52
|
+
reason: string;
|
|
53
|
+
};
|
|
54
|
+
rimGain: number;
|
|
55
|
+
fillGain: number;
|
|
56
|
+
darkThreshold: number;
|
|
57
|
+
status: "measured" | "unknown";
|
|
58
|
+
meanRadiance: number | null;
|
|
59
|
+
meanRGB: readonly [number, number, number] | null;
|
|
60
|
+
reason: string;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The mean radiance and colour of a bounded linear sample, or `unknown` with the reason.
|
|
65
|
+
*
|
|
66
|
+
* @situation turn an environment readback into the radiance a material's fill light needs
|
|
67
|
+
* @situation know why an environment sample could not be measured
|
|
68
|
+
* @constraint the sample must be the qualified 64x32 float RGBA readback; anything else is refused by name
|
|
69
|
+
* @example const m = sampledRadiance(readback, 1);
|
|
70
|
+
*/
|
|
71
|
+
declare function sampledRadiance(samples: unknown, intensity: number): IEnvironmentMeasurement;
|
|
72
|
+
|
|
73
|
+
/** Provenance stays outside the printable measurement; source/image references are borrowed. */
|
|
74
|
+
interface IEnvironmentSourceSnapshot {
|
|
75
|
+
readonly source: Texture | null;
|
|
76
|
+
readonly intensity: number;
|
|
77
|
+
readonly textureVersion: number | null;
|
|
78
|
+
readonly sourceVersion: number | null;
|
|
79
|
+
readonly colorSpace: string | null;
|
|
80
|
+
readonly mapping: number | null;
|
|
81
|
+
readonly image: unknown;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The provenance of a scene's environment: which texture, at which intensity, in which colour space.
|
|
85
|
+
*
|
|
86
|
+
* @situation reject an environment readback that belongs to a different sky
|
|
87
|
+
* @example const snapshot = captureEnvironmentSnapshot(scene);
|
|
88
|
+
*/
|
|
89
|
+
declare function captureEnvironmentSnapshot(scene: Scene): IEnvironmentSourceSnapshot;
|
|
90
|
+
/**
|
|
91
|
+
* Whether the scene's environment still matches the snapshot a sample was taken from.
|
|
92
|
+
*
|
|
93
|
+
* @situation hold a material's fill light to the sky that is on screen now
|
|
94
|
+
* @example if (environmentSnapshotCurrent(scene, snapshot)) draw(snapshot);
|
|
95
|
+
*/
|
|
96
|
+
declare function environmentSnapshotCurrent(scene: Scene, snapshot: IEnvironmentSourceSnapshot): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Whether an environment texture's mapping and colour space are qualified for the bounded GPU sample.
|
|
99
|
+
*
|
|
100
|
+
* @situation know why an environment was not sampled on the GPU
|
|
101
|
+
* @example if (samplingSourceSupported(source)) sample(source);
|
|
102
|
+
*/
|
|
103
|
+
declare function samplingSourceSupported(source: NonNullable<Scene["environment"]>): boolean;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Which renderers may run the material-lighting lane, and whether a renderer is running three's
|
|
107
|
+
* WebGL backend behind a WebGPU wrapper.
|
|
108
|
+
*
|
|
109
|
+
* Both questions are asked by the environment sampling mechanism beside this file, and both were
|
|
110
|
+
* answered in each template's `quality.ts` — twelve copies of the same predicate, so a fix to one
|
|
111
|
+
* left eleven kits admitting a renderer the fix refused. The tier they compare is the caller's, so
|
|
112
|
+
* a game that wants a different admission rule passes its own tier; nothing here decides how
|
|
113
|
+
* anything looks.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
/** First admitted material lane: high desktop hardware WebGPU in the browser only. */
|
|
117
|
+
interface IMaterialLightingEnvironment {
|
|
118
|
+
readonly web: boolean;
|
|
119
|
+
readonly rendererKind: string;
|
|
120
|
+
readonly mobile?: boolean;
|
|
121
|
+
readonly software?: boolean;
|
|
122
|
+
readonly webglFallback?: boolean;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Whether `tier` may run the material-lighting lane in `environment`.
|
|
126
|
+
*
|
|
127
|
+
* @situation decide whether this renderer is the admitted material lane
|
|
128
|
+
* @constraint high tier, browser, hardware WebGPU, not mobile, not software, not a WebGL fallback
|
|
129
|
+
* @example if (materialLightingEnabled("high", env)) lightMaterials();
|
|
130
|
+
*/
|
|
131
|
+
declare function materialLightingEnabled(tier: QualityTier, environment: IMaterialLightingEnvironment): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Whether a `WebGPURenderer` wrapper is running three's WebGL backend behind it.
|
|
134
|
+
*
|
|
135
|
+
* @situation refuse a GPU-only lane on a WebGL fallback instead of drawing something wrong
|
|
136
|
+
* @example if (isWebGLFallbackRenderer(renderer)) skipMaterialLane();
|
|
137
|
+
*/
|
|
138
|
+
declare function isWebGLFallbackRenderer(renderer: unknown): boolean;
|
|
139
|
+
|
|
140
|
+
interface IEnvironmentSample extends IEnvironmentSourceSnapshot {
|
|
141
|
+
readonly measurement: IEnvironmentMeasurement;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Measures and samples the scene's real environment on the GPU, bounded by a readback deadline.
|
|
145
|
+
*
|
|
146
|
+
* @situation measure what a scene's environment actually contributes without stalling the frame
|
|
147
|
+
* @situation give a material's fill light the environment's own radiance
|
|
148
|
+
* @constraint off unless the renderer is the admitted high-tier WebGPU lane; every refusal is reported by name
|
|
149
|
+
* @constraint the readback is abandoned after the deadline and the frame keeps the previous answer
|
|
150
|
+
* @example const sample = await sampleEnvironment(renderer, scene, env);
|
|
151
|
+
*/
|
|
152
|
+
declare function sampleEnvironment(renderer: unknown, scene: Scene, environment: IMaterialLightingEnvironment): Promise<IEnvironmentSample>;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The sample this renderer took of `scene`'s environment, if it is still current.
|
|
156
|
+
*
|
|
157
|
+
* @situation skip a second environment readback in the same frame
|
|
158
|
+
* @constraint a sample whose source texture or intensity moved is dropped, so a stale one never reaches a material
|
|
159
|
+
* @example const hit = cachedEnvironmentSample(renderer, scene);
|
|
160
|
+
*/
|
|
161
|
+
declare function cachedEnvironmentSample(renderer: object, scene: Scene): IEnvironmentSample | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* Remembers `sample` as this renderer's reading of `scene`'s environment.
|
|
164
|
+
*
|
|
165
|
+
* @situation reuse one environment readback across the materials of a scene
|
|
166
|
+
* @example cacheEnvironmentSample(renderer, scene, sample);
|
|
167
|
+
*/
|
|
168
|
+
declare function cacheEnvironmentSample(renderer: object, scene: Scene, sample: IEnvironmentSample): void;
|
|
169
|
+
|
|
170
|
+
export { type IEnvironmentMeasurement, type IEnvironmentSample, type IEnvironmentSourceSnapshot, type IMaterialLightingEnvironment, cacheEnvironmentSample, cachedEnvironmentSample, captureEnvironmentSnapshot, environmentSnapshotCurrent, isWebGLFallbackRenderer, materialLightingEnabled, measureEnvironment, reportEnvironmentContribution, sampleEnvironment, sampledRadiance, samplingSourceSupported };
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { SRGBColorSpace, EquirectangularReflectionMapping, NoColorSpace, LinearSRGBColorSpace, RenderTarget, RGBAFormat, FloatType, NoToneMapping, UnsignedByteType } from 'three';
|
|
2
|
+
import { texture, uv } from 'three/tsl';
|
|
3
|
+
import { MeshBasicNodeMaterial, QuadMesh } from 'three/webgpu';
|
|
4
|
+
|
|
5
|
+
// src/render/environment/environmentContribution.ts
|
|
6
|
+
var unknown = (reason) => ({
|
|
7
|
+
status: "unknown",
|
|
8
|
+
meanRadiance: null,
|
|
9
|
+
meanRGB: null,
|
|
10
|
+
reason
|
|
11
|
+
});
|
|
12
|
+
var linear = (value) => value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
|
13
|
+
function validSize(value) {
|
|
14
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
15
|
+
}
|
|
16
|
+
function readSource(texture2, maxSourceTexels) {
|
|
17
|
+
if (texture2.mapping !== EquirectangularReflectionMapping)
|
|
18
|
+
return unknown("Only CPU-readable equirectangular source radiance is qualified.");
|
|
19
|
+
const image = texture2.image;
|
|
20
|
+
if (image === null || typeof image !== "object" || !("data" in image) || !("width" in image) || !("height" in image))
|
|
21
|
+
return unknown("Environment source pixels are not CPU-readable; no radiance was inferred.");
|
|
22
|
+
const { data, width, height } = image;
|
|
23
|
+
if (!validSize(width) || !validSize(height))
|
|
24
|
+
return unknown("Environment source dimensions are invalid.");
|
|
25
|
+
if (width * height > maxSourceTexels)
|
|
26
|
+
return unknown("Environment CPU sample budget exceeded; no radiance was inferred.");
|
|
27
|
+
if (texture2.format !== RGBAFormat)
|
|
28
|
+
return unknown("Only explicit RGBA source samples are qualified.");
|
|
29
|
+
const bytes = texture2.type === UnsignedByteType && data instanceof Uint8Array;
|
|
30
|
+
const floats = texture2.type === FloatType && data instanceof Float32Array;
|
|
31
|
+
if (!bytes && !floats) return unknown("Environment source sample type is not qualified.");
|
|
32
|
+
if (data.length !== width * height * 4)
|
|
33
|
+
return unknown("Environment source samples do not match their dimensions.");
|
|
34
|
+
if (!(/* @__PURE__ */ new Set([NoColorSpace, LinearSRGBColorSpace, SRGBColorSpace])).has(texture2.colorSpace))
|
|
35
|
+
return unknown("Environment source color-space conversion is not qualified.");
|
|
36
|
+
return { status: "source", data, width, height, bytes };
|
|
37
|
+
}
|
|
38
|
+
function accumulate(source, srgb) {
|
|
39
|
+
const { data, width, height, bytes } = source;
|
|
40
|
+
const sums = [0, 0, 0];
|
|
41
|
+
const weights = Array.from(
|
|
42
|
+
{ length: height },
|
|
43
|
+
(_, y) => Math.cos(Math.PI * y / height) - Math.cos(Math.PI * (y + 1) / height)
|
|
44
|
+
);
|
|
45
|
+
for (let offset = 0; offset < data.length; offset += 4) {
|
|
46
|
+
const weight = weights[Math.floor(offset / (width * 4))] ?? 0;
|
|
47
|
+
for (let channel = 0; channel < 3; channel += 1) {
|
|
48
|
+
const sample = data[offset + channel];
|
|
49
|
+
if (sample === void 0 || !Number.isFinite(sample) || sample < 0)
|
|
50
|
+
return unknown("Environment radiance samples must be finite and nonnegative.");
|
|
51
|
+
const value = bytes ? sample / 255 : sample;
|
|
52
|
+
sums[channel] = (sums[channel] ?? 0) + (srgb ? linear(value) : value) * weight;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return { sums, weightSum: weights.reduce((a, b) => a + b, 0) * width };
|
|
56
|
+
}
|
|
57
|
+
function measureEnvironment(scene, maxSourceTexels) {
|
|
58
|
+
if (!Number.isSafeInteger(maxSourceTexels) || maxSourceTexels < 1)
|
|
59
|
+
throw new Error("Environment CPU sample budget must be a positive safe integer.");
|
|
60
|
+
const texture2 = scene.environment;
|
|
61
|
+
if (texture2 === null)
|
|
62
|
+
return {
|
|
63
|
+
status: "measured",
|
|
64
|
+
meanRadiance: 0,
|
|
65
|
+
meanRGB: [0, 0, 0],
|
|
66
|
+
reason: "No environment is bound."
|
|
67
|
+
};
|
|
68
|
+
if (!Number.isFinite(scene.environmentIntensity) || scene.environmentIntensity < 0)
|
|
69
|
+
return unknown("Environment intensity must be finite and nonnegative.");
|
|
70
|
+
const source = readSource(texture2, maxSourceTexels);
|
|
71
|
+
if (source.status !== "source") return source;
|
|
72
|
+
const accumulated = accumulate(source, texture2.colorSpace === SRGBColorSpace);
|
|
73
|
+
if ("status" in accumulated) return accumulated;
|
|
74
|
+
const { sums, weightSum } = accumulated;
|
|
75
|
+
const meanRGB = sums.map((sum) => sum / weightSum * scene.environmentIntensity);
|
|
76
|
+
const meanRadiance = meanRGB[0] * 0.2126 + meanRGB[1] * 0.7152 + meanRGB[2] * 0.0722;
|
|
77
|
+
if (!meanRGB.every(Number.isFinite) || !Number.isFinite(meanRadiance))
|
|
78
|
+
return unknown("Environment radiance accumulation overflowed.");
|
|
79
|
+
return {
|
|
80
|
+
status: "measured",
|
|
81
|
+
meanRadiance,
|
|
82
|
+
meanRGB,
|
|
83
|
+
reason: "Solid-angle-weighted linear source radiance, with active environment intensity."
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function fillReport(options) {
|
|
87
|
+
const blackColorOverride = options.fillColor.toArray().every((value) => value === 0);
|
|
88
|
+
let reason = "analytic fill enabled by caller; contribution still needs pixel qualification";
|
|
89
|
+
if (!options.fillAdmitted) reason = "not admitted by this qualification";
|
|
90
|
+
else if (options.fillGain === 0) reason = "disabled by fillGain override";
|
|
91
|
+
else if (blackColorOverride) reason = "disabled by black fillColor override";
|
|
92
|
+
return {
|
|
93
|
+
requestedGain: options.fillGain,
|
|
94
|
+
admitted: options.fillAdmitted,
|
|
95
|
+
effectiveGain: options.fillAdmitted ? options.fillGain : 0,
|
|
96
|
+
color: options.fillColor.toArray(),
|
|
97
|
+
blackColorOverride,
|
|
98
|
+
reason
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function reportEnvironmentContribution(scene, options, measurement) {
|
|
102
|
+
if (![
|
|
103
|
+
options.darkThreshold,
|
|
104
|
+
options.rimGain,
|
|
105
|
+
options.fillGain,
|
|
106
|
+
...options.fillColor.toArray()
|
|
107
|
+
].every((value) => Number.isFinite(value) && value >= 0))
|
|
108
|
+
throw new Error("Backlight measurement controls must be finite and nonnegative.");
|
|
109
|
+
const measured = measurement ?? measureEnvironment(scene, options.maxSourceTexels);
|
|
110
|
+
const dark = measured.meanRadiance === null ? null : measured.meanRadiance <= options.darkThreshold;
|
|
111
|
+
const environmentState = scene.environment === null ? "missing" : dark === null ? "unknown" : dark ? "dark" : "bright";
|
|
112
|
+
const report = {
|
|
113
|
+
...measured,
|
|
114
|
+
scope: "scene environment source availability; not material-specific reflected contribution",
|
|
115
|
+
environmentState,
|
|
116
|
+
ibl: dark === null ? "unknown" : dark ? "non-contributing" : "contributing",
|
|
117
|
+
analyticFill: fillReport(options),
|
|
118
|
+
rimGain: options.rimGain,
|
|
119
|
+
fillGain: options.fillGain,
|
|
120
|
+
darkThreshold: options.darkThreshold
|
|
121
|
+
};
|
|
122
|
+
console.info(`TN_ENVIRONMENT_CONTRIBUTION:${JSON.stringify(report)}`);
|
|
123
|
+
return report;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// src/render/environment/environmentRadiance.ts
|
|
127
|
+
var WIDTH = 64;
|
|
128
|
+
var HEIGHT = 32;
|
|
129
|
+
function unmeasured(reason) {
|
|
130
|
+
return { status: "unknown", meanRadiance: null, meanRGB: null, reason };
|
|
131
|
+
}
|
|
132
|
+
function sampledRadiance(samples2, intensity) {
|
|
133
|
+
if (!(samples2 instanceof Float32Array) || samples2.length !== WIDTH * HEIGHT * 4)
|
|
134
|
+
return unmeasured("GPU readback did not provide the qualified float RGBA sample layout.");
|
|
135
|
+
const sums = [0, 0, 0];
|
|
136
|
+
const weights = Array.from(
|
|
137
|
+
{ length: HEIGHT },
|
|
138
|
+
(_, y) => Math.cos(Math.PI * y / HEIGHT) - Math.cos(Math.PI * (y + 1) / HEIGHT)
|
|
139
|
+
);
|
|
140
|
+
const totalWeight = weights.reduce((sum, weight) => sum + weight, 0) * WIDTH;
|
|
141
|
+
for (const [offset, value] of samples2.entries()) {
|
|
142
|
+
const channel = offset % 4;
|
|
143
|
+
if (channel === 3) continue;
|
|
144
|
+
if (!Number.isFinite(value) || value < 0)
|
|
145
|
+
return unmeasured("GPU radiance samples must be finite and nonnegative.");
|
|
146
|
+
const weight = weights[Math.floor(offset / (WIDTH * 4))] ?? 0;
|
|
147
|
+
sums[channel] = (sums[channel] ?? 0) + value * weight;
|
|
148
|
+
}
|
|
149
|
+
const meanRGB = sums.map((sum) => sum / totalWeight * intensity);
|
|
150
|
+
const meanRadiance = meanRGB[0] * 0.2126 + meanRGB[1] * 0.7152 + meanRGB[2] * 0.0722;
|
|
151
|
+
if (!meanRGB.every(Number.isFinite) || !Number.isFinite(meanRadiance))
|
|
152
|
+
return unmeasured("GPU radiance accumulation overflowed.");
|
|
153
|
+
return {
|
|
154
|
+
status: "measured",
|
|
155
|
+
meanRGB,
|
|
156
|
+
meanRadiance,
|
|
157
|
+
reason: "Estimated linear scene-environment source radiance from 64x32 GPU samples, spherical row weighting and active intensity; not material-specific BRDF contribution."
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function captureEnvironmentSnapshot(scene) {
|
|
161
|
+
const source = scene.environment;
|
|
162
|
+
return {
|
|
163
|
+
source,
|
|
164
|
+
intensity: scene.environmentIntensity,
|
|
165
|
+
textureVersion: source?.version ?? null,
|
|
166
|
+
sourceVersion: source?.source.version ?? null,
|
|
167
|
+
colorSpace: source?.colorSpace ?? null,
|
|
168
|
+
mapping: source?.mapping ?? null,
|
|
169
|
+
image: source?.image ?? null
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function environmentSnapshotCurrent(scene, snapshot) {
|
|
173
|
+
const source = scene.environment;
|
|
174
|
+
return source === snapshot.source && scene.environmentIntensity === snapshot.intensity && (source?.version ?? null) === snapshot.textureVersion && (source?.source.version ?? null) === snapshot.sourceVersion && (source?.colorSpace ?? null) === snapshot.colorSpace && (source?.mapping ?? null) === snapshot.mapping && (source?.image ?? null) === snapshot.image;
|
|
175
|
+
}
|
|
176
|
+
function samplingSourceSupported(source) {
|
|
177
|
+
return source.mapping === EquirectangularReflectionMapping && (/* @__PURE__ */ new Set([NoColorSpace, LinearSRGBColorSpace, SRGBColorSpace])).has(source.colorSpace);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// src/render/environment/environmentSampleCache.ts
|
|
181
|
+
var samples = /* @__PURE__ */ new WeakMap();
|
|
182
|
+
function cachedEnvironmentSample(renderer, scene) {
|
|
183
|
+
if (scene.environment === null) return void 0;
|
|
184
|
+
const sample = samples.get(renderer)?.get(scene.environment);
|
|
185
|
+
return sample !== void 0 && environmentSnapshotCurrent(scene, sample) ? copySample(sample) : void 0;
|
|
186
|
+
}
|
|
187
|
+
function cacheEnvironmentSample(renderer, scene, sample) {
|
|
188
|
+
if (sample.source === null || sample.measurement.status !== "measured" || !environmentSnapshotCurrent(scene, sample))
|
|
189
|
+
return;
|
|
190
|
+
let byTexture = samples.get(renderer);
|
|
191
|
+
if (byTexture === void 0) {
|
|
192
|
+
byTexture = /* @__PURE__ */ new WeakMap();
|
|
193
|
+
samples.set(renderer, byTexture);
|
|
194
|
+
}
|
|
195
|
+
byTexture.set(sample.source, copySample(sample));
|
|
196
|
+
}
|
|
197
|
+
function copySample(sample) {
|
|
198
|
+
return {
|
|
199
|
+
...sample,
|
|
200
|
+
measurement: {
|
|
201
|
+
...sample.measurement,
|
|
202
|
+
meanRGB: sample.measurement.meanRGB === null ? null : [...sample.measurement.meanRGB]
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// src/render/environment/gate.ts
|
|
208
|
+
function materialLightingEnabled(tier, environment) {
|
|
209
|
+
return tier === "high" && environment.web && environment.rendererKind === "webgpu" && environment.mobile !== true && environment.software !== true && environment.webglFallback !== true;
|
|
210
|
+
}
|
|
211
|
+
function isWebGLFallbackRenderer(renderer) {
|
|
212
|
+
if (renderer === null || typeof renderer !== "object") return false;
|
|
213
|
+
const backend = Reflect.get(renderer, "backend");
|
|
214
|
+
return backend !== null && typeof backend === "object" && Reflect.get(backend, "isWebGLBackend") === true;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// src/render/environment/environmentSampling.ts
|
|
218
|
+
var ENVIRONMENT_READBACK_TIMEOUT_MS = 1e3;
|
|
219
|
+
var WIDTH2 = 64;
|
|
220
|
+
var HEIGHT2 = 32;
|
|
221
|
+
async function sampleEnvironment(renderer, scene, environment) {
|
|
222
|
+
const snapshot = captureEnvironmentSnapshot(scene);
|
|
223
|
+
const { source, intensity } = snapshot;
|
|
224
|
+
const result = (measurement) => ({
|
|
225
|
+
...snapshot,
|
|
226
|
+
measurement
|
|
227
|
+
});
|
|
228
|
+
const unknown2 = (reason) => result({ status: "unknown", meanRadiance: null, meanRGB: null, reason });
|
|
229
|
+
if (!materialLightingEnabled("high", environment) || isWebGLFallbackRenderer(renderer))
|
|
230
|
+
return unknown2("Environment GPU sampling is unqualified on this platform/renderer.");
|
|
231
|
+
if (source === null) return result(measureEnvironment(scene, WIDTH2 * HEIGHT2));
|
|
232
|
+
if (!samplingSourceSupported(source))
|
|
233
|
+
return unknown2("Environment mapping/color-space is not qualified for the bounded GPU sample.");
|
|
234
|
+
if (!Number.isFinite(intensity) || intensity < 0)
|
|
235
|
+
return unknown2("Environment intensity must be finite and nonnegative.");
|
|
236
|
+
if (!samplingRendererSupported(renderer))
|
|
237
|
+
return unknown2("Raw Three.js renderer lacks the qualified sampling/readback methods.");
|
|
238
|
+
const raw = renderer;
|
|
239
|
+
const cached = cachedEnvironmentSample(raw, scene);
|
|
240
|
+
if (cached !== void 0) return cached;
|
|
241
|
+
let state;
|
|
242
|
+
try {
|
|
243
|
+
state = {
|
|
244
|
+
target: raw.getRenderTarget(),
|
|
245
|
+
face: raw.getActiveCubeFace(),
|
|
246
|
+
mip: raw.getActiveMipmapLevel(),
|
|
247
|
+
toneMapping: raw.toneMapping,
|
|
248
|
+
colorSpace: raw.outputColorSpace,
|
|
249
|
+
autoClear: raw.autoClear
|
|
250
|
+
};
|
|
251
|
+
} catch {
|
|
252
|
+
return unknown2("Raw renderer state could not be saved; GPU sample skipped.");
|
|
253
|
+
}
|
|
254
|
+
const target = new RenderTarget(WIDTH2, HEIGHT2, {
|
|
255
|
+
type: FloatType,
|
|
256
|
+
format: RGBAFormat,
|
|
257
|
+
depthBuffer: false,
|
|
258
|
+
stencilBuffer: false
|
|
259
|
+
});
|
|
260
|
+
target.texture.colorSpace = LinearSRGBColorSpace;
|
|
261
|
+
const material = new MeshBasicNodeMaterial();
|
|
262
|
+
material.toneMapped = false;
|
|
263
|
+
material.colorNode = texture(source, uv()).rgb;
|
|
264
|
+
const quad = new QuadMesh(material);
|
|
265
|
+
let pendingReadback;
|
|
266
|
+
let readbackSettled = false;
|
|
267
|
+
let cleaned = false;
|
|
268
|
+
function cleanup() {
|
|
269
|
+
if (cleaned) return;
|
|
270
|
+
cleaned = true;
|
|
271
|
+
try {
|
|
272
|
+
material.dispose();
|
|
273
|
+
} finally {
|
|
274
|
+
target.dispose();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
try {
|
|
278
|
+
try {
|
|
279
|
+
raw.toneMapping = NoToneMapping;
|
|
280
|
+
raw.outputColorSpace = LinearSRGBColorSpace;
|
|
281
|
+
raw.autoClear = true;
|
|
282
|
+
raw.setRenderTarget(target, 0, 0);
|
|
283
|
+
quad.render(raw);
|
|
284
|
+
pendingReadback = Promise.resolve(
|
|
285
|
+
raw.readRenderTargetPixelsAsync(target, 0, 0, WIDTH2, HEIGHT2)
|
|
286
|
+
).then(
|
|
287
|
+
(value) => {
|
|
288
|
+
readbackSettled = true;
|
|
289
|
+
return value;
|
|
290
|
+
},
|
|
291
|
+
(error) => {
|
|
292
|
+
readbackSettled = true;
|
|
293
|
+
throw error;
|
|
294
|
+
}
|
|
295
|
+
);
|
|
296
|
+
} finally {
|
|
297
|
+
try {
|
|
298
|
+
raw.setRenderTarget(state.target, state.face, state.mip);
|
|
299
|
+
} finally {
|
|
300
|
+
raw.toneMapping = state.toneMapping;
|
|
301
|
+
raw.outputColorSpace = state.colorSpace;
|
|
302
|
+
raw.autoClear = state.autoClear;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
const outcome = await waitForReadback(pendingReadback);
|
|
306
|
+
if (outcome.timedOut)
|
|
307
|
+
return unknown2(
|
|
308
|
+
`Environment GPU readback exceeded ${ENVIRONMENT_READBACK_TIMEOUT_MS} ms budget; scratch resources retained until readback settles.`
|
|
309
|
+
);
|
|
310
|
+
const samples2 = outcome.samples;
|
|
311
|
+
if (!environmentSnapshotCurrent(scene, snapshot))
|
|
312
|
+
return unknown2(
|
|
313
|
+
"Environment source/content/interpretation changed while GPU readback was pending; sample refused."
|
|
314
|
+
);
|
|
315
|
+
const sampled = result(sampledRadiance(samples2, intensity));
|
|
316
|
+
cacheEnvironmentSample(raw, scene, sampled);
|
|
317
|
+
return sampled;
|
|
318
|
+
} catch (error) {
|
|
319
|
+
return unknown2(`Environment GPU sample/readback unavailable: ${String(error)}`);
|
|
320
|
+
} finally {
|
|
321
|
+
finishSampleCleanup(pendingReadback, readbackSettled, cleanup);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
async function waitForReadback(readback) {
|
|
325
|
+
let timer;
|
|
326
|
+
try {
|
|
327
|
+
return await Promise.race([
|
|
328
|
+
readback.then((samples2) => ({ timedOut: false, samples: samples2 })),
|
|
329
|
+
new Promise((resolve) => {
|
|
330
|
+
timer = setTimeout(() => resolve({ timedOut: true }), ENVIRONMENT_READBACK_TIMEOUT_MS);
|
|
331
|
+
})
|
|
332
|
+
]);
|
|
333
|
+
} finally {
|
|
334
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
function samplingRendererSupported(renderer) {
|
|
338
|
+
return renderer !== null && typeof renderer === "object" && Reflect.get(renderer, "isWebGPURenderer") === true && [
|
|
339
|
+
"render",
|
|
340
|
+
"getRenderTarget",
|
|
341
|
+
"getActiveCubeFace",
|
|
342
|
+
"getActiveMipmapLevel",
|
|
343
|
+
"setRenderTarget",
|
|
344
|
+
"readRenderTargetPixelsAsync"
|
|
345
|
+
].every((name) => typeof Reflect.get(renderer, name) === "function");
|
|
346
|
+
}
|
|
347
|
+
function finishSampleCleanup(readback, settled, cleanup) {
|
|
348
|
+
if (readback !== void 0 && !settled) void readback.then(cleanup, cleanup);
|
|
349
|
+
else cleanup();
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export { cacheEnvironmentSample, cachedEnvironmentSample, captureEnvironmentSnapshot, environmentSnapshotCurrent, isWebGLFallbackRenderer, materialLightingEnabled, measureEnvironment, reportEnvironmentContribution, sampleEnvironment, sampledRadiance, samplingSourceSupported };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Vector2, Texture, RenderTarget, Object3D, Matrix4, Camera, BufferGeometry, DepthTexture } from 'three';
|
|
2
2
|
import { MRTNode, Node, StorageBufferAttribute, ReadbackBuffer } from 'three/webgpu';
|
|
3
|
+
import { R as RendererToneMapping } from './default-tone-mapping-GgKPTiBP.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Host-boundary counters, default-off, on the frame budget's own record.
|
|
@@ -78,25 +79,6 @@ declare class FrameCounters {
|
|
|
78
79
|
uninstall(): void;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
/**
|
|
82
|
-
* Where the main-thread frame goes, by stage (PRD-771).
|
|
83
|
-
*
|
|
84
|
-
* The frame budget's `render` phase wraps one synchronous `renderer.render()` call, and on the owned
|
|
85
|
-
* Wasm engine that call holds the scene walk, the draw plan, the encode, the post passes and the queue
|
|
86
|
-
* submit, all in C++. A phase that large with nothing named inside it is a question, not a measurement.
|
|
87
|
-
* This splits it with one clock read per boundary, so the split rides every window rather than a
|
|
88
|
-
* diagnostic flag:
|
|
89
|
-
*
|
|
90
|
-
* - the JS before the engine call (cull, `beforeRender`, reconcile, LOD, matrix walk) and after it;
|
|
91
|
-
* - the engine's own CPU stages, from the running totals the Wasm facade publishes in
|
|
92
|
-
* `renderer.info.engine.cpuMs` (three-native `gpu-stages.ts`), differenced per frame;
|
|
93
|
-
* - what is left of the call, named: JS inside `render()` around the Wasm call, and Wasm time no stage owns.
|
|
94
|
-
*
|
|
95
|
-
* The stages partition the render phase. `wasmOther` and `engineJs` are subtractions, published as
|
|
96
|
-
* stages (`wasmRendererGap` is what `Renderer::render` spends outside its plan and encode halves) so the unlocated time is a number and never a quiet category. On an engine that publishes no
|
|
97
|
-
* stage totals (upstream three), the whole call is `engineJs`.
|
|
98
|
-
*/
|
|
99
|
-
|
|
100
82
|
/** The stages of the render phase, in the order a frame spends them. They sum to the frame's `render` phase. */
|
|
101
83
|
declare const RENDER_STAGES: readonly ["jsBefore", "engineJs", "wasmScene", "wasmPlan", "wasmCompute", "wasmEncode", "wasmPost", "wasmSubmit", "wasmPoll", "wasmTail", "wasmRendererGap", "wasmDatabaseGap", "wasmTargets", "wasmOther", "jsAfter"];
|
|
102
84
|
type RenderStage = (typeof RENDER_STAGES)[number];
|
|
@@ -182,8 +164,8 @@ interface IStageGpuReading {
|
|
|
182
164
|
declare function stageGpuReading(renderer: unknown): IStageGpuReading | undefined;
|
|
183
165
|
|
|
184
166
|
type PlatformRuntime = "web" | "native";
|
|
185
|
-
type PlatformOS = "android" | "ios" | "linux" | "macos" | "windows" | "unknown";
|
|
186
|
-
type PlatformFormFactor = "mobile" | "desktop" | "unknown";
|
|
167
|
+
type PlatformOS = "android" | "ios" | "linux" | "macos" | "windows" | "ps4" | "unknown";
|
|
168
|
+
type PlatformFormFactor = "mobile" | "desktop" | "console" | "unknown";
|
|
187
169
|
interface IPlatformInfo {
|
|
188
170
|
readonly runtime: PlatformRuntime;
|
|
189
171
|
readonly os: PlatformOS;
|
|
@@ -194,6 +176,10 @@ declare function getPlatform(): Readonly<IPlatformInfo>;
|
|
|
194
176
|
declare function isWeb(): boolean;
|
|
195
177
|
declare function isNative(): boolean;
|
|
196
178
|
declare function isMobile(): boolean;
|
|
179
|
+
/** A games console (PS4): a pad is the input, there is no keyboard, mouse or touchscreen. */
|
|
180
|
+
declare function isConsole(): boolean;
|
|
181
|
+
/** A PlayStation 4: the pad is a DualShock 4, so its buttons are ✕ ○ □ △ and OPTIONS. */
|
|
182
|
+
declare function isPs4(): boolean;
|
|
197
183
|
declare function isTouchscreenAvailable(): boolean;
|
|
198
184
|
|
|
199
185
|
/**
|
|
@@ -277,9 +263,9 @@ declare function resolveTargetFps(config: ITargetFpsConfig | undefined, platform
|
|
|
277
263
|
*/
|
|
278
264
|
|
|
279
265
|
/** Marker printed once per report window. */
|
|
280
|
-
declare const FRAME_BUDGET_MARKER
|
|
266
|
+
declare const FRAME_BUDGET_MARKER: "TN_FRAME_BUDGET";
|
|
281
267
|
/** Marker printed the moment a gap between presented frames exceeds `hitchMs`. */
|
|
282
|
-
declare const FRAME_HITCH_MARKER
|
|
268
|
+
declare const FRAME_HITCH_MARKER: "TN_FRAME_HITCH";
|
|
283
269
|
/**
|
|
284
270
|
* The named parts of one presented frame. They partition the frame: `hostGap` is the time before
|
|
285
271
|
* the callback (present wait plus whatever the host did between callbacks), and `update`,
|
|
@@ -707,6 +693,10 @@ declare class FrameBudget {
|
|
|
707
693
|
* @param nowMs the monotonic clock at callback entry.
|
|
708
694
|
*/
|
|
709
695
|
dispose(): void;
|
|
696
|
+
/** Marks the following frames as behind the presentation cover: no hot-call line for them. */
|
|
697
|
+
markCovered(): void;
|
|
698
|
+
/** Marks the cover lifted: the next window that begins reports hot calls again. */
|
|
699
|
+
markRevealed(): void;
|
|
710
700
|
beginFrame(timestampMs: number, nowMs: number): void;
|
|
711
701
|
/** The boundary between the fixed-step simulation and everything the render phase does. */
|
|
712
702
|
markSimulationEnd(nowMs: number, substeps: number): void;
|
|
@@ -1092,9 +1082,6 @@ interface IGpuFrameObservation {
|
|
|
1092
1082
|
dispose(): void;
|
|
1093
1083
|
}
|
|
1094
1084
|
|
|
1095
|
-
/** `filmic` is a fresh Unreal 5.8.3 project's curve and the default; the rest are the named overrides. */
|
|
1096
|
-
type RendererToneMapping = "filmic" | "aces" | "agx" | "neutral" | "none";
|
|
1097
|
-
|
|
1098
1085
|
/** The marker shared by alpha-antialiasing logs, playtests, and native diagnostics. */
|
|
1099
1086
|
declare const ALPHA_ANTIALIASING_MARKER = "TN_ALPHA_ANTIALIASING";
|
|
1100
1087
|
interface IAlphaAntialiasingReport {
|
|
@@ -1507,6 +1494,20 @@ type RenderOutputSetter = ((node: unknown, worldPass?: unknown, options?: IRende
|
|
|
1507
1494
|
* ancestor or its siblings.
|
|
1508
1495
|
*/
|
|
1509
1496
|
declare function prewarm(object: Object3D | readonly Object3D[]): void;
|
|
1497
|
+
/** Where one resolved frame's GPU time went, when the renderer times its own passes (the owned engine). */
|
|
1498
|
+
interface IGpuFrameSplit {
|
|
1499
|
+
/** The scene (main colour) pass. */
|
|
1500
|
+
readonly main: number;
|
|
1501
|
+
/** Every shadow map the frame drew: the sun's and the lamps'. */
|
|
1502
|
+
readonly shadow: number;
|
|
1503
|
+
/** Everything else: post chain, output, global illumination gather. */
|
|
1504
|
+
readonly other: number;
|
|
1505
|
+
}
|
|
1506
|
+
/** One resolved GPU frame: its duration, the Three.js frame id it belongs to, and its pass split when known. */
|
|
1507
|
+
interface IGpuFrameSample extends Partial<IGpuFrameSplit> {
|
|
1508
|
+
readonly frame: number;
|
|
1509
|
+
readonly ms: number;
|
|
1510
|
+
}
|
|
1510
1511
|
interface IRendererLike {
|
|
1511
1512
|
readonly domElement: HTMLCanvasElement;
|
|
1512
1513
|
readonly kind: RendererKind;
|
|
@@ -1712,10 +1713,7 @@ interface IRendererLike {
|
|
|
1712
1713
|
* resolve twice. Optional like `gpuFrameAge`, for stubs that implement only the drawing
|
|
1713
1714
|
* contract. `createRenderer` always provides it.
|
|
1714
1715
|
*/
|
|
1715
|
-
gpuFrameSample?():
|
|
1716
|
-
readonly frame: number;
|
|
1717
|
-
readonly ms: number;
|
|
1718
|
-
} | undefined;
|
|
1716
|
+
gpuFrameSample?(): IGpuFrameSample | undefined;
|
|
1719
1717
|
/**
|
|
1720
1718
|
* Observes complete allocated render-query groups without changing ordinary sampling.
|
|
1721
1719
|
* Frame IDs are Three query IDs, including any overlay draws; callers map world callbacks.
|
|
@@ -1838,4 +1836,4 @@ interface IRendererOptions {
|
|
|
1838
1836
|
}>) => unknown;
|
|
1839
1837
|
}
|
|
1840
1838
|
|
|
1841
|
-
export { RENDER_CHAIN_STAGE_ORDER as $, type IRenderChainBudgetWindow as A, type IRenderChainDroppedStage as B, type IRenderChainOptions as C, DEFAULT_PIPELINE_CENSUS_LIMIT as D, type IRenderChainRenderer as E, type FramePassKind as F, type IRenderChainRequest as G, type IRenderChainStage as H, type IRendererLike as I, type IRenderChainStageContext as J, type IRenderChainVelocityMeasurement as K, type IRenderChainVelocityReport as L, type IRenderChainVelocityRequest as M, type IRenderChainVelocityResult as N, type ITargetFps as O, type IVelocityRenderPass as P, MAX_TARGET_FPS as Q, type MainDrawSource as R, PIPELINE_CENSUS_CAPABILITY as S, PIPELINE_CENSUS_VERSION as T, PipelineCensus as U, type PipelineCensusMode as V, type PipelineCensusStatus as W, type PlatformFormFactor as X, type PlatformOS as Y, type PlatformRuntime as Z, RENDER_CHAIN_MARKER as _, type IFrameBudgetWindow as a, RENDER_CHAIN_TIERS as a0, RenderChain as a1, type RenderChainSource as a2, type RenderChainStageId as a3, type RenderChainStageName as a4, type RenderChainTier as a5, type RenderChainTierRequest as a6, type RenderChainVelocitySource as a7, type
|
|
1839
|
+
export { RENDER_CHAIN_STAGE_ORDER as $, type IRenderChainBudgetWindow as A, type IRenderChainDroppedStage as B, type IRenderChainOptions as C, DEFAULT_PIPELINE_CENSUS_LIMIT as D, type IRenderChainRenderer as E, type FramePassKind as F, type IRenderChainRequest as G, type IRenderChainStage as H, type IRendererLike as I, type IRenderChainStageContext as J, type IRenderChainVelocityMeasurement as K, type IRenderChainVelocityReport as L, type IRenderChainVelocityRequest as M, type IRenderChainVelocityResult as N, type ITargetFps as O, type IVelocityRenderPass as P, MAX_TARGET_FPS as Q, type MainDrawSource as R, PIPELINE_CENSUS_CAPABILITY as S, PIPELINE_CENSUS_VERSION as T, PipelineCensus as U, type PipelineCensusMode as V, type PipelineCensusStatus as W, type PlatformFormFactor as X, type PlatformOS as Y, type PlatformRuntime as Z, RENDER_CHAIN_MARKER as _, type IFrameBudgetWindow as a, RENDER_CHAIN_TIERS as a0, RenderChain as a1, type RenderChainSource as a2, type RenderChainStageId as a3, type RenderChainStageName as a4, type RenderChainTier as a5, type RenderChainTierRequest as a6, type RenderChainVelocitySource as a7, type TargetFpsSource as a8, VELOCITY_OUTPUT_NAME as a9, VELOCITY_PREVIOUS_BONE_MATRICES as aa, VELOCITY_PREVIOUS_INSTANCE_MATRICES as ab, VELOCITY_PREVIOUS_WORLD_MATRIX as ac, VelocityTracker as ad, counterDeviceOf as ae, createPipelineCensus as af, ensureVelocityOutput as ag, getPlatform as ah, isConsole as ai, isMobile as aj, isNative as ak, isPs4 as al, isTouchscreenAvailable as am, isWeb as an, prewarm as ao, readRenderChainObservation as ap, readRenderChainReport as aq, readVelocityPreviousBoneMatrices as ar, readVelocityPreviousMatrices as as, readVelocityPreviousWorldMatrix as at, resolveTargetFps as au, snapRefreshRate as av, stageGpuReading as aw, velocityTexture as ax, withVelocityContext as ay, type IFrameBudgetSimulation as b, type IRenderPassSample as c, type IFramePhaseSample as d, type IRendererOptions as e, type IPipelineCensus as f, type IFrameBudgetOptions as g, type IStageGpuReading as h, DEFAULT_TARGET_FPS as i, FRAME_BUDGET_MARKER as j, FRAME_BUDGET_PHASES as k, FRAME_HITCH_MARKER as l, FrameBudget as m, type FrameBudgetPhase as n, FrameCounters as o, type ICounterDevice as p, type IFrameBudgetPassSummary as q, type IFrameBudgetSummary as r, type IFrameCounters as s, type IPipelineCensusCounts as t, type IPipelineCensusEvent as u, type IPipelineCensusOptions as v, type IPipelineProvenance as w, type IPipelineShaderObservation as x, type IPlatformInfo as y, type IRenderChainApplied as z };
|
package/dist/spells/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CameraShake, GPUParticles3D } from '../chunk-
|
|
1
|
+
import { CameraShake, GPUParticles3D } from '../chunk-H4J6IAJE.js';
|
|
2
2
|
import '../chunk-QWJEMUUT.js';
|
|
3
3
|
import { Vector3, PointLight, Vector2, Vector4 } from 'three';
|
|
4
4
|
import * as three from 'three/webgpu';
|