@driftengine/core 4.9.0 → 4.10.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.
Files changed (135) hide show
  1. package/CHANGELOG.json +62 -11
  2. package/README.md +43 -38
  3. package/dist/index.d.ts +3 -1
  4. package/dist/index.js +4 -3
  5. package/dist/render/ambientHarmonics.d.ts +1 -1
  6. package/dist/render/ambientHarmonics.js +1 -1
  7. package/dist/render/areaLights.d.ts +4 -4
  8. package/dist/render/areaLights.js +1 -1
  9. package/dist/render/backend/api.d.ts +10 -3
  10. package/dist/render/backend/select.js +11 -5
  11. package/dist/render/backend/webgl2/boneAnimations.d.ts +29 -0
  12. package/dist/render/backend/webgl2/boneAnimations.js +80 -0
  13. package/dist/render/backend/webgl2/instanced.d.ts +5 -1
  14. package/dist/render/backend/webgl2/instanced.js +13 -1
  15. package/dist/render/backend/webgl2/renderer.d.ts +90 -2
  16. package/dist/render/backend/webgl2/renderer.js +253 -24
  17. package/dist/render/backend/webgl2/skinPaletteTexture.d.ts +5 -3
  18. package/dist/render/backend/webgl2/skinPaletteTexture.js +6 -4
  19. package/dist/render/backend/webgpu/boneAnimations.d.ts +34 -0
  20. package/dist/render/backend/webgpu/boneAnimations.js +76 -0
  21. package/dist/render/backend/webgpu/buffers.d.ts +19 -4
  22. package/dist/render/backend/webgpu/buffers.js +18 -11
  23. package/dist/render/backend/webgpu/compressedUpload.d.ts +0 -1
  24. package/dist/render/backend/webgpu/compressedUpload.js +53 -8
  25. package/dist/render/backend/webgpu/depthPass.d.ts +59 -3
  26. package/dist/render/backend/webgpu/depthPass.js +49 -14
  27. package/dist/render/backend/webgpu/drawCommand.d.ts +18 -4
  28. package/dist/render/backend/webgpu/drawCommand.js +10 -3
  29. package/dist/render/backend/webgpu/flatPass.d.ts +85 -42
  30. package/dist/render/backend/webgpu/flatPass.js +136 -20
  31. package/dist/render/backend/webgpu/instanced.d.ts +14 -1
  32. package/dist/render/backend/webgpu/instanced.js +24 -1
  33. package/dist/render/backend/webgpu/materialStore.d.ts +101 -0
  34. package/dist/render/backend/webgpu/materialStore.js +265 -0
  35. package/dist/render/backend/webgpu/pipelineCache.d.ts +6 -0
  36. package/dist/render/backend/webgpu/pipelineCache.js +7 -0
  37. package/dist/render/backend/webgpu/renderer.d.ts +152 -35
  38. package/dist/render/backend/webgpu/renderer.js +787 -142
  39. package/dist/render/backend/webgpu/skinPaletteRing.d.ts +7 -3
  40. package/dist/render/backend/webgpu/skinPaletteRing.js +13 -7
  41. package/dist/render/backend/webgpu/skinPaletteTexture.d.ts +6 -0
  42. package/dist/render/backend/webgpu/skinPaletteTexture.js +7 -1
  43. package/dist/render/backend/webgpu/staticBundles.d.ts +125 -0
  44. package/dist/render/backend/webgpu/staticBundles.js +241 -0
  45. package/dist/render/backend/webgpu/surfaceTexturePass.d.ts +10 -3
  46. package/dist/render/backend/webgpu/surfaceTexturePass.js +20 -2
  47. package/dist/render/backend/webgpu/uniformRing.d.ts +21 -0
  48. package/dist/render/backend/webgpu/uniformRing.js +9 -1
  49. package/dist/render/bloomChain.d.ts +3 -3
  50. package/dist/render/boneAnimation.d.ts +92 -0
  51. package/dist/render/boneAnimation.js +133 -0
  52. package/dist/render/compressedSource.d.ts +33 -13
  53. package/dist/render/compressedSource.js +70 -25
  54. package/dist/render/glCompressed.js +83 -0
  55. package/dist/render/instances.d.ts +26 -0
  56. package/dist/render/lightBudget.d.ts +10 -0
  57. package/dist/render/lightBudget.js +10 -0
  58. package/dist/render/lightmap.d.ts +1 -1
  59. package/dist/render/mesh.d.ts +5 -0
  60. package/dist/render/mesh.js +6 -0
  61. package/dist/render/pointLightSelection.d.ts +4 -4
  62. package/dist/render/screenSpaceReflection.d.ts +2 -1
  63. package/dist/render/shaders/boneAnimation.d.ts +19 -0
  64. package/dist/render/shaders/boneAnimation.js +63 -0
  65. package/dist/render/shaders/depth.d.ts +7 -0
  66. package/dist/render/shaders/depth.js +35 -10
  67. package/dist/render/shaders/flat/index.d.ts +6 -0
  68. package/dist/render/shaders/flat/index.js +27 -5
  69. package/dist/render/shaders/flat/main.d.ts +1 -1
  70. package/dist/render/shaders/flat/main.js +15 -5
  71. package/dist/render/shaders/flat/models.js +1 -1
  72. package/dist/render/shaders/flat/overlay.js +1 -1
  73. package/dist/render/shaders/flat/pointShadow.js +2 -2
  74. package/dist/render/shaders/flat/preamble.js +38 -24
  75. package/dist/render/shaders/generated/depth.wgsl.d.ts +93 -0
  76. package/dist/render/shaders/generated/depth.wgsl.js +93 -0
  77. package/dist/render/shaders/generated/flat.wgsl.d.ts +3077 -2903
  78. package/dist/render/shaders/generated/flat.wgsl.js +3100 -2925
  79. package/dist/render/shaders/outputTransform.d.ts +7 -0
  80. package/dist/render/shaders/outputTransform.js +28 -14
  81. package/dist/render/shaders/vertexChannel.d.ts +7 -0
  82. package/dist/render/shaders/vertexChannel.js +26 -0
  83. package/dist/render/staticDraws.d.ts +47 -0
  84. package/dist/render/staticDraws.js +43 -0
  85. package/dist/render/surfaceTexture.d.ts +38 -7
  86. package/dist/render/surfaceTexture.js +56 -17
  87. package/package.json +6 -6
  88. package/src/index.ts +8 -2
  89. package/src/render/ambientHarmonics.ts +1 -1
  90. package/src/render/areaLights.ts +4 -4
  91. package/src/render/backend/api.ts +13 -3
  92. package/src/render/backend/select.ts +10 -5
  93. package/src/render/backend/webgl2/boneAnimations.ts +105 -0
  94. package/src/render/backend/webgl2/instanced.ts +20 -1
  95. package/src/render/backend/webgl2/renderer.ts +315 -24
  96. package/src/render/backend/webgl2/skinPaletteTexture.ts +6 -4
  97. package/src/render/backend/webgpu/boneAnimations.ts +97 -0
  98. package/src/render/backend/webgpu/buffers.ts +42 -16
  99. package/src/render/backend/webgpu/compressedUpload.ts +59 -9
  100. package/src/render/backend/webgpu/depthPass.ts +51 -10
  101. package/src/render/backend/webgpu/drawCommand.ts +22 -4
  102. package/src/render/backend/webgpu/flatPass.ts +187 -14
  103. package/src/render/backend/webgpu/instanced.ts +32 -1
  104. package/src/render/backend/webgpu/materialStore.ts +276 -0
  105. package/src/render/backend/webgpu/pipelineCache.ts +7 -0
  106. package/src/render/backend/webgpu/renderer.ts +928 -155
  107. package/src/render/backend/webgpu/skinPaletteRing.ts +13 -7
  108. package/src/render/backend/webgpu/skinPaletteTexture.ts +7 -1
  109. package/src/render/backend/webgpu/staticBundles.ts +363 -0
  110. package/src/render/backend/webgpu/surfaceTexturePass.ts +29 -3
  111. package/src/render/backend/webgpu/uniformRing.ts +10 -1
  112. package/src/render/bloomChain.ts +3 -3
  113. package/src/render/boneAnimation.ts +223 -0
  114. package/src/render/compressedSource.ts +121 -29
  115. package/src/render/glCompressed.ts +83 -0
  116. package/src/render/instances.ts +27 -0
  117. package/src/render/lightBudget.ts +11 -0
  118. package/src/render/lightmap.ts +1 -1
  119. package/src/render/mesh.ts +6 -0
  120. package/src/render/pointLightSelection.ts +4 -4
  121. package/src/render/screenSpaceReflection.ts +2 -1
  122. package/src/render/shaders/boneAnimation.ts +63 -0
  123. package/src/render/shaders/depth.ts +45 -10
  124. package/src/render/shaders/flat/index.ts +33 -5
  125. package/src/render/shaders/flat/main.ts +15 -5
  126. package/src/render/shaders/flat/models.ts +1 -1
  127. package/src/render/shaders/flat/overlay.ts +1 -1
  128. package/src/render/shaders/flat/pointShadow.ts +2 -2
  129. package/src/render/shaders/flat/preamble.ts +38 -24
  130. package/src/render/shaders/generated/depth.wgsl.ts +95 -0
  131. package/src/render/shaders/generated/flat.wgsl.ts +3100 -2925
  132. package/src/render/shaders/outputTransform.ts +30 -14
  133. package/src/render/shaders/vertexChannel.ts +27 -0
  134. package/src/render/staticDraws.ts +95 -0
  135. package/src/render/surfaceTexture.ts +94 -27
@@ -81,7 +81,7 @@ export const MAIN_GLSL = `void main() {
81
81
  */
82
82
  float share = cutoutShare(tested, uCutout.x);
83
83
  if (uCutout.y == 1.0) {
84
- if (!cutoutKeeps(share, gl_FragCoord.xy, uCutout.z)) discard;
84
+ if (!cutoutKeeps(share, gl_FragCoord.xy, uHighlightMin.w)) discard;
85
85
  kept = 1.0;
86
86
  } else {
87
87
  kept = share;
@@ -1280,7 +1280,7 @@ export const MAIN_GLSL = `void main() {
1280
1280
  */
1281
1281
  float falloff;
1282
1282
  /*
1283
- * **A light may name its own falloff, and then it is Unreal's for a light without
1283
+ * **A light may name its own falloff, and then it is the usual one for a light without
1284
1284
  * inverse-square falloff**: \`(1 - (d/R)^2)^n\` with no distance term, so a fill authored to
1285
1285
  * light a whole hall across a hundred metres does, where the inverse square would have it
1286
1286
  * gone a few metres out. Zero is the frame's own rule below, which every light was before.
@@ -1996,7 +1996,7 @@ export const MAIN_GLSL = `void main() {
1996
1996
  // finishing a run reads the same at noon and at midnight. Costs one compare
1997
1997
  // per fragment and no extra draw call — the box is a uniform, not geometry.
1998
1998
  if (uHighlightMax.w > 0.0) {
1999
- vec3 inside = step(uHighlightMin, vWorldPos) * step(vWorldPos, uHighlightMax.xyz);
1999
+ vec3 inside = step(uHighlightMin.xyz, vWorldPos) * step(vWorldPos, uHighlightMax.xyz);
2000
2000
  lit += albedo * uHighlightMax.w * inside.x * inside.y * inside.z;
2001
2001
  }
2002
2002
  }
@@ -2100,7 +2100,17 @@ export const MAIN_GLSL = `void main() {
2100
2100
  vec3 refractV = normalize(uCameraPos - vWorldPos);
2101
2101
  ivec2 snapSize = textureSize(uRefractScene, 0);
2102
2102
  vec2 screenUv = gl_FragCoord.xy / vec2(snapSize);
2103
- vec2 bent = clamp(screenUv + refractN.xy * uSeeThrough.x, vec2(0.0), vec2(1.0));
2103
+ /*
2104
+ * **The normal's sideways part as the eye sees it**: the shading normal in view space, its x
2105
+ * and y across the screen, y turned to the way this frame's rows run (w of the tint). It was the
2106
+ * normal's world x and y until 4.10.0, which on a quad facing the camera is the quad's own lean
2107
+ * against the world's axes: one offset over the whole quad, a lens, with a normal map's tilt a
2108
+ * small change on top. In view space a quad facing the eye bends by nothing but its map, which
2109
+ * is a shimmer, and a pane bends by how it leans toward the eye wherever the eye stands.
2110
+ */
2111
+ vec3 seenN = mat3(uView) * refractN;
2112
+ vec2 bend = vec2(seenN.x, seenN.y * uRefractTint.w);
2113
+ vec2 bent = clamp(screenUv + bend * uSeeThrough.x, vec2(0.0), vec2(1.0));
2104
2114
  /*
2105
2115
  * **An explicit level, and frost is what picks it** — the 2026-08-07 rule, and the reason a
2106
2116
  * frosted pane blurs rather than fades: the copy carries a mip chain on a frame that draws glass,
@@ -2114,7 +2124,7 @@ export const MAIN_GLSL = `void main() {
2114
2124
  /* Unsigned: a pane passes the same light seen from either side, and so does its Fresnel. */
2115
2125
  float cosView = max(abs(dot(refractN, refractV)), 0.05);
2116
2126
  float pathLength = uSeeThrough.y * vThickness / cosView;
2117
- vec3 seen = behind * pow(uRefractTint, vec3(pathLength));
2127
+ vec3 seen = behind * pow(uRefractTint.rgb, vec3(pathLength));
2118
2128
  if (glassTransmission > 0.0) {
2119
2129
  /*
2120
2130
  * **Glass keeps its own surface and shows what is behind over it**, by how much it lets
@@ -57,7 +57,7 @@ const bool PHYSICAL_SPECULAR = PHYSICAL_SPECULAR_ON; // wgsl:override
57
57
  * A model's numbers, two vectors a material — the lit stage's uniform budget has no more room
58
58
  * (surfaceModel.ts) — and whether a model map is bound, in the last component.
59
59
  */
60
- uniform vec4 uModelParams[2];
60
+ uniform vec4 uModelParams[2]; // wgsl:material
61
61
  /* The model's own channels, in the albedo's layout: what each means is each model's to say. */
62
62
  uniform highp sampler2DArray uModelMap;
63
63
 
@@ -26,7 +26,7 @@ vec3 overlayGlow(vec2 uv, vec3 n) { return vec3(0.0); }
26
26
  /* Whether this program carries a draw's overlay. Off but where one has been set: overlay.ts. */
27
27
  const bool SURFACE_OVERLAY = true; // wgsl:override
28
28
  /* The overlay's fifteen vectors; packSurfaceOverlay in surfaceOverlay.ts says what each holds. */
29
- uniform vec4 uOverlay[15];
29
+ uniform vec4 uOverlay[15]; // wgsl:material
30
30
 
31
31
  /* Whether the atlas is what the refraction slot holds: not where this draw refracts or is glass. */
32
32
  bool overlayImagesBound() {
@@ -13,7 +13,7 @@
13
13
  * picture and is its own change.
14
14
  */
15
15
  import { MAX_SHADOW_FILTER_TAPS } from '../../renderQuality.js';
16
- import { OUTPUT_TRANSFORM_GLSL } from '../outputTransform.js';
16
+ import { LIT_OUTPUT_TRANSFORM_GLSL } from '../outputTransform.js';
17
17
  import { LAMP_GLASS_GLSL } from './lampGlass.js';
18
18
  export const POINTSHADOW_GLSL = `/**
19
19
  * How much of one tap's occlusion survives its own penumbra.
@@ -343,7 +343,7 @@ ${LAMP_GLASS_GLSL}
343
343
 
344
344
  layout(location = 0) out vec4 outColor;
345
345
 
346
- ${OUTPUT_TRANSFORM_GLSL}
346
+ ${LIT_OUTPUT_TRANSFORM_GLSL}
347
347
 
348
348
  /**
349
349
  * A fixed Poisson disk avoids the grid-shaped edge left by square 3x3 PCF.
@@ -108,9 +108,15 @@ uniform sampler2D uRefractScene;
108
108
  * gives up, and four separate floats cost half the shadowed lights such a device can have. The tints
109
109
  * stay colours of their own. Zero transmission is not glass — see glass.ts.
110
110
  */
111
- uniform vec4 uSeeThrough;
112
- uniform vec3 uRefractTint;
113
- uniform vec3 uGlassTint;
111
+ uniform vec4 uSeeThrough; // wgsl:material
112
+ /*
113
+ * What a metre of the medium leaves of each channel (rgb), and in w which way this frame's rows run
114
+ * up the screen: +1 where the first row is the bottom (WebGL2), -1 where it is the top (WebGPU). The
115
+ * bend is taken in view space, whose y is up whatever the framebuffer says, so it is turned here to
116
+ * the rows a screen coordinate counts. A vec4 where a vec3 already spent the row.
117
+ */
118
+ uniform vec4 uRefractTint; // wgsl:material
119
+ uniform vec3 uGlassTint; // wgsl:material
114
120
  flat in int vHasTangents;
115
121
 
116
122
  /**
@@ -141,7 +147,7 @@ uniform mediump sampler2DArray uAlbedo;
141
147
  * card. Its draw culls nothing, and a back face is lit as a front, with the shading normal turned
142
148
  * toward the viewer.
143
149
  */
144
- uniform ivec4 uMaterialFlags;
150
+ uniform ivec4 uMaterialFlags; // wgsl:material
145
151
  /**
146
152
  * Alpha below which a textured fragment is thrown away entirely, 0 to disable.
147
153
  *
@@ -155,13 +161,17 @@ uniform ivec4 uMaterialFlags;
155
161
  * else changes.
156
162
  *
157
163
  * **Four numbers in one row**: x is the cutoff, y how this frame resolves the edge (0 the hard test,
158
- * 1 a dither the temporal resolve averages, 2 alpha-to-coverage; see \`cutoutDither.ts\`), z the
159
- * frame the dither's pattern is offset by, w the material's lighting channels — a mask a light
160
- * shades it only where its own shares a bit with (\`SurfaceMaterial.lightChannels\`, 1 unless a
161
- * material names others). One vector rather than a float and three more, because every loose
162
- * scalar is a row of WebGL2's 224 that the light budget gives up.
164
+ * 1 a dither the temporal resolve averages, 2 alpha-to-coverage; see \`cutoutDither.ts\`), z unused,
165
+ * w the material's lighting channels — a mask a light shades it only where its own shares a bit
166
+ * with (\`SurfaceMaterial.lightChannels\`, 1 unless a material names others). One vector rather than
167
+ * a float and three more, because every loose scalar is a row of WebGL2's 224 that the light budget
168
+ * gives up.
169
+ *
170
+ * **z was the frame the dither's pattern is offset by until 4.10.0**, and that made every material
171
+ * new every frame: a material is kept on WebGPU by its numbers, and one of them changed with the
172
+ * clock. The frame is the pass's, in \`uHighlightMin.w\`.
163
173
  */
164
- uniform vec4 uCutout;
174
+ uniform vec4 uCutout; // wgsl:material
165
175
  /**
166
176
  * A draw's own ambient, as nine spherical-harmonic coefficients of incoming radiance, red green blue
167
177
  * in turn, twenty-seven floats, and in the last of the twenty-eight a 1 where they are on — 0 is the
@@ -169,7 +179,7 @@ uniform vec4 uCutout;
169
179
  * and the basis, and its tests hold this to it. Seven rows of the material block, which is per draw
170
180
  * as far as anything here is: \`setAmbientSH\` moves it between two draws as \`setMaterial\` does.
171
181
  */
172
- uniform vec4 uAmbientSH[7];
182
+ uniform vec4 uAmbientSH[7]; // wgsl:material
173
183
 
174
184
  /** The ambient a surface facing \`n\` receives from \`uAmbientSH\`: \`ambientFromSH\`'s arithmetic. */
175
185
  vec3 ambientHarmonics(vec3 n) {
@@ -216,7 +226,7 @@ uniform highp sampler2DArray uNormalMap;
216
226
  * shadow samplers, where a profile with shadows off should declare none of them; it is the wrong
217
227
  * tool for one image on a shader that already declares one.
218
228
  */
219
- uniform float uNormalStrength;
229
+ uniform float uNormalStrength; // wgsl:material
220
230
 
221
231
  /**
222
232
  * Occlusion, roughness and metallic in one image. glTF's packing, because that is what an import
@@ -237,7 +247,7 @@ uniform highp sampler2DArray uOrmMap;
237
247
  * occlusionTexture.strength is: 1 + strength * (texel - 1). A multiply at 0 means fully occluded,
238
248
  * which is the opposite of what a caller asking for no occlusion means.
239
249
  */
240
- uniform vec3 uOrmScale;
250
+ uniform vec3 uOrmScale; // wgsl:material
241
251
  /**
242
252
  * 1 when \`uEnvironment\` holds the GGX-prefiltered cube, 0 when it holds the capture's box chain.
243
253
  *
@@ -253,7 +263,7 @@ uniform vec3 uOrmScale;
253
263
  * (\`uniformVectorBudget.ts\`). y is how much of the environment the material mirrors, z how
254
264
  * bright what it mirrors is.
255
265
  */
256
- uniform vec3 uEnvironmentDials;
266
+ uniform vec3 uEnvironmentDials; // wgsl:material
257
267
 
258
268
  /**
259
269
  * Where a surface glows, and in what colour.
@@ -275,7 +285,7 @@ uniform highp sampler2DArray uEmissiveMap;
275
285
  * The counterpart of \`uOrmScale\`: a factor that multiplies a texture is not a value, and this is
276
286
  * where the multiplier lives once an image supplies the shape.
277
287
  */
278
- uniform vec3 uEmissiveScale;
288
+ uniform vec3 uEmissiveScale; // wgsl:material
279
289
 
280
290
  #if DIRECTIONAL_SHADOWS
281
291
  /*
@@ -362,7 +372,7 @@ uniform vec4 uSurfaceScene;
362
372
  * draw moves it), y the night factor emission is gated on. One row where two floats were two
363
373
  * (\`uniformVectorBudget.ts\`).
364
374
  */
365
- uniform vec2 uEmission;
375
+ uniform vec2 uEmission; // wgsl:material
366
376
  #if NIGHT_EMISSIVE
367
377
  /**
368
378
  * Emission that only shows where the dominant light does not reach. 0 is off and is the default.
@@ -387,7 +397,7 @@ uniform float uNightEmissive;
387
397
  * of that to change one channel is how a renderer ends up with two shaders that
388
398
  * disagree about the sun. The caller owns the blend state; this owns the number.
389
399
  */
390
- uniform float uOpacity;
400
+ uniform float uOpacity; // wgsl:material
391
401
 
392
402
  /**
393
403
  * Two per-draw switches on how a fragment is *written* rather than what colour it is, sharing one
@@ -419,7 +429,7 @@ uniform float uOpacity;
419
429
  * crossfade reads as grain for as long as it lasts, which is why it should be short; and a blended
420
430
  * draw that asks for it is dithered too, since the test is a discard.
421
431
  */
422
- uniform vec2 uWriteMode;
432
+ uniform vec2 uWriteMode; // wgsl:material
423
433
 
424
434
  /** Whether this fragment is one \`uWriteMode.y\` keeps. Integer arithmetic, per the device rule. */
425
435
  bool ditherKeeps(float amount) {
@@ -452,7 +462,7 @@ bool ditherKeeps(float amount) {
452
462
  * one uniform skips the untaken side rather than computing both and discarding one, which is
453
463
  * only true because nothing here reads it through a *varying*-dependent branch.
454
464
  */
455
- uniform int uLightingEnabled;
465
+ uniform int uLightingEnabled; // wgsl:material
456
466
  /**
457
467
  * How this draw meets the medium: the atmospheric haze and the underwater tint both, folded
458
468
  * together because both are the *camera's* medium rather than a property of the surface — see
@@ -474,7 +484,7 @@ uniform int uLightingEnabled;
474
484
  * is what "exactly as its colour says" has to mean for it; the cost is that such a draw will
475
485
  * not tint if the camera goes under water, unlike everything else in the frame.
476
486
  */
477
- uniform int uFogEnabled;
487
+ uniform int uFogEnabled; // wgsl:material
478
488
 
479
489
  /**
480
490
  * A pass-level scale over the grain the geometry declared, 0 to 1.
@@ -484,7 +494,7 @@ uniform int uFogEnabled;
484
494
  * imported model that declares nothing is drawn with the pass's own answer, and a scene
485
495
  * can dial a whole draw down without rebuilding its geometry.
486
496
  */
487
- uniform float uGrain;
497
+ uniform float uGrain; // wgsl:material
488
498
  /*
489
499
  * The material's own relief: how strong, and how many bumps to a metre.
490
500
  *
@@ -493,7 +503,7 @@ uniform float uGrain;
493
503
  * between them, and the geometry carrying them is identical in all three cases. See
494
504
  * Renderer.setSurfaceRelief. x is the strength and y the bumps to a metre, in one row.
495
505
  */
496
- uniform vec2 uRelief;
506
+ uniform vec2 uRelief; // wgsl:material
497
507
  /**
498
508
  * How hard the bound surface texture's own luminance turns the shading normal, 0 for not at all.
499
509
  *
@@ -516,7 +526,7 @@ uniform vec2 uRelief;
516
526
  * 0..1 like its neighbours for the same reason: this is an amplitude against a luminance
517
527
  * gradient, not a fraction of anything.
518
528
  */
519
- uniform float uTextureRelief;
529
+ uniform float uTextureRelief; // wgsl:material
520
530
 
521
531
  /**
522
532
  * How much of the environment this material mirrors, 0 to 1.
@@ -651,8 +661,12 @@ uniform vec3 uProbeGridSets;
651
661
  /**
652
662
  * A world-space box that lights up regardless of time of day: its corners, and in the far corner's
653
663
  * w the gain — one row where a loose float was another (\`uniformVectorBudget.ts\`).
664
+ *
665
+ * **And in the near corner's w the frame the cutout dither's pattern is offset by**, for the same
666
+ * reason: a row the lit stage already pays for, holding a number the pass sets and no material does.
667
+ * See \`uCutout\`.
654
668
  */
655
- uniform vec3 uHighlightMin;
669
+ uniform vec4 uHighlightMin;
656
670
  uniform vec4 uHighlightMax;
657
671
 
658
672
  /*
@@ -1,6 +1,8 @@
1
1
  export declare const DEPTH_CUTOUT_FRAG_WGSL = "struct Uniforms {\n uPeelShadowLayer: i32,\n}\n\nvar<private> vUv_1: vec3<f32>;\n@group(0) @binding(34) \nvar uCutoutMap_t: texture_2d_array<f32>;\n@group(0) @binding(35) \nvar uCutoutMap_s: sampler;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vLightPosition_1: vec4<f32>;\n@group(0) @binding(32) \nvar uPreviousShadowMap_t: texture_2d_array<f32>;\n@group(0) @binding(33) \nvar uPreviousShadowMap_s: sampler;\nvar<private> gl_FragCoord_1: vec4<f32>;\nvar<private> vAlphaCutout_1: vec2<f32>;\n\nfn cutoutKeeps_u0028_f1_u003b_vf2_u003b_f1_u003b(share: ptr<function, f32>, pixel: ptr<function, vec2<f32>>, frame: ptr<function, f32>) -> bool {\n var p: vec2<f32>;\n var noise: f32;\n\n let _e31 = (*pixel);\n let _e32 = (*frame);\n p = (_e31 + vec2((5.588238f * _e32)));\n let _e36 = p;\n noise = fract((52.982918f * fract(dot(_e36, vec2<f32>(0.06711056f, 0.00583715f)))));\n let _e41 = (*share);\n let _e42 = noise;\n return (_e41 > _e42);\n}\n\nfn cutoutShare_u0028_f1_u003b_f1_u003b(alpha: ptr<function, f32>, cutoff: ptr<function, f32>) -> f32 {\n var band: f32;\n\n let _e29 = (*cutoff);\n let _e30 = (*cutoff);\n band = max((2f * min(_e29, (1f - _e30))), 0.0001f);\n let _e35 = (*alpha);\n let _e36 = (*cutoff);\n let _e38 = band;\n return clamp((((_e35 - _e36) / _e38) + 0.5f), 0f, 1f);\n}\n\nfn cutoutAlpha_u0028_f1_u003b_vf2_u003b(alpha_1: ptr<function, f32>, texels: ptr<function, vec2<f32>>) -> f32 {\n var dx: vec2<f32>;\n var dy: vec2<f32>;\n var level: f32;\n\n let _e31 = (*texels);\n let _e32 = dpdx(_e31);\n dx = _e32;\n let _e33 = (*texels);\n let _e34 = dpdy(_e33);\n dy = _e34;\n let _e35 = dx;\n let _e36 = dx;\n let _e38 = dy;\n let _e39 = dy;\n level = max(0f, (0.5f * log2(max(dot(_e35, _e36), dot(_e38, _e39)))));\n let _e45 = (*alpha_1);\n let _e46 = level;\n return (_e45 * (1f + (_e46 * 0.25f)));\n}\n\nfn main_1() {\n var at: vec3<f32>;\n var alpha_2: f32;\n var param: f32;\n var param_1: vec2<f32>;\n var p_1: vec3<f32>;\n var uv: vec2<f32>;\n var previousDepth: f32;\n var param_2: f32;\n var param_3: f32;\n var param_4: f32;\n var param_5: vec2<f32>;\n var param_6: f32;\n\n let _e38 = vUv_1;\n let _e39 = _e38.xy;\n let _e41 = vUv_1[2u];\n at = vec3<f32>(_e39.x, _e39.y, floor((_e41 + 0.5f)));\n let _e47 = at;\n let _e53 = textureSample(uCutoutMap_t, uCutoutMap_s, vec2<f32>(_e47.x, _e47.y), i32(_e47.z));\n let _e54 = vUv_1;\n let _e56 = textureDimensions(uCutoutMap_t, 0i);\n param = _e53.w;\n param_1 = (_e54.xy * vec2<f32>(vec2<i32>(_e56).xy));\n let _e62 = cutoutAlpha_u0028_f1_u003b_vf2_u003b((&param), (&param_1));\n alpha_2 = _e62;\n let _e64 = unnamed.uPeelShadowLayer;\n if (_e64 != 0i) {\n let _e66 = vLightPosition_1;\n let _e69 = vLightPosition_1[3u];\n p_1 = (_e66.xyz / vec3(_e69));\n let _e72 = p_1;\n uv = ((_e72.xy * 0.5f) + vec2(0.5f));\n let _e77 = uv;\n let _e80 = vec3<f32>(_e77.x, _e77.y, 0f);\n let _e86 = textureSampleLevel(uPreviousShadowMap_t, uPreviousShadowMap_s, vec2<f32>(_e80.x, _e80.y), i32(_e80.z), 0f);\n previousDepth = _e86.x;\n let _e89 = gl_FragCoord_1[2u];\n let _e90 = previousDepth;\n if (_e89 <= (_e90 + 0.00001f)) {\n discard;\n }\n }\n let _e94 = vAlphaCutout_1[1u];\n if (_e94 > 0.5f) {\n let _e96 = alpha_2;\n param_2 = _e96;\n let _e98 = vAlphaCutout_1[0u];\n param_3 = _e98;\n let _e99 = cutoutShare_u0028_f1_u003b_f1_u003b((&param_2), (&param_3));\n param_4 = _e99;\n let _e100 = gl_FragCoord_1;\n param_5 = _e100.xy;\n param_6 = 0f;\n let _e102 = cutoutKeeps_u0028_f1_u003b_vf2_u003b_f1_u003b((&param_4), (&param_5), (&param_6));\n if !(_e102) {\n discard;\n }\n } else {\n let _e104 = alpha_2;\n let _e106 = vAlphaCutout_1[0u];\n if (_e104 < _e106) {\n discard;\n }\n }\n return;\n}\n\n@fragment \nfn main(@location(1) vUv: vec3<f32>, @location(0) vLightPosition: vec4<f32>, @builtin(position) gl_FragCoord: vec4<f32>, @location(2) @interpolate(flat) vAlphaCutout: vec2<f32>) {\n vUv_1 = vUv;\n vLightPosition_1 = vLightPosition;\n gl_FragCoord_1 = gl_FragCoord;\n vAlphaCutout_1 = vAlphaCutout;\n main_1();\n}\n";
2
2
  export declare const DEPTH_CUTOUT_VERT_WGSL = "struct Uniforms {\n uLightViewProj: mat4x4<f32>,\n uModel: mat4x4<f32>,\n uWindDirection: vec2<f32>,\n uWindSpeed: f32,\n uWindGust: f32,\n uWindTime: f32,\n uWindSpatialPhase: vec2<f32>,\n uUvScale: vec2<f32>,\n uUvOffset: vec2<f32>,\n uAlphaCutout: vec2<f32>,\n}\n\nstruct gl_PerVertex {\n @builtin(position) gl_Position: vec4<f32>,\n gl_PointSize: f32,\n}\n\nstruct VertexOutput {\n @location(0) member: vec4<f32>,\n @builtin(position) gl_Position: vec4<f32>,\n @location(1) member_1: vec3<f32>,\n @location(2) @interpolate(flat) member_2: vec2<f32>,\n}\n\n@group(0) @binding(0) \nvar<uniform> unnamed: Uniforms;\nvar<private> aPosition_1: vec3<f32>;\nvar<private> aChannel_1: vec4<f32>;\nvar<private> vLightPosition: vec4<f32>;\nvar<private> unnamed_1: gl_PerVertex = gl_PerVertex(vec4<f32>(0f, 0f, 0f, 1f), 1f);\nvar<private> vUv: vec3<f32>;\nvar<private> aUv_1: vec3<f32>;\nvar<private> vAlphaCutout: vec2<f32>;\n\nfn channelBend_u0028_vf3_u003b_f1_u003b(worldPos: ptr<function, vec3<f32>>, sway: ptr<function, f32>) -> vec3<f32> {\n var phase: f32;\n var bend: f32;\n\n let _e28 = (*sway);\n if (_e28 <= 0f) {\n let _e30 = (*worldPos);\n return _e30;\n }\n let _e31 = (*worldPos);\n let _e34 = unnamed.uWindSpatialPhase;\n let _e37 = unnamed.uWindTime;\n phase = (dot(_e31.xz, _e34) + _e37);\n let _e40 = unnamed.uWindSpeed;\n let _e42 = unnamed.uWindGust;\n let _e44 = phase;\n let _e47 = (*sway);\n bend = (((_e40 + _e42) * sin(_e44)) * _e47);\n let _e50 = (*worldPos)[0u];\n let _e53 = unnamed.uWindDirection[0u];\n let _e54 = bend;\n let _e58 = (*worldPos)[1u];\n let _e60 = (*worldPos)[2u];\n let _e63 = unnamed.uWindDirection[1u];\n let _e64 = bend;\n return vec3<f32>((_e50 + (_e53 * _e54)), _e58, (_e60 + (_e63 * _e64)));\n}\n\nfn main_1() {\n var local: vec4<f32>;\n var model: mat4x4<f32>;\n var world: vec4<f32>;\n var bent: vec3<f32>;\n var param: vec3<f32>;\n var param_1: f32;\n\n let _e30 = aPosition_1;\n local = vec4<f32>(_e30.x, _e30.y, _e30.z, 1f);\n let _e36 = unnamed.uModel;\n model = _e36;\n let _e37 = model;\n let _e38 = local;\n world = (_e37 * _e38);\n let _e40 = world;\n param = _e40.xyz;\n let _e43 = aChannel_1[0u];\n param_1 = _e43;\n let _e44 = channelBend_u0028_vf3_u003b_f1_u003b((&param), (&param_1));\n bent = _e44;\n let _e46 = unnamed.uLightViewProj;\n let _e47 = bent;\n let _e49 = world[3u];\n vLightPosition = (_e46 * vec4<f32>(_e47.x, _e47.y, _e47.z, _e49));\n let _e55 = vLightPosition;\n unnamed_1.gl_Position = _e55;\n let _e57 = aUv_1;\n let _e60 = unnamed.uUvScale;\n let _e63 = unnamed.uUvOffset;\n let _e64 = ((_e57.xy * _e60) + _e63);\n let _e66 = aUv_1[2u];\n vUv = vec3<f32>(_e64.x, _e64.y, _e66);\n let _e71 = unnamed.uAlphaCutout;\n vAlphaCutout = _e71;\n return;\n}\n\n@vertex \nfn main(@location(0) aPosition: vec3<f32>, @location(13) aChannel: vec4<f32>, @location(5) aUv: vec3<f32>) -> VertexOutput {\n aPosition_1 = aPosition;\n aChannel_1 = aChannel;\n aUv_1 = aUv;\n main_1();\n let _e12 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e12);\n let _e14 = vLightPosition;\n let _e15 = unnamed_1.gl_Position;\n let _e16 = vUv;\n let _e17 = vAlphaCutout;\n return VertexOutput(_e14, _e15, _e16, _e17);\n}\n";
3
3
  export declare const DEPTH_FRAG_WGSL = "struct Uniforms {\n uPeelShadowLayer: i32,\n}\n\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vLightPosition_1: vec4<f32>;\n@group(0) @binding(32) \nvar uPreviousShadowMap_t: texture_2d_array<f32>;\n@group(0) @binding(33) \nvar uPreviousShadowMap_s: sampler;\nvar<private> gl_FragCoord_1: vec4<f32>;\n\nfn main_1() {\n var p: vec3<f32>;\n var uv: vec2<f32>;\n var previousDepth: f32;\n\n let _e16 = unnamed.uPeelShadowLayer;\n if (_e16 != 0i) {\n let _e18 = vLightPosition_1;\n let _e21 = vLightPosition_1[3u];\n p = (_e18.xyz / vec3(_e21));\n let _e24 = p;\n uv = ((_e24.xy * 0.5f) + vec2(0.5f));\n let _e29 = uv;\n let _e32 = vec3<f32>(_e29.x, _e29.y, 0f);\n let _e38 = textureSample(uPreviousShadowMap_t, uPreviousShadowMap_s, vec2<f32>(_e32.x, _e32.y), i32(_e32.z));\n previousDepth = _e38.x;\n let _e41 = gl_FragCoord_1[2u];\n let _e42 = previousDepth;\n if (_e41 <= (_e42 + 0.00001f)) {\n discard;\n }\n }\n return;\n}\n\n@fragment \nfn main(@location(0) vLightPosition: vec4<f32>, @builtin(position) gl_FragCoord: vec4<f32>) {\n vLightPosition_1 = vLightPosition;\n gl_FragCoord_1 = gl_FragCoord;\n main_1();\n}\n";
4
+ export declare const DEPTH_INSTANCED_ANIMATED_CUTOUT_VERT_WGSL = "struct Uniforms {\n uLightViewProj: mat4x4<f32>,\n uUvScale: vec2<f32>,\n uUvOffset: vec2<f32>,\n uAlphaCutout: vec2<f32>,\n uSceneTime: f32,\n uBoneClip: vec2<f32>,\n}\n\nstruct gl_PerVertex {\n @builtin(position) gl_Position: vec4<f32>,\n gl_PointSize: f32,\n}\n\nstruct VertexOutput {\n @location(0) member: vec4<f32>,\n @builtin(position) gl_Position: vec4<f32>,\n @location(1) member_1: vec3<f32>,\n @location(2) @interpolate(flat) member_2: vec2<f32>,\n}\n\n@group(0) @binding(16) \nvar uBonePlaces_t: texture_2d<f32>;\n@group(0) @binding(20) \nvar uInstanceClocks_t: texture_2d<f32>;\nvar<private> gl_InstanceIndex_1: i32;\n@group(0) @binding(0) \nvar<uniform> unnamed: Uniforms;\nvar<private> aGrain_1: f32;\n@group(0) @binding(18) \nvar uBoneTurns_t: texture_2d<f32>;\nvar<private> aPosition_1: vec3<f32>;\nvar<private> aInstanceModel0_1: vec4<f32>;\nvar<private> aInstanceModel1_1: vec4<f32>;\nvar<private> aInstanceModel2_1: vec4<f32>;\nvar<private> aInstanceModel3_1: vec4<f32>;\nvar<private> vLightPosition: vec4<f32>;\nvar<private> unnamed_1: gl_PerVertex = gl_PerVertex(vec4<f32>(0f, 0f, 0f, 1f), 1f);\nvar<private> vUv: vec3<f32>;\nvar<private> aUv_1: vec3<f32>;\nvar<private> vAlphaCutout: vec2<f32>;\n@group(0) @binding(17) \nvar uBonePlaces_s: sampler;\n@group(0) @binding(19) \nvar uBoneTurns_s: sampler;\n@group(0) @binding(21) \nvar uInstanceClocks_s: sampler;\n\nfn boneTurn_u0028_vf4_u003b_vf3_u003b(q: ptr<function, vec4<f32>>, v: ptr<function, vec3<f32>>) -> vec3<f32> {\n let _e38 = (*v);\n let _e39 = (*q);\n let _e41 = (*q);\n let _e43 = (*v);\n let _e46 = (*q)[3u];\n let _e47 = (*v);\n return (_e38 + (cross(_e39.xyz, (cross(_e41.xyz, _e43) + (_e47 * _e46))) * 2f));\n}\n\nfn boneAnimate_u0028_vf3_u003b_vf3_u003b_vf3_u003b(position: ptr<function, vec3<f32>>, normal: ptr<function, vec3<f32>>, tangent: ptr<function, vec3<f32>>) -> vec3<f32> {\n var size: vec2<i32>;\n var clocksWidth: i32;\n var clock: vec2<f32>;\n var moment: f32;\n var frames: f32;\n var wrapped: f32;\n var first: i32;\n var second: i32;\n var local: i32;\n var blend: f32;\n var bone: i32;\n var q0_: vec4<f32>;\n var q1_: vec4<f32>;\n var q_1: vec4<f32>;\n var place: vec3<f32>;\n var param: vec4<f32>;\n var param_1: vec3<f32>;\n var param_2: vec4<f32>;\n var param_3: vec3<f32>;\n var param_4: vec4<f32>;\n var param_5: vec3<f32>;\n\n let _e60 = textureDimensions(uBonePlaces_t, 0i);\n size = vec2<i32>(_e60);\n let _e62 = textureDimensions(uInstanceClocks_t, 0i);\n clocksWidth = vec2<i32>(_e62).x;\n let _e65 = gl_InstanceIndex_1;\n let _e66 = clocksWidth;\n let _e74 = gl_InstanceIndex_1;\n let _e75 = clocksWidth;\n let _e78 = textureLoad(uInstanceClocks_t, vec2<i32>((_e65 - (i32(floor((f32(_e65) / f32(_e66)))) * _e66)), (_e74 / _e75)), 0i);\n clock = _e78.xy;\n let _e81 = unnamed.uSceneTime;\n let _e83 = clock[1u];\n let _e86 = clock[0u];\n let _e90 = unnamed.uBoneClip[0u];\n moment = (((_e81 * _e83) + _e86) * _e90);\n let _e93 = size[1u];\n frames = f32(_e93);\n let _e95 = moment;\n let _e96 = frames;\n let _e97 = moment;\n let _e98 = frames;\n wrapped = (_e95 - (_e96 * floor((_e97 / _e98))));\n let _e103 = wrapped;\n let _e107 = size[1u];\n first = min(i32(floor(_e103)), (_e107 - 1i));\n let _e110 = first;\n let _e113 = size[1u];\n if ((_e110 + 1i) == _e113) {\n local = 0i;\n } else {\n let _e115 = first;\n local = (_e115 + 1i);\n }\n let _e117 = local;\n second = _e117;\n let _e118 = wrapped;\n let _e119 = first;\n blend = clamp((_e118 - f32(_e119)), 0f, 1f);\n let _e123 = aGrain_1;\n let _e127 = unnamed.uBoneClip[1u];\n let _e133 = size[0u];\n bone = clamp(i32(floor((((-1f - _e123) * _e127) + 0.5f))), 0i, (_e133 - 1i));\n let _e136 = bone;\n let _e137 = first;\n let _e139 = textureLoad(uBoneTurns_t, vec2<i32>(_e136, _e137), 0i);\n q0_ = _e139;\n let _e140 = bone;\n let _e141 = second;\n let _e143 = textureLoad(uBoneTurns_t, vec2<i32>(_e140, _e141), 0i);\n q1_ = _e143;\n let _e144 = q0_;\n let _e145 = q1_;\n if (dot(_e144, _e145) < 0f) {\n let _e148 = q1_;\n q1_ = -(_e148);\n }\n let _e150 = q0_;\n let _e151 = q1_;\n let _e152 = blend;\n q_1 = normalize(mix(_e150, _e151, vec4(_e152)));\n let _e156 = bone;\n let _e157 = first;\n let _e159 = textureLoad(uBonePlaces_t, vec2<i32>(_e156, _e157), 0i);\n let _e161 = bone;\n let _e162 = second;\n let _e164 = textureLoad(uBonePlaces_t, vec2<i32>(_e161, _e162), 0i);\n let _e166 = blend;\n place = mix(_e159.xyz, _e164.xyz, vec3(_e166));\n let _e169 = q_1;\n param = _e169;\n let _e170 = (*normal);\n param_1 = _e170;\n let _e171 = boneTurn_u0028_vf4_u003b_vf3_u003b((&param), (&param_1));\n (*normal) = _e171;\n let _e172 = q_1;\n param_2 = _e172;\n let _e173 = (*tangent);\n param_3 = _e173;\n let _e174 = boneTurn_u0028_vf4_u003b_vf3_u003b((&param_2), (&param_3));\n (*tangent) = _e174;\n let _e175 = q_1;\n param_4 = _e175;\n let _e176 = (*position);\n param_5 = _e176;\n let _e177 = boneTurn_u0028_vf4_u003b_vf3_u003b((&param_4), (&param_5));\n let _e178 = place;\n return (_e177 + _e178);\n}\n\nfn main_1() {\n var local_1: vec4<f32>;\n var animatedNormal: vec3<f32>;\n var animatedTangent: vec3<f32>;\n var param_6: vec3<f32>;\n var param_7: vec3<f32>;\n var param_8: vec3<f32>;\n var model: mat4x4<f32>;\n var instanceCell: vec4<f32>;\n var world: vec4<f32>;\n var bent: vec3<f32>;\n\n let _e46 = aPosition_1;\n local_1 = vec4<f32>(_e46.x, _e46.y, _e46.z, 1f);\n animatedNormal = vec3<f32>(0f, 1f, 0f);\n animatedTangent = vec3<f32>(1f, 0f, 0f);\n let _e51 = local_1;\n param_6 = _e51.xyz;\n let _e53 = animatedNormal;\n param_7 = _e53;\n let _e54 = animatedTangent;\n param_8 = _e54;\n let _e55 = boneAnimate_u0028_vf3_u003b_vf3_u003b_vf3_u003b((&param_6), (&param_7), (&param_8));\n let _e56 = param_7;\n animatedNormal = _e56;\n let _e57 = param_8;\n animatedTangent = _e57;\n local_1 = vec4<f32>(_e55.x, _e55.y, _e55.z, 1f);\n let _e62 = aInstanceModel0_1;\n let _e63 = aInstanceModel1_1;\n let _e64 = aInstanceModel2_1;\n let _e65 = aInstanceModel3_1;\n model = mat4x4<f32>(vec4<f32>(_e62.x, _e62.y, _e62.z, _e62.w), vec4<f32>(_e63.x, _e63.y, _e63.z, _e63.w), vec4<f32>(_e64.x, _e64.y, _e64.z, _e64.w), vec4<f32>(_e65.x, _e65.y, _e65.z, _e65.w));\n let _e89 = model[0][3u];\n let _e92 = model[1][3u];\n let _e95 = model[2][3u];\n let _e98 = model[3][3u];\n instanceCell = vec4<f32>(_e89, _e92, _e95, _e98);\n model[0][3u] = 0f;\n model[1][3u] = 0f;\n model[2][3u] = 0f;\n model[3][3u] = 1f;\n let _e108 = model;\n let _e109 = local_1;\n world = (_e108 * _e109);\n let _e111 = world;\n bent = _e111.xyz;\n let _e114 = unnamed.uLightViewProj;\n let _e115 = bent;\n let _e117 = world[3u];\n vLightPosition = (_e114 * vec4<f32>(_e115.x, _e115.y, _e115.z, _e117));\n let _e123 = vLightPosition;\n unnamed_1.gl_Position = _e123;\n let _e125 = aUv_1;\n let _e127 = instanceCell;\n let _e130 = instanceCell;\n let _e134 = unnamed.uUvScale;\n let _e137 = unnamed.uUvOffset;\n let _e138 = ((((_e125.xy * _e127.xy) + _e130.zw) * _e134) + _e137);\n let _e140 = aUv_1[2u];\n vUv = vec3<f32>(_e138.x, _e138.y, _e140);\n let _e145 = unnamed.uAlphaCutout;\n vAlphaCutout = _e145;\n return;\n}\n\n@vertex \nfn main(@builtin(instance_index) gl_InstanceIndex: u32, @location(8) aGrain: f32, @location(0) aPosition: vec3<f32>, @location(11) aInstanceModel0_: vec4<f32>, @location(12) aInstanceModel1_: vec4<f32>, @location(13) aInstanceModel2_: vec4<f32>, @location(14) aInstanceModel3_: vec4<f32>, @location(5) aUv: vec3<f32>) -> VertexOutput {\n gl_InstanceIndex_1 = i32(gl_InstanceIndex);\n aGrain_1 = aGrain;\n aPosition_1 = aPosition;\n aInstanceModel0_1 = aInstanceModel0_;\n aInstanceModel1_1 = aInstanceModel1_;\n aInstanceModel2_1 = aInstanceModel2_;\n aInstanceModel3_1 = aInstanceModel3_;\n aUv_1 = aUv;\n main_1();\n let _e23 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e23);\n let _e25 = vLightPosition;\n let _e26 = unnamed_1.gl_Position;\n let _e27 = vUv;\n let _e28 = vAlphaCutout;\n return VertexOutput(_e25, _e26, _e27, _e28);\n}\n";
5
+ export declare const DEPTH_INSTANCED_ANIMATED_VERT_WGSL = "struct Uniforms {\n uLightViewProj: mat4x4<f32>,\n uSceneTime: f32,\n uBoneClip: vec2<f32>,\n}\n\nstruct gl_PerVertex {\n @builtin(position) gl_Position: vec4<f32>,\n gl_PointSize: f32,\n}\n\nstruct VertexOutput {\n @location(0) member: vec4<f32>,\n @builtin(position) gl_Position: vec4<f32>,\n}\n\n@group(0) @binding(16) \nvar uBonePlaces_t: texture_2d<f32>;\n@group(0) @binding(20) \nvar uInstanceClocks_t: texture_2d<f32>;\nvar<private> gl_InstanceIndex_1: i32;\n@group(0) @binding(0) \nvar<uniform> unnamed: Uniforms;\nvar<private> aGrain_1: f32;\n@group(0) @binding(18) \nvar uBoneTurns_t: texture_2d<f32>;\nvar<private> aPosition_1: vec3<f32>;\nvar<private> aInstanceModel0_1: vec4<f32>;\nvar<private> aInstanceModel1_1: vec4<f32>;\nvar<private> aInstanceModel2_1: vec4<f32>;\nvar<private> aInstanceModel3_1: vec4<f32>;\nvar<private> vLightPosition: vec4<f32>;\nvar<private> unnamed_1: gl_PerVertex = gl_PerVertex(vec4<f32>(0f, 0f, 0f, 1f), 1f);\n@group(0) @binding(17) \nvar uBonePlaces_s: sampler;\n@group(0) @binding(19) \nvar uBoneTurns_s: sampler;\n@group(0) @binding(21) \nvar uInstanceClocks_s: sampler;\n\nfn boneTurn_u0028_vf4_u003b_vf3_u003b(q: ptr<function, vec4<f32>>, v: ptr<function, vec3<f32>>) -> vec3<f32> {\n let _e32 = (*v);\n let _e33 = (*q);\n let _e35 = (*q);\n let _e37 = (*v);\n let _e40 = (*q)[3u];\n let _e41 = (*v);\n return (_e32 + (cross(_e33.xyz, (cross(_e35.xyz, _e37) + (_e41 * _e40))) * 2f));\n}\n\nfn boneAnimate_u0028_vf3_u003b_vf3_u003b_vf3_u003b(position: ptr<function, vec3<f32>>, normal: ptr<function, vec3<f32>>, tangent: ptr<function, vec3<f32>>) -> vec3<f32> {\n var size: vec2<i32>;\n var clocksWidth: i32;\n var clock: vec2<f32>;\n var moment: f32;\n var frames: f32;\n var wrapped: f32;\n var first: i32;\n var second: i32;\n var local: i32;\n var blend: f32;\n var bone: i32;\n var q0_: vec4<f32>;\n var q1_: vec4<f32>;\n var q_1: vec4<f32>;\n var place: vec3<f32>;\n var param: vec4<f32>;\n var param_1: vec3<f32>;\n var param_2: vec4<f32>;\n var param_3: vec3<f32>;\n var param_4: vec4<f32>;\n var param_5: vec3<f32>;\n\n let _e54 = textureDimensions(uBonePlaces_t, 0i);\n size = vec2<i32>(_e54);\n let _e56 = textureDimensions(uInstanceClocks_t, 0i);\n clocksWidth = vec2<i32>(_e56).x;\n let _e59 = gl_InstanceIndex_1;\n let _e60 = clocksWidth;\n let _e68 = gl_InstanceIndex_1;\n let _e69 = clocksWidth;\n let _e72 = textureLoad(uInstanceClocks_t, vec2<i32>((_e59 - (i32(floor((f32(_e59) / f32(_e60)))) * _e60)), (_e68 / _e69)), 0i);\n clock = _e72.xy;\n let _e75 = unnamed.uSceneTime;\n let _e77 = clock[1u];\n let _e80 = clock[0u];\n let _e84 = unnamed.uBoneClip[0u];\n moment = (((_e75 * _e77) + _e80) * _e84);\n let _e87 = size[1u];\n frames = f32(_e87);\n let _e89 = moment;\n let _e90 = frames;\n let _e91 = moment;\n let _e92 = frames;\n wrapped = (_e89 - (_e90 * floor((_e91 / _e92))));\n let _e97 = wrapped;\n let _e101 = size[1u];\n first = min(i32(floor(_e97)), (_e101 - 1i));\n let _e104 = first;\n let _e107 = size[1u];\n if ((_e104 + 1i) == _e107) {\n local = 0i;\n } else {\n let _e109 = first;\n local = (_e109 + 1i);\n }\n let _e111 = local;\n second = _e111;\n let _e112 = wrapped;\n let _e113 = first;\n blend = clamp((_e112 - f32(_e113)), 0f, 1f);\n let _e117 = aGrain_1;\n let _e121 = unnamed.uBoneClip[1u];\n let _e127 = size[0u];\n bone = clamp(i32(floor((((-1f - _e117) * _e121) + 0.5f))), 0i, (_e127 - 1i));\n let _e130 = bone;\n let _e131 = first;\n let _e133 = textureLoad(uBoneTurns_t, vec2<i32>(_e130, _e131), 0i);\n q0_ = _e133;\n let _e134 = bone;\n let _e135 = second;\n let _e137 = textureLoad(uBoneTurns_t, vec2<i32>(_e134, _e135), 0i);\n q1_ = _e137;\n let _e138 = q0_;\n let _e139 = q1_;\n if (dot(_e138, _e139) < 0f) {\n let _e142 = q1_;\n q1_ = -(_e142);\n }\n let _e144 = q0_;\n let _e145 = q1_;\n let _e146 = blend;\n q_1 = normalize(mix(_e144, _e145, vec4(_e146)));\n let _e150 = bone;\n let _e151 = first;\n let _e153 = textureLoad(uBonePlaces_t, vec2<i32>(_e150, _e151), 0i);\n let _e155 = bone;\n let _e156 = second;\n let _e158 = textureLoad(uBonePlaces_t, vec2<i32>(_e155, _e156), 0i);\n let _e160 = blend;\n place = mix(_e153.xyz, _e158.xyz, vec3(_e160));\n let _e163 = q_1;\n param = _e163;\n let _e164 = (*normal);\n param_1 = _e164;\n let _e165 = boneTurn_u0028_vf4_u003b_vf3_u003b((&param), (&param_1));\n (*normal) = _e165;\n let _e166 = q_1;\n param_2 = _e166;\n let _e167 = (*tangent);\n param_3 = _e167;\n let _e168 = boneTurn_u0028_vf4_u003b_vf3_u003b((&param_2), (&param_3));\n (*tangent) = _e168;\n let _e169 = q_1;\n param_4 = _e169;\n let _e170 = (*position);\n param_5 = _e170;\n let _e171 = boneTurn_u0028_vf4_u003b_vf3_u003b((&param_4), (&param_5));\n let _e172 = place;\n return (_e171 + _e172);\n}\n\nfn main_1() {\n var local_1: vec4<f32>;\n var animatedNormal: vec3<f32>;\n var animatedTangent: vec3<f32>;\n var param_6: vec3<f32>;\n var param_7: vec3<f32>;\n var param_8: vec3<f32>;\n var model: mat4x4<f32>;\n var instanceCell: vec4<f32>;\n var world: vec4<f32>;\n var bent: vec3<f32>;\n\n let _e40 = aPosition_1;\n local_1 = vec4<f32>(_e40.x, _e40.y, _e40.z, 1f);\n animatedNormal = vec3<f32>(0f, 1f, 0f);\n animatedTangent = vec3<f32>(1f, 0f, 0f);\n let _e45 = local_1;\n param_6 = _e45.xyz;\n let _e47 = animatedNormal;\n param_7 = _e47;\n let _e48 = animatedTangent;\n param_8 = _e48;\n let _e49 = boneAnimate_u0028_vf3_u003b_vf3_u003b_vf3_u003b((&param_6), (&param_7), (&param_8));\n let _e50 = param_7;\n animatedNormal = _e50;\n let _e51 = param_8;\n animatedTangent = _e51;\n local_1 = vec4<f32>(_e49.x, _e49.y, _e49.z, 1f);\n let _e56 = aInstanceModel0_1;\n let _e57 = aInstanceModel1_1;\n let _e58 = aInstanceModel2_1;\n let _e59 = aInstanceModel3_1;\n model = mat4x4<f32>(vec4<f32>(_e56.x, _e56.y, _e56.z, _e56.w), vec4<f32>(_e57.x, _e57.y, _e57.z, _e57.w), vec4<f32>(_e58.x, _e58.y, _e58.z, _e58.w), vec4<f32>(_e59.x, _e59.y, _e59.z, _e59.w));\n let _e83 = model[0][3u];\n let _e86 = model[1][3u];\n let _e89 = model[2][3u];\n let _e92 = model[3][3u];\n instanceCell = vec4<f32>(_e83, _e86, _e89, _e92);\n model[0][3u] = 0f;\n model[1][3u] = 0f;\n model[2][3u] = 0f;\n model[3][3u] = 1f;\n let _e102 = model;\n let _e103 = local_1;\n world = (_e102 * _e103);\n let _e105 = world;\n bent = _e105.xyz;\n let _e108 = unnamed.uLightViewProj;\n let _e109 = bent;\n let _e111 = world[3u];\n vLightPosition = (_e108 * vec4<f32>(_e109.x, _e109.y, _e109.z, _e111));\n let _e117 = vLightPosition;\n unnamed_1.gl_Position = _e117;\n return;\n}\n\n@vertex \nfn main(@builtin(instance_index) gl_InstanceIndex: u32, @location(8) aGrain: f32, @location(0) aPosition: vec3<f32>, @location(11) aInstanceModel0_: vec4<f32>, @location(12) aInstanceModel1_: vec4<f32>, @location(13) aInstanceModel2_: vec4<f32>, @location(14) aInstanceModel3_: vec4<f32>) -> VertexOutput {\n gl_InstanceIndex_1 = i32(gl_InstanceIndex);\n aGrain_1 = aGrain;\n aPosition_1 = aPosition;\n aInstanceModel0_1 = aInstanceModel0_;\n aInstanceModel1_1 = aInstanceModel1_;\n aInstanceModel2_1 = aInstanceModel2_;\n aInstanceModel3_1 = aInstanceModel3_;\n main_1();\n let _e19 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e19);\n let _e21 = vLightPosition;\n let _e22 = unnamed_1.gl_Position;\n return VertexOutput(_e21, _e22);\n}\n";
4
6
  export declare const DEPTH_INSTANCED_CUTOUT_VERT_WGSL = "struct Uniforms {\n uLightViewProj: mat4x4<f32>,\n uUvScale: vec2<f32>,\n uUvOffset: vec2<f32>,\n uAlphaCutout: vec2<f32>,\n}\n\nstruct gl_PerVertex {\n @builtin(position) gl_Position: vec4<f32>,\n gl_PointSize: f32,\n}\n\nstruct VertexOutput {\n @location(0) member: vec4<f32>,\n @builtin(position) gl_Position: vec4<f32>,\n @location(1) member_1: vec3<f32>,\n @location(2) @interpolate(flat) member_2: vec2<f32>,\n}\n\nvar<private> aPosition_1: vec3<f32>;\nvar<private> aInstanceModel0_1: vec4<f32>;\nvar<private> aInstanceModel1_1: vec4<f32>;\nvar<private> aInstanceModel2_1: vec4<f32>;\nvar<private> aInstanceModel3_1: vec4<f32>;\nvar<private> vLightPosition: vec4<f32>;\n@group(0) @binding(0) \nvar<uniform> unnamed: Uniforms;\nvar<private> unnamed_1: gl_PerVertex = gl_PerVertex(vec4<f32>(0f, 0f, 0f, 1f), 1f);\nvar<private> vUv: vec3<f32>;\nvar<private> aUv_1: vec3<f32>;\nvar<private> vAlphaCutout: vec2<f32>;\n\nfn main_1() {\n var local: vec4<f32>;\n var model: mat4x4<f32>;\n var instanceCell: vec4<f32>;\n var world: vec4<f32>;\n var bent: vec3<f32>;\n\n let _e24 = aPosition_1;\n local = vec4<f32>(_e24.x, _e24.y, _e24.z, 1f);\n let _e29 = aInstanceModel0_1;\n let _e30 = aInstanceModel1_1;\n let _e31 = aInstanceModel2_1;\n let _e32 = aInstanceModel3_1;\n model = mat4x4<f32>(vec4<f32>(_e29.x, _e29.y, _e29.z, _e29.w), vec4<f32>(_e30.x, _e30.y, _e30.z, _e30.w), vec4<f32>(_e31.x, _e31.y, _e31.z, _e31.w), vec4<f32>(_e32.x, _e32.y, _e32.z, _e32.w));\n let _e56 = model[0][3u];\n let _e59 = model[1][3u];\n let _e62 = model[2][3u];\n let _e65 = model[3][3u];\n instanceCell = vec4<f32>(_e56, _e59, _e62, _e65);\n model[0][3u] = 0f;\n model[1][3u] = 0f;\n model[2][3u] = 0f;\n model[3][3u] = 1f;\n let _e75 = model;\n let _e76 = local;\n world = (_e75 * _e76);\n let _e78 = world;\n bent = _e78.xyz;\n let _e81 = unnamed.uLightViewProj;\n let _e82 = bent;\n let _e84 = world[3u];\n vLightPosition = (_e81 * vec4<f32>(_e82.x, _e82.y, _e82.z, _e84));\n let _e90 = vLightPosition;\n unnamed_1.gl_Position = _e90;\n let _e92 = aUv_1;\n let _e94 = instanceCell;\n let _e97 = instanceCell;\n let _e101 = unnamed.uUvScale;\n let _e104 = unnamed.uUvOffset;\n let _e105 = ((((_e92.xy * _e94.xy) + _e97.zw) * _e101) + _e104);\n let _e107 = aUv_1[2u];\n vUv = vec3<f32>(_e105.x, _e105.y, _e107);\n let _e112 = unnamed.uAlphaCutout;\n vAlphaCutout = _e112;\n return;\n}\n\n@vertex \nfn main(@location(0) aPosition: vec3<f32>, @location(11) aInstanceModel0_: vec4<f32>, @location(12) aInstanceModel1_: vec4<f32>, @location(13) aInstanceModel2_: vec4<f32>, @location(14) aInstanceModel3_: vec4<f32>, @location(5) aUv: vec3<f32>) -> VertexOutput {\n aPosition_1 = aPosition;\n aInstanceModel0_1 = aInstanceModel0_;\n aInstanceModel1_1 = aInstanceModel1_;\n aInstanceModel2_1 = aInstanceModel2_;\n aInstanceModel3_1 = aInstanceModel3_;\n aUv_1 = aUv;\n main_1();\n let _e18 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e18);\n let _e20 = vLightPosition;\n let _e21 = unnamed_1.gl_Position;\n let _e22 = vUv;\n let _e23 = vAlphaCutout;\n return VertexOutput(_e20, _e21, _e22, _e23);\n}\n";
5
7
  export declare const DEPTH_INSTANCED_VERT_WGSL = "struct Uniforms {\n uLightViewProj: mat4x4<f32>,\n}\n\nstruct gl_PerVertex {\n @builtin(position) gl_Position: vec4<f32>,\n gl_PointSize: f32,\n}\n\nstruct VertexOutput {\n @location(0) member: vec4<f32>,\n @builtin(position) gl_Position: vec4<f32>,\n}\n\nvar<private> aPosition_1: vec3<f32>;\nvar<private> aInstanceModel0_1: vec4<f32>;\nvar<private> aInstanceModel1_1: vec4<f32>;\nvar<private> aInstanceModel2_1: vec4<f32>;\nvar<private> aInstanceModel3_1: vec4<f32>;\nvar<private> vLightPosition: vec4<f32>;\n@group(0) @binding(0) \nvar<uniform> unnamed: Uniforms;\nvar<private> unnamed_1: gl_PerVertex = gl_PerVertex(vec4<f32>(0f, 0f, 0f, 1f), 1f);\n\nfn main_1() {\n var local: vec4<f32>;\n var model: mat4x4<f32>;\n var instanceCell: vec4<f32>;\n var world: vec4<f32>;\n var bent: vec3<f32>;\n\n let _e20 = aPosition_1;\n local = vec4<f32>(_e20.x, _e20.y, _e20.z, 1f);\n let _e25 = aInstanceModel0_1;\n let _e26 = aInstanceModel1_1;\n let _e27 = aInstanceModel2_1;\n let _e28 = aInstanceModel3_1;\n model = mat4x4<f32>(vec4<f32>(_e25.x, _e25.y, _e25.z, _e25.w), vec4<f32>(_e26.x, _e26.y, _e26.z, _e26.w), vec4<f32>(_e27.x, _e27.y, _e27.z, _e27.w), vec4<f32>(_e28.x, _e28.y, _e28.z, _e28.w));\n let _e52 = model[0][3u];\n let _e55 = model[1][3u];\n let _e58 = model[2][3u];\n let _e61 = model[3][3u];\n instanceCell = vec4<f32>(_e52, _e55, _e58, _e61);\n model[0][3u] = 0f;\n model[1][3u] = 0f;\n model[2][3u] = 0f;\n model[3][3u] = 1f;\n let _e71 = model;\n let _e72 = local;\n world = (_e71 * _e72);\n let _e74 = world;\n bent = _e74.xyz;\n let _e77 = unnamed.uLightViewProj;\n let _e78 = bent;\n let _e80 = world[3u];\n vLightPosition = (_e77 * vec4<f32>(_e78.x, _e78.y, _e78.z, _e80));\n let _e86 = vLightPosition;\n unnamed_1.gl_Position = _e86;\n return;\n}\n\n@vertex \nfn main(@location(0) aPosition: vec3<f32>, @location(11) aInstanceModel0_: vec4<f32>, @location(12) aInstanceModel1_: vec4<f32>, @location(13) aInstanceModel2_: vec4<f32>, @location(14) aInstanceModel3_: vec4<f32>) -> VertexOutput {\n aPosition_1 = aPosition;\n aInstanceModel0_1 = aInstanceModel0_;\n aInstanceModel1_1 = aInstanceModel1_;\n aInstanceModel2_1 = aInstanceModel2_;\n aInstanceModel3_1 = aInstanceModel3_;\n main_1();\n let _e14 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e14);\n let _e16 = vLightPosition;\n let _e17 = unnamed_1.gl_Position;\n return VertexOutput(_e16, _e17);\n}\n";
6
8
  export declare const DEPTH_SKINNED_VERT_WGSL = "struct Uniforms {\n uLightViewProj: mat4x4<f32>,\n uModel: mat4x4<f32>,\n uWindDirection: vec2<f32>,\n uWindSpeed: f32,\n uWindGust: f32,\n uWindTime: f32,\n uWindSpatialPhase: vec2<f32>,\n}\n\nstruct gl_PerVertex {\n @builtin(position) gl_Position: vec4<f32>,\n gl_PointSize: f32,\n}\n\nstruct VertexOutput {\n @location(0) member: vec4<f32>,\n @builtin(position) gl_Position: vec4<f32>,\n}\n\n@id(0) override SKIN_EIGHT: bool = false;\n@id(1) override CLOTH_BOUND: bool = false;\n\n@group(0) @binding(16) \nvar uJointPalette_t: texture_2d<f32>;\nvar<private> aJoints_1: vec4<f32>;\nvar<private> aWeights_1: vec4<f32>;\nvar<private> aJoints2_1: vec4<f32>;\nvar<private> aWeights2_1: vec4<f32>;\n@group(0) @binding(18) \nvar uClothBinding_t: texture_2d<f32>;\n@group(0) @binding(20) \nvar uClothParticles_t: texture_2d<f32>;\n@group(0) @binding(22) \nvar uClothRest_t: texture_2d<f32>;\nvar<private> gl_VertexIndex_1: i32;\n@group(0) @binding(0) \nvar<uniform> unnamed: Uniforms;\nvar<private> aPosition_1: vec3<f32>;\nvar<private> aChannel_1: vec4<f32>;\nvar<private> vLightPosition: vec4<f32>;\nvar<private> unnamed_1: gl_PerVertex = gl_PerVertex(vec4<f32>(0f, 0f, 0f, 1f), 1f);\n@group(0) @binding(17) \nvar uJointPalette_s: sampler;\n@group(0) @binding(19) \nvar uClothBinding_s: sampler;\n@group(0) @binding(21) \nvar uClothParticles_s: sampler;\n@group(0) @binding(23) \nvar uClothRest_s: sampler;\n\nfn clothFrame_u0028_vf3_u003b_vf3_u003b_vf3_u003b(a: ptr<function, vec3<f32>>, b: ptr<function, vec3<f32>>, c: ptr<function, vec3<f32>>) -> mat3x3<f32> {\n var edge: vec3<f32>;\n var n: vec3<f32>;\n var t: vec3<f32>;\n\n let _e43 = (*b);\n let _e44 = (*a);\n edge = (_e43 - _e44);\n let _e46 = edge;\n let _e47 = (*c);\n let _e48 = (*a);\n n = normalize(cross(_e46, (_e47 - _e48)));\n let _e52 = edge;\n t = normalize(_e52);\n let _e54 = t;\n let _e55 = n;\n let _e56 = t;\n let _e57 = cross(_e55, _e56);\n let _e58 = n;\n return mat3x3<f32>(vec3<f32>(_e54.x, _e54.y, _e54.z), vec3<f32>(_e57.x, _e57.y, _e57.z), vec3<f32>(_e58.x, _e58.y, _e58.z));\n}\n\nfn clothTexel_u0028_i1_u003b_i1_u003b(i: ptr<function, i32>, width: ptr<function, i32>) -> vec2<i32> {\n let _e39 = (*i);\n let _e40 = (*width);\n let _e48 = (*i);\n let _e49 = (*width);\n return vec2<i32>((_e39 - (i32(floor((f32(_e39) / f32(_e40)))) * _e40)), (_e48 / _e49));\n}\n\nfn clothPlace_u0028_vf3_u003b_mf33_u003b(position: ptr<function, vec3<f32>>, turn: ptr<function, mat3x3<f32>>) -> f32 {\n var bindingWidth: i32;\n var particleWidth: i32;\n var restWidth: i32;\n var indices: vec4<f32>;\n var param: i32;\n var param_1: i32;\n var at: vec4<f32>;\n var param_2: i32;\n var param_3: i32;\n var a_1: i32;\n var b_1: i32;\n var c_1: i32;\n var pa: vec3<f32>;\n var param_4: i32;\n var param_5: i32;\n var pb: vec3<f32>;\n var param_6: i32;\n var param_7: i32;\n var pc: vec3<f32>;\n var param_8: i32;\n var param_9: i32;\n var now: mat3x3<f32>;\n var param_10: vec3<f32>;\n var param_11: vec3<f32>;\n var param_12: vec3<f32>;\n var rest: mat3x3<f32>;\n var param_13: i32;\n var param_14: i32;\n var param_15: i32;\n var param_16: i32;\n var param_17: i32;\n var param_18: i32;\n var param_19: vec3<f32>;\n var param_20: vec3<f32>;\n var param_21: vec3<f32>;\n\n let _e74 = textureDimensions(uClothBinding_t, 0i);\n bindingWidth = vec2<i32>(_e74).x;\n let _e77 = textureDimensions(uClothParticles_t, 0i);\n particleWidth = vec2<i32>(_e77).x;\n let _e80 = textureDimensions(uClothRest_t, 0i);\n restWidth = vec2<i32>(_e80).x;\n let _e83 = gl_VertexIndex_1;\n param = (_e83 * 2i);\n let _e85 = bindingWidth;\n param_1 = _e85;\n let _e86 = clothTexel_u0028_i1_u003b_i1_u003b((&param), (&param_1));\n let _e87 = textureLoad(uClothBinding_t, _e86, 0i);\n indices = _e87;\n let _e88 = gl_VertexIndex_1;\n param_2 = ((_e88 * 2i) + 1i);\n let _e91 = bindingWidth;\n param_3 = _e91;\n let _e92 = clothTexel_u0028_i1_u003b_i1_u003b((&param_2), (&param_3));\n let _e93 = textureLoad(uClothBinding_t, _e92, 0i);\n at = _e93;\n let _e95 = indices[0u];\n a_1 = i32(_e95);\n let _e98 = indices[1u];\n b_1 = i32(_e98);\n let _e101 = indices[2u];\n c_1 = i32(_e101);\n let _e103 = a_1;\n param_4 = _e103;\n let _e104 = particleWidth;\n param_5 = _e104;\n let _e105 = clothTexel_u0028_i1_u003b_i1_u003b((&param_4), (&param_5));\n let _e106 = textureLoad(uClothParticles_t, _e105, 0i);\n pa = _e106.xyz;\n let _e108 = a_1;\n let _e109 = b_1;\n let _e111 = b_1;\n let _e112 = c_1;\n if ((_e108 == _e109) && (_e111 == _e112)) {\n let _e115 = pa;\n (*position) = _e115;\n (*turn) = mat3x3<f32>(vec3<f32>(1f, 0f, 0f), vec3<f32>(0f, 1f, 0f), vec3<f32>(0f, 0f, 1f));\n let _e117 = indices[3u];\n return _e117;\n }\n let _e118 = b_1;\n param_6 = _e118;\n let _e119 = particleWidth;\n param_7 = _e119;\n let _e120 = clothTexel_u0028_i1_u003b_i1_u003b((&param_6), (&param_7));\n let _e121 = textureLoad(uClothParticles_t, _e120, 0i);\n pb = _e121.xyz;\n let _e123 = c_1;\n param_8 = _e123;\n let _e124 = particleWidth;\n param_9 = _e124;\n let _e125 = clothTexel_u0028_i1_u003b_i1_u003b((&param_8), (&param_9));\n let _e126 = textureLoad(uClothParticles_t, _e125, 0i);\n pc = _e126.xyz;\n let _e128 = pa;\n param_10 = _e128;\n let _e129 = pb;\n param_11 = _e129;\n let _e130 = pc;\n param_12 = _e130;\n let _e131 = clothFrame_u0028_vf3_u003b_vf3_u003b_vf3_u003b((&param_10), (&param_11), (&param_12));\n now = _e131;\n let _e132 = a_1;\n param_13 = _e132;\n let _e133 = restWidth;\n param_14 = _e133;\n let _e134 = clothTexel_u0028_i1_u003b_i1_u003b((&param_13), (&param_14));\n let _e135 = textureLoad(uClothRest_t, _e134, 0i);\n let _e136 = b_1;\n param_15 = _e136;\n let _e137 = restWidth;\n param_16 = _e137;\n let _e138 = clothTexel_u0028_i1_u003b_i1_u003b((&param_15), (&param_16));\n let _e139 = textureLoad(uClothRest_t, _e138, 0i);\n let _e140 = c_1;\n param_17 = _e140;\n let _e141 = restWidth;\n param_18 = _e141;\n let _e142 = clothTexel_u0028_i1_u003b_i1_u003b((&param_17), (&param_18));\n let _e143 = textureLoad(uClothRest_t, _e142, 0i);\n param_19 = _e135.xyz;\n param_20 = _e139.xyz;\n param_21 = _e143.xyz;\n let _e147 = clothFrame_u0028_vf3_u003b_vf3_u003b_vf3_u003b((&param_19), (&param_20), (&param_21));\n rest = _e147;\n let _e148 = pa;\n let _e150 = at[0u];\n let _e153 = at[1u];\n let _e156 = pb;\n let _e158 = at[0u];\n let _e161 = pc;\n let _e163 = at[1u];\n let _e167 = now[2];\n let _e169 = at[2u];\n (*position) = ((((_e148 * ((1f - _e150) - _e153)) + (_e156 * _e158)) + (_e161 * _e163)) + (_e167 * _e169));\n let _e172 = now;\n let _e173 = rest;\n (*turn) = (_e172 * transpose(_e173));\n let _e177 = indices[3u];\n return _e177;\n}\n\nfn channelBend_u0028_vf3_u003b_f1_u003b(worldPos: ptr<function, vec3<f32>>, sway: ptr<function, f32>) -> vec3<f32> {\n var phase: f32;\n var bend: f32;\n\n let _e41 = (*sway);\n if (_e41 <= 0f) {\n let _e43 = (*worldPos);\n return _e43;\n }\n let _e44 = (*worldPos);\n let _e47 = unnamed.uWindSpatialPhase;\n let _e50 = unnamed.uWindTime;\n phase = (dot(_e44.xz, _e47) + _e50);\n let _e53 = unnamed.uWindSpeed;\n let _e55 = unnamed.uWindGust;\n let _e57 = phase;\n let _e60 = (*sway);\n bend = (((_e53 + _e55) * sin(_e57)) * _e60);\n let _e63 = (*worldPos)[0u];\n let _e66 = unnamed.uWindDirection[0u];\n let _e67 = bend;\n let _e71 = (*worldPos)[1u];\n let _e73 = (*worldPos)[2u];\n let _e76 = unnamed.uWindDirection[1u];\n let _e77 = bend;\n return vec3<f32>((_e63 + (_e66 * _e67)), _e71, (_e73 + (_e76 * _e77)));\n}\n\nfn jointMatrix_u0028_i1_u003b(index: ptr<function, i32>) -> mat4x4<f32> {\n var x: i32;\n\n let _e39 = (*index);\n x = (_e39 * 4i);\n let _e41 = x;\n let _e43 = textureLoad(uJointPalette_t, vec2<i32>(_e41, 0i), 0i);\n let _e44 = x;\n let _e47 = textureLoad(uJointPalette_t, vec2<i32>((_e44 + 1i), 0i), 0i);\n let _e48 = x;\n let _e51 = textureLoad(uJointPalette_t, vec2<i32>((_e48 + 2i), 0i), 0i);\n let _e52 = x;\n let _e55 = textureLoad(uJointPalette_t, vec2<i32>((_e52 + 3i), 0i), 0i);\n return mat4x4<f32>(vec4<f32>(_e43.x, _e43.y, _e43.z, _e43.w), vec4<f32>(_e47.x, _e47.y, _e47.z, _e47.w), vec4<f32>(_e51.x, _e51.y, _e51.z, _e51.w), vec4<f32>(_e55.x, _e55.y, _e55.z, _e55.w));\n}\n\nfn skinMatrix_u0028_() -> mat4x4<f32> {\n var m: mat4x4<f32>;\n var param_22: i32;\n var param_23: i32;\n var param_24: i32;\n var param_25: i32;\n var param_26: i32;\n var param_27: i32;\n var param_28: i32;\n var param_29: i32;\n\n let _e47 = aJoints_1[0u];\n param_22 = i32(_e47);\n let _e49 = jointMatrix_u0028_i1_u003b((&param_22));\n let _e51 = aWeights_1[0u];\n let _e52 = (_e49 * _e51);\n let _e54 = aJoints_1[1u];\n param_23 = i32(_e54);\n let _e56 = jointMatrix_u0028_i1_u003b((&param_23));\n let _e58 = aWeights_1[1u];\n let _e59 = (_e56 * _e58);\n let _e72 = mat4x4<f32>((_e52[0] + _e59[0]), (_e52[1] + _e59[1]), (_e52[2] + _e59[2]), (_e52[3] + _e59[3]));\n let _e74 = aJoints_1[2u];\n param_24 = i32(_e74);\n let _e76 = jointMatrix_u0028_i1_u003b((&param_24));\n let _e78 = aWeights_1[2u];\n let _e79 = (_e76 * _e78);\n let _e92 = mat4x4<f32>((_e72[0] + _e79[0]), (_e72[1] + _e79[1]), (_e72[2] + _e79[2]), (_e72[3] + _e79[3]));\n let _e94 = aJoints_1[3u];\n param_25 = i32(_e94);\n let _e96 = jointMatrix_u0028_i1_u003b((&param_25));\n let _e98 = aWeights_1[3u];\n let _e99 = (_e96 * _e98);\n m = mat4x4<f32>((_e92[0] + _e99[0]), (_e92[1] + _e99[1]), (_e92[2] + _e99[2]), (_e92[3] + _e99[3]));\n if SKIN_EIGHT {\n let _e114 = aJoints2_1[0u];\n param_26 = i32(_e114);\n let _e116 = jointMatrix_u0028_i1_u003b((&param_26));\n let _e118 = aWeights2_1[0u];\n let _e119 = (_e116 * _e118);\n let _e121 = aJoints2_1[1u];\n param_27 = i32(_e121);\n let _e123 = jointMatrix_u0028_i1_u003b((&param_27));\n let _e125 = aWeights2_1[1u];\n let _e126 = (_e123 * _e125);\n let _e139 = mat4x4<f32>((_e119[0] + _e126[0]), (_e119[1] + _e126[1]), (_e119[2] + _e126[2]), (_e119[3] + _e126[3]));\n let _e141 = aJoints2_1[2u];\n param_28 = i32(_e141);\n let _e143 = jointMatrix_u0028_i1_u003b((&param_28));\n let _e145 = aWeights2_1[2u];\n let _e146 = (_e143 * _e145);\n let _e159 = mat4x4<f32>((_e139[0] + _e146[0]), (_e139[1] + _e146[1]), (_e139[2] + _e146[2]), (_e139[3] + _e146[3]));\n let _e161 = aJoints2_1[3u];\n param_29 = i32(_e161);\n let _e163 = jointMatrix_u0028_i1_u003b((&param_29));\n let _e165 = aWeights2_1[3u];\n let _e166 = (_e163 * _e165);\n let _e179 = mat4x4<f32>((_e159[0] + _e166[0]), (_e159[1] + _e166[1]), (_e159[2] + _e166[2]), (_e159[3] + _e166[3]));\n let _e180 = m;\n m = mat4x4<f32>((_e180[0] + _e179[0]), (_e180[1] + _e179[1]), (_e180[2] + _e179[2]), (_e180[3] + _e179[3]));\n }\n let _e194 = m;\n return _e194;\n}\n\nfn main_1() {\n var local: vec4<f32>;\n var model: mat4x4<f32>;\n var world: vec4<f32>;\n var bent: vec3<f32>;\n var param_30: vec3<f32>;\n var param_31: f32;\n var follow: f32;\n var clothPosition: vec3<f32>;\n var turn_1: mat3x3<f32>;\n var param_32: vec3<f32>;\n var param_33: mat3x3<f32>;\n\n let _e48 = skinMatrix_u0028_();\n let _e49 = aPosition_1;\n local = (_e48 * vec4<f32>(_e49.x, _e49.y, _e49.z, 1f));\n let _e56 = unnamed.uModel;\n model = _e56;\n let _e57 = model;\n let _e58 = local;\n world = (_e57 * _e58);\n let _e60 = world;\n param_30 = _e60.xyz;\n let _e63 = aChannel_1[0u];\n param_31 = _e63;\n let _e64 = channelBend_u0028_vf3_u003b_f1_u003b((&param_30), (&param_31));\n bent = _e64;\n if CLOTH_BOUND {\n let _e65 = clothPlace_u0028_vf3_u003b_mf33_u003b((&param_32), (&param_33));\n let _e66 = param_32;\n clothPosition = _e66;\n let _e67 = param_33;\n turn_1 = _e67;\n follow = _e65;\n let _e68 = bent;\n let _e69 = clothPosition;\n let _e70 = follow;\n bent = mix(_e68, _e69, vec3(_e70));\n }\n let _e74 = unnamed.uLightViewProj;\n let _e75 = bent;\n let _e77 = world[3u];\n vLightPosition = (_e74 * vec4<f32>(_e75.x, _e75.y, _e75.z, _e77));\n let _e83 = vLightPosition;\n unnamed_1.gl_Position = _e83;\n return;\n}\n\n@vertex \nfn main(@location(11) aJoints: vec4<f32>, @location(12) aWeights: vec4<f32>, @location(14) aJoints2_: vec4<f32>, @location(15) aWeights2_: vec4<f32>, @builtin(vertex_index) gl_VertexIndex: u32, @location(0) aPosition: vec3<f32>, @location(13) aChannel: vec4<f32>) -> VertexOutput {\n aJoints_1 = aJoints;\n aWeights_1 = aWeights;\n aJoints2_1 = aJoints2_;\n aWeights2_1 = aWeights2_;\n gl_VertexIndex_1 = i32(gl_VertexIndex);\n aPosition_1 = aPosition;\n aChannel_1 = aChannel;\n main_1();\n let _e19 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e19);\n let _e21 = vLightPosition;\n let _e22 = unnamed_1.gl_Position;\n return VertexOutput(_e21, _e22);\n}\n";
@@ -116,6 +118,97 @@ export declare const DEPTH_BINDINGS: {
116
118
  };
117
119
  };
118
120
  };
121
+ readonly DEPTH_INSTANCED_ANIMATED_CUTOUT_VERT: {
122
+ readonly uniforms: 0;
123
+ readonly uniformSize: 112;
124
+ readonly fields: {
125
+ readonly uLightViewProj: {
126
+ readonly offset: 0;
127
+ readonly size: 64;
128
+ readonly type: "mat4";
129
+ };
130
+ readonly uUvScale: {
131
+ readonly offset: 64;
132
+ readonly size: 8;
133
+ readonly type: "vec2";
134
+ };
135
+ readonly uUvOffset: {
136
+ readonly offset: 72;
137
+ readonly size: 8;
138
+ readonly type: "vec2";
139
+ };
140
+ readonly uAlphaCutout: {
141
+ readonly offset: 80;
142
+ readonly size: 8;
143
+ readonly type: "vec2";
144
+ };
145
+ readonly uSceneTime: {
146
+ readonly offset: 88;
147
+ readonly size: 4;
148
+ readonly type: "float";
149
+ };
150
+ readonly uBoneClip: {
151
+ readonly offset: 96;
152
+ readonly size: 8;
153
+ readonly type: "vec2";
154
+ };
155
+ };
156
+ readonly textures: {
157
+ readonly uBonePlaces: {
158
+ readonly texture: 16;
159
+ readonly sampler: 17;
160
+ readonly type: "sampler2D";
161
+ };
162
+ readonly uBoneTurns: {
163
+ readonly texture: 18;
164
+ readonly sampler: 19;
165
+ readonly type: "sampler2D";
166
+ };
167
+ readonly uInstanceClocks: {
168
+ readonly texture: 20;
169
+ readonly sampler: 21;
170
+ readonly type: "sampler2D";
171
+ };
172
+ };
173
+ };
174
+ readonly DEPTH_INSTANCED_ANIMATED_VERT: {
175
+ readonly uniforms: 0;
176
+ readonly uniformSize: 80;
177
+ readonly fields: {
178
+ readonly uLightViewProj: {
179
+ readonly offset: 0;
180
+ readonly size: 64;
181
+ readonly type: "mat4";
182
+ };
183
+ readonly uSceneTime: {
184
+ readonly offset: 64;
185
+ readonly size: 4;
186
+ readonly type: "float";
187
+ };
188
+ readonly uBoneClip: {
189
+ readonly offset: 72;
190
+ readonly size: 8;
191
+ readonly type: "vec2";
192
+ };
193
+ };
194
+ readonly textures: {
195
+ readonly uBonePlaces: {
196
+ readonly texture: 16;
197
+ readonly sampler: 17;
198
+ readonly type: "sampler2D";
199
+ };
200
+ readonly uBoneTurns: {
201
+ readonly texture: 18;
202
+ readonly sampler: 19;
203
+ readonly type: "sampler2D";
204
+ };
205
+ readonly uInstanceClocks: {
206
+ readonly texture: 20;
207
+ readonly sampler: 21;
208
+ readonly type: "sampler2D";
209
+ };
210
+ };
211
+ };
119
212
  readonly DEPTH_INSTANCED_CUTOUT_VERT: {
120
213
  readonly uniforms: 0;
121
214
  readonly uniformSize: 96;