@driftengine/core 4.2.1 → 4.4.0
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/CHANGELOG.json +272 -0
- package/README.md +1 -1
- package/dist/cinematic/cameraPath.d.ts +53 -0
- package/dist/cinematic/cameraPath.js +118 -0
- package/dist/environment/daylight.d.ts +77 -0
- package/dist/environment/daylight.js +77 -0
- package/dist/geometry/meshConcat.d.ts +9 -0
- package/dist/geometry/meshConcat.js +101 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.js +14 -1
- package/dist/render/backend/createRenderer.d.ts +13 -1
- package/dist/render/backend/createRenderer.js +6 -5
- package/dist/render/backend/webgl2/renderer.d.ts +166 -1
- package/dist/render/backend/webgl2/renderer.js +424 -23
- package/dist/render/backend/webgpu/buffers.js +46 -8
- package/dist/render/backend/webgpu/depthPass.d.ts +81 -3
- package/dist/render/backend/webgpu/depthPass.js +75 -14
- package/dist/render/backend/webgpu/exposurePass.d.ts +39 -0
- package/dist/render/backend/webgpu/exposurePass.js +190 -0
- package/dist/render/backend/webgpu/fieldCompose.d.ts +11 -0
- package/dist/render/backend/webgpu/fieldCompose.js +13 -0
- package/dist/render/backend/webgpu/flatPass.d.ts +3 -1
- package/dist/render/backend/webgpu/flatPass.js +12 -5
- package/dist/render/backend/webgpu/particlePass.d.ts +8 -0
- package/dist/render/backend/webgpu/particlePass.js +1 -0
- package/dist/render/backend/webgpu/postPass.d.ts +12 -2
- package/dist/render/backend/webgpu/probeBake.d.ts +59 -3
- package/dist/render/backend/webgpu/probeBake.js +97 -7
- package/dist/render/backend/webgpu/probeTargets.d.ts +65 -0
- package/dist/render/backend/webgpu/probeTargets.js +180 -0
- package/dist/render/backend/webgpu/renderer.d.ts +176 -11
- package/dist/render/backend/webgpu/renderer.js +680 -250
- package/dist/render/backend/webgpu/scatterPass.js +7 -7
- package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.d.ts +1 -1
- package/dist/render/backend/webgpu/skinPaletteRing.d.ts +4 -0
- package/dist/render/backend/webgpu/skinPaletteRing.js +9 -0
- package/dist/render/backend/webgpu/skyPass.js +5 -1
- package/dist/render/backend/webgpu/uniformRing.d.ts +31 -1
- package/dist/render/backend/webgpu/uniformRing.js +53 -3
- package/dist/render/bloomChain.d.ts +6 -0
- package/dist/render/bloomChain.js +8 -0
- package/dist/render/clusteredLights.d.ts +19 -11
- package/dist/render/clusteredLights.js +96 -45
- package/dist/render/cutoutCaster.d.ts +23 -0
- package/dist/render/cutoutCaster.js +20 -0
- package/dist/render/driftLight/bake.d.ts +34 -0
- package/dist/render/driftLight/bake.js +95 -0
- package/dist/render/driftLight/falloff.d.ts +16 -0
- package/dist/render/driftLight/falloff.js +23 -0
- package/dist/render/driftLight/layout.d.ts +59 -0
- package/dist/render/driftLight/layout.js +138 -0
- package/dist/render/driftLight/lightField.d.ts +108 -0
- package/dist/render/driftLight/lightField.js +179 -0
- package/dist/render/driftLight/uniforms.d.ts +28 -0
- package/dist/render/driftLight/uniforms.js +41 -0
- package/dist/render/driftLight/visibility.d.ts +18 -0
- package/dist/render/driftLight/visibility.js +47 -0
- package/dist/render/emptyTexture.d.ts +6 -0
- package/dist/render/emptyTexture.js +19 -0
- package/dist/render/exposurePass.d.ts +48 -0
- package/dist/render/exposurePass.js +172 -0
- package/dist/render/flameLight.d.ts +71 -0
- package/dist/render/flameLight.js +63 -0
- package/dist/render/gi/bounceLights.d.ts +34 -0
- package/dist/render/gi/bounceLights.js +66 -0
- package/dist/render/gi/fieldReach.d.ts +12 -0
- package/dist/render/gi/fieldReach.js +62 -0
- package/dist/render/gi/globalField.d.ts +8 -0
- package/dist/render/gi/globalField.js +31 -0
- package/dist/render/gi/probeTrace.d.ts +3 -1
- package/dist/render/gi/probeTrace.js +3 -1
- package/dist/render/gpuCapability.js +19 -4
- package/dist/render/lightBudget.d.ts +11 -0
- package/dist/render/lightBudget.js +11 -0
- package/dist/render/pointLightSelection.d.ts +16 -0
- package/dist/render/pointLightSelection.js +178 -83
- package/dist/render/probeGrid.d.ts +11 -1
- package/dist/render/probeGrid.js +5 -2
- package/dist/render/probeSweeps.d.ts +45 -0
- package/dist/render/probeSweeps.js +77 -0
- package/dist/render/reflectionProbe.d.ts +43 -1
- package/dist/render/reflectionProbe.js +17 -3
- package/dist/render/renderQuality.d.ts +3 -1
- package/dist/render/rendererHarness.d.ts +9 -0
- package/dist/render/rendererHarness.js +18 -3
- package/dist/render/sceneTarget.d.ts +20 -0
- package/dist/render/sceneTarget.js +62 -1
- package/dist/render/shaders/agx.d.ts +31 -0
- package/dist/render/shaders/agx.js +81 -0
- package/dist/render/shaders/ambientOcclusion.d.ts +24 -5
- package/dist/render/shaders/ambientOcclusion.js +120 -63
- package/dist/render/shaders/cutoutCoverage.d.ts +31 -0
- package/dist/render/shaders/cutoutCoverage.js +40 -0
- package/dist/render/shaders/depth.d.ts +25 -0
- package/dist/render/shaders/depth.js +69 -3
- package/dist/render/shaders/exposure.d.ts +52 -0
- package/dist/render/shaders/exposure.js +124 -0
- package/dist/render/shaders/filmLook.d.ts +47 -0
- package/dist/render/shaders/filmLook.js +98 -0
- package/dist/render/shaders/flat/directionalShadow.js +35 -4
- package/dist/render/shaders/flat/driftLight.d.ts +29 -0
- package/dist/render/shaders/flat/driftLight.js +75 -0
- package/dist/render/shaders/flat/index.js +5 -0
- package/dist/render/shaders/flat/lobes.js +13 -0
- package/dist/render/shaders/flat/main.d.ts +1 -1
- package/dist/render/shaders/flat/main.js +68 -9
- package/dist/render/shaders/flat/preamble.js +23 -5
- package/dist/render/shaders/flat/probeGrid.js +46 -3
- package/dist/render/shaders/generated/ambientOcclusion.wgsl.d.ts +1 -1
- package/dist/render/shaders/generated/ambientOcclusion.wgsl.js +1 -1
- package/dist/render/shaders/generated/depth.wgsl.d.ts +100 -0
- package/dist/render/shaders/generated/depth.wgsl.js +100 -0
- package/dist/render/shaders/generated/exposure.wgsl.d.ts +42 -0
- package/dist/render/shaders/generated/exposure.wgsl.js +48 -0
- package/dist/render/shaders/generated/flat.wgsl.d.ts +1800 -1344
- package/dist/render/shaders/generated/flat.wgsl.js +1816 -1360
- package/dist/render/shaders/generated/localExposure.wgsl.d.ts +18 -0
- package/dist/render/shaders/generated/localExposure.wgsl.js +24 -0
- package/dist/render/shaders/generated/rush.wgsl.d.ts +40 -10
- package/dist/render/shaders/generated/rush.wgsl.js +40 -10
- package/dist/render/shaders/generated/temporalResolve.wgsl.d.ts +1 -1
- package/dist/render/shaders/generated/temporalResolve.wgsl.js +1 -1
- package/dist/render/shaders/gi/driftLight.wgsl.d.ts +16 -0
- package/dist/render/shaders/gi/driftLight.wgsl.js +49 -0
- package/dist/render/shaders/gi/probeBake.wgsl.d.ts +29 -4
- package/dist/render/shaders/gi/probeBake.wgsl.js +190 -20
- package/dist/render/shaders/globalMedium.js +4 -0
- package/dist/render/shaders/localExposure.d.ts +35 -0
- package/dist/render/shaders/localExposure.js +138 -0
- package/dist/render/shaders/prefilter.d.ts +1 -1
- package/dist/render/shaders/prefilter.js +6 -0
- package/dist/render/shaders/rush.js +33 -5
- package/dist/render/shaders/tangentFrame.d.ts +1 -1
- package/dist/render/shaders/tangentFrame.js +15 -3
- package/dist/render/shaders/temporalResolve.js +39 -1
- package/dist/render/shadowCasters.d.ts +5 -3
- package/dist/render/shadowMap.js +13 -0
- package/dist/render/surfaceTexture.d.ts +5 -0
- package/package.json +6 -6
- package/scripts/gpuCompute.mjs +24 -3
- package/scripts/png.mjs +23 -12
- package/src/cinematic/cameraPath.ts +178 -0
- package/src/environment/daylight.ts +152 -0
- package/src/geometry/meshConcat.ts +100 -0
- package/src/index.ts +32 -0
- package/src/render/backend/createRenderer.ts +22 -6
- package/src/render/backend/webgl2/renderer.ts +462 -20
- package/src/render/backend/webgpu/buffers.ts +51 -8
- package/src/render/backend/webgpu/depthPass.ts +78 -10
- package/src/render/backend/webgpu/exposurePass.ts +234 -0
- package/src/render/backend/webgpu/fieldCompose.ts +15 -0
- package/src/render/backend/webgpu/flatPass.ts +10 -2
- package/src/render/backend/webgpu/particlePass.ts +9 -0
- package/src/render/backend/webgpu/probeBake.ts +143 -9
- package/src/render/backend/webgpu/probeTargets.ts +211 -0
- package/src/render/backend/webgpu/renderer.ts +807 -271
- package/src/render/backend/webgpu/scatterPass.ts +7 -7
- package/src/render/backend/webgpu/skinPaletteRing.ts +10 -0
- package/src/render/backend/webgpu/skyPass.ts +5 -1
- package/src/render/backend/webgpu/uniformRing.ts +49 -3
- package/src/render/bloomChain.ts +9 -0
- package/src/render/clusteredLights.ts +108 -63
- package/src/render/cutoutCaster.ts +44 -0
- package/src/render/driftLight/bake.ts +125 -0
- package/src/render/driftLight/falloff.ts +26 -0
- package/src/render/driftLight/layout.ts +177 -0
- package/src/render/driftLight/lightField.ts +227 -0
- package/src/render/driftLight/uniforms.ts +61 -0
- package/src/render/driftLight/visibility.ts +58 -0
- package/src/render/emptyTexture.ts +41 -0
- package/src/render/exposurePass.ts +186 -0
- package/src/render/flameLight.ts +135 -0
- package/src/render/gi/bounceLights.ts +68 -0
- package/src/render/gi/fieldReach.ts +74 -0
- package/src/render/gi/globalField.ts +39 -0
- package/src/render/gi/probeTrace.ts +3 -1
- package/src/render/gpuCapability.ts +18 -5
- package/src/render/lightBudget.ts +12 -0
- package/src/render/pointLightSelection.ts +191 -79
- package/src/render/probeGrid.ts +13 -2
- package/src/render/probeSweeps.ts +80 -0
- package/src/render/reflectionProbe.ts +54 -2
- package/src/render/renderQuality.ts +3 -1
- package/src/render/rendererHarness.ts +25 -3
- package/src/render/sceneTarget.ts +75 -1
- package/src/render/shaders/ambientOcclusion.ts +125 -63
- package/src/render/shaders/cutoutCoverage.ts +43 -0
- package/src/render/shaders/depth.ts +80 -3
- package/src/render/shaders/exposure.ts +128 -0
- package/src/render/shaders/filmLook.ts +111 -0
- package/src/render/shaders/flat/directionalShadow.ts +35 -4
- package/src/render/shaders/flat/driftLight.ts +75 -0
- package/src/render/shaders/flat/index.ts +5 -0
- package/src/render/shaders/flat/lobes.ts +13 -0
- package/src/render/shaders/flat/main.ts +68 -9
- package/src/render/shaders/flat/preamble.ts +23 -5
- package/src/render/shaders/flat/probeGrid.ts +46 -3
- package/src/render/shaders/generated/ambientOcclusion.wgsl.ts +1 -1
- package/src/render/shaders/generated/depth.wgsl.ts +103 -0
- package/src/render/shaders/generated/exposure.wgsl.ts +51 -0
- package/src/render/shaders/generated/flat.wgsl.ts +1816 -1360
- package/src/render/shaders/generated/localExposure.wgsl.ts +26 -0
- package/src/render/shaders/generated/rush.wgsl.ts +40 -10
- package/src/render/shaders/generated/temporalResolve.wgsl.ts +1 -1
- package/src/render/shaders/gi/driftLight.wgsl.ts +49 -0
- package/src/render/shaders/gi/probeBake.wgsl.ts +191 -20
- package/src/render/shaders/globalMedium.ts +4 -0
- package/src/render/shaders/localExposure.ts +154 -0
- package/src/render/shaders/prefilter.ts +6 -0
- package/src/render/shaders/rush.ts +33 -5
- package/src/render/shaders/tangentFrame.ts +15 -3
- package/src/render/shaders/temporalResolve.ts +39 -1
- package/src/render/shadowCasters.ts +5 -3
- package/src/render/shadowMap.ts +14 -0
- package/src/render/surfaceTexture.ts +5 -0
|
@@ -11,6 +11,8 @@ import type { PassDefinition, PassHandle } from '../../pass.ts';
|
|
|
11
11
|
import type { Vec3 } from '../../../math/color.ts';
|
|
12
12
|
import { GpuTimer } from '../../gpuTimer.ts';
|
|
13
13
|
import type { ColourGradeLut } from '../../colourGrade.ts';
|
|
14
|
+
import { LightField } from '../../driftLight/lightField.ts';
|
|
15
|
+
import type { LightFieldOptions, LightFieldSource } from '../../driftLight/lightField.ts';
|
|
14
16
|
/**
|
|
15
17
|
* How far the rush's outermost tap reaches at full strength, in UV.
|
|
16
18
|
*
|
|
@@ -541,6 +543,14 @@ export interface TranslucentMeshOptions {
|
|
|
541
543
|
* that two surfaces overlapping in view blend in submission order. And a surface that writes no
|
|
542
544
|
* depth cannot occlude the sky. A caller wanting both wants the pieces sorted and this left
|
|
543
545
|
* alone.
|
|
546
|
+
*
|
|
547
|
+
* **And depth a blended surface writes is where the frame's depth-reading passes stop.** The
|
|
548
|
+
* global medium marches to it on both backends, and on WebGPU ambient occlusion, the temporal
|
|
549
|
+
* resolve and motion blur take it for the surface too. Right for a pane that is most of a pixel's
|
|
550
|
+
* colour; wrong for a faint sheet. A bought courtyard's dirt decals stand a centimetre off their
|
|
551
|
+
* stone and overhang every corner they wrap, and the haze stopped at each overhang, a clear band
|
|
552
|
+
* down a pier's whole height. A decal lying on an opaque surface needs no depth to hold the sky
|
|
553
|
+
* off, since the surface under it already does, so `false` costs it only an order among decals.
|
|
544
554
|
*/
|
|
545
555
|
readonly depthWrite?: boolean;
|
|
546
556
|
/**
|
|
@@ -777,6 +787,8 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
777
787
|
private readonly panelProgram;
|
|
778
788
|
private readonly panelUniforms;
|
|
779
789
|
private readonly panelVao;
|
|
790
|
+
/** The unit quad behind `panelVao`, held so `dispose` can release it. */
|
|
791
|
+
private readonly panelBuffer;
|
|
780
792
|
private readonly filmProgram;
|
|
781
793
|
/**
|
|
782
794
|
* The off-screen colour target, when screen effects are on. Null is not a failure —
|
|
@@ -807,6 +819,14 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
807
819
|
/** Whether a palette is currently chosen. Distinct from whether one was ever uploaded. */
|
|
808
820
|
private skinPaletteSet;
|
|
809
821
|
private readonly emptyTexture2D;
|
|
822
|
+
/** DriftLight's stand-ins while no field is whole: no brick anywhere, and no light. */
|
|
823
|
+
private readonly emptyDriftIndex;
|
|
824
|
+
private readonly emptyDriftAtlas;
|
|
825
|
+
/** The scene's DriftLight field, and its two volumes once it is whole. See `createLightField`. */
|
|
826
|
+
private lightField;
|
|
827
|
+
private driftIndex;
|
|
828
|
+
private driftAtlas;
|
|
829
|
+
private readonly driftUniforms;
|
|
810
830
|
private readonly emptyTexture2DArray;
|
|
811
831
|
private readonly emptyTextureCube;
|
|
812
832
|
/** How hard the rush blurs this frame, and how far its outermost tap reaches. */
|
|
@@ -865,6 +885,8 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
865
885
|
private motionBlurScale;
|
|
866
886
|
/** How much of the bloom ceiling this frame takes. See `setBloom`. */
|
|
867
887
|
private bloomScale;
|
|
888
|
+
/** In scene units, once `setBloom` has moved it; null reads the profile's. */
|
|
889
|
+
private bloomThresholdSet;
|
|
868
890
|
/**
|
|
869
891
|
* This frame's exposure into the tone curve. See `setOutputExposure`.
|
|
870
892
|
*
|
|
@@ -972,6 +994,15 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
972
994
|
private readonly depthUniforms;
|
|
973
995
|
private readonly depthInstancedProgram;
|
|
974
996
|
private readonly depthInstancedUniforms;
|
|
997
|
+
/**
|
|
998
|
+
* The cutout casters' depth programs, rigid and instanced: a leaf or a chain link casts the shape
|
|
999
|
+
* in its texture's alpha, not its whole card. See `DEPTH_CUTOUT_FRAG`. Chosen per draw by
|
|
1000
|
+
* `cutoutOf`, so an opaque caster never touches them.
|
|
1001
|
+
*/
|
|
1002
|
+
private readonly depthCutoutProgram;
|
|
1003
|
+
private readonly depthCutoutUniforms;
|
|
1004
|
+
private readonly depthInstancedCutoutProgram;
|
|
1005
|
+
private readonly depthInstancedCutoutUniforms;
|
|
975
1006
|
private readonly scatterDepthProgram;
|
|
976
1007
|
private readonly scatterDepthUniforms;
|
|
977
1008
|
private readonly shadowMap;
|
|
@@ -1030,6 +1061,10 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1030
1061
|
private readonly probeCapture;
|
|
1031
1062
|
/** Every probe of the grid, as one array texture. Allocated when a grid is declared. */
|
|
1032
1063
|
private probeArray;
|
|
1064
|
+
/** Which layers a bake writes and the shading reads. See `probeSweeps.ts`. */
|
|
1065
|
+
private probeSweeps;
|
|
1066
|
+
/** `uProbeGridSets`, rewritten in place. */
|
|
1067
|
+
private readonly probeSets;
|
|
1033
1068
|
/**
|
|
1034
1069
|
* Where those probes stand. A single baked probe is a grid of one at that probe's own origin.
|
|
1035
1070
|
*
|
|
@@ -1055,6 +1090,8 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1055
1090
|
private warnedEnvironmentAmbient;
|
|
1056
1091
|
/** Whether a probe is being baked, so the passes that would recurse into one can tell. */
|
|
1057
1092
|
private probePassActive;
|
|
1093
|
+
/** Whether the bake under way lights its faces by the grid. `ProbeBakeOptions.bounce`. */
|
|
1094
|
+
private probeBounce;
|
|
1058
1095
|
/** The clip-control extension, or null where this context does not offer it. */
|
|
1059
1096
|
private clipControl;
|
|
1060
1097
|
/**
|
|
@@ -1157,6 +1194,17 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1157
1194
|
*/
|
|
1158
1195
|
private activeDepthViewProj;
|
|
1159
1196
|
private activeDepthPeel;
|
|
1197
|
+
/**
|
|
1198
|
+
* Whether a peel pass has filled the second layer since the first one last opened, which is
|
|
1199
|
+
* what the frame samples it on: the rule the other backend's `peelFilled` states, held here too.
|
|
1200
|
+
*
|
|
1201
|
+
* **Not whether the map exists.** That was the test here, on the belief that a GL texture is
|
|
1202
|
+
* born reading as the far plane; it is born zeroed, and a scene that built the layer and never
|
|
1203
|
+
* peeled it sampled an occluder at the light. `ShadowMap` now clears itself at birth, so an
|
|
1204
|
+
* unfilled layer would read as lit either way — this is what keeps the two backends one
|
|
1205
|
+
* decision, and a frame that does not peel from paying a fetch per tap for nothing.
|
|
1206
|
+
*/
|
|
1207
|
+
private peelFilled;
|
|
1160
1208
|
/**
|
|
1161
1209
|
* Whether the depth pass this scatter draw interrupts wants back-face culling.
|
|
1162
1210
|
*
|
|
@@ -1167,6 +1215,11 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1167
1215
|
* cubemap — so the pass states what it wants and this restores that.
|
|
1168
1216
|
*/
|
|
1169
1217
|
private depthPassCullsFaces;
|
|
1218
|
+
/**
|
|
1219
|
+
* Whether the bound material is seen from both faces, so its draws cull nothing. Toggled around
|
|
1220
|
+
* each such draw and handed back, where the other backend bakes it into a pipeline.
|
|
1221
|
+
*/
|
|
1222
|
+
private materialDoubleSided;
|
|
1170
1223
|
/**
|
|
1171
1224
|
* The one sink handed to every caster enumeration.
|
|
1172
1225
|
*
|
|
@@ -1174,6 +1227,11 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1174
1227
|
* per pass would allocate six objects per light per frame.
|
|
1175
1228
|
*/
|
|
1176
1229
|
private readonly casterSink;
|
|
1230
|
+
/**
|
|
1231
|
+
* What a cutout depth draw needs beyond the plain one: the pass's matrix and peel, the material's
|
|
1232
|
+
* cutoff and UV scale, and its albedo on the surface unit, which the caller gives back after.
|
|
1233
|
+
*/
|
|
1234
|
+
private bindCutoutDepth;
|
|
1177
1235
|
private readonly drawPointShadowFace;
|
|
1178
1236
|
/**
|
|
1179
1237
|
* Viewport in CSS pixels rather than device pixels.
|
|
@@ -1839,6 +1897,25 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1839
1897
|
* whatever box the caller lays out in, and the game's own card is not always the canvas.
|
|
1840
1898
|
*/
|
|
1841
1899
|
drawText(text: TextRenderer, viewportWidth: number, viewportHeight: number, originX: number, originY: number, style: TextStyle, timeSec: number): void;
|
|
1900
|
+
/**
|
|
1901
|
+
* The cell size to draw a bitmap glyph at so every cell covers whole device pixels.
|
|
1902
|
+
*
|
|
1903
|
+
* **The caller snaps, and then measures and draws with the one number.** 4.1.4 applied this
|
|
1904
|
+
* inside `drawText` instead, where `textWidthPx` could not see it — it takes no viewport and so
|
|
1905
|
+
* cannot know the ratio — and every consumer went on laying out against the cell it asked for
|
|
1906
|
+
* while the engine drew a smaller one. A centred line, a right-aligned column and a line fitted
|
|
1907
|
+
* to a box broke together. Snapped here, the arithmetic and the picture cannot disagree.
|
|
1908
|
+
*
|
|
1909
|
+
* **It is on the renderer because only the renderer knows the second number.** `viewportWidth`
|
|
1910
|
+
* is the caller's, and it already passes it to `drawText`; the drawing buffer is not on the
|
|
1911
|
+
* shared surface and a game's text layout is a pure function over CSS pixels, so reaching it
|
|
1912
|
+
* meant threading a canvas through an interface layer to a value the renderer was holding.
|
|
1913
|
+
*
|
|
1914
|
+
* The decision itself stays in `textLayout.ts` and only this binding is per backend, which is
|
|
1915
|
+
* the 2026-08-13 rule: a cell already whole comes back untouched, and the snap is downward so a
|
|
1916
|
+
* line fitted to a box can only leave a gap rather than overflow it.
|
|
1917
|
+
*/
|
|
1918
|
+
snapTextCellSize(cellSize: number, viewportWidth: number): number;
|
|
1842
1919
|
/** Width of the string this handle currently holds, in pixels at a given cell size. */
|
|
1843
1920
|
textWidth(text: TextRenderer, cellSize: number): number;
|
|
1844
1921
|
disposeText(text: TextRenderer): void;
|
|
@@ -2495,6 +2572,53 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
2495
2572
|
* than anything in the world.
|
|
2496
2573
|
*/
|
|
2497
2574
|
setCameraMotionBlur(scale: number): void;
|
|
2575
|
+
/**
|
|
2576
|
+
* The camera has cut: this frame is a new shot, not the next moment of the last one.
|
|
2577
|
+
*
|
|
2578
|
+
* **Everything temporal reprojects through the previous frame's view**: the motion blur measures
|
|
2579
|
+
* its smear against it, and the temporal resolve reads its history through it. A cut is a jump
|
|
2580
|
+
* the renderer cannot tell from a fast camera, so without this a transport that seeks, a respawn
|
|
2581
|
+
* or an edit smears its first frame along the whole jump and blends in a picture of somewhere
|
|
2582
|
+
* else. The caller knows it cut; this is how it says so, before the frame's `beginFrame`.
|
|
2583
|
+
*
|
|
2584
|
+
* What it gives up is one frame of history: the frame after a cut has no blur and no temporal
|
|
2585
|
+
* blend, as the first frame of a session has none. Nothing else is reset.
|
|
2586
|
+
*/
|
|
2587
|
+
cameraCut(): void;
|
|
2588
|
+
/**
|
|
2589
|
+
* **Eye adaptation**: how far the frame's exposure follows its own brightness, 0 to 1, and the
|
|
2590
|
+
* seconds since the last frame. 0 is off and the default, and at 0 nothing is metered or allocated.
|
|
2591
|
+
*
|
|
2592
|
+
* The finished scene is metered on the GPU each frame — the log-mean of its luminance — and a
|
|
2593
|
+
* held brightness moves toward it at a fixed rate, about 78% of the way in a second; the composite
|
|
2594
|
+
* then scales scene light toward middle grey by \`strength\` of the stops between them, at most six
|
|
2595
|
+
* either way. So a shaded courtyard floor opens up the way a camera or an eye would, and
|
|
2596
|
+
* \`setOutputExposure\` becomes a bias on top: a night kept darker than a day is a bias under one.
|
|
2597
|
+
* **The time is the caller's**, because the engine takes time from its caller; a held capture
|
|
2598
|
+
* passes 0 and holds. \`cameraCut\` snaps it, so a new shot is metered rather than eased into.
|
|
2599
|
+
*
|
|
2600
|
+
* What it gives up is regional metering: every pixel counts the same. Needs \`screenEffects\` and
|
|
2601
|
+
* \`hdrScene\`, and says so once rather than doing nothing. See \`shaders/exposure.ts\`.
|
|
2602
|
+
*/
|
|
2603
|
+
setAutoExposure(strength: number, dtSec: number): void;
|
|
2604
|
+
/**
|
|
2605
|
+
* **Local exposure**: how far each region of the frame is brought toward the frame's own
|
|
2606
|
+
* brightness, 0 to 1. 0 is off and the default, and at 0 nothing more is measured or allocated.
|
|
2607
|
+
*
|
|
2608
|
+
* A tone curve maps one range, and a sunlit courtyard is two: its shaded arcades hold a fiftieth
|
|
2609
|
+
* of the light on its sunlit paving, so exposed for either the other is black or white. This moves
|
|
2610
|
+
* each region `strength` of the stops between it and the frame's held brightness, at most three,
|
|
2611
|
+
* read from a bilateral grid over the exposure meter's tiles, so shade beside sun is lifted as
|
|
2612
|
+
* shade rather than as the average of the two. The eye's held brightness is what regions move
|
|
2613
|
+
* toward, so it is measured whether or not `setAutoExposure` is on; with adaptation off the frame
|
|
2614
|
+
* as a whole keeps the exposure it was given. About 0.5 is a photograph's latitude, and 1 is a
|
|
2615
|
+
* frame with no light and shade left in it.
|
|
2616
|
+
*
|
|
2617
|
+
* What it gives up is contrast between regions, which is the point, and a halo a tile wide where
|
|
2618
|
+
* two regions of one brightness band differ. Needs `screenEffects` and `hdrScene`, and says so
|
|
2619
|
+
* once rather than doing nothing. See `shaders/localExposure.ts`.
|
|
2620
|
+
*/
|
|
2621
|
+
setLocalExposure(strength: number): void;
|
|
2498
2622
|
/**
|
|
2499
2623
|
* Where this frame's lens is focused, how deep the sharp zone is, and how much of the ceiling
|
|
2500
2624
|
* to take.
|
|
@@ -2543,8 +2667,15 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
2543
2667
|
*
|
|
2544
2668
|
* Set before `beginFrame` and held until changed. Ignored entirely when `bloom` is 0, since
|
|
2545
2669
|
* the chain is never built.
|
|
2670
|
+
*
|
|
2671
|
+
* **`threshold` moves `bloomThreshold` for this frame and every one after**, in the same scene
|
|
2672
|
+
* units. A threshold is compared before exposure is applied, so one fixed at construction means a
|
|
2673
|
+
* different brightness on screen at every exposure. That is harmless while exposure stands still
|
|
2674
|
+
* and wrong for a day whose exposure spans 2.5 to 14: a courtyard blooming at noon, or candles
|
|
2675
|
+
* never blooming at night. A caller whose exposure moves passes what it wants on screen over the
|
|
2676
|
+
* exposure. Omitted leaves it where it was, so a caller that never passes one keeps the profile's.
|
|
2546
2677
|
*/
|
|
2547
|
-
setBloom(scale: number): void;
|
|
2678
|
+
setBloom(scale: number, threshold?: number): void;
|
|
2548
2679
|
/**
|
|
2549
2680
|
* How thick the air is, this frame: a global participating medium filling the whole frustum.
|
|
2550
2681
|
*
|
|
@@ -2650,6 +2781,21 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
2650
2781
|
* because a consumer setting a grade every frame would otherwise flood a console.
|
|
2651
2782
|
*/
|
|
2652
2783
|
setColourGrade(lut: ColourGradeLut | null, strength?: number): void;
|
|
2784
|
+
/**
|
|
2785
|
+
* How strongly the lens darkens the frame's corners, held until changed: 0 is none, 0.5 is about
|
|
2786
|
+
* 1.2 stops at the corner. Applied to scene light before the tone curve, as a lens loses light;
|
|
2787
|
+
* see `filmLook.ts`. Needs `screenEffects`, and says so once rather than doing nothing.
|
|
2788
|
+
*/
|
|
2789
|
+
setVignette(strength: number): void;
|
|
2790
|
+
/**
|
|
2791
|
+
* Film grain, held until changed: an amplitude in display values (0 is none, 0.03 is a fine
|
|
2792
|
+
* grain) and this frame's seed. **The seed is the caller's**, because the engine takes time from
|
|
2793
|
+
* its caller: pass a new one each frame for grain that moves, and the same one for a still that
|
|
2794
|
+
* is identical run to run. Applied last, after the grade and the veil; see `filmLook.ts`.
|
|
2795
|
+
*/
|
|
2796
|
+
setFilmGrain(strength: number, seed: number): void;
|
|
2797
|
+
private warnedLookWithoutComposite;
|
|
2798
|
+
private warnLookWithoutComposite;
|
|
2653
2799
|
/**
|
|
2654
2800
|
* What this frame asked for. **Every ceiling here is `null`, and that is the finding.**
|
|
2655
2801
|
*
|
|
@@ -2823,6 +2969,25 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
2823
2969
|
private useFlatProgram;
|
|
2824
2970
|
/** Bind the flat pass once per frame; then issue any number of drawMesh calls. */
|
|
2825
2971
|
bindMeshPass(camera: Camera, env: Environment): void;
|
|
2972
|
+
/**
|
|
2973
|
+
* Sum a scene's many fixed lights into a DriftLight field, which stands in for each of them
|
|
2974
|
+
* wherever the frame's choice of exact lights does not reach. See `driftLight/lightField.ts`.
|
|
2975
|
+
*
|
|
2976
|
+
* Replaces any field made before. The scene then paces `field.bake(bricks)` and calls
|
|
2977
|
+
* `field.follow(buffer.complete, ...)` each frame with the selection that chose its exact lights;
|
|
2978
|
+
* the volume is summed into the frame once every brick has landed.
|
|
2979
|
+
*/
|
|
2980
|
+
createLightField(lights: readonly LightFieldSource[], options?: Omit<LightFieldOptions, 'falloff'>): LightField;
|
|
2981
|
+
/** Let go of the field and its volumes; the scene's lights are all exact again. */
|
|
2982
|
+
disposeLightField(): void;
|
|
2983
|
+
private forgetLightFieldVolumes;
|
|
2984
|
+
/**
|
|
2985
|
+
* Upload the field's two volumes, once, when its last brick has baked: nothing samples them
|
|
2986
|
+
* before that, so uploading as bricks land would be work for no picture.
|
|
2987
|
+
*/
|
|
2988
|
+
private uploadLightField;
|
|
2989
|
+
/** The field's uniforms and volumes for this pass, or the stand-ins that switch it off. */
|
|
2990
|
+
private bindDriftLight;
|
|
2826
2991
|
/**
|
|
2827
2992
|
* Everything one flat program needs to know about this frame.
|
|
2828
2993
|
*
|