@driftengine/core 4.8.6 → 4.9.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 +132 -0
- package/README.md +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.js +8 -1
- package/dist/render/anisotropicLobe.d.ts +10 -0
- package/dist/render/anisotropicLobe.js +19 -0
- package/dist/render/areaLights.d.ts +35 -0
- package/dist/render/areaLights.js +35 -0
- package/dist/render/atmosphere.d.ts +13 -0
- package/dist/render/atmosphere.js +9 -1
- package/dist/render/backend/api.d.ts +41 -3
- package/dist/render/backend/createRenderer.d.ts +6 -0
- package/dist/render/backend/createRenderer.js +4 -1
- package/dist/render/backend/webgl2/renderer.d.ts +140 -16
- package/dist/render/backend/webgl2/renderer.js +436 -44
- package/dist/render/backend/webgl2/sceneCaptureTarget.d.ts +29 -0
- package/dist/render/backend/webgl2/sceneCaptureTarget.js +96 -0
- package/dist/render/backend/webgpu/device.d.ts +7 -1
- package/dist/render/backend/webgpu/device.js +31 -3
- package/dist/render/backend/webgpu/flatPass.d.ts +16 -1
- package/dist/render/backend/webgpu/flatPass.js +58 -26
- package/dist/render/backend/webgpu/particlePass.js +2 -1
- package/dist/render/backend/webgpu/postPass.d.ts +51 -9
- package/dist/render/backend/webgpu/postPass.js +16 -2
- package/dist/render/backend/webgpu/reflectionSurfacePass.d.ts +30 -0
- package/dist/render/backend/webgpu/reflectionSurfacePass.js +100 -0
- package/dist/render/backend/webgpu/renderer.d.ts +166 -3
- package/dist/render/backend/webgpu/renderer.js +738 -83
- package/dist/render/backend/webgpu/sceneCaptureTarget.d.ts +24 -0
- package/dist/render/backend/webgpu/sceneCaptureTarget.js +59 -0
- package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.d.ts +1 -1
- package/dist/render/backend/webgpu/surfaceTexturePass.d.ts +4 -1
- package/dist/render/backend/webgpu/surfaceTexturePass.js +34 -8
- package/dist/render/backend/webgpu/waterPass.d.ts +1 -1
- package/dist/render/clusteredLights.d.ts +23 -5
- package/dist/render/clusteredLights.js +35 -8
- package/dist/render/displayRange.d.ts +31 -0
- package/dist/render/displayRange.js +47 -0
- package/dist/render/driftLight/bake.d.ts +2 -0
- package/dist/render/driftLight/bake.js +1 -1
- package/dist/render/driftLight/falloff.d.ts +4 -2
- package/dist/render/driftLight/falloff.js +8 -2
- package/dist/render/filmicCurve.d.ts +74 -0
- package/dist/render/filmicCurve.js +203 -0
- package/dist/render/fog.d.ts +4 -1
- package/dist/render/fog.js +12 -2
- package/dist/render/frame/resources.d.ts +2 -2
- package/dist/render/frame/resources.js +6 -0
- package/dist/render/frameReflections.d.ts +40 -0
- package/dist/render/frameReflections.js +48 -0
- package/dist/render/gi/bounceLights.d.ts +3 -2
- package/dist/render/gi/bounceLights.js +8 -3
- package/dist/render/instanceCull.js +5 -0
- package/dist/render/instances.d.ts +19 -5
- package/dist/render/instances.js +9 -3
- package/dist/render/lightBudget.d.ts +12 -1
- package/dist/render/lightBudget.js +23 -3
- package/dist/render/lightmap.d.ts +23 -9
- package/dist/render/lightmap.js +40 -18
- package/dist/render/particlePool.d.ts +21 -0
- package/dist/render/particlePool.js +7 -0
- package/dist/render/pass.d.ts +49 -0
- package/dist/render/pointLightSelection.d.ts +13 -0
- package/dist/render/pointLightSelection.js +3 -1
- package/dist/render/reflectionSurfaceTargets.d.ts +28 -0
- package/dist/render/reflectionSurfaceTargets.js +99 -0
- package/dist/render/renderQuality.d.ts +47 -15
- package/dist/render/renderQuality.js +4 -0
- package/dist/render/rendererHarness.js +3 -0
- package/dist/render/rgb9e5.d.ts +22 -0
- package/dist/render/rgb9e5.js +47 -0
- package/dist/render/sceneCapture.d.ts +29 -0
- package/dist/render/sceneCapture.js +36 -0
- package/dist/render/sceneTarget.d.ts +5 -0
- package/dist/render/sceneTarget.js +24 -1
- package/dist/render/screenSpaceReflection.d.ts +32 -1
- package/dist/render/screenSpaceReflection.js +14 -0
- package/dist/render/shaders/arcane.d.ts +1 -1
- package/dist/render/shaders/bolt.d.ts +1 -1
- package/dist/render/shaders/bolt.js +7 -1
- package/dist/render/shaders/caustics.d.ts +1 -1
- package/dist/render/shaders/depth.js +11 -0
- package/dist/render/shaders/film.d.ts +1 -1
- package/dist/render/shaders/filmLook.js +2 -1
- package/dist/render/shaders/fire.d.ts +1 -1
- package/dist/render/shaders/flat/anisotropic.d.ts +1 -1
- package/dist/render/shaders/flat/anisotropic.js +37 -3
- package/dist/render/shaders/flat/areaLight.d.ts +1 -1
- package/dist/render/shaders/flat/areaLight.js +46 -0
- package/dist/render/shaders/flat/glassTint.d.ts +3 -2
- package/dist/render/shaders/flat/glassTint.js +5 -1
- package/dist/render/shaders/flat/index.d.ts +15 -0
- package/dist/render/shaders/flat/index.js +22 -2
- package/dist/render/shaders/flat/lobes.d.ts +6 -0
- package/dist/render/shaders/flat/lobes.js +49 -43
- package/dist/render/shaders/flat/main.d.ts +1 -1
- package/dist/render/shaders/flat/main.js +85 -22
- package/dist/render/shaders/flat/models.d.ts +5 -2
- package/dist/render/shaders/flat/models.js +100 -16
- package/dist/render/shaders/flat/overlay.d.ts +16 -0
- package/dist/render/shaders/flat/overlay.js +117 -0
- package/dist/render/shaders/flat/pointShadow.js +1 -1
- package/dist/render/shaders/flat/preamble.js +10 -3
- package/dist/render/shaders/flat/reflectionSurface.d.ts +21 -0
- package/dist/render/shaders/flat/reflectionSurface.js +61 -0
- package/dist/render/shaders/fog.d.ts +1 -1
- package/dist/render/shaders/fog.js +9 -2
- package/dist/render/shaders/fringe.d.ts +29 -0
- package/dist/render/shaders/fringe.js +55 -0
- package/dist/render/shaders/generated/arcane.wgsl.d.ts +1 -1
- package/dist/render/shaders/generated/arcane.wgsl.js +1 -1
- package/dist/render/shaders/generated/bolt.wgsl.d.ts +1 -1
- package/dist/render/shaders/generated/bolt.wgsl.js +1 -1
- package/dist/render/shaders/generated/caustics.wgsl.d.ts +1 -1
- package/dist/render/shaders/generated/caustics.wgsl.js +1 -1
- package/dist/render/shaders/generated/depth.wgsl.d.ts +4 -4
- package/dist/render/shaders/generated/depth.wgsl.js +4 -4
- package/dist/render/shaders/generated/film.wgsl.d.ts +1 -1
- package/dist/render/shaders/generated/film.wgsl.js +1 -1
- package/dist/render/shaders/generated/fire.wgsl.d.ts +1 -1
- package/dist/render/shaders/generated/fire.wgsl.js +1 -1
- package/dist/render/shaders/generated/flat.wgsl.d.ts +192 -16
- package/dist/render/shaders/generated/flat.wgsl.js +230 -54
- package/dist/render/shaders/generated/line.wgsl.d.ts +1 -1
- package/dist/render/shaders/generated/line.wgsl.js +1 -1
- package/dist/render/shaders/generated/particle.wgsl.d.ts +4 -4
- package/dist/render/shaders/generated/particle.wgsl.js +4 -4
- package/dist/render/shaders/generated/rush.wgsl.d.ts +56 -26
- package/dist/render/shaders/generated/rush.wgsl.js +56 -26
- package/dist/render/shaders/generated/scatter.wgsl.d.ts +1 -1
- package/dist/render/shaders/generated/scatter.wgsl.js +1 -1
- package/dist/render/shaders/generated/smoke.wgsl.d.ts +1 -1
- package/dist/render/shaders/generated/smoke.wgsl.js +1 -1
- package/dist/render/shaders/generated/ssrResolve.wgsl.d.ts +29 -0
- package/dist/render/shaders/generated/ssrResolve.wgsl.js +29 -0
- package/dist/render/shaders/generated/ssrTrace.wgsl.d.ts +32 -7
- package/dist/render/shaders/generated/ssrTrace.wgsl.js +32 -7
- package/dist/render/shaders/generated/water.wgsl.d.ts +23 -16
- package/dist/render/shaders/generated/water.wgsl.js +23 -16
- package/dist/render/shaders/gi/probeBake.wgsl.js +9 -5
- package/dist/render/shaders/gpudriven/fog.wgsl.d.ts +2 -2
- package/dist/render/shaders/gpudriven/fog.wgsl.js +11 -3
- package/dist/render/shaders/line.d.ts +1 -1
- package/dist/render/shaders/particle.d.ts +3 -3
- package/dist/render/shaders/recon/motion.wgsl.d.ts +1 -1
- package/dist/render/shaders/recon/motion.wgsl.js +13 -2
- package/dist/render/shaders/rush.js +54 -11
- package/dist/render/shaders/scatter.d.ts +1 -1
- package/dist/render/shaders/smoke.d.ts +1 -1
- package/dist/render/shaders/ssrResolve.d.ts +17 -0
- package/dist/render/shaders/ssrResolve.js +51 -0
- package/dist/render/shaders/ssrTrace.js +46 -1
- package/dist/render/shaders/water.d.ts +1 -1
- package/dist/render/shaders/water.js +12 -3
- package/dist/render/skinScatter.d.ts +3 -1
- package/dist/render/skinScatter.js +3 -1
- package/dist/render/ssrPass.d.ts +16 -0
- package/dist/render/ssrPass.js +107 -1
- package/dist/render/surfaceModel.d.ts +29 -8
- package/dist/render/surfaceModel.js +33 -9
- package/dist/render/surfaceOverlay.d.ts +132 -0
- package/dist/render/surfaceOverlay.js +85 -0
- package/dist/render/surfaceTexture.d.ts +44 -1
- package/dist/render/surfaceTexture.js +96 -5
- package/dist/render/temporalAa.d.ts +14 -0
- package/dist/render/temporalAa.js +20 -0
- package/dist/render/vertexDefaults.d.ts +17 -0
- package/dist/render/vertexDefaults.js +24 -0
- package/package.json +6 -6
- package/src/index.ts +22 -2
- package/src/render/anisotropicLobe.ts +29 -0
- package/src/render/areaLights.ts +58 -0
- package/src/render/atmosphere.ts +22 -1
- package/src/render/backend/api.ts +58 -2
- package/src/render/backend/createRenderer.ts +18 -1
- package/src/render/backend/webgl2/renderer.ts +548 -50
- package/src/render/backend/webgl2/sceneCaptureTarget.ts +130 -0
- package/src/render/backend/webgpu/device.ts +42 -3
- package/src/render/backend/webgpu/flatPass.ts +63 -26
- package/src/render/backend/webgpu/particlePass.ts +2 -1
- package/src/render/backend/webgpu/postPass.ts +18 -0
- package/src/render/backend/webgpu/reflectionSurfacePass.ts +114 -0
- package/src/render/backend/webgpu/renderer.ts +927 -100
- package/src/render/backend/webgpu/sceneCaptureTarget.ts +63 -0
- package/src/render/backend/webgpu/surfaceTexturePass.ts +44 -14
- package/src/render/clusteredLights.ts +41 -8
- package/src/render/displayRange.ts +61 -0
- package/src/render/driftLight/bake.ts +3 -1
- package/src/render/driftLight/falloff.ts +13 -2
- package/src/render/filmicCurve.ts +229 -0
- package/src/render/fog.ts +19 -3
- package/src/render/frame/resources.ts +6 -0
- package/src/render/frameReflections.ts +72 -0
- package/src/render/gi/bounceLights.ts +12 -3
- package/src/render/instanceCull.ts +4 -0
- package/src/render/instances.ts +26 -6
- package/src/render/lightBudget.ts +40 -2
- package/src/render/lightmap.ts +64 -23
- package/src/render/particlePool.ts +23 -0
- package/src/render/pass.ts +53 -1
- package/src/render/pointLightSelection.ts +20 -1
- package/src/render/reflectionSurfaceTargets.ts +105 -0
- package/src/render/renderQuality.ts +52 -15
- package/src/render/rendererHarness.ts +3 -0
- package/src/render/rgb9e5.ts +52 -0
- package/src/render/sceneCapture.ts +56 -0
- package/src/render/sceneTarget.ts +30 -2
- package/src/render/screenSpaceReflection.ts +38 -1
- package/src/render/shaders/bolt.ts +7 -1
- package/src/render/shaders/depth.ts +11 -0
- package/src/render/shaders/filmLook.ts +2 -1
- package/src/render/shaders/flat/anisotropic.ts +37 -3
- package/src/render/shaders/flat/areaLight.ts +46 -0
- package/src/render/shaders/flat/glassTint.ts +13 -2
- package/src/render/shaders/flat/index.ts +37 -2
- package/src/render/shaders/flat/lobes.ts +50 -43
- package/src/render/shaders/flat/main.ts +85 -22
- package/src/render/shaders/flat/models.ts +100 -16
- package/src/render/shaders/flat/overlay.ts +117 -0
- package/src/render/shaders/flat/pointShadow.ts +1 -1
- package/src/render/shaders/flat/preamble.ts +10 -3
- package/src/render/shaders/flat/reflectionSurface.ts +61 -0
- package/src/render/shaders/fog.ts +9 -2
- package/src/render/shaders/fringe.ts +59 -0
- package/src/render/shaders/generated/arcane.wgsl.ts +1 -1
- package/src/render/shaders/generated/bolt.wgsl.ts +1 -1
- package/src/render/shaders/generated/caustics.wgsl.ts +1 -1
- package/src/render/shaders/generated/depth.wgsl.ts +4 -4
- package/src/render/shaders/generated/film.wgsl.ts +1 -1
- package/src/render/shaders/generated/fire.wgsl.ts +1 -1
- package/src/render/shaders/generated/flat.wgsl.ts +230 -54
- package/src/render/shaders/generated/line.wgsl.ts +1 -1
- package/src/render/shaders/generated/particle.wgsl.ts +4 -4
- package/src/render/shaders/generated/rush.wgsl.ts +56 -26
- package/src/render/shaders/generated/scatter.wgsl.ts +1 -1
- package/src/render/shaders/generated/smoke.wgsl.ts +1 -1
- package/src/render/shaders/generated/ssrResolve.wgsl.ts +30 -0
- package/src/render/shaders/generated/ssrTrace.wgsl.ts +32 -7
- package/src/render/shaders/generated/water.wgsl.ts +23 -16
- package/src/render/shaders/gi/probeBake.wgsl.ts +9 -5
- package/src/render/shaders/gpudriven/fog.wgsl.ts +11 -3
- package/src/render/shaders/recon/motion.wgsl.ts +13 -2
- package/src/render/shaders/rush.ts +54 -11
- package/src/render/shaders/ssrResolve.ts +52 -0
- package/src/render/shaders/ssrTrace.ts +46 -1
- package/src/render/shaders/water.ts +12 -3
- package/src/render/skinScatter.ts +3 -1
- package/src/render/ssrPass.ts +139 -1
- package/src/render/surfaceModel.ts +47 -10
- package/src/render/surfaceOverlay.ts +195 -0
- package/src/render/surfaceTexture.ts +136 -9
- package/src/render/temporalAa.ts +20 -0
- package/src/render/vertexDefaults.ts +28 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The surface half of a reflection traced through the frame's materials, on this backend: the
|
|
3
|
+
* frame's opaque lit draws again, against the depth they wrote, into two half-float targets — the
|
|
4
|
+
* environment as the frame shows it with the surface's roughness, and what a reflection found in the
|
|
5
|
+
* frame is multiplied by to land in its place. `shaders/flat/reflectionSurface.ts` is what the two
|
|
6
|
+
* hold and why the swap is exact; this is where they are drawn.
|
|
7
|
+
*
|
|
8
|
+
* **Why a second pass and not a second output of the frame's.** Every pipeline drawn into the
|
|
9
|
+
* frame's pass would have to declare a target it never writes — the sky, water, particles, text and
|
|
10
|
+
* every pass a consumer registers — so the frame keeps its one attachment, and the lit stage's two
|
|
11
|
+
* extra outputs land nowhere there. Here they land: the same pipelines with `REFLECTION_SURFACE` on,
|
|
12
|
+
* which leaves before the lamps, the same bind groups and ring slots, tested `equal` against the
|
|
13
|
+
* frame's depth so only what the frame kept writes.
|
|
14
|
+
*
|
|
15
|
+
* **The draws are commands, kept the way the skin's halves are** (`skinScatterPass.ts`): the frame
|
|
16
|
+
* graph's pool is spent at every flush, and these are replayed after the flush that ends the frame's
|
|
17
|
+
* pass. Each holds the ring slots its frame draw used, which stay valid until the frame's last
|
|
18
|
+
* submit, after this has run.
|
|
19
|
+
*
|
|
20
|
+
* **What it costs**: every opaque lit draw twice, the second without its lamps; two half-float
|
|
21
|
+
* targets the size of the frame. Single-sampled only, as the trace that reads them is.
|
|
22
|
+
*/
|
|
23
|
+
import { createCommandPool, resetPool, takeCommand } from './drawCommand.js';
|
|
24
|
+
/** Both targets' format: linear light and a tint, which an eight-bit target would clip and band. */
|
|
25
|
+
export const REFLECTION_SURFACE_FORMAT = 'rgba16float';
|
|
26
|
+
const USAGE_TARGET = 0x10 | 0x4; // RENDER_ATTACHMENT | TEXTURE_BINDING
|
|
27
|
+
export class ReflectionSurfacePass {
|
|
28
|
+
device;
|
|
29
|
+
commands = createCommandPool(256);
|
|
30
|
+
probe = null;
|
|
31
|
+
tint = null;
|
|
32
|
+
/** The environment as the frame shows it, and the roughness in alpha. */
|
|
33
|
+
probeView = null;
|
|
34
|
+
/** What a found reflection is multiplied by. */
|
|
35
|
+
tintView = null;
|
|
36
|
+
constructor(device) {
|
|
37
|
+
this.device = device;
|
|
38
|
+
}
|
|
39
|
+
/** A command for one opaque lit draw's surface half, filled by the caller. */
|
|
40
|
+
take() {
|
|
41
|
+
return this.commands.commands[takeCommand(this.commands)];
|
|
42
|
+
}
|
|
43
|
+
/** How many draws the frame kept. */
|
|
44
|
+
get kept() {
|
|
45
|
+
return this.commands.taken;
|
|
46
|
+
}
|
|
47
|
+
/** A new frame keeps nothing yet. */
|
|
48
|
+
reset() {
|
|
49
|
+
resetPool(this.commands);
|
|
50
|
+
}
|
|
51
|
+
/** The two targets at the frame's size, made again only when it changes. */
|
|
52
|
+
size(width, height) {
|
|
53
|
+
if (this.probe !== null && this.probe.width === width && this.probe.height === height)
|
|
54
|
+
return;
|
|
55
|
+
this.release();
|
|
56
|
+
const make = (label) => this.device.createTexture({
|
|
57
|
+
label,
|
|
58
|
+
size: [width, height],
|
|
59
|
+
format: REFLECTION_SURFACE_FORMAT,
|
|
60
|
+
usage: USAGE_TARGET,
|
|
61
|
+
});
|
|
62
|
+
this.probe = make('reflection.probe');
|
|
63
|
+
this.tint = make('reflection.tint');
|
|
64
|
+
this.probeView = this.probe.createView();
|
|
65
|
+
this.tintView = this.tint.createView();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Every kept draw into the two targets against the frame's depth, which it reads and does not
|
|
69
|
+
* write; both cleared first, so a pixel no lit surface reached reflects nothing. Called with no
|
|
70
|
+
* pass open on `encoder`, and drawn even with nothing kept, since the clear is what the trace
|
|
71
|
+
* reads there.
|
|
72
|
+
*/
|
|
73
|
+
draw(encoder, depth, issue) {
|
|
74
|
+
const probe = this.probeView;
|
|
75
|
+
const tint = this.tintView;
|
|
76
|
+
if (probe === null || tint === null)
|
|
77
|
+
return;
|
|
78
|
+
const pass = encoder.beginRenderPass({
|
|
79
|
+
label: 'reflection.surface',
|
|
80
|
+
colorAttachments: [
|
|
81
|
+
null,
|
|
82
|
+
{ view: probe, clearValue: [0, 0, 0, 1], loadOp: 'clear', storeOp: 'store' },
|
|
83
|
+
{ view: tint, clearValue: [0, 0, 0, 0], loadOp: 'clear', storeOp: 'store' },
|
|
84
|
+
],
|
|
85
|
+
depthStencilAttachment: { view: depth, depthReadOnly: true },
|
|
86
|
+
});
|
|
87
|
+
for (let i = 0; i < this.commands.taken; i += 1) {
|
|
88
|
+
issue(pass, this.commands.commands[i]);
|
|
89
|
+
}
|
|
90
|
+
pass.end();
|
|
91
|
+
}
|
|
92
|
+
release() {
|
|
93
|
+
this.probe?.destroy();
|
|
94
|
+
this.tint?.destroy();
|
|
95
|
+
this.probe = null;
|
|
96
|
+
this.tint = null;
|
|
97
|
+
this.probeView = null;
|
|
98
|
+
this.tintView = null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -23,6 +23,7 @@ import type { TextStyle } from '../../textLayout.ts';
|
|
|
23
23
|
import { GpuSurfaceTexture } from './surfaceTexturePass.ts';
|
|
24
24
|
import { GpuClothBinding, GpuClothParticles } from './clothTextures.ts';
|
|
25
25
|
import type { ComputeHost } from './computeHost.ts';
|
|
26
|
+
import { type SurfaceOverlay } from '../../surfaceOverlay.ts';
|
|
26
27
|
import type { ClothBindingData } from '../../clothBindingData.ts';
|
|
27
28
|
import type { CompressedTextureFormat, SurfaceSource } from '../../compressedSource.ts';
|
|
28
29
|
import { GpuSdfText } from './sdfTextPass.ts';
|
|
@@ -30,13 +31,15 @@ import type { SdfFont } from '../../sdfFont.ts';
|
|
|
30
31
|
import type { SdfTextStyle } from '../../sdfTextLayout.ts';
|
|
31
32
|
import type { SurfaceMaterial, SurfaceTextureOptions } from '../../surfaceTexture.ts';
|
|
32
33
|
import type { RenderBackend } from '../api.ts';
|
|
34
|
+
import { type DisplayRange } from '../../displayRange.ts';
|
|
35
|
+
import { type FilmicCurve } from '../../filmicCurve.ts';
|
|
33
36
|
import { type ColourGradeLut } from '../../colourGrade.ts';
|
|
34
37
|
import type { CausticSheet } from '../../causticsRenderer.ts';
|
|
35
38
|
import { type GpuCaustics } from './causticsPass.ts';
|
|
36
39
|
import type { BoltSegments } from '../../boltPool.ts';
|
|
37
40
|
import type { LineSegments } from '../../linePoints.ts';
|
|
38
41
|
import { type ParticleBatchOptions } from '../../particleBatch.ts';
|
|
39
|
-
import type { ParticleInstances } from '../../particlePool.ts';
|
|
42
|
+
import type { DeviceParticles, ParticleInstances } from '../../particlePool.ts';
|
|
40
43
|
import type { PlumeOptions, PlumePlacement } from '../../plumeRenderer.ts';
|
|
41
44
|
import type { InstanceData } from '../../instancedMesh.ts';
|
|
42
45
|
import { type RenderQuality } from '../../renderQuality.ts';
|
|
@@ -508,6 +511,17 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
508
511
|
*/
|
|
509
512
|
private refractSnapshot;
|
|
510
513
|
private refractSnapshotView;
|
|
514
|
+
/**
|
|
515
|
+
* The frame's colour as a registered pass reads it (`reads: ['colorSnapshot']`): the scene's own
|
|
516
|
+
* size and format, refilled at each such pass's draw. Allocated only once a pass declares the
|
|
517
|
+
* read, beside the frame's targets, and never in the frame loop. See `takePassColour`.
|
|
518
|
+
*/
|
|
519
|
+
private passColour;
|
|
520
|
+
private passColourView;
|
|
521
|
+
/** Registered passes that read the colour, queued this frame for after the upscale. */
|
|
522
|
+
private readonly latePasses;
|
|
523
|
+
/** A late pass draws unjittered, as every late draw does. */
|
|
524
|
+
private readonly latePassJitter;
|
|
511
525
|
/** Whether this frame has taken it. One snapshot serves every refracting draw. */
|
|
512
526
|
private refractSnapshotTaken;
|
|
513
527
|
/**
|
|
@@ -992,6 +1006,15 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
992
1006
|
private readonly reflectionQueue;
|
|
993
1007
|
private ssrLayout;
|
|
994
1008
|
private ssrResolveLayout;
|
|
1009
|
+
/** The frame's materials' reflections, resolved; null where off. See `frameReflections.ts`. */
|
|
1010
|
+
private readonly frameReflections;
|
|
1011
|
+
/** Their surface half, null where they are off or cannot be drawn: `reflectionSurfacePass.ts`. */
|
|
1012
|
+
private readonly reflectionSurface;
|
|
1013
|
+
/** The material resolve: its layout, its one block (the blur) and its group over the three maps. */
|
|
1014
|
+
private ssrMaterialLayout;
|
|
1015
|
+
private ssrMaterialUniforms;
|
|
1016
|
+
private readonly ssrMaterialFloats;
|
|
1017
|
+
private ssrMaterialGroup;
|
|
995
1018
|
private ssrUniforms;
|
|
996
1019
|
private readonly ssrStaging;
|
|
997
1020
|
private readonly ssrFloats;
|
|
@@ -1186,6 +1209,27 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1186
1209
|
createSurfaceTextureArray(sources: readonly SurfaceSource[], options?: SurfaceTextureOptions): GpuSurfaceTexture;
|
|
1187
1210
|
/** A baked lightmap page, as a `lightmapModel` material's `modelMap`. See `RendererApi`. */
|
|
1188
1211
|
createLightmap(page: LightmapPage): GpuSurfaceTexture;
|
|
1212
|
+
/**
|
|
1213
|
+
* A texture the scene can be drawn into, for a material to show. See `RendererApi` and
|
|
1214
|
+
* `sceneCapture.ts`. At the world's own format, which under `hdrScene` is half floats.
|
|
1215
|
+
*/
|
|
1216
|
+
createSceneCapture(width: number, height: number): GpuSurfaceTexture;
|
|
1217
|
+
/** Each capture's attachments, beside the texture a material binds. */
|
|
1218
|
+
private readonly captureTargets;
|
|
1219
|
+
/**
|
|
1220
|
+
* Whether a scene capture is being drawn: an off-screen pass as a probe bake is, so the frame's
|
|
1221
|
+
* camera, jitter, motion, refraction copy, skin's spread and late routing are left alone, but
|
|
1222
|
+
* lit by the probes and DriftLight as the frame is. See `captureScene`.
|
|
1223
|
+
*/
|
|
1224
|
+
private capturePassActive;
|
|
1225
|
+
/**
|
|
1226
|
+
* Draw the scene into a capture from `camera`. See `RendererApi.captureScene`.
|
|
1227
|
+
*
|
|
1228
|
+
* **Its own encoder, as a probe bake's**: the frame's pass is set aside and restored, the rings
|
|
1229
|
+
* are marked and rewound around the submit, and the frame graph is flushed at both boundaries so
|
|
1230
|
+
* no recorded draw crosses one. **Radiance**: the output transform and exposure are held off.
|
|
1231
|
+
*/
|
|
1232
|
+
captureScene(capture: GpuSurfaceTexture, camera: Camera, clearColor: Vec3, draw: (camera: Camera) => void): boolean;
|
|
1189
1233
|
/**
|
|
1190
1234
|
* GPU textures an `updateSurfaceTexture` replaced, destroyed when the next frame begins.
|
|
1191
1235
|
*
|
|
@@ -1298,6 +1342,12 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1298
1342
|
* frame's. See `Renderer.setAmbientSH`: material state, so the next draw takes a slot of its own.
|
|
1299
1343
|
*/
|
|
1300
1344
|
setAmbientSH(coefficients: ArrayLike<number> | null): void;
|
|
1345
|
+
/**
|
|
1346
|
+
* The overlay the following draws wear, or null for none: pass state, put back to none by
|
|
1347
|
+
* `bindMeshPass`. See `renderer.ts` and `surfaceOverlay.ts`. The numbers go in the material block,
|
|
1348
|
+
* which every variant declares; the atlas goes in a twin of each flat group (`overlayGroup`).
|
|
1349
|
+
*/
|
|
1350
|
+
setSurfaceOverlay(overlay: SurfaceOverlay | null): void;
|
|
1301
1351
|
/** How reflective the surfaces drawn next are. Clamped, as `renderer.ts` clamps it. */
|
|
1302
1352
|
setSurfaceReflectivity(amount: number): void;
|
|
1303
1353
|
/** How bright the environment the surfaces drawn next reflect is. See `renderer.ts`. */
|
|
@@ -1448,6 +1498,17 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1448
1498
|
private gradeCode;
|
|
1449
1499
|
private gradeExposure;
|
|
1450
1500
|
drawParticles(batch: GpuParticles, data: ParticleInstances, camera: Camera, env: Environment, timeSeconds: number): void;
|
|
1501
|
+
/**
|
|
1502
|
+
* Draw particles a caller's own compute wrote, where they lie. See `DeviceParticles`.
|
|
1503
|
+
*
|
|
1504
|
+
* **The pool's draw with its instance stream swapped**: the same material, blend, flipbook, soft
|
|
1505
|
+
* edge and fog, reading the caller's buffer in place of the one the pool uploads into — so nothing
|
|
1506
|
+
* crosses back to the CPU. Not sorted, and a count past what the buffer holds is cut to it rather
|
|
1507
|
+
* than handed to a draw the device would refuse with the frame.
|
|
1508
|
+
*/
|
|
1509
|
+
drawDeviceParticles(batch: GpuParticles, particles: DeviceParticles, camera: Camera, env: Environment, timeSeconds: number): void;
|
|
1510
|
+
/** A pool's uniforms for this view, and its draw from `instances`: both entry points' tail. */
|
|
1511
|
+
private drawParticleInstances;
|
|
1451
1512
|
/**
|
|
1452
1513
|
* A sprite's flipbook and fades into its fragment block `f`, and the bind group holding the
|
|
1453
1514
|
* frame's depth copy its soft edge reads — built again only when that copy is replaced.
|
|
@@ -1767,6 +1828,8 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
1767
1828
|
private writeWind;
|
|
1768
1829
|
/** Refilled per frame rather than allocated; see `resolvePointLights`. */
|
|
1769
1830
|
private readonly lights;
|
|
1831
|
+
/** The fixed arm's rectangles as `uAreaLightSize` holds them. See `packAreaSizesAndDoors`. */
|
|
1832
|
+
private readonly areaSizesAndDoors;
|
|
1770
1833
|
/** Refilled per frame rather than allocated; see `resolveAtmosphere`. */
|
|
1771
1834
|
private readonly medium;
|
|
1772
1835
|
private readonly panelLayout;
|
|
@@ -2521,6 +2584,20 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
2521
2584
|
private warnedNoPointShadowArray;
|
|
2522
2585
|
/** Said once, for the retired ambient dial. */
|
|
2523
2586
|
private warnedEnvironmentAmbient;
|
|
2587
|
+
/** The overlay the draws wear, `uOverlay`: see `setSurfaceOverlay`. */
|
|
2588
|
+
private readonly overlayFloats;
|
|
2589
|
+
/** Its atlas, bound where the refraction copy goes in a twin of each flat group. */
|
|
2590
|
+
private overlayMaps;
|
|
2591
|
+
/**
|
|
2592
|
+
* Each flat group's twin with the atlas in the refraction slot, by the group and the atlas, built
|
|
2593
|
+
* on the first draw that wears it and dropped wherever `flatBindGroups` is.
|
|
2594
|
+
*/
|
|
2595
|
+
private readonly overlayGroups;
|
|
2596
|
+
/** True while a twin is built: what `flatTextures` hands the refraction slot then. */
|
|
2597
|
+
private overlayBinding;
|
|
2598
|
+
/** True between `bindSeeThrough` and `releaseSeeThrough`: that draw reads the copy, not the atlas. */
|
|
2599
|
+
private seeThroughBound;
|
|
2600
|
+
private warnedOverlayRefraction;
|
|
2524
2601
|
private readonly castingWorldIndices;
|
|
2525
2602
|
private readonly resolvedPointShadows;
|
|
2526
2603
|
/** One face's view-projection, rebuilt per face rather than allocated. */
|
|
@@ -2584,6 +2661,15 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
2584
2661
|
*/
|
|
2585
2662
|
private resolveFace;
|
|
2586
2663
|
private buildFlatBindGroup;
|
|
2664
|
+
/**
|
|
2665
|
+
* The open material's flat group, or its twin with the surface overlay's atlas in the refraction
|
|
2666
|
+
* slot where the draw wears one and does not refract. A twin is built from the live material,
|
|
2667
|
+
* which `bindGroup` always is, and kept by the group and the atlas.
|
|
2668
|
+
*
|
|
2669
|
+
* **A draw that refracts, or is glass, keeps the frame's copy** and its overlay reads no image —
|
|
2670
|
+
* the shader asks the same of `uSeeThrough` (`overlayImagesBound`) — said once.
|
|
2671
|
+
*/
|
|
2672
|
+
private overlayGroup;
|
|
2587
2673
|
/**
|
|
2588
2674
|
* The bind group a draw uses, skinned or not.
|
|
2589
2675
|
*
|
|
@@ -2772,6 +2858,13 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
2772
2858
|
* the grade, so they are graded exactly as they were when they were drawn into the scene.
|
|
2773
2859
|
*/
|
|
2774
2860
|
private runLate;
|
|
2861
|
+
/**
|
|
2862
|
+
* The registered passes `drawPass` queued for after the upscale: each handed a fresh copy of the
|
|
2863
|
+
* reconstructed picture with every late draw in it, in the output-size texture the late
|
|
2864
|
+
* refraction keeps (its own reads are done by now: they were recorded before this copy), then
|
|
2865
|
+
* drawn over the picture in a pass of its own.
|
|
2866
|
+
*/
|
|
2867
|
+
private runLatePasses;
|
|
2775
2868
|
/** Whether this draw lands in the reconstructed picture. See `lateRouting.ts`. */
|
|
2776
2869
|
private tracksMotionNow;
|
|
2777
2870
|
/**
|
|
@@ -2976,6 +3069,16 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
2976
3069
|
* the frame, or an order-independent set, none of which the spread reads.
|
|
2977
3070
|
*/
|
|
2978
3071
|
private skinSplits;
|
|
3072
|
+
/** Whether a draw now is the frame's own, and so has a surface half to keep. */
|
|
3073
|
+
private reflectionSurfaceKeeps;
|
|
3074
|
+
/**
|
|
3075
|
+
* An opaque lit draw's surface half, kept for the frame's materials' reflections: the draw again,
|
|
3076
|
+
* with the same slots, buffers and bind group, through the pipeline with `REFLECTION_SURFACE` on —
|
|
3077
|
+
* which writes what the pixel reflects of its environment into the two targets
|
|
3078
|
+
* `reflectionSurfacePass.ts` holds and tests for the depth its frame draw wrote. Replayed when the
|
|
3079
|
+
* frame's pass has ended, before the trace reads them. See `shaders/flat/reflectionSurface.ts`.
|
|
3080
|
+
*/
|
|
3081
|
+
private keepReflectionSurface;
|
|
2979
3082
|
/**
|
|
2980
3083
|
* A skin draw's diffuse and colour halves, kept for the spread: the frame's draw again, twice,
|
|
2981
3084
|
* with the same slots, buffers and bind group, through the pipelines that write the diffuse's
|
|
@@ -2993,6 +3096,21 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
2993
3096
|
*/
|
|
2994
3097
|
private runSkinScatter;
|
|
2995
3098
|
private takeVolumeDepth;
|
|
3099
|
+
/** The colour copy a registered pass reads, at the scene's size and format. See `passColour`. */
|
|
3100
|
+
private allocatePassColour;
|
|
3101
|
+
/**
|
|
3102
|
+
* The frame's colour so far, into `passColour`, for a registered pass that reads it: the
|
|
3103
|
+
* boundary `takeRefractSnapshot` describes — flush, end the pass, copy what its end resolved,
|
|
3104
|
+
* reopen with `load` — and refused where that one is, in a mirror, a probe bake or a capture,
|
|
3105
|
+
* whose pictures are not the frame's. **Not latched**, unlike refraction's: each reading pass
|
|
3106
|
+
* sees the passes drawn before it, at a full-frame copy each.
|
|
3107
|
+
*/
|
|
3108
|
+
private takePassColour;
|
|
3109
|
+
/**
|
|
3110
|
+
* The frame's pass again after a copy between passes, loading everything already drawn: the same
|
|
3111
|
+
* attachments the copy's caller ended, with nothing cleared.
|
|
3112
|
+
*/
|
|
3113
|
+
private reopenFramePass;
|
|
2996
3114
|
/**
|
|
2997
3115
|
* The pass to record into, reopening one on the canvas if the frame has already gone.
|
|
2998
3116
|
*
|
|
@@ -3550,6 +3668,30 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
3550
3668
|
setOutputExposure(exposure: number): void;
|
|
3551
3669
|
/** This frame's exposure into the tone curve. Starts at the profile's own. */
|
|
3552
3670
|
private exposure;
|
|
3671
|
+
/**
|
|
3672
|
+
* The `filmic` curve every later frame is graded through, until it is set again. See
|
|
3673
|
+
* `RendererApi.setFilmicCurve`; the constants are solved here once, not per frame or per pixel.
|
|
3674
|
+
*/
|
|
3675
|
+
setFilmicCurve(curve: FilmicCurve): void;
|
|
3676
|
+
private warnedFilmClamped;
|
|
3677
|
+
/** The curve last set, so a new headroom can solve it again. */
|
|
3678
|
+
private filmCurve;
|
|
3679
|
+
/** The display's peak over paper white; 1 on a standard range. See `setDisplayLuminance`. */
|
|
3680
|
+
private headroom;
|
|
3681
|
+
/** The range the frame goes out in. See `RendererApi.displayRange`. */
|
|
3682
|
+
get displayRange(): DisplayRange;
|
|
3683
|
+
/** Why it is that range, in words. */
|
|
3684
|
+
get displayRangeReason(): string;
|
|
3685
|
+
/**
|
|
3686
|
+
* How bright paper white and the display's peak are, in any one unit (nits, usually), held until
|
|
3687
|
+
* changed: their ratio is how far above white the highlights may run on a high range display,
|
|
3688
|
+
* and nothing changes on a standard one. See `RendererApi.setDisplayLuminance`.
|
|
3689
|
+
*/
|
|
3690
|
+
setDisplayLuminance(paperWhite: number, peak: number): void;
|
|
3691
|
+
/** The curve's eight constants, and the two views the composite uploads them through. */
|
|
3692
|
+
private readonly filmConstants;
|
|
3693
|
+
private readonly filmA;
|
|
3694
|
+
private readonly filmB;
|
|
3553
3695
|
private bloomScale;
|
|
3554
3696
|
/** The draw's own ambient, as `packAmbientSH` writes it; zeros are the frame's. */
|
|
3555
3697
|
private readonly ambientSH;
|
|
@@ -3573,6 +3715,8 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
3573
3715
|
private readonly veilColor;
|
|
3574
3716
|
private veilAlpha;
|
|
3575
3717
|
private vignette;
|
|
3718
|
+
/** The lens's colour fringe: red's and green's pull and where it begins. See `fringe.ts`. */
|
|
3719
|
+
private readonly fringe;
|
|
3576
3720
|
private grain;
|
|
3577
3721
|
private grainSeed;
|
|
3578
3722
|
private warnedLookWithoutComposite;
|
|
@@ -3588,6 +3732,14 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
3588
3732
|
* see `filmLook.ts`. Needs `screenEffects`, and says so once rather than doing nothing.
|
|
3589
3733
|
*/
|
|
3590
3734
|
setVignette(strength: number): void;
|
|
3735
|
+
/**
|
|
3736
|
+
* The lens's colour fringe, held until changed: `intensity` is a percentage, 0 is none, and red
|
|
3737
|
+
* and green are pulled toward the centre by their wavelength's distance from blue, growing from
|
|
3738
|
+
* `start` — a share of the half-frame, 0 the centre — to the whole of it at the edge. Applied to
|
|
3739
|
+
* scene light at the composite's first read. Needs `screenEffects`, and says so once rather than
|
|
3740
|
+
* doing nothing. See `shaders/fringe.ts`.
|
|
3741
|
+
*/
|
|
3742
|
+
setChromaticAberration(intensity: number, start?: number): void;
|
|
3591
3743
|
/**
|
|
3592
3744
|
* Film grain, held until changed: an amplitude in display values (0 is none, 0.03 is a fine
|
|
3593
3745
|
* grain) and this frame's seed. **The seed is the caller's**, because the engine takes time from
|
|
@@ -3633,8 +3785,19 @@ export declare class WebGPURenderer implements RendererApi {
|
|
|
3633
3785
|
setGlobalMedium(density: number, albedo?: number, anisotropy?: number, maxDistance?: number): void;
|
|
3634
3786
|
/** How much speed blur the frame should resolve with, 0 to 1. */
|
|
3635
3787
|
setSpeedRush(strength: number): void;
|
|
3636
|
-
/**
|
|
3637
|
-
|
|
3788
|
+
/**
|
|
3789
|
+
* How much of the frame's motion blur to apply, 0 to 1, and the longest smear as a share of the
|
|
3790
|
+
* frame, both held until changed. See `RendererApi.setCameraMotionBlur`.
|
|
3791
|
+
*/
|
|
3792
|
+
setCameraMotionBlur(scale: number, maxShare?: number): void;
|
|
3793
|
+
/** The longest smear, as a share of the frame. See `setCameraMotionBlur`. */
|
|
3794
|
+
private motionBlurMax;
|
|
3795
|
+
private warnedObjectBlur;
|
|
3796
|
+
/**
|
|
3797
|
+
* Said once: a draw named where it was last frame while the frame blurs, and this frame keeps no
|
|
3798
|
+
* motion target to blur it by — the camera's motion alone smears it. See `OBJECT_BLUR_UNKEPT`.
|
|
3799
|
+
*/
|
|
3800
|
+
private warnObjectBlur;
|
|
3638
3801
|
/**
|
|
3639
3802
|
* The camera has cut: this frame is a new shot, not the next moment of the last one.
|
|
3640
3803
|
*
|