@driftengine/core 4.9.0 → 4.11.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 +133 -11
- package/README.md +43 -38
- package/dist/index.d.ts +7 -4
- package/dist/index.js +5 -4
- package/dist/render/ambientHarmonics.d.ts +1 -1
- package/dist/render/ambientHarmonics.js +1 -1
- package/dist/render/areaLights.d.ts +4 -4
- package/dist/render/areaLights.js +1 -1
- package/dist/render/backend/api.d.ts +10 -3
- package/dist/render/backend/select.js +11 -5
- package/dist/render/backend/webgl2/boneAnimations.d.ts +29 -0
- package/dist/render/backend/webgl2/boneAnimations.js +80 -0
- package/dist/render/backend/webgl2/instanced.d.ts +5 -1
- package/dist/render/backend/webgl2/instanced.js +13 -1
- package/dist/render/backend/webgl2/renderer.d.ts +189 -4
- package/dist/render/backend/webgl2/renderer.js +614 -66
- package/dist/render/backend/webgl2/skinPaletteTexture.d.ts +5 -3
- package/dist/render/backend/webgl2/skinPaletteTexture.js +6 -4
- package/dist/render/backend/webgpu/boneAnimations.d.ts +34 -0
- package/dist/render/backend/webgpu/boneAnimations.js +76 -0
- package/dist/render/backend/webgpu/buffers.d.ts +24 -4
- package/dist/render/backend/webgpu/buffers.js +116 -59
- package/dist/render/backend/webgpu/clothKernels.d.ts +8 -0
- package/dist/render/backend/webgpu/clothKernels.js +76 -0
- package/dist/render/backend/webgpu/clothOps.d.ts +39 -0
- package/dist/render/backend/webgpu/clothOps.js +78 -0
- package/dist/render/backend/webgpu/clothSetLayout.d.ts +25 -0
- package/dist/render/backend/webgpu/clothSetLayout.js +84 -0
- package/dist/render/backend/webgpu/clothSetPack.d.ts +33 -0
- package/dist/render/backend/webgpu/clothSetPack.js +144 -0
- package/dist/render/backend/webgpu/compressedUpload.d.ts +0 -1
- package/dist/render/backend/webgpu/compressedUpload.js +53 -8
- package/dist/render/backend/webgpu/depthPass.d.ts +59 -3
- package/dist/render/backend/webgpu/depthPass.js +49 -14
- package/dist/render/backend/webgpu/drawCommand.d.ts +20 -4
- package/dist/render/backend/webgpu/drawCommand.js +11 -3
- package/dist/render/backend/webgpu/flatPass.d.ts +85 -42
- package/dist/render/backend/webgpu/flatPass.js +137 -20
- package/dist/render/backend/webgpu/gpuClothSet.d.ts +80 -0
- package/dist/render/backend/webgpu/gpuClothSet.js +462 -0
- package/dist/render/backend/webgpu/instanced.d.ts +14 -1
- package/dist/render/backend/webgpu/instanced.js +24 -1
- package/dist/render/backend/webgpu/latePass.js +1 -0
- package/dist/render/backend/webgpu/materialStore.d.ts +101 -0
- package/dist/render/backend/webgpu/materialStore.js +265 -0
- package/dist/render/backend/webgpu/motionPass.js +15 -6
- package/dist/render/backend/webgpu/pipelineCache.d.ts +28 -1
- package/dist/render/backend/webgpu/pipelineCache.js +46 -1
- package/dist/render/backend/webgpu/postPass.d.ts +1 -1
- package/dist/render/backend/webgpu/renderer.d.ts +200 -35
- package/dist/render/backend/webgpu/renderer.js +993 -168
- package/dist/render/backend/webgpu/shaders/clothSolve.wgsl.d.ts +9 -2
- package/dist/render/backend/webgpu/shaders/clothSolve.wgsl.js +121 -47
- package/dist/render/backend/webgpu/skinPaletteRing.d.ts +7 -3
- package/dist/render/backend/webgpu/skinPaletteRing.js +13 -7
- package/dist/render/backend/webgpu/skinPaletteTexture.d.ts +6 -0
- package/dist/render/backend/webgpu/skinPaletteTexture.js +7 -1
- package/dist/render/backend/webgpu/staticBundles.d.ts +125 -0
- package/dist/render/backend/webgpu/staticBundles.js +242 -0
- package/dist/render/backend/webgpu/surfaceTexturePass.d.ts +10 -3
- package/dist/render/backend/webgpu/surfaceTexturePass.js +20 -2
- package/dist/render/backend/webgpu/uniformRing.d.ts +21 -0
- package/dist/render/backend/webgpu/uniformRing.js +9 -1
- package/dist/render/backend/webgpu/vertexFormats.d.ts +22 -0
- package/dist/render/backend/webgpu/vertexFormats.js +97 -0
- package/dist/render/bloomChain.d.ts +3 -3
- package/dist/render/boneAnimation.d.ts +92 -0
- package/dist/render/boneAnimation.js +133 -0
- package/dist/render/compressedSource.d.ts +33 -13
- package/dist/render/compressedSource.js +70 -25
- package/dist/render/glCompressed.js +83 -0
- package/dist/render/globalMediumPass.d.ts +2 -0
- package/dist/render/globalMediumPass.js +1 -0
- package/dist/render/indexWidth.d.ts +17 -0
- package/dist/render/indexWidth.js +23 -0
- package/dist/render/instances.d.ts +26 -0
- package/dist/render/lightBudget.d.ts +10 -0
- package/dist/render/lightBudget.js +10 -0
- package/dist/render/lightMatrix.d.ts +11 -0
- package/dist/render/lightMatrix.js +14 -0
- package/dist/render/lightmap.d.ts +1 -1
- package/dist/render/mesh.d.ts +14 -0
- package/dist/render/mesh.js +44 -14
- package/dist/render/pointLightSelection.d.ts +4 -4
- package/dist/render/renderQuality.d.ts +30 -0
- package/dist/render/renderQuality.js +5 -0
- package/dist/render/rendererHarness.d.ts +7 -0
- package/dist/render/rendererHarness.js +12 -0
- package/dist/render/screenSpaceReflection.d.ts +2 -1
- package/dist/render/shader.d.ts +15 -0
- package/dist/render/shader.js +41 -0
- package/dist/render/shaders/boneAnimation.d.ts +19 -0
- package/dist/render/shaders/boneAnimation.js +63 -0
- package/dist/render/shaders/depth.d.ts +7 -0
- package/dist/render/shaders/depth.js +35 -10
- package/dist/render/shaders/flat/directionalShadow.js +84 -10
- package/dist/render/shaders/flat/glassTint.d.ts +1 -1
- package/dist/render/shaders/flat/glassTint.js +3 -0
- package/dist/render/shaders/flat/index.d.ts +21 -0
- package/dist/render/shaders/flat/index.js +42 -7
- package/dist/render/shaders/flat/layered.d.ts +19 -0
- package/dist/render/shaders/flat/layered.js +115 -0
- package/dist/render/shaders/flat/main.d.ts +1 -1
- package/dist/render/shaders/flat/main.js +58 -21
- package/dist/render/shaders/flat/mapReads.d.ts +10 -0
- package/dist/render/shaders/flat/mapReads.js +38 -0
- package/dist/render/shaders/flat/models.js +1 -1
- package/dist/render/shaders/flat/movingSun.d.ts +21 -0
- package/dist/render/shaders/flat/movingSun.js +46 -0
- package/dist/render/shaders/flat/normalMap.d.ts +6 -2
- package/dist/render/shaders/flat/normalMap.js +14 -3
- package/dist/render/shaders/flat/overlay.d.ts +3 -2
- package/dist/render/shaders/flat/overlay.js +42 -20
- package/dist/render/shaders/flat/pointShadow.js +2 -2
- package/dist/render/shaders/flat/preamble.js +59 -27
- package/dist/render/shaders/flat/worldUv.d.ts +22 -0
- package/dist/render/shaders/flat/worldUv.js +113 -0
- package/dist/render/shaders/generated/depth.wgsl.d.ts +93 -0
- package/dist/render/shaders/generated/depth.wgsl.js +93 -0
- package/dist/render/shaders/generated/flat.wgsl.d.ts +3616 -3042
- package/dist/render/shaders/generated/flat.wgsl.js +3688 -3113
- package/dist/render/shaders/generated/globalMedium.wgsl.d.ts +8 -3
- package/dist/render/shaders/generated/globalMedium.wgsl.js +8 -3
- package/dist/render/shaders/generated/lightVolume.wgsl.d.ts +15 -10
- package/dist/render/shaders/generated/lightVolume.wgsl.js +16 -11
- package/dist/render/shaders/globalMedium.js +9 -1
- package/dist/render/shaders/lightVolume.js +9 -1
- package/dist/render/shaders/outputTransform.d.ts +7 -0
- package/dist/render/shaders/outputTransform.js +28 -14
- package/dist/render/shaders/tangentFrame.d.ts +1 -1
- package/dist/render/shaders/tangentFrame.js +16 -3
- package/dist/render/shaders/vertexChannel.d.ts +7 -0
- package/dist/render/shaders/vertexChannel.js +26 -0
- package/dist/render/skinnedClothRun.d.ts +28 -0
- package/dist/render/skinnedClothRun.js +103 -35
- package/dist/render/staticDraws.d.ts +47 -0
- package/dist/render/staticDraws.js +43 -0
- package/dist/render/surfaceLayers.d.ts +39 -0
- package/dist/render/surfaceLayers.js +26 -0
- package/dist/render/surfaceOverlay.d.ts +16 -3
- package/dist/render/surfaceOverlay.js +11 -6
- package/dist/render/surfaceProjection.d.ts +34 -0
- package/dist/render/surfaceProjection.js +30 -0
- package/dist/render/surfaceTexture.d.ts +68 -7
- package/dist/render/surfaceTexture.js +56 -17
- package/dist/render/vertexPacking.d.ts +48 -0
- package/dist/render/vertexPacking.js +68 -0
- package/package.json +6 -6
- package/src/index.ts +12 -4
- package/src/render/ambientHarmonics.ts +1 -1
- package/src/render/areaLights.ts +4 -4
- package/src/render/backend/api.ts +13 -3
- package/src/render/backend/select.ts +10 -5
- package/src/render/backend/webgl2/boneAnimations.ts +105 -0
- package/src/render/backend/webgl2/instanced.ts +20 -1
- package/src/render/backend/webgl2/renderer.ts +723 -79
- package/src/render/backend/webgl2/skinPaletteTexture.ts +6 -4
- package/src/render/backend/webgpu/boneAnimations.ts +97 -0
- package/src/render/backend/webgpu/buffers.ts +195 -70
- package/src/render/backend/webgpu/clothKernels.ts +86 -0
- package/src/render/backend/webgpu/clothOps.ts +86 -0
- package/src/render/backend/webgpu/clothSetLayout.ts +102 -0
- package/src/render/backend/webgpu/clothSetPack.ts +197 -0
- package/src/render/backend/webgpu/compressedUpload.ts +59 -9
- package/src/render/backend/webgpu/depthPass.ts +51 -10
- package/src/render/backend/webgpu/drawCommand.ts +25 -4
- package/src/render/backend/webgpu/flatPass.ts +212 -41
- package/src/render/backend/webgpu/gpuClothSet.ts +564 -0
- package/src/render/backend/webgpu/instanced.ts +32 -1
- package/src/render/backend/webgpu/latePass.ts +1 -0
- package/src/render/backend/webgpu/materialStore.ts +276 -0
- package/src/render/backend/webgpu/motionPass.ts +18 -7
- package/src/render/backend/webgpu/pipelineCache.ts +53 -7
- package/src/render/backend/webgpu/renderer.ts +1201 -202
- package/src/render/backend/webgpu/shaders/clothSolve.wgsl.ts +121 -47
- package/src/render/backend/webgpu/skinPaletteRing.ts +13 -7
- package/src/render/backend/webgpu/skinPaletteTexture.ts +7 -1
- package/src/render/backend/webgpu/staticBundles.ts +364 -0
- package/src/render/backend/webgpu/surfaceTexturePass.ts +29 -3
- package/src/render/backend/webgpu/uniformRing.ts +10 -1
- package/src/render/backend/webgpu/vertexFormats.ts +113 -0
- package/src/render/bloomChain.ts +3 -3
- package/src/render/boneAnimation.ts +223 -0
- package/src/render/compressedSource.ts +121 -29
- package/src/render/glCompressed.ts +83 -0
- package/src/render/globalMediumPass.ts +7 -0
- package/src/render/indexWidth.ts +27 -0
- package/src/render/instances.ts +27 -0
- package/src/render/lightBudget.ts +11 -0
- package/src/render/lightMatrix.ts +15 -0
- package/src/render/lightmap.ts +1 -1
- package/src/render/mesh.ts +72 -14
- package/src/render/pointLightSelection.ts +4 -4
- package/src/render/renderQuality.ts +38 -0
- package/src/render/rendererHarness.ts +15 -0
- package/src/render/screenSpaceReflection.ts +2 -1
- package/src/render/shader.ts +59 -0
- package/src/render/shaders/boneAnimation.ts +63 -0
- package/src/render/shaders/depth.ts +45 -10
- package/src/render/shaders/flat/directionalShadow.ts +84 -10
- package/src/render/shaders/flat/glassTint.ts +7 -1
- package/src/render/shaders/flat/index.ts +63 -7
- package/src/render/shaders/flat/layered.ts +115 -0
- package/src/render/shaders/flat/main.ts +58 -21
- package/src/render/shaders/flat/mapReads.ts +38 -0
- package/src/render/shaders/flat/models.ts +1 -1
- package/src/render/shaders/flat/movingSun.ts +46 -0
- package/src/render/shaders/flat/normalMap.ts +14 -3
- package/src/render/shaders/flat/overlay.ts +42 -20
- package/src/render/shaders/flat/pointShadow.ts +2 -2
- package/src/render/shaders/flat/preamble.ts +59 -27
- package/src/render/shaders/flat/worldUv.ts +113 -0
- package/src/render/shaders/generated/depth.wgsl.ts +95 -0
- package/src/render/shaders/generated/flat.wgsl.ts +3688 -3113
- package/src/render/shaders/generated/globalMedium.wgsl.ts +8 -3
- package/src/render/shaders/generated/lightVolume.wgsl.ts +16 -11
- package/src/render/shaders/globalMedium.ts +9 -1
- package/src/render/shaders/lightVolume.ts +9 -1
- package/src/render/shaders/outputTransform.ts +30 -14
- package/src/render/shaders/tangentFrame.ts +16 -3
- package/src/render/shaders/vertexChannel.ts +27 -0
- package/src/render/skinnedClothRun.ts +138 -38
- package/src/render/staticDraws.ts +95 -0
- package/src/render/surfaceLayers.ts +57 -0
- package/src/render/surfaceOverlay.ts +24 -7
- package/src/render/surfaceProjection.ts +57 -0
- package/src/render/surfaceTexture.ts +124 -27
- package/src/render/vertexPacking.ts +109 -0
- package/dist/render/backend/webgpu/gpuSkinnedCloth.d.ts +0 -74
- package/dist/render/backend/webgpu/gpuSkinnedCloth.js +0 -452
- package/src/render/backend/webgpu/gpuSkinnedCloth.ts +0 -502
|
@@ -207,12 +207,18 @@ async function acquireWebGpu(gpu, wantsGpuTiming, shaders, stage) {
|
|
|
207
207
|
features.push('timestamp-query');
|
|
208
208
|
}
|
|
209
209
|
/*
|
|
210
|
-
*
|
|
211
|
-
* a device without
|
|
212
|
-
* texture at a byte a texel instead of four.
|
|
210
|
+
* The three block families, on the same terms: each asked for wherever the adapter offers it,
|
|
211
|
+
* because a device without one still draws — the loader decodes, or encodes ETC2, for it — and
|
|
212
|
+
* one with it samples a texture at a byte a texel or half of one instead of four. Desktops
|
|
213
|
+
* offer BC; phones ETC2 and ASTC. See `compressedUpload.ts`.
|
|
213
214
|
*/
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
for (const family of [
|
|
216
|
+
'texture-compression-bc',
|
|
217
|
+
'texture-compression-etc2',
|
|
218
|
+
'texture-compression-astc',
|
|
219
|
+
]) {
|
|
220
|
+
if (adapter.features?.has(family) === true)
|
|
221
|
+
features.push(family);
|
|
216
222
|
}
|
|
217
223
|
const descriptor = {};
|
|
218
224
|
if (Object.keys(required).length > 0)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A bone animation's textures on this backend, and a batch's clocks: what
|
|
3
|
+
* `shaders/boneAnimation.ts` reads with `texelFetch`, made once and never filtered. The twin of
|
|
4
|
+
* `webgpu/boneAnimations.ts`, at the same formats for the same reason: a turn in half floats jitters
|
|
5
|
+
* a crowd's hands at the frame's rate.
|
|
6
|
+
*/
|
|
7
|
+
import { type BoneAnimationHandle, type BoneAnimationTexels } from '../../boneAnimation.ts';
|
|
8
|
+
/** A clip on the device, from `createBoneAnimation`. */
|
|
9
|
+
export declare class GlBoneAnimation implements BoneAnimationHandle {
|
|
10
|
+
readonly bones: number;
|
|
11
|
+
readonly frames: number;
|
|
12
|
+
readonly framesPerSecond: number;
|
|
13
|
+
readonly boneScale: number;
|
|
14
|
+
readonly places: WebGLTexture;
|
|
15
|
+
readonly turns: WebGLTexture;
|
|
16
|
+
disposed: boolean;
|
|
17
|
+
constructor(gl: WebGL2RenderingContext, texels: BoneAnimationTexels);
|
|
18
|
+
dispose(gl: WebGL2RenderingContext): void;
|
|
19
|
+
}
|
|
20
|
+
/** A batch's clocks: two floats an instance, wrapped onto rows `CLOCK_TEXTURE_WIDTH` wide. */
|
|
21
|
+
export declare class GlInstanceClocks {
|
|
22
|
+
readonly texture: WebGLTexture;
|
|
23
|
+
readonly staging: Float32Array;
|
|
24
|
+
private readonly width;
|
|
25
|
+
constructor(gl: WebGL2RenderingContext, capacity: number);
|
|
26
|
+
/** The rows that hold the first `count` instances, from `staging`. */
|
|
27
|
+
upload(gl: WebGL2RenderingContext, count: number): void;
|
|
28
|
+
dispose(gl: WebGL2RenderingContext): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A bone animation's textures on this backend, and a batch's clocks: what
|
|
3
|
+
* `shaders/boneAnimation.ts` reads with `texelFetch`, made once and never filtered. The twin of
|
|
4
|
+
* `webgpu/boneAnimations.ts`, at the same formats for the same reason: a turn in half floats jitters
|
|
5
|
+
* a crowd's hands at the frame's rate.
|
|
6
|
+
*/
|
|
7
|
+
import { CLOCK_TEXTURE_WIDTH, } from '../../boneAnimation.js';
|
|
8
|
+
/**
|
|
9
|
+
* A float texture read by index: one level, nearest, clamped. Bound on unit 0, chosen rather than
|
|
10
|
+
* inherited, for the reason `oitPass.ts` gives: `bindTexture` binds to whatever unit is active, and
|
|
11
|
+
* a frame leaves that wherever its last pass finished.
|
|
12
|
+
*/
|
|
13
|
+
function floatTexture(gl, internal, width, height) {
|
|
14
|
+
const texture = gl.createTexture();
|
|
15
|
+
if (texture === null)
|
|
16
|
+
throw new Error('boneAnimations: createTexture failed');
|
|
17
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
18
|
+
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
19
|
+
gl.texStorage2D(gl.TEXTURE_2D, 1, internal, width, height);
|
|
20
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
21
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
22
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
23
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
24
|
+
return texture;
|
|
25
|
+
}
|
|
26
|
+
/** A clip on the device, from `createBoneAnimation`. */
|
|
27
|
+
export class GlBoneAnimation {
|
|
28
|
+
bones;
|
|
29
|
+
frames;
|
|
30
|
+
framesPerSecond;
|
|
31
|
+
boneScale;
|
|
32
|
+
places;
|
|
33
|
+
turns;
|
|
34
|
+
disposed = false;
|
|
35
|
+
constructor(gl, texels) {
|
|
36
|
+
this.bones = texels.bones;
|
|
37
|
+
this.frames = texels.frames;
|
|
38
|
+
this.framesPerSecond = texels.framesPerSecond;
|
|
39
|
+
this.boneScale = texels.boneScale;
|
|
40
|
+
const make = (data) => {
|
|
41
|
+
const texture = floatTexture(gl, gl.RGBA32F, texels.bones, texels.frames);
|
|
42
|
+
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, texels.bones, texels.frames, gl.RGBA, gl.FLOAT, data);
|
|
43
|
+
return texture;
|
|
44
|
+
};
|
|
45
|
+
this.places = make(texels.places);
|
|
46
|
+
this.turns = make(texels.turns);
|
|
47
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
48
|
+
}
|
|
49
|
+
dispose(gl) {
|
|
50
|
+
this.disposed = true;
|
|
51
|
+
gl.deleteTexture(this.places);
|
|
52
|
+
gl.deleteTexture(this.turns);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** A batch's clocks: two floats an instance, wrapped onto rows `CLOCK_TEXTURE_WIDTH` wide. */
|
|
56
|
+
export class GlInstanceClocks {
|
|
57
|
+
texture;
|
|
58
|
+
staging;
|
|
59
|
+
width;
|
|
60
|
+
constructor(gl, capacity) {
|
|
61
|
+
this.width = Math.max(1, Math.min(capacity, CLOCK_TEXTURE_WIDTH));
|
|
62
|
+
const rows = Math.max(1, Math.ceil(capacity / this.width));
|
|
63
|
+
this.staging = new Float32Array(this.width * rows * 2);
|
|
64
|
+
this.texture = floatTexture(gl, gl.RG32F, this.width, rows);
|
|
65
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
66
|
+
}
|
|
67
|
+
/** The rows that hold the first `count` instances, from `staging`. */
|
|
68
|
+
upload(gl, count) {
|
|
69
|
+
if (count <= 0)
|
|
70
|
+
return;
|
|
71
|
+
const rows = Math.ceil(count / this.width);
|
|
72
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
73
|
+
gl.bindTexture(gl.TEXTURE_2D, this.texture);
|
|
74
|
+
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, this.width, rows, gl.RG, gl.FLOAT, this.staging);
|
|
75
|
+
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
76
|
+
}
|
|
77
|
+
dispose(gl) {
|
|
78
|
+
gl.deleteTexture(this.texture);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { MeshInstances } from '../../instances.ts';
|
|
2
2
|
import type { Mesh } from '../../mesh.ts';
|
|
3
3
|
import type { FrustumPlanes } from '../../../math/frustum.ts';
|
|
4
|
+
import { GlInstanceClocks, type GlBoneAnimation } from './boneAnimations.ts';
|
|
4
5
|
/**
|
|
5
6
|
* One batch of a mesh: its per-instance buffer and a vertex array of its own.
|
|
6
7
|
*
|
|
@@ -29,7 +30,10 @@ export declare class InstancedBatch {
|
|
|
29
30
|
/** The survivors of a lightmapped batch's cull, made the first time one is culled. */
|
|
30
31
|
private keptRegioned;
|
|
31
32
|
private readonly kept;
|
|
32
|
-
|
|
33
|
+
/** The bone animation every instance plays, and its clocks; null for a batch that plays none. */
|
|
34
|
+
readonly animation: GlBoneAnimation | null;
|
|
35
|
+
readonly clocks: GlInstanceClocks | null;
|
|
36
|
+
constructor(gl: WebGL2RenderingContext, mesh: Mesh, capacity: number, cull?: boolean, animation?: GlBoneAnimation | null);
|
|
33
37
|
upload(gl: WebGL2RenderingContext, data: MeshInstances): void;
|
|
34
38
|
/** Draw the first `count` uploaded instances: every draw but a culling camera draw. */
|
|
35
39
|
draw(gl: WebGL2RenderingContext, count: number): void;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { cullInstances, instancesBox } from '../../instanceCull.js';
|
|
2
2
|
import { INSTANCE_FLOATS, INSTANCE_STRIDE, createMeshInstances, packInstances, } from '../../instances.js';
|
|
3
|
+
import { packInstanceClocks } from '../../boneAnimation.js';
|
|
4
|
+
import { GlInstanceClocks } from './boneAnimations.js';
|
|
3
5
|
/**
|
|
4
6
|
* One batch of a mesh: its per-instance buffer and a vertex array of its own.
|
|
5
7
|
*
|
|
@@ -28,10 +30,15 @@ export class InstancedBatch {
|
|
|
28
30
|
/** The survivors of a lightmapped batch's cull, made the first time one is culled. */
|
|
29
31
|
keptRegioned = null;
|
|
30
32
|
kept;
|
|
31
|
-
|
|
33
|
+
/** The bone animation every instance plays, and its clocks; null for a batch that plays none. */
|
|
34
|
+
animation;
|
|
35
|
+
clocks;
|
|
36
|
+
constructor(gl, mesh, capacity, cull = false, animation = null) {
|
|
32
37
|
this.mesh = mesh;
|
|
33
38
|
this.capacity = capacity;
|
|
34
39
|
this.cull = cull;
|
|
40
|
+
this.animation = animation;
|
|
41
|
+
this.clocks = animation === null ? null : new GlInstanceClocks(gl, capacity);
|
|
35
42
|
this.staging = new Float32Array(capacity * INSTANCE_FLOATS);
|
|
36
43
|
this.buffer = allocate(gl, capacity);
|
|
37
44
|
this.vao = mesh.createInstanceArray(gl, this.buffer, INSTANCE_STRIDE);
|
|
@@ -56,6 +63,10 @@ export class InstancedBatch {
|
|
|
56
63
|
packInstances(data, this.staging);
|
|
57
64
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
|
|
58
65
|
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.staging, 0, count * INSTANCE_FLOATS);
|
|
66
|
+
if (this.clocks !== null) {
|
|
67
|
+
packInstanceClocks(data, this.clocks.staging);
|
|
68
|
+
this.clocks.upload(gl, count);
|
|
69
|
+
}
|
|
59
70
|
}
|
|
60
71
|
/** Draw the first `count` uploaded instances: every draw but a culling camera draw. */
|
|
61
72
|
draw(gl, count) {
|
|
@@ -88,6 +99,7 @@ export class InstancedBatch {
|
|
|
88
99
|
dispose(gl) {
|
|
89
100
|
gl.deleteVertexArray(this.vao);
|
|
90
101
|
gl.deleteBuffer(this.buffer);
|
|
102
|
+
this.clocks?.dispose(gl);
|
|
91
103
|
if (this.kept !== null) {
|
|
92
104
|
gl.deleteVertexArray(this.kept.vao);
|
|
93
105
|
gl.deleteBuffer(this.kept.buffer);
|
|
@@ -44,13 +44,14 @@ import type { AreaLightBuffer, AreaLightSource } from '../../areaLights.ts';
|
|
|
44
44
|
import type { PhotometricProfile } from '../../iesProfile.ts';
|
|
45
45
|
import type { ShadowLight } from '../../pointShadowSystem.ts';
|
|
46
46
|
import type { ShadowCasters } from '../../shadowCasters.ts';
|
|
47
|
+
import type { StaticDrawsHandle } from '../../staticDraws.ts';
|
|
47
48
|
import type { RenderQuality, RenderQualityOptions } from '../../renderQuality.ts';
|
|
48
49
|
import { Mesh } from '../../mesh.ts';
|
|
49
50
|
import type { IncrementalMesh } from '../../mesh.ts';
|
|
50
51
|
import type { MeshData } from '../../mesh.ts';
|
|
51
52
|
import type { MeshOptions } from '../api.ts';
|
|
52
53
|
import { SurfaceTexture } from '../../surfaceTexture.ts';
|
|
53
|
-
import type { CompressedTextureFormat, SurfaceSource } from '../../compressedSource.ts';
|
|
54
|
+
import type { CompressedTextureFormat, CompressedTextureSource, SurfaceSource } from '../../compressedSource.ts';
|
|
54
55
|
import type { SurfaceMaterial, SurfaceTextureOptions } from '../../surfaceTexture.ts';
|
|
55
56
|
import { PlumeRenderer } from '../../plumeRenderer.ts';
|
|
56
57
|
import type { PlumeOptions, PlumePlacement } from '../../plumeRenderer.ts';
|
|
@@ -82,6 +83,7 @@ import type { WindStreakOptions } from '../../windStreakRenderer.ts';
|
|
|
82
83
|
import type { WindField } from '../../windField.ts';
|
|
83
84
|
import type { FlockParams } from '../../flockRenderer.ts';
|
|
84
85
|
import { InstancedBatch } from './instanced.ts';
|
|
86
|
+
import type { BoneAnimationClip, BoneAnimationHandle } from '../../boneAnimation.ts';
|
|
85
87
|
import type { InstancedOptions, MeshInstances } from '../../instances.ts';
|
|
86
88
|
/** Reused each frame: which shader light slot each bound cubemap serves. */
|
|
87
89
|
export type { ShadowCasterSink, ShadowCasters } from '../../shadowCasters.ts';
|
|
@@ -929,6 +931,15 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
929
931
|
* compiled the first time a draw asks for one. See `modelProgram`.
|
|
930
932
|
*/
|
|
931
933
|
private readonly modelFlat;
|
|
934
|
+
/**
|
|
935
|
+
* Model programs still compiling, where draws skip a compile (`pipelineCompile: 'skip'`) and the
|
|
936
|
+
* context offers `KHR_parallel_shader_compile`; `parallelCompile` is its completion query then,
|
|
937
|
+
* and null where draws wait for a program here instead. See `modelProgram`.
|
|
938
|
+
*/
|
|
939
|
+
private readonly modelPending;
|
|
940
|
+
/** What `drawVariantOf` answers, rewritten each draw rather than made. */
|
|
941
|
+
private readonly drawVariant;
|
|
942
|
+
private readonly parallelCompile;
|
|
932
943
|
/** The last palette chosen, which an eye's axis is turned by. See `setSkinPalette`. */
|
|
933
944
|
private paletteData;
|
|
934
945
|
private readonly emptyTexture2D;
|
|
@@ -991,7 +1002,7 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
991
1002
|
private oitReplaying;
|
|
992
1003
|
/** `uSurfaceScene`, resolved once a pass. See `surfaceScene.ts`. */
|
|
993
1004
|
private readonly surfaceScene;
|
|
994
|
-
/** The
|
|
1005
|
+
/** The three lanes of `uWriteMode`, kept here because a `vec3` is written whole. */
|
|
995
1006
|
private oitWeight;
|
|
996
1007
|
/**
|
|
997
1008
|
* How the surfaces drawn next meet the medium: what `setSurfaceFog` set, and `FOG_RECEDE` from
|
|
@@ -999,6 +1010,7 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
999
1010
|
*/
|
|
1000
1011
|
private surfaceFog;
|
|
1001
1012
|
private ditherFade;
|
|
1013
|
+
private ditherOpacity;
|
|
1002
1014
|
/** Said once, not per frame, where the context cannot give the float target the sum needs. */
|
|
1003
1015
|
private oitRefused;
|
|
1004
1016
|
/** Said once for the whole renderer. See `refuseOitMultisampled`. */
|
|
@@ -1156,6 +1168,11 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1156
1168
|
private readonly depthCutoutUniforms;
|
|
1157
1169
|
private readonly depthInstancedCutoutProgram;
|
|
1158
1170
|
private readonly depthInstancedCutoutUniforms;
|
|
1171
|
+
/** A crowd's casters: the instanced depth programs that play a bone animation. */
|
|
1172
|
+
private readonly depthAnimatedProgram;
|
|
1173
|
+
private readonly depthAnimatedUniforms;
|
|
1174
|
+
private readonly depthAnimatedCutoutProgram;
|
|
1175
|
+
private readonly depthAnimatedCutoutUniforms;
|
|
1159
1176
|
private readonly scatterDepthProgram;
|
|
1160
1177
|
private readonly scatterDepthUniforms;
|
|
1161
1178
|
/** The sun's static, moving and peeled maps, as layers of one array. See `shadowMap.ts`. */
|
|
@@ -1250,6 +1267,28 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1250
1267
|
private overlayTexture;
|
|
1251
1268
|
/** Whether this device's lit stage has room for the overlay's vectors: asked once. */
|
|
1252
1269
|
private overlayRoom;
|
|
1270
|
+
/**
|
|
1271
|
+
* The matrix the sun's dynamic shadow pass was last drawn with, uncorrected, and whether one has
|
|
1272
|
+
* been: what the moving layer is read through. See `movingLightFor`.
|
|
1273
|
+
*/
|
|
1274
|
+
private readonly movingLightViewProj;
|
|
1275
|
+
private movingLightKnown;
|
|
1276
|
+
/** Whether the lit stage has room for the moving layer's matrix, and whether its refusal was said. */
|
|
1277
|
+
private movingRoom;
|
|
1278
|
+
private warnedMovingRoom;
|
|
1279
|
+
/** The same answer for a material's projection, and whether its refusal was said. */
|
|
1280
|
+
private projectionRoom;
|
|
1281
|
+
private warnedProjectionRoom;
|
|
1282
|
+
/** `uWorldUv`, the current material's projection packed. See `surfaceProjection.ts`. */
|
|
1283
|
+
private readonly projection;
|
|
1284
|
+
/** The current material's `diffuseTransmission`, `uGlassTint.w`, 0 to 1. */
|
|
1285
|
+
private diffuseTransmission;
|
|
1286
|
+
/** `uLayers`, the current material's layers packed. See `surfaceLayers.ts`. */
|
|
1287
|
+
private readonly layerFloats;
|
|
1288
|
+
/** Whether the lit stage has room for layers' two vectors, and which refusals were said. */
|
|
1289
|
+
private layersRoom;
|
|
1290
|
+
private warnedLayersRoom;
|
|
1291
|
+
private warnedLayersModelMap;
|
|
1253
1292
|
private warnedOverlayRoom;
|
|
1254
1293
|
private warnedOverlayBlocks;
|
|
1255
1294
|
/** Whether a probe is being baked, so the passes that would recurse into one can tell. */
|
|
@@ -1779,6 +1818,15 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1779
1818
|
* this before its first frame gets the right behaviour on both without asking which backend
|
|
1780
1819
|
* it has, which is the contract `RendererApi` exists to keep.
|
|
1781
1820
|
*/
|
|
1821
|
+
/**
|
|
1822
|
+
* Resolve once every program a draw has started compiling has finished, adopting each: what a
|
|
1823
|
+
* loading screen awaits after drawing what its scene will use, where draws skip a compile. See
|
|
1824
|
+
* `RenderQuality.pipelineCompile`; nothing is started anywhere else here, so otherwise it is now.
|
|
1825
|
+
*
|
|
1826
|
+
* **It waits without holding the thread**, as the other backend's does: it asks the driver
|
|
1827
|
+
* whether each is done, which does not wait, and yields between asks. A driver that never says
|
|
1828
|
+
* done is asked the way that waits after `READY_MAX_POLLS`, so this cannot hang a loading screen.
|
|
1829
|
+
*/
|
|
1782
1830
|
ready(): Promise<void>;
|
|
1783
1831
|
dispose(options?: {
|
|
1784
1832
|
releaseContext?: boolean;
|
|
@@ -1894,7 +1942,7 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1894
1942
|
*
|
|
1895
1943
|
* Not a hot path — it re-uploads the whole image and regenerates the mip chain.
|
|
1896
1944
|
*/
|
|
1897
|
-
updateSurfaceTexture(texture: SurfaceTexture, source: TexImageSource): void;
|
|
1945
|
+
updateSurfaceTexture(texture: SurfaceTexture, source: TexImageSource | CompressedTextureSource): void;
|
|
1898
1946
|
disposeSurfaceTexture(texture: SurfaceTexture): void;
|
|
1899
1947
|
/**
|
|
1900
1948
|
* Choose the surface texture the following `drawMesh` calls sample, or `null` for none.
|
|
@@ -1929,6 +1977,8 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
1929
1977
|
* material at once, as `ensureClothPrograms` feeds its own.
|
|
1930
1978
|
*/
|
|
1931
1979
|
private modelProgram;
|
|
1980
|
+
/** A model program compiled: kept, written to by every material setter, and fed the pass. */
|
|
1981
|
+
private adoptModel;
|
|
1932
1982
|
/**
|
|
1933
1983
|
* An eye's axis in the world for this draw, into its program's `uModelParams`: the material's
|
|
1934
1984
|
* own numbers with the axis turned by the draw's model matrix and the eye's joint. See
|
|
@@ -2035,6 +2085,16 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
2035
2085
|
* exactly as it did.
|
|
2036
2086
|
*/
|
|
2037
2087
|
setSurfaceReflectivity(amount: number): void;
|
|
2088
|
+
/**
|
|
2089
|
+
* The reflectivity and environment gain the setters gave the pass, and the ones the material
|
|
2090
|
+
* set now states, or null where it states none (`SurfaceMaterial.reflectivity`). A draw wears the
|
|
2091
|
+
* material's where it has one and the pass's otherwise.
|
|
2092
|
+
*/
|
|
2093
|
+
private passReflectivity;
|
|
2094
|
+
private passEnvironmentGain;
|
|
2095
|
+
private materialReflectivity;
|
|
2096
|
+
private materialEnvironmentGain;
|
|
2097
|
+
private writeEnvironmentDials;
|
|
2038
2098
|
/**
|
|
2039
2099
|
* The overlay the following draws wear — a rim of light, a dissolve, wrinkles by region — or null
|
|
2040
2100
|
* for none. Pass state, as the material is: `bindMeshPass` puts it back to none. See
|
|
@@ -2056,6 +2116,32 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
2056
2116
|
private overlayRoomLeft;
|
|
2057
2117
|
/** Whether the lit shader with the overlay compiled in fits this GPU: counted once. */
|
|
2058
2118
|
private overlayFits;
|
|
2119
|
+
/**
|
|
2120
|
+
* Whether a material's projection can be drawn: none asked, or the lit stage has the room for its
|
|
2121
|
+
* one vector. **Refused, said once, where it has not**, as the overlay is, and the material's
|
|
2122
|
+
* maps are then laid by the mesh's coordinates, as they were before it existed.
|
|
2123
|
+
*/
|
|
2124
|
+
private projectionFits;
|
|
2125
|
+
/**
|
|
2126
|
+
* What the sun's moving layer is read through: the matrix its shadow pass was last drawn with,
|
|
2127
|
+
* where the lit stage carries one (`MOVING_SUN`); the environment's otherwise, which every caller
|
|
2128
|
+
* drawing both layers with one matrix hands it anyway.
|
|
2129
|
+
*/
|
|
2130
|
+
private movingLightFor;
|
|
2131
|
+
/**
|
|
2132
|
+
* Turn the moving layer's own matrix on the first time a frame draws that layer with one the
|
|
2133
|
+
* environment's does not share. **Refused, said once, where the lit stage has no room for its five
|
|
2134
|
+
* vectors**: the layer is then read through the environment's matrix, so its shadows land where
|
|
2135
|
+
* that matrix puts them, and a caller there draws both layers with one.
|
|
2136
|
+
*/
|
|
2137
|
+
private askMovingSun;
|
|
2138
|
+
/**
|
|
2139
|
+
* A material's layers where they can be drawn: none asked, a model's map in the mask's place, or
|
|
2140
|
+
* no room for their two vectors each leave one layer, the last two said once each.
|
|
2141
|
+
*/
|
|
2142
|
+
private layersOf;
|
|
2143
|
+
/** Whether the lit shader with `feature` compiled in fits this GPU's fragment uniform vectors. */
|
|
2144
|
+
private switchFits;
|
|
2059
2145
|
/**
|
|
2060
2146
|
* How bright the environment the surfaces drawn next reflect is. 1 is the default and identity.
|
|
2061
2147
|
*
|
|
@@ -2138,7 +2224,25 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
2138
2224
|
* are a pass of their own, do not. See `uDither` in `flat/preamble.ts` for what it costs.
|
|
2139
2225
|
*/
|
|
2140
2226
|
setDitherFade(amount: number): void;
|
|
2141
|
-
/**
|
|
2227
|
+
/**
|
|
2228
|
+
* Whether the draws that follow spend their own opacity on a screen door rather than on blending:
|
|
2229
|
+
* an instance's `MeshInstances.alphas`, or a vertex's channel alpha, keeps that share of the
|
|
2230
|
+
* pixels `setDitherFade` would and draws the rest not at all. So an opaque or cut-out batch fades
|
|
2231
|
+
* one instance at a time, with no sorting and no blend, and an instance at 1 is drawn whole.
|
|
2232
|
+
*
|
|
2233
|
+
* Off is what `bindMeshPass` restores. It shares the fade's pattern, so a crossfade at `t` and
|
|
2234
|
+
* `-t` of an instance at opacity `a` covers that instance's share once, without holes. Material
|
|
2235
|
+
* state like `setDitherFade`; instanced draws read it, and shadow casters do not.
|
|
2236
|
+
*
|
|
2237
|
+
* What it gives up: a fade reads as grain while it lasts, which a temporal resolve smooths and a
|
|
2238
|
+
* plain frame does not; a blended draw that asks spends its opacity here and blends none of it;
|
|
2239
|
+
* and a lightmapped batch carries regions where the opacities would be, so it has none to fade.
|
|
2240
|
+
*/
|
|
2241
|
+
setDitherOpacity(on: boolean): void;
|
|
2242
|
+
/**
|
|
2243
|
+
* `uWriteMode`: the order-independent weight, the fade and whether the opacity is dithered, which
|
|
2244
|
+
* share one uniform row.
|
|
2245
|
+
*/
|
|
2142
2246
|
private writeMode;
|
|
2143
2247
|
/**
|
|
2144
2248
|
* How strong the microscopic relief on the surfaces drawn next is, and how coarse.
|
|
@@ -2231,6 +2335,40 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
2231
2335
|
* one. `Mesh.attachInstances` is what refuses a second, and says why.
|
|
2232
2336
|
*/
|
|
2233
2337
|
createInstanced(mesh: Mesh, capacity: number, options?: InstancedOptions): InstancedBatch;
|
|
2338
|
+
/**
|
|
2339
|
+
* A bone animation an instanced batch can play (`InstancedOptions.animation`): per frame, a turn
|
|
2340
|
+
* and a place for each bone, which every vertex of the batch's mesh follows — the bone its second
|
|
2341
|
+
* coordinates' u names, times `boneScale` — at each instance's own moment of the clip. What a
|
|
2342
|
+
* crowd is made of: every instance moves at the frame's rate on its own clock, in the colour pass
|
|
2343
|
+
* and in every shadow, with nothing on the processor after this. See `boneAnimation.ts` for the
|
|
2344
|
+
* clip's layout and the arithmetic, which both backends run.
|
|
2345
|
+
*
|
|
2346
|
+
* What it gives up against skinning is the blend: a vertex follows one bone. Refused, with what
|
|
2347
|
+
* was wrong, for a clip whose numbers are not its size, or past 2,048 bones or frames.
|
|
2348
|
+
*/
|
|
2349
|
+
createBoneAnimation(clip: BoneAnimationClip): BoneAnimationHandle;
|
|
2350
|
+
/** Release a clip. A batch still playing it draws nothing, and casts nothing, after. */
|
|
2351
|
+
disposeBoneAnimation(animation: BoneAnimationHandle): void;
|
|
2352
|
+
/**
|
|
2353
|
+
* The clock a bone animation plays by this frame, in seconds on the caller's clock: an instance's
|
|
2354
|
+
* moment is this times its rate plus its phase (`MeshInstances.clocks`). **Set it before the
|
|
2355
|
+
* shadows are drawn**, once a frame, as the wind is set: a shadow drawn under one clock and its
|
|
2356
|
+
* caster under another come apart at the frame's rate. 0 until set, which holds every crowd at
|
|
2357
|
+
* the moment its phases name.
|
|
2358
|
+
*/
|
|
2359
|
+
setAnimationTime(seconds: number): void;
|
|
2360
|
+
/** The clock `setAnimationTime` set. */
|
|
2361
|
+
private animationTime;
|
|
2362
|
+
/**
|
|
2363
|
+
* An animated batch's clip, clocks and numbers into whichever program is bound: the three vertex
|
|
2364
|
+
* textures on units of their own (`lightBudget.ts`), the clip's speed and bone scale, the clock.
|
|
2365
|
+
*/
|
|
2366
|
+
private bindAnimation;
|
|
2367
|
+
/** The animated instanced program, compiled on first use. See `ensureInstancedProgram`. */
|
|
2368
|
+
private flatAnimatedProgram;
|
|
2369
|
+
private flatAnimatedUniforms;
|
|
2370
|
+
/** Compile the animated variant, once, and feed it this frame's pass state. */
|
|
2371
|
+
private ensureAnimatedProgram;
|
|
2234
2372
|
/** Push placement and colour. Only the live prefix. */
|
|
2235
2373
|
uploadInstanced(batch: InstancedBatch, data: MeshInstances): void;
|
|
2236
2374
|
/** Draw every live instance, opaque. */
|
|
@@ -2765,6 +2903,43 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
2765
2903
|
*/
|
|
2766
2904
|
drawSceneCasters(casters: ShadowCasters): void;
|
|
2767
2905
|
drawShadowCasters(casters: ShadowCasters): void;
|
|
2906
|
+
/**
|
|
2907
|
+
* Draws that do not change between frames, enumerated once and kept: what a stage, a set or any
|
|
2908
|
+
* world that stands still draws, recorded so a frame replays it rather than issuing it.
|
|
2909
|
+
*
|
|
2910
|
+
* **The same enumeration `drawSceneCasters` takes**, called once, here: rigid meshes and instanced
|
|
2911
|
+
* batches, each with its material. A skinned mesh or a scatter batch is refused by name, since
|
|
2912
|
+
* both change every frame. What it captures is what the enumeration said at the time — the
|
|
2913
|
+
* matrices and the instance counts are copied, so a caller's scratch is free to move on — while
|
|
2914
|
+
* the meshes, batches, textures and materials stay the caller's: a list must be disposed, or made
|
|
2915
|
+
* again, before anything it holds is, and made again when a material it holds is changed.
|
|
2916
|
+
*
|
|
2917
|
+
* **What it is for is the frame's processor time.** WebGPU records the list into a render bundle
|
|
2918
|
+
* per view and replays it with one call, where a draw issued a frame at a time costs its encoding
|
|
2919
|
+
* every frame and again for every view that draws it. This backend has no bundles and replays the
|
|
2920
|
+
* entries through the scene-caster path every frame, at the cost a frame drawing them itself pays;
|
|
2921
|
+
* the picture is the same.
|
|
2922
|
+
*
|
|
2923
|
+
* What a list gives up against drawing each frame is culling: every entry is drawn in every view,
|
|
2924
|
+
* because a bundle cannot leave one out. A world split into lists by region culls by list.
|
|
2925
|
+
*/
|
|
2926
|
+
createStaticDraws(casters: ShadowCasters): StaticDrawsHandle;
|
|
2927
|
+
/**
|
|
2928
|
+
* Draw a list into the open mesh pass, under the camera, the lights and the fog `bindMeshPass`
|
|
2929
|
+
* set — the frame's, a mirror's, a capture's. Opaque draws, through each entry's material.
|
|
2930
|
+
*
|
|
2931
|
+
* **Its draws are rigid and wear no overlay**, so a skin palette, morph weights, cloth or a surface
|
|
2932
|
+
* overlay set before it is put back to none, as `bindMeshPass` puts an overlay back; and no
|
|
2933
|
+
* material is left set after it, which is what `setMaterial(null)` leaves. The state a pass set —
|
|
2934
|
+
* the grain, the relief, the fog, the grade — is the list's to draw with, as it is any draw's, and
|
|
2935
|
+
* a list drawn under a different one is recorded again for it on WebGPU.
|
|
2936
|
+
*/
|
|
2937
|
+
drawStaticDraws(draws: StaticDrawsHandle): void;
|
|
2938
|
+
/** Release a list. Its meshes, batches and materials are the caller's and are not released. */
|
|
2939
|
+
disposeStaticDraws(draws: StaticDrawsHandle): void;
|
|
2940
|
+
/** A disposed list drawn, said once: the frame loop does not throw. */
|
|
2941
|
+
private warnStaticDisposed;
|
|
2942
|
+
private warnedStaticDisposed;
|
|
2768
2943
|
/**
|
|
2769
2944
|
* Draw the pass's glass twice: where the nearest pane is, and what the panes let through.
|
|
2770
2945
|
*
|
|
@@ -3621,6 +3796,16 @@ export declare class WebGL2Renderer implements RendererApi {
|
|
|
3621
3796
|
*/
|
|
3622
3797
|
private scatterSkin;
|
|
3623
3798
|
/** One draw of a mesh, as `drawMesh` describes, of the half of a skin `half` names. */
|
|
3799
|
+
/**
|
|
3800
|
+
* Whether every half a split skin draws has its program, starting any that has not: a skin drawn
|
|
3801
|
+
* without its kept halves would lose its diffuse light for the frames they take to compile.
|
|
3802
|
+
*/
|
|
3803
|
+
private skinHalvesReady;
|
|
3804
|
+
/**
|
|
3805
|
+
* The vertex variant a draw of `mesh` takes now, and its program and uniforms where it is not the
|
|
3806
|
+
* plain one: what a model's program is keyed by, and what `drawMeshHalf` draws with.
|
|
3807
|
+
*/
|
|
3808
|
+
private drawVariantOf;
|
|
3624
3809
|
private drawMeshHalf;
|
|
3625
3810
|
/**
|
|
3626
3811
|
* Draw a mesh you can see through, in the same material as everything else by default.
|