@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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What one garment of a set has asked the device for and the device has not yet recorded: a pose, a
|
|
3
|
+
* reset to rest, steps — each with the numbers its round reads, taken when it was asked for.
|
|
4
|
+
*
|
|
5
|
+
* **Taken when asked for, because they change after.** `ClothControl` moves its targets to a step's
|
|
6
|
+
* fraction and calls the device; by the time the set records the step, the next step has moved them
|
|
7
|
+
* again. So each op keeps the head of its record — fraction, blend, the poses it reads, the carry and
|
|
8
|
+
* the wind — as it stood, and the set copies it into the round that runs it.
|
|
9
|
+
*
|
|
10
|
+
* Grows by doubling and never shrinks, so a settled set allocates nothing a frame.
|
|
11
|
+
*/
|
|
12
|
+
/** Words of a garment's record in a round: the shader's `Pace`. */
|
|
13
|
+
export declare const PACE_WORDS = 44;
|
|
14
|
+
/** The head of it, which an op carries: everything before the garment's own constants. */
|
|
15
|
+
export declare const PACE_HEAD_WORDS = 32;
|
|
16
|
+
export declare const CLOTH_OP_POSE = 0;
|
|
17
|
+
export declare const CLOTH_OP_REST = 1;
|
|
18
|
+
export declare const CLOTH_OP_STEP = 2;
|
|
19
|
+
export declare class ClothOps {
|
|
20
|
+
private kinds;
|
|
21
|
+
private heads;
|
|
22
|
+
private floats;
|
|
23
|
+
private words;
|
|
24
|
+
private first;
|
|
25
|
+
private end;
|
|
26
|
+
get pending(): number;
|
|
27
|
+
/** The kind of the op to run next, or -1 where there is none. */
|
|
28
|
+
get next(): number;
|
|
29
|
+
/** A new op of `kind`, its head zeroed, for the caller to fill: the float and word offset of it. */
|
|
30
|
+
push(kind: number): number;
|
|
31
|
+
get headFloats(): Float32Array;
|
|
32
|
+
get headWords(): Uint32Array;
|
|
33
|
+
/**
|
|
34
|
+
* The next op's head into `out` at `at`, and the op gone. Copied as words, since a head holds
|
|
35
|
+
* integers too, and a word at a time, since a view a call would be an allocation a round.
|
|
36
|
+
*/
|
|
37
|
+
take(out: Uint32Array, at: number): void;
|
|
38
|
+
private grow;
|
|
39
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What one garment of a set has asked the device for and the device has not yet recorded: a pose, a
|
|
3
|
+
* reset to rest, steps — each with the numbers its round reads, taken when it was asked for.
|
|
4
|
+
*
|
|
5
|
+
* **Taken when asked for, because they change after.** `ClothControl` moves its targets to a step's
|
|
6
|
+
* fraction and calls the device; by the time the set records the step, the next step has moved them
|
|
7
|
+
* again. So each op keeps the head of its record — fraction, blend, the poses it reads, the carry and
|
|
8
|
+
* the wind — as it stood, and the set copies it into the round that runs it.
|
|
9
|
+
*
|
|
10
|
+
* Grows by doubling and never shrinks, so a settled set allocates nothing a frame.
|
|
11
|
+
*/
|
|
12
|
+
/** Words of a garment's record in a round: the shader's `Pace`. */
|
|
13
|
+
export const PACE_WORDS = 44;
|
|
14
|
+
/** The head of it, which an op carries: everything before the garment's own constants. */
|
|
15
|
+
export const PACE_HEAD_WORDS = 32;
|
|
16
|
+
export const CLOTH_OP_POSE = 0;
|
|
17
|
+
export const CLOTH_OP_REST = 1;
|
|
18
|
+
export const CLOTH_OP_STEP = 2;
|
|
19
|
+
export class ClothOps {
|
|
20
|
+
kinds = new Uint8Array(8);
|
|
21
|
+
heads = new ArrayBuffer(8 * PACE_HEAD_WORDS * 4);
|
|
22
|
+
floats = new Float32Array(this.heads);
|
|
23
|
+
words = new Uint32Array(this.heads);
|
|
24
|
+
first = 0;
|
|
25
|
+
end = 0;
|
|
26
|
+
get pending() {
|
|
27
|
+
return this.end - this.first;
|
|
28
|
+
}
|
|
29
|
+
/** The kind of the op to run next, or -1 where there is none. */
|
|
30
|
+
get next() {
|
|
31
|
+
return this.first < this.end ? this.kinds[this.first] : -1;
|
|
32
|
+
}
|
|
33
|
+
/** A new op of `kind`, its head zeroed, for the caller to fill: the float and word offset of it. */
|
|
34
|
+
push(kind) {
|
|
35
|
+
if (this.end === this.kinds.length)
|
|
36
|
+
this.grow();
|
|
37
|
+
const at = this.end * PACE_HEAD_WORDS;
|
|
38
|
+
this.floats.fill(0, at, at + PACE_HEAD_WORDS);
|
|
39
|
+
this.kinds[this.end] = kind;
|
|
40
|
+
this.end++;
|
|
41
|
+
return at;
|
|
42
|
+
}
|
|
43
|
+
get headFloats() {
|
|
44
|
+
return this.floats;
|
|
45
|
+
}
|
|
46
|
+
get headWords() {
|
|
47
|
+
return this.words;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The next op's head into `out` at `at`, and the op gone. Copied as words, since a head holds
|
|
51
|
+
* integers too, and a word at a time, since a view a call would be an allocation a round.
|
|
52
|
+
*/
|
|
53
|
+
take(out, at) {
|
|
54
|
+
const from = this.first * PACE_HEAD_WORDS;
|
|
55
|
+
for (let w = 0; w < PACE_HEAD_WORDS; w++)
|
|
56
|
+
out[at + w] = this.words[from + w];
|
|
57
|
+
this.first++;
|
|
58
|
+
if (this.first === this.end) {
|
|
59
|
+
this.first = 0;
|
|
60
|
+
this.end = 0;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
grow() {
|
|
64
|
+
const live = this.end - this.first;
|
|
65
|
+
const capacity = this.kinds.length * 2;
|
|
66
|
+
const kinds = new Uint8Array(capacity);
|
|
67
|
+
kinds.set(this.kinds.subarray(this.first, this.end));
|
|
68
|
+
const heads = new ArrayBuffer(capacity * PACE_HEAD_WORDS * 4);
|
|
69
|
+
const floats = new Float32Array(heads);
|
|
70
|
+
floats.set(this.floats.subarray(this.first * PACE_HEAD_WORDS, this.end * PACE_HEAD_WORDS));
|
|
71
|
+
this.kinds = kinds;
|
|
72
|
+
this.heads = heads;
|
|
73
|
+
this.floats = floats;
|
|
74
|
+
this.words = new Uint32Array(heads);
|
|
75
|
+
this.first = 0;
|
|
76
|
+
this.end = live;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a set of garments writes once into the buffers its rounds read, and the one per-step number
|
|
3
|
+
* worked out on the CPU: the constants, each round slot's first record, each colour's and each
|
|
4
|
+
* garment's batch slot, and the carry a step hands a garment that keeps less than all of its
|
|
5
|
+
* character's motion. Plain functions over the packed set, apart from the solver that schedules.
|
|
6
|
+
*/
|
|
7
|
+
import type { ResolvedClothParameters } from '@driftengine/physics';
|
|
8
|
+
import type { PackedClothSet } from './clothSetPack.ts';
|
|
9
|
+
/** Bytes of the shader's `Constants`. */
|
|
10
|
+
export declare const CLOTH_CONSTANT_BYTES = 48;
|
|
11
|
+
/** The set's `Constants`: its totals, and the substep length every garment of it shares. */
|
|
12
|
+
export declare function clothConstants(packed: PackedClothSet, h: number): ArrayBuffer;
|
|
13
|
+
/** Each of `rounds` round slots' first record: the round's index times the garments. */
|
|
14
|
+
export declare function clothRoundOffsets(rounds: number, garments: number): Uint32Array<ArrayBuffer>;
|
|
15
|
+
/**
|
|
16
|
+
* Each colour's range, twice — opening a substep's iterations and not — at a slot each, kind by
|
|
17
|
+
* kind; then one slot a garment for publishing, its particles' range and its index.
|
|
18
|
+
*/
|
|
19
|
+
export declare function clothBatchSlots(packed: PackedClothSet): Uint32Array<ArrayBuffer>;
|
|
20
|
+
/**
|
|
21
|
+
* `carryParticles`' rotation, origin and move, into a record's head at `at`, between the model
|
|
22
|
+
* matrices before and after the step; nothing where the garment keeps all of its character's
|
|
23
|
+
* motion, which leaves the head's carry at 0.
|
|
24
|
+
*/
|
|
25
|
+
export declare function writeClothCarry(parameters: ResolvedClothParameters, previous: Float32Array, next: Float32Array, words: Uint32Array, f: Float32Array, at: number): void;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { DYNAMIC_ALIGNMENT } from './uniformRing.js';
|
|
2
|
+
/** Bytes of the shader's `Constants`. */
|
|
3
|
+
export const CLOTH_CONSTANT_BYTES = 48;
|
|
4
|
+
/** The set's `Constants`: its totals, and the substep length every garment of it shares. */
|
|
5
|
+
export function clothConstants(packed, h) {
|
|
6
|
+
const bytes = new ArrayBuffer(CLOTH_CONSTANT_BYTES);
|
|
7
|
+
const u = new Uint32Array(bytes);
|
|
8
|
+
const f = new Float32Array(bytes);
|
|
9
|
+
u[0] = packed.count;
|
|
10
|
+
u[1] = packed.distances;
|
|
11
|
+
u[2] = packed.bendings;
|
|
12
|
+
u[3] = packed.joints;
|
|
13
|
+
u[4] = packed.colliders;
|
|
14
|
+
f[8] = h;
|
|
15
|
+
f[9] = 1 / h;
|
|
16
|
+
f[10] = 1 / (h * h);
|
|
17
|
+
return bytes;
|
|
18
|
+
}
|
|
19
|
+
/** Each of `rounds` round slots' first record: the round's index times the garments. */
|
|
20
|
+
export function clothRoundOffsets(rounds, garments) {
|
|
21
|
+
const words = new Uint32Array((rounds * DYNAMIC_ALIGNMENT) / 4);
|
|
22
|
+
for (let r = 0; r < rounds; r++)
|
|
23
|
+
words[(r * DYNAMIC_ALIGNMENT) / 4] = r * garments;
|
|
24
|
+
return words;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Each colour's range, twice — opening a substep's iterations and not — at a slot each, kind by
|
|
28
|
+
* kind; then one slot a garment for publishing, its particles' range and its index.
|
|
29
|
+
*/
|
|
30
|
+
export function clothBatchSlots(packed) {
|
|
31
|
+
const { distanceBatches, bendingBatches, tetherBatches, garments } = packed;
|
|
32
|
+
const kinds = [distanceBatches, bendingBatches, tetherBatches];
|
|
33
|
+
let slots = garments.length;
|
|
34
|
+
for (const batches of kinds)
|
|
35
|
+
slots += (batches.length - 1) * 2;
|
|
36
|
+
const words = new Uint32Array((slots * DYNAMIC_ALIGNMENT) / 4);
|
|
37
|
+
let slot = 0;
|
|
38
|
+
for (const batches of kinds) {
|
|
39
|
+
for (let b = 0; b + 1 < batches.length; b++) {
|
|
40
|
+
for (let first = 0; first < 2; first++) {
|
|
41
|
+
const at = (slot * DYNAMIC_ALIGNMENT) / 4;
|
|
42
|
+
words[at] = batches[b];
|
|
43
|
+
words[at + 1] = batches[b + 1];
|
|
44
|
+
words[at + 2] = first;
|
|
45
|
+
slot++;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
garments.forEach((range, g) => {
|
|
50
|
+
const at = (slot * DYNAMIC_ALIGNMENT) / 4;
|
|
51
|
+
words[at] = range.particleBase;
|
|
52
|
+
words[at + 1] = range.particleBase + range.count;
|
|
53
|
+
words[at + 2] = g;
|
|
54
|
+
slot++;
|
|
55
|
+
});
|
|
56
|
+
return words;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* `carryParticles`' rotation, origin and move, into a record's head at `at`, between the model
|
|
60
|
+
* matrices before and after the step; nothing where the garment keeps all of its character's
|
|
61
|
+
* motion, which leaves the head's carry at 0.
|
|
62
|
+
*/
|
|
63
|
+
export function writeClothCarry(parameters, previous, next, words, f, at) {
|
|
64
|
+
const turn = 1 - parameters.angularInertia;
|
|
65
|
+
const move = 1 - parameters.linearInertia;
|
|
66
|
+
if (turn === 0 && move === 0)
|
|
67
|
+
return;
|
|
68
|
+
words[at + 3] = 1;
|
|
69
|
+
/* Column c of R = R_next × R_previousᵀ, at turn0 … turn2. */
|
|
70
|
+
for (let col = 0; col < 3; col++) {
|
|
71
|
+
for (let row = 0; row < 3; row++) {
|
|
72
|
+
let sum = 0;
|
|
73
|
+
for (let k = 0; k < 3; k++) {
|
|
74
|
+
sum += next[k * 4 + row] * previous[k * 4 + col];
|
|
75
|
+
}
|
|
76
|
+
f[at + 8 + col * 4 + row] = sum;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
for (let k = 0; k < 3; k++) {
|
|
80
|
+
f[at + 20 + k] = previous[12 + k];
|
|
81
|
+
f[at + 24 + k] = (next[12 + k] - previous[12 + k]) * move;
|
|
82
|
+
}
|
|
83
|
+
f[at + 23] = turn;
|
|
84
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PackedCloth } from './clothSolvePack.ts';
|
|
2
|
+
/** Floats of statics a particle in a set: a garment's own, and which garment it is. */
|
|
3
|
+
export declare const CLOTH_SET_STATIC_FLOATS: number;
|
|
4
|
+
/** Where one garment sits in a set. */
|
|
5
|
+
export interface ClothGarmentRange {
|
|
6
|
+
readonly particleBase: number;
|
|
7
|
+
readonly count: number;
|
|
8
|
+
readonly jointBase: number;
|
|
9
|
+
readonly joints: number;
|
|
10
|
+
readonly colliderBase: number;
|
|
11
|
+
readonly colliders: number;
|
|
12
|
+
/** `packCloth`'s limit flags, the garment's own. */
|
|
13
|
+
readonly limits: number;
|
|
14
|
+
readonly rigged: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface PackedClothSet {
|
|
17
|
+
/** Particles across every garment. */
|
|
18
|
+
readonly count: number;
|
|
19
|
+
readonly statics: Float32Array;
|
|
20
|
+
readonly constraints: Uint32Array;
|
|
21
|
+
readonly distances: number;
|
|
22
|
+
readonly bendings: number;
|
|
23
|
+
readonly tethers: number;
|
|
24
|
+
/** Each kind's colours across the set: colour `b` of every garment is `[b]` up to `[b + 1]`. */
|
|
25
|
+
readonly distanceBatches: Uint32Array;
|
|
26
|
+
readonly bendingBatches: Uint32Array;
|
|
27
|
+
readonly tetherBatches: Uint32Array;
|
|
28
|
+
/** Skin matrices and colliders across every garment. */
|
|
29
|
+
readonly joints: number;
|
|
30
|
+
readonly colliders: number;
|
|
31
|
+
readonly garments: readonly ClothGarmentRange[];
|
|
32
|
+
}
|
|
33
|
+
export declare function packClothSet(packs: readonly PackedCloth[]): PackedClothSet;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Several garments' packs as one set of buffers, so that one dispatch solves a colour of one kind of
|
|
3
|
+
* constraint for every garment at once: `packCloth`'s sections laid end to end, and each kind's
|
|
4
|
+
* records regrouped so a colour of all of them is one range.
|
|
5
|
+
*
|
|
6
|
+
* **Why regrouping by colour keeps each garment's solve.** A batch is a set of constraints that share
|
|
7
|
+
* no movable particle, and two garments share no particle at all, so colour `b` of every garment is
|
|
8
|
+
* still such a set. Each garment's own colours still run in its own order, 0 then 1 then 2, so it is
|
|
9
|
+
* solved exactly as it would be alone: the CPU solver, which steps garments one at a time, is the
|
|
10
|
+
* reference for every one of them.
|
|
11
|
+
*
|
|
12
|
+
* **Every index a record or a static holds is the set's**: a particle is offset by where its garment
|
|
13
|
+
* starts, a joint by where its garment's skin matrices start. A section `packCloth` lays at `s · n`
|
|
14
|
+
* lies at `s · N` here, with a garment's particles at its base inside it, and one more section says
|
|
15
|
+
* which garment each particle is — what a kernel reads its garment's numbers by.
|
|
16
|
+
*
|
|
17
|
+
* **What it gives up**: a colour is dispatched over the most records any garment has in it, so a set
|
|
18
|
+
* of one garment of nine colours and fourteen of three runs nine colours' dispatches for all of them;
|
|
19
|
+
* and a garment joins a set when the set is made, so changing one rebuilds the set.
|
|
20
|
+
*/
|
|
21
|
+
import { CLOTH_STATIC_FLOATS } from './clothSolvePack.js';
|
|
22
|
+
/** Floats of statics a particle in a set: a garment's own, and which garment it is. */
|
|
23
|
+
export const CLOTH_SET_STATIC_FLOATS = CLOTH_STATIC_FLOATS + 1;
|
|
24
|
+
/** `packCloth`'s sections: where each starts, in particle counts, and its floats a particle. */
|
|
25
|
+
const SECTIONS = [
|
|
26
|
+
[0, 1],
|
|
27
|
+
[1, 1],
|
|
28
|
+
[2, 2],
|
|
29
|
+
[4, 2],
|
|
30
|
+
[6, 1],
|
|
31
|
+
[7, 3],
|
|
32
|
+
[10, 3],
|
|
33
|
+
[13, 16],
|
|
34
|
+
];
|
|
35
|
+
/** Where the influences start, and where the garment's index sits, in particle counts. */
|
|
36
|
+
const INFLUENCES = 13;
|
|
37
|
+
const GARMENT = CLOTH_STATIC_FLOATS;
|
|
38
|
+
export function packClothSet(packs) {
|
|
39
|
+
const garments = [];
|
|
40
|
+
let count = 0;
|
|
41
|
+
let joints = 0;
|
|
42
|
+
let colliders = 0;
|
|
43
|
+
for (const pack of packs) {
|
|
44
|
+
garments.push({
|
|
45
|
+
particleBase: count,
|
|
46
|
+
count: pack.count,
|
|
47
|
+
jointBase: joints,
|
|
48
|
+
joints: pack.joints,
|
|
49
|
+
colliderBase: colliders,
|
|
50
|
+
colliders: pack.colliders,
|
|
51
|
+
limits: pack.limits,
|
|
52
|
+
rigged: pack.rigged,
|
|
53
|
+
});
|
|
54
|
+
count += pack.count;
|
|
55
|
+
joints += pack.joints;
|
|
56
|
+
colliders += pack.colliders;
|
|
57
|
+
}
|
|
58
|
+
const statics = new Float32Array(count * CLOTH_SET_STATIC_FLOATS);
|
|
59
|
+
packs.forEach((pack, g) => {
|
|
60
|
+
const { particleBase: base, count: n, jointBase } = garments[g];
|
|
61
|
+
for (const [start, stride] of SECTIONS) {
|
|
62
|
+
const from = pack.statics.subarray(start * n, (start + stride) * n);
|
|
63
|
+
statics.set(from, start * count + base * stride);
|
|
64
|
+
}
|
|
65
|
+
/* Each influence's joint, the set's: four joints, four weights, four joints, four weights. */
|
|
66
|
+
for (let i = 0; i < n; i++) {
|
|
67
|
+
const at = INFLUENCES * count + (base + i) * 16;
|
|
68
|
+
for (let k = 0; k < 4; k++) {
|
|
69
|
+
statics[at + k] = statics[at + k] + jointBase;
|
|
70
|
+
statics[at + 8 + k] = statics[at + 8 + k] + jointBase;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
statics.fill(g, GARMENT * count + base, GARMENT * count + base + n);
|
|
74
|
+
});
|
|
75
|
+
const distances = sum(packs, (pack) => pack.distances);
|
|
76
|
+
const bendings = sum(packs, (pack) => pack.bendings);
|
|
77
|
+
const tethers = sum(packs, (pack) => pack.tethers);
|
|
78
|
+
const constraints = new Uint32Array(distances * 4 + bendings * 6 + tethers * 3);
|
|
79
|
+
/* Each kind: where its records start, a record's words, how many of them are particles. */
|
|
80
|
+
const distanceBatches = regroup(packs, garments, constraints, 0, 4, 2, 'distanceBatches');
|
|
81
|
+
const bendingStart = distances * 4;
|
|
82
|
+
const bendingBatches = regroup(packs, garments, constraints, bendingStart, 6, 4, 'bendingBatches');
|
|
83
|
+
const tetherStart = bendingStart + bendings * 6;
|
|
84
|
+
const tetherBatches = regroup(packs, garments, constraints, tetherStart, 3, 2, 'tetherBatches');
|
|
85
|
+
return {
|
|
86
|
+
count,
|
|
87
|
+
statics,
|
|
88
|
+
constraints,
|
|
89
|
+
distances,
|
|
90
|
+
bendings,
|
|
91
|
+
tethers,
|
|
92
|
+
distanceBatches,
|
|
93
|
+
bendingBatches,
|
|
94
|
+
tetherBatches,
|
|
95
|
+
joints,
|
|
96
|
+
colliders,
|
|
97
|
+
garments,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function sum(packs, of) {
|
|
101
|
+
let total = 0;
|
|
102
|
+
for (const pack of packs)
|
|
103
|
+
total += of(pack);
|
|
104
|
+
return total;
|
|
105
|
+
}
|
|
106
|
+
/** Where one kind's records start in a garment's own pack, in words. */
|
|
107
|
+
function kindStart(pack, kind) {
|
|
108
|
+
if (kind === 'distanceBatches')
|
|
109
|
+
return 0;
|
|
110
|
+
if (kind === 'bendingBatches')
|
|
111
|
+
return pack.distances * 4;
|
|
112
|
+
return pack.distances * 4 + pack.bendings * 6;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* One kind's records, colour by colour and within a colour garment by garment, into `out` from
|
|
116
|
+
* `start`; each record's first `ids` words offset by its garment's first particle. The set's colours.
|
|
117
|
+
*/
|
|
118
|
+
function regroup(packs, garments, out, start, words, ids, kind) {
|
|
119
|
+
let colours = 0;
|
|
120
|
+
for (const pack of packs)
|
|
121
|
+
colours = Math.max(colours, pack[kind].length - 1);
|
|
122
|
+
const batches = new Uint32Array(colours + 1);
|
|
123
|
+
let record = 0;
|
|
124
|
+
for (let b = 0; b < colours; b++) {
|
|
125
|
+
packs.forEach((pack, g) => {
|
|
126
|
+
const own = pack[kind];
|
|
127
|
+
if (b + 1 >= own.length)
|
|
128
|
+
return;
|
|
129
|
+
const base = garments[g].particleBase;
|
|
130
|
+
const from = kindStart(pack, kind);
|
|
131
|
+
for (let r = own[b]; r < own[b + 1]; r++) {
|
|
132
|
+
const src = from + r * words;
|
|
133
|
+
const dst = start + record * words;
|
|
134
|
+
for (let w = 0; w < words; w++) {
|
|
135
|
+
const word = pack.constraints[src + w];
|
|
136
|
+
out[dst + w] = w < ids ? word + base : word;
|
|
137
|
+
}
|
|
138
|
+
record++;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
batches[b + 1] = record;
|
|
142
|
+
}
|
|
143
|
+
return batches;
|
|
144
|
+
}
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
* the level nominally has.
|
|
13
13
|
*/
|
|
14
14
|
import type { CompressedTextureFormat, CompressedTextureSource } from '../../compressedSource.ts';
|
|
15
|
-
/** Every BC format, where the device carries the feature; none where it does not. */
|
|
16
15
|
export declare function gpuCompressedFormats(device: GPUDevice): CompressedTextureFormat[];
|
|
17
16
|
/** A texture holding `layers` as `name`, `levels` levels of each, written as they are. */
|
|
18
17
|
export declare function createCompressedTexture(device: GPUDevice, name: CompressedTextureFormat, layers: readonly CompressedTextureSource[], levels: number): GPUTexture;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BLOCK_SHAPES, blockFamily } from '../../compressedSource.js';
|
|
2
2
|
const GPU_FORMAT = {
|
|
3
3
|
bc1: 'bc1-rgba-unorm',
|
|
4
4
|
'bc1-srgb': 'bc1-rgba-unorm-srgb',
|
|
@@ -10,28 +10,73 @@ const GPU_FORMAT = {
|
|
|
10
10
|
bc5: 'bc5-rg-unorm',
|
|
11
11
|
bc7: 'bc7-rgba-unorm',
|
|
12
12
|
'bc7-srgb': 'bc7-rgba-unorm-srgb',
|
|
13
|
+
'etc2-rgb8': 'etc2-rgb8unorm',
|
|
14
|
+
'etc2-rgb8-srgb': 'etc2-rgb8unorm-srgb',
|
|
15
|
+
'etc2-rgb8a1': 'etc2-rgb8a1unorm',
|
|
16
|
+
'etc2-rgb8a1-srgb': 'etc2-rgb8a1unorm-srgb',
|
|
17
|
+
'etc2-rgba8': 'etc2-rgba8unorm',
|
|
18
|
+
'etc2-rgba8-srgb': 'etc2-rgba8unorm-srgb',
|
|
19
|
+
'eac-r11': 'eac-r11unorm',
|
|
20
|
+
'eac-rg11': 'eac-rg11unorm',
|
|
21
|
+
'astc-4x4': 'astc-4x4-unorm',
|
|
22
|
+
'astc-4x4-srgb': 'astc-4x4-unorm-srgb',
|
|
23
|
+
'astc-5x4': 'astc-5x4-unorm',
|
|
24
|
+
'astc-5x4-srgb': 'astc-5x4-unorm-srgb',
|
|
25
|
+
'astc-5x5': 'astc-5x5-unorm',
|
|
26
|
+
'astc-5x5-srgb': 'astc-5x5-unorm-srgb',
|
|
27
|
+
'astc-6x5': 'astc-6x5-unorm',
|
|
28
|
+
'astc-6x5-srgb': 'astc-6x5-unorm-srgb',
|
|
29
|
+
'astc-6x6': 'astc-6x6-unorm',
|
|
30
|
+
'astc-6x6-srgb': 'astc-6x6-unorm-srgb',
|
|
31
|
+
'astc-8x5': 'astc-8x5-unorm',
|
|
32
|
+
'astc-8x5-srgb': 'astc-8x5-unorm-srgb',
|
|
33
|
+
'astc-8x6': 'astc-8x6-unorm',
|
|
34
|
+
'astc-8x6-srgb': 'astc-8x6-unorm-srgb',
|
|
35
|
+
'astc-8x8': 'astc-8x8-unorm',
|
|
36
|
+
'astc-8x8-srgb': 'astc-8x8-unorm-srgb',
|
|
37
|
+
'astc-10x5': 'astc-10x5-unorm',
|
|
38
|
+
'astc-10x5-srgb': 'astc-10x5-unorm-srgb',
|
|
39
|
+
'astc-10x6': 'astc-10x6-unorm',
|
|
40
|
+
'astc-10x6-srgb': 'astc-10x6-unorm-srgb',
|
|
41
|
+
'astc-10x8': 'astc-10x8-unorm',
|
|
42
|
+
'astc-10x8-srgb': 'astc-10x8-unorm-srgb',
|
|
43
|
+
'astc-10x10': 'astc-10x10-unorm',
|
|
44
|
+
'astc-10x10-srgb': 'astc-10x10-unorm-srgb',
|
|
45
|
+
'astc-12x10': 'astc-12x10-unorm',
|
|
46
|
+
'astc-12x10-srgb': 'astc-12x10-unorm-srgb',
|
|
47
|
+
'astc-12x12': 'astc-12x12-unorm',
|
|
48
|
+
'astc-12x12-srgb': 'astc-12x12-unorm-srgb',
|
|
13
49
|
};
|
|
14
50
|
/** Every BC format, where the device carries the feature; none where it does not. */
|
|
51
|
+
/** The feature that grants each family, which `select.ts` asks for wherever the adapter offers it. */
|
|
52
|
+
const FEATURE = {
|
|
53
|
+
bc: 'texture-compression-bc',
|
|
54
|
+
etc2: 'texture-compression-etc2',
|
|
55
|
+
astc: 'texture-compression-astc',
|
|
56
|
+
};
|
|
15
57
|
export function gpuCompressedFormats(device) {
|
|
16
|
-
return device.features.has(
|
|
17
|
-
|
|
18
|
-
|
|
58
|
+
return Object.keys(GPU_FORMAT).filter((name) => device.features.has(FEATURE[blockFamily(baseOf(name))]));
|
|
59
|
+
}
|
|
60
|
+
/** The format a name is of, without its colour space. */
|
|
61
|
+
function baseOf(name) {
|
|
62
|
+
return (name.endsWith('-srgb') ? name.slice(0, -'-srgb'.length) : name);
|
|
19
63
|
}
|
|
20
64
|
/** A texture holding `layers` as `name`, `levels` levels of each, written as they are. */
|
|
21
65
|
export function createCompressedTexture(device, name, layers, levels) {
|
|
22
66
|
const { format, width, height } = layers[0];
|
|
23
67
|
const texture = device.createTexture({
|
|
24
|
-
label:
|
|
68
|
+
label: `surface.texture.${format}`,
|
|
25
69
|
size: [width, height, layers.length],
|
|
26
70
|
format: GPU_FORMAT[name],
|
|
27
71
|
mipLevelCount: levels,
|
|
28
72
|
usage: 0x2 | 0x4, // COPY_DST | TEXTURE_BINDING
|
|
29
73
|
});
|
|
74
|
+
const block = BLOCK_SHAPES[format];
|
|
30
75
|
for (let level = 0; level < levels; level++) {
|
|
31
|
-
const across = Math.ceil(Math.max(1, width >> level) /
|
|
32
|
-
const down = Math.ceil(Math.max(1, height >> level) /
|
|
76
|
+
const across = Math.ceil(Math.max(1, width >> level) / block.width);
|
|
77
|
+
const down = Math.ceil(Math.max(1, height >> level) / block.height);
|
|
33
78
|
for (let layer = 0; layer < layers.length; layer++) {
|
|
34
|
-
device.queue.writeTexture({ texture, mipLevel: level, origin: [0, 0, layer] }, layers[layer].levels[level], { bytesPerRow: across *
|
|
79
|
+
device.queue.writeTexture({ texture, mipLevel: level, origin: [0, 0, layer] }, layers[layer].levels[level], { bytesPerRow: across * block.bytes, rowsPerImage: down }, { width: across * block.width, height: down * block.height, depthOrArrayLayers: 1 });
|
|
35
80
|
}
|
|
36
81
|
}
|
|
37
82
|
return texture;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DEPTH_FRAG_WGSL } from '../../shaders/generated/depth.wgsl.ts';
|
|
2
2
|
import type { PipelineCache } from './pipelineCache.ts';
|
|
3
3
|
import type { ClothViews } from './clothTextures.ts';
|
|
4
|
+
import type { AnimationViews } from './flatPass.ts';
|
|
4
5
|
/**
|
|
5
6
|
* The shadow pass: the world drawn from the light, into a depth map.
|
|
6
7
|
*
|
|
@@ -136,6 +137,55 @@ export declare const DEPTH_PALETTE_BINDING: {
|
|
|
136
137
|
readonly sampler: 17;
|
|
137
138
|
readonly type: "sampler2D";
|
|
138
139
|
};
|
|
140
|
+
export declare const DEPTH_INSTANCED_ANIMATED_VERT_FIELDS: {
|
|
141
|
+
readonly uLightViewProj: {
|
|
142
|
+
readonly offset: 0;
|
|
143
|
+
readonly size: 64;
|
|
144
|
+
readonly type: "mat4";
|
|
145
|
+
};
|
|
146
|
+
readonly uSceneTime: {
|
|
147
|
+
readonly offset: 64;
|
|
148
|
+
readonly size: 4;
|
|
149
|
+
readonly type: "float";
|
|
150
|
+
};
|
|
151
|
+
readonly uBoneClip: {
|
|
152
|
+
readonly offset: 72;
|
|
153
|
+
readonly size: 8;
|
|
154
|
+
readonly type: "vec2";
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
export declare const DEPTH_INSTANCED_ANIMATED_CUTOUT_VERT_FIELDS: {
|
|
158
|
+
readonly uLightViewProj: {
|
|
159
|
+
readonly offset: 0;
|
|
160
|
+
readonly size: 64;
|
|
161
|
+
readonly type: "mat4";
|
|
162
|
+
};
|
|
163
|
+
readonly uUvScale: {
|
|
164
|
+
readonly offset: 64;
|
|
165
|
+
readonly size: 8;
|
|
166
|
+
readonly type: "vec2";
|
|
167
|
+
};
|
|
168
|
+
readonly uUvOffset: {
|
|
169
|
+
readonly offset: 72;
|
|
170
|
+
readonly size: 8;
|
|
171
|
+
readonly type: "vec2";
|
|
172
|
+
};
|
|
173
|
+
readonly uAlphaCutout: {
|
|
174
|
+
readonly offset: 80;
|
|
175
|
+
readonly size: 8;
|
|
176
|
+
readonly type: "vec2";
|
|
177
|
+
};
|
|
178
|
+
readonly uSceneTime: {
|
|
179
|
+
readonly offset: 88;
|
|
180
|
+
readonly size: 4;
|
|
181
|
+
readonly type: "float";
|
|
182
|
+
};
|
|
183
|
+
readonly uBoneClip: {
|
|
184
|
+
readonly offset: 96;
|
|
185
|
+
readonly size: 8;
|
|
186
|
+
readonly type: "vec2";
|
|
187
|
+
};
|
|
188
|
+
};
|
|
139
189
|
/**
|
|
140
190
|
* The format the shadow map is stored in.
|
|
141
191
|
*
|
|
@@ -160,7 +210,9 @@ skinned?: boolean,
|
|
|
160
210
|
* Separate for the palette's reason: the plain layout stays exactly what it was, and a frame with
|
|
161
211
|
* no cutout caster pays nothing.
|
|
162
212
|
*/
|
|
163
|
-
cutout?: boolean
|
|
213
|
+
cutout?: boolean,
|
|
214
|
+
/** An instanced caster playing a bone animation: its three vertex textures. */
|
|
215
|
+
animated?: boolean): GPUBindGroupLayout;
|
|
164
216
|
export declare function createDepthBindGroup(device: GPUDevice, layout: GPUBindGroupLayout, perDraw: GPUBuffer, perPass: GPUBuffer, previous: GPUTextureView, sampler: GPUSampler,
|
|
165
217
|
/** The joint palette, for a layout built with `skinned`. Omit for the rigid layout. */
|
|
166
218
|
palette?: GPUTextureView | null,
|
|
@@ -170,7 +222,9 @@ cutout?: {
|
|
|
170
222
|
readonly sampler: GPUSampler;
|
|
171
223
|
} | null,
|
|
172
224
|
/** A skinned group's cloth views: the caster's, or the stand-in where it has none. */
|
|
173
|
-
cloth?: ClothViews | null
|
|
225
|
+
cloth?: ClothViews | null,
|
|
226
|
+
/** An animated caster's clip and clocks. See `AnimationViews`. */
|
|
227
|
+
animation?: AnimationViews | null): GPUBindGroup;
|
|
174
228
|
/**
|
|
175
229
|
* The depth pipeline.
|
|
176
230
|
*
|
|
@@ -209,4 +263,6 @@ cutout?: boolean,
|
|
|
209
263
|
*/
|
|
210
264
|
skinEight?: boolean,
|
|
211
265
|
/** Whether a skinned caster is placed by a cloth binding, as its visible draw is. The key carries it. */
|
|
212
|
-
cloth?: boolean
|
|
266
|
+
cloth?: boolean,
|
|
267
|
+
/** An instanced caster playing a bone animation. The key must carry it. */
|
|
268
|
+
animated?: boolean): GPURenderPipeline;
|