@driftengine/core 4.8.3 → 4.8.5

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 (180) hide show
  1. package/CHANGELOG.json +82 -0
  2. package/README.md +1 -1
  3. package/dist/build/shaderComments.js +0 -0
  4. package/dist/geometry/meshConcat.js +2 -0
  5. package/dist/index.d.ts +10 -4
  6. package/dist/index.js +16 -1
  7. package/dist/math/scalar.js +1 -1
  8. package/dist/render/anisotropicLobe.d.ts +7 -0
  9. package/dist/render/anisotropicLobe.js +33 -0
  10. package/dist/render/backend/api.d.ts +41 -4
  11. package/dist/render/backend/select.js +8 -0
  12. package/dist/render/backend/webgl2/clothTextures.d.ts +27 -0
  13. package/dist/render/backend/webgl2/clothTextures.js +93 -0
  14. package/dist/render/backend/webgl2/renderer.d.ts +136 -3
  15. package/dist/render/backend/webgl2/renderer.js +604 -63
  16. package/dist/render/backend/webgl2/skinScatter.d.ts +50 -0
  17. package/dist/render/backend/webgl2/skinScatter.js +256 -0
  18. package/dist/render/backend/webgpu/buffers.d.ts +25 -11
  19. package/dist/render/backend/webgpu/buffers.js +98 -49
  20. package/dist/render/backend/webgpu/clothSolvePack.d.ts +27 -0
  21. package/dist/render/backend/webgpu/clothSolvePack.js +129 -0
  22. package/dist/render/backend/webgpu/clothTextures.d.ts +68 -0
  23. package/dist/render/backend/webgpu/clothTextures.js +145 -0
  24. package/dist/render/backend/webgpu/compressedUpload.d.ts +18 -0
  25. package/dist/render/backend/webgpu/compressedUpload.js +38 -0
  26. package/dist/render/backend/webgpu/computeHost.d.ts +21 -0
  27. package/dist/render/backend/webgpu/computeHost.js +5 -0
  28. package/dist/render/backend/webgpu/depthPass.d.ts +16 -6
  29. package/dist/render/backend/webgpu/depthPass.js +39 -9
  30. package/dist/render/backend/webgpu/drawCommand.js +6 -2
  31. package/dist/render/backend/webgpu/flatPass.d.ts +38 -4
  32. package/dist/render/backend/webgpu/flatPass.js +109 -12
  33. package/dist/render/backend/webgpu/gpuSkinnedCloth.d.ts +74 -0
  34. package/dist/render/backend/webgpu/gpuSkinnedCloth.js +452 -0
  35. package/dist/render/backend/webgpu/motionPass.d.ts +20 -0
  36. package/dist/render/backend/webgpu/motionPass.js +106 -9
  37. package/dist/render/backend/webgpu/postPass.d.ts +3 -1
  38. package/dist/render/backend/webgpu/postPass.js +6 -3
  39. package/dist/render/backend/webgpu/renderer.d.ts +113 -5
  40. package/dist/render/backend/webgpu/renderer.js +498 -48
  41. package/dist/render/backend/webgpu/shaders/clothSolve.wgsl.d.ts +33 -0
  42. package/dist/render/backend/webgpu/shaders/clothSolve.wgsl.js +469 -0
  43. package/dist/render/backend/webgpu/skinScatterPass.d.ts +51 -0
  44. package/dist/render/backend/webgpu/skinScatterPass.js +253 -0
  45. package/dist/render/backend/webgpu/surfaceTexturePass.d.ts +4 -1
  46. package/dist/render/backend/webgpu/surfaceTexturePass.js +37 -12
  47. package/dist/render/clothBindingData.d.ts +41 -0
  48. package/dist/render/clothBindingData.js +72 -0
  49. package/dist/render/clothPlacement.d.ts +25 -0
  50. package/dist/render/clothPlacement.js +85 -0
  51. package/dist/render/compressedSource.d.ts +66 -0
  52. package/dist/render/compressedSource.js +138 -0
  53. package/dist/render/cutoutCaster.d.ts +2 -0
  54. package/dist/render/cutoutCaster.js +2 -0
  55. package/dist/render/cutoutDither.d.ts +51 -0
  56. package/dist/render/cutoutDither.js +90 -0
  57. package/dist/render/eyeRefraction.d.ts +35 -0
  58. package/dist/render/eyeRefraction.js +40 -0
  59. package/dist/render/glCompressed.d.ts +27 -0
  60. package/dist/render/glCompressed.js +53 -0
  61. package/dist/render/hairLobes.d.ts +70 -0
  62. package/dist/render/hairLobes.js +120 -0
  63. package/dist/render/lightBudget.d.ts +22 -0
  64. package/dist/render/lightBudget.js +22 -0
  65. package/dist/render/mesh.d.ts +7 -0
  66. package/dist/render/mesh.js +24 -0
  67. package/dist/render/recon/motionVectors.d.ts +4 -2
  68. package/dist/render/recon/motionVectors.js +6 -3
  69. package/dist/render/renderQuality.d.ts +20 -0
  70. package/dist/render/renderQuality.js +5 -0
  71. package/dist/render/rendererHarness.js +4 -0
  72. package/dist/render/sceneTarget.d.ts +12 -0
  73. package/dist/render/sceneTarget.js +14 -0
  74. package/dist/render/shaders/clothBinding.d.ts +22 -0
  75. package/dist/render/shaders/clothBinding.js +80 -0
  76. package/dist/render/shaders/depth.js +42 -6
  77. package/dist/render/shaders/flat/anisotropic.d.ts +15 -0
  78. package/dist/render/shaders/flat/anisotropic.js +68 -0
  79. package/dist/render/shaders/flat/eye.d.ts +1 -0
  80. package/dist/render/shaders/flat/eye.js +81 -0
  81. package/dist/render/shaders/flat/hair.d.ts +1 -0
  82. package/dist/render/shaders/flat/hair.js +101 -0
  83. package/dist/render/shaders/flat/index.js +36 -2
  84. package/dist/render/shaders/flat/main.d.ts +1 -1
  85. package/dist/render/shaders/flat/main.js +113 -17
  86. package/dist/render/shaders/flat/models.d.ts +14 -0
  87. package/dist/render/shaders/flat/models.js +273 -0
  88. package/dist/render/shaders/flat/preamble.js +26 -24
  89. package/dist/render/shaders/flat/skin.d.ts +1 -0
  90. package/dist/render/shaders/flat/skin.js +114 -0
  91. package/dist/render/shaders/generated/depth.wgsl.d.ts +38 -16
  92. package/dist/render/shaders/generated/depth.wgsl.js +38 -16
  93. package/dist/render/shaders/generated/flat.wgsl.d.ts +1790 -1704
  94. package/dist/render/shaders/generated/flat.wgsl.js +1828 -1742
  95. package/dist/render/shaders/generated/skinBlur.wgsl.d.ts +48 -0
  96. package/dist/render/shaders/generated/skinBlur.wgsl.js +54 -0
  97. package/dist/render/shaders/recon/motion.wgsl.d.ts +1 -1
  98. package/dist/render/shaders/recon/motion.wgsl.js +102 -0
  99. package/dist/render/shaders/skinBlur.d.ts +1 -0
  100. package/dist/render/shaders/skinBlur.js +103 -0
  101. package/dist/render/shaders/skinning.d.ts +3 -1
  102. package/dist/render/shaders/skinning.js +31 -4
  103. package/dist/render/shadowCasters.d.ts +13 -1
  104. package/dist/render/skinBlur.d.ts +41 -0
  105. package/dist/render/skinBlur.js +49 -0
  106. package/dist/render/skinScatter.d.ts +67 -0
  107. package/dist/render/skinScatter.js +80 -0
  108. package/dist/render/skinnedClothRun.d.ts +26 -0
  109. package/dist/render/skinnedClothRun.js +84 -0
  110. package/dist/render/surfaceModel.d.ts +129 -0
  111. package/dist/render/surfaceModel.js +152 -0
  112. package/dist/render/surfaceTexture.d.ts +44 -4
  113. package/dist/render/surfaceTexture.js +60 -46
  114. package/dist/render/vertexDefaults.js +7 -0
  115. package/package.json +6 -6
  116. package/src/build/shaderComments.ts +0 -0
  117. package/src/geometry/meshConcat.ts +2 -0
  118. package/src/index.ts +40 -1
  119. package/src/math/scalar.ts +1 -1
  120. package/src/render/anisotropicLobe.ts +41 -0
  121. package/src/render/backend/api.ts +52 -3
  122. package/src/render/backend/select.ts +8 -0
  123. package/src/render/backend/webgl2/clothTextures.ts +120 -0
  124. package/src/render/backend/webgl2/renderer.ts +693 -64
  125. package/src/render/backend/webgl2/skinScatter.ts +309 -0
  126. package/src/render/backend/webgpu/buffers.ts +137 -63
  127. package/src/render/backend/webgpu/clothSolvePack.ts +161 -0
  128. package/src/render/backend/webgpu/clothTextures.ts +194 -0
  129. package/src/render/backend/webgpu/compressedUpload.ts +65 -0
  130. package/src/render/backend/webgpu/computeHost.ts +25 -0
  131. package/src/render/backend/webgpu/depthPass.ts +39 -7
  132. package/src/render/backend/webgpu/drawCommand.ts +6 -2
  133. package/src/render/backend/webgpu/flatPass.ts +145 -7
  134. package/src/render/backend/webgpu/gpuSkinnedCloth.ts +502 -0
  135. package/src/render/backend/webgpu/motionPass.ts +128 -9
  136. package/src/render/backend/webgpu/postPass.ts +5 -1
  137. package/src/render/backend/webgpu/renderer.ts +663 -43
  138. package/src/render/backend/webgpu/shaders/clothSolve.wgsl.ts +470 -0
  139. package/src/render/backend/webgpu/skinScatterPass.ts +309 -0
  140. package/src/render/backend/webgpu/surfaceTexturePass.ts +42 -12
  141. package/src/render/clothBindingData.ts +89 -0
  142. package/src/render/clothPlacement.ts +114 -0
  143. package/src/render/compressedSource.ts +198 -0
  144. package/src/render/cutoutCaster.ts +5 -0
  145. package/src/render/cutoutDither.ts +99 -0
  146. package/src/render/eyeRefraction.ts +72 -0
  147. package/src/render/glCompressed.ts +86 -0
  148. package/src/render/hairLobes.ts +188 -0
  149. package/src/render/lightBudget.ts +25 -0
  150. package/src/render/mesh.ts +23 -0
  151. package/src/render/recon/motionVectors.ts +6 -3
  152. package/src/render/renderQuality.ts +28 -0
  153. package/src/render/rendererHarness.ts +4 -0
  154. package/src/render/sceneTarget.ts +21 -0
  155. package/src/render/shaders/clothBinding.ts +81 -0
  156. package/src/render/shaders/depth.ts +42 -6
  157. package/src/render/shaders/flat/anisotropic.ts +68 -0
  158. package/src/render/shaders/flat/eye.ts +82 -0
  159. package/src/render/shaders/flat/hair.ts +102 -0
  160. package/src/render/shaders/flat/index.ts +36 -2
  161. package/src/render/shaders/flat/main.ts +113 -17
  162. package/src/render/shaders/flat/models.ts +286 -0
  163. package/src/render/shaders/flat/preamble.ts +26 -24
  164. package/src/render/shaders/flat/skin.ts +116 -0
  165. package/src/render/shaders/generated/depth.wgsl.ts +38 -16
  166. package/src/render/shaders/generated/flat.wgsl.ts +1828 -1742
  167. package/src/render/shaders/generated/skinBlur.wgsl.ts +56 -0
  168. package/src/render/shaders/recon/motion.wgsl.ts +102 -0
  169. package/src/render/shaders/skinBlur.ts +105 -0
  170. package/src/render/shaders/skinning.ts +31 -4
  171. package/src/render/shadowCasters.ts +13 -0
  172. package/src/render/skinBlur.ts +53 -0
  173. package/src/render/skinScatter.ts +92 -0
  174. package/src/render/skinnedClothRun.ts +128 -0
  175. package/src/render/surfaceModel.ts +274 -0
  176. package/src/render/surfaceTexture.ts +123 -63
  177. package/src/render/vertexDefaults.ts +7 -0
  178. package/dist/math/exact.d.ts +0 -76
  179. package/dist/math/exact.js +0 -327
  180. package/src/math/exact.ts +0 -340
@@ -139,8 +139,22 @@ flat in int vHasTangents;
139
139
  * white shades identically to one with no texture at all.
140
140
  */
141
141
  uniform mediump sampler2DArray uAlbedo;
142
- /** 0 leaves every textured path unevaluated, for the majority of geometry with no image. */
143
- uniform int uAlbedoEnabled;
142
+ /**
143
+ * **The material's four switches in one row**, because every loose scalar is a row of the 256 an
144
+ * Adreno 740 offers and the eight-light build had none to spare once a shading model asked for two
145
+ * (\`models.ts\`): four ints were four rows, and this is one.
146
+ *
147
+ * - **x, the albedo**: 0 leaves every textured path unevaluated, for the majority of geometry with
148
+ * no image.
149
+ * - **y, the ORM map**: 1 when one is bound, gating its whole block. A uniform rather than a
150
+ * permutation flag, because a fifth flag takes the sixteen permutations flatSource.test.ts sweeps
151
+ * to thirty-two and roughly doubles the generated WGSL every consumer bundles.
152
+ * - **z, the emissive map**: 1 when one is bound, gating its sample, for the same reason.
153
+ * - **w, two-sided**: 1 for a surface seen from both faces — glTF's doubleSided, a curtain, a leaf
154
+ * card. Its draw culls nothing, and a back face is lit as a front, with the shading normal turned
155
+ * toward the viewer.
156
+ */
157
+ uniform ivec4 uMaterialFlags;
144
158
  /**
145
159
  * Alpha below which a textured fragment is thrown away entirely, 0 to disable.
146
160
  *
@@ -152,8 +166,13 @@ uniform int uAlbedoEnabled;
152
166
  *
153
167
  * Zero by default, so a texture with no alpha to speak of costs one compare and nothing
154
168
  * else changes.
169
+ *
170
+ * **Four numbers in one row**: x is the cutoff, y how this frame resolves the edge (0 the hard test,
171
+ * 1 a dither the temporal resolve averages, 2 alpha-to-coverage; see \`cutoutDither.ts\`), z the
172
+ * frame the dither's pattern is offset by, w spare. One vector rather than a float and two more,
173
+ * because every loose scalar is a row of WebGL2's 224 that the light budget gives up.
155
174
  */
156
- uniform float uAlbedoCutout;
175
+ uniform vec4 uCutout;
157
176
  /**
158
177
  * The albedo array's per-layer effects table: six texels a layer, read with \`texelFetch\` at the
159
178
  * layer a vertex carries. A 1×1 stand-in where the array has none, which the size test below reads
@@ -161,11 +180,6 @@ uniform float uAlbedoCutout;
161
180
  */
162
181
  uniform mediump sampler2D uSurfaceEffects;
163
182
 
164
- /**
165
- * 1 for a surface seen from both faces: glTF's doubleSided, a curtain or a leaf card. Its draw culls
166
- * nothing, and a back face is lit as a front, with the shading normal turned toward the viewer.
167
- */
168
- uniform int uDoubleSided;
169
183
 
170
184
  /**
171
185
  * A normal map, in the surface's own space.
@@ -181,7 +195,7 @@ uniform highp sampler2DArray uNormalMap;
181
195
  /**
182
196
  * How hard the map turns the shading normal. 0 is no map at all, and gates the whole block.
183
197
  *
184
- * A uniform rather than a permutation flag, following uAlbedoEnabled: a fifth boolean would take
198
+ * A uniform rather than a permutation flag, following the albedo's flag: a fifth boolean would take
185
199
  * the exhaustive permutation sweep from sixteen shaders to thirty-two, and the generated WGSL that
186
200
  * consumers bundle as source from 766 KB to about 1.5 MB. A permutation is the right tool for the
187
201
  * shadow samplers, where a profile with shadows off should declare none of them; it is the wrong
@@ -200,16 +214,6 @@ uniform float uNormalStrength;
200
214
  * decoding them as display values would bend every one of them toward its floor.
201
215
  */
202
216
  uniform highp sampler2DArray uOrmMap;
203
- /**
204
- * 1 when a map is bound. Gates the whole block, following uAlbedoEnabled.
205
- *
206
- * A uniform rather than a fifth permutation flag: FlatShaderOptions has four booleans and
207
- * flatSource.test.ts sweeps all sixteen exhaustively, so a fifth takes that to thirty-two and
208
- * roughly doubles the generated WGSL that consumers bundle as source, this engine having no build
209
- * step. A permutation is the right tool for the shadow samplers, where a profile with shadows off
210
- * should declare none of them. It is the wrong tool for one more image.
211
- */
212
- uniform int uOrmEnabled;
213
217
  /**
214
218
  * What each channel is scaled by, component-aligned with the map: r occlusion, g roughness,
215
219
  * b metallic. The alignment is the documentation.
@@ -227,7 +231,7 @@ uniform vec3 uOrmScale;
227
231
  * wants a roughness combined in quadrature. Likewise the weight: the split sum is the correct share
228
232
  * of a *prefiltered* environment and asserts an integral that was never performed over a box chain.
229
233
  *
230
- * A uniform rather than a permutation flag, following \`uOrmEnabled\`: a fifth boolean doubles the
234
+ * A uniform rather than a permutation flag, following the ORM map's in \`uMaterialFlags\`: a fifth boolean doubles the
231
235
  * generated WGSL every consumer bundles as source, and this is a few multiply-adds.
232
236
  */
233
237
  uniform float uEnvironmentPrefiltered;
@@ -241,13 +245,11 @@ uniform float uEnvironmentPrefiltered;
241
245
  * where it should be saturated — but it is silent, because a glow that is too dim reads as a
242
246
  * material choice rather than as a decode.
243
247
  *
244
- * A uniform gate rather than a permutation flag, for exactly the reasons \`uOrmEnabled\` gives
248
+ * A uniform gate rather than a permutation flag, for exactly the reasons \`uMaterialFlags\` gives
245
249
  * above, and now with a number behind them: a fifth flag was built and measured at 49% of the
246
250
  * bundle. See \`ARCHITECTURE.md\` §1.
247
251
  */
248
252
  uniform highp sampler2DArray uEmissiveMap;
249
- /** 1 when a map is bound. Gates the sample, following uOrmEnabled. */
250
- uniform int uEmissiveMapEnabled;
251
253
  /**
252
254
  * What the map is scaled by, per channel. 1 is the identity and the default.
253
255
  *
@@ -423,7 +425,7 @@ bool ditherKeeps(float amount) {
423
425
  * block member the shader does not already carry the size of; it is one \`int\` beside
424
426
  * \`uOpacity\`, read once. And the branch it drives is on a value that is the same for every
425
427
  * fragment in one draw call, which is exactly the guarantee \`uReflectivity\` and
426
- * \`uAlbedoEnabled\` already lean on above: a compiler asked to predicate a whole wavefront on
428
+ * \`uMaterialFlags\` already lean on above: a compiler asked to predicate a whole wavefront on
427
429
  * one uniform skips the untaken side rather than computing both and discarding one, which is
428
430
  * only true because nothing here reads it through a *varying*-dependent branch.
429
431
  */
@@ -0,0 +1,116 @@
1
+ /**
2
+ * The skin model in GLSL: `skinScatter.ts` is the same arithmetic, and its tests hold the
3
+ * pre-integrated fit to the ring integral done numerically, Lambert at no curvature, the
4
+ * transmission through thin and thick parts, and the penumbra's ends.
5
+ *
6
+ * **Each channel scatters its own distance**, the model's radius times its scatter colour, and the
7
+ * surface's curvature turns that into the one number per channel the fit takes. The curvature is
8
+ * the model map's green where one is bound — 1 is a radius of a centimetre — and otherwise the
9
+ * screen's: how fast the interpolated normal turns against how fast the position moves, which is a
10
+ * derivative and so is taken where control flow is uniform, with the surface. **A thin part's
11
+ * thickness** is the map's red — 1 is two centimetres — and otherwise its curvature's diameter,
12
+ * which is what an ear's rim and a nostril's wall are about as thick as.
13
+ *
14
+ * **Transmission is not shadowed by the lamp it comes from.** That lamp's shadow map sees a thin
15
+ * part's own back as the occluder of its front, so a shadowed lamp would put out exactly the light
16
+ * that passes through. What it gives up is an occluder further back: an ear behind a wall, its lamp
17
+ * behind both, still glows. The shadow map's depth at the receiver would separate the two, and the
18
+ * lamp loop reads a visibility rather than a depth.
19
+ *
20
+ * **Under \`skinScattering: 'screen-space'\`** the surface is drawn in two halves: the frame's
21
+ * without its diffuse, and the diffuse alone into the blur's target — Lambert's, with the shadow as
22
+ * it is, because the blur that follows carries light across curvature and shadow edges in the
23
+ * picture and the fit as well would count it twice — keeping the transmission, which the picture
24
+ * cannot see. \`skinBlur.ts\` is the rest.
25
+ *
26
+ * **The highlight** is two GGX lobes — 0.85 at the material's roughness and 0.15 at 0.6 of it, for
27
+ * the skin's oil — normalised, with Smith's masking and the Fresnel of index 1.4, in lamp units, so
28
+ * like hair it ignores the specular attribute, which defaults to nothing. The environment is
29
+ * reflected at that Fresnel's split-sum share.
30
+ */
31
+ import { SKIN_F0, SKIN_FIT, SKIN_MAX_K, SKIN_PENUMBRA_WIDTH } from '../../skinScatter.ts';
32
+
33
+ /** A fitted number as the shader writes it: six figures, which is as many as the fit has. */
34
+ const literal = (value: number): string => value.toPrecision(6);
35
+
36
+ export const SKIN_GLSL = /* glsl */ `
37
+ const float SKIN_F0 = ${SKIN_F0.toFixed(9)};
38
+ const float SKIN_PENUMBRA_WIDTH = ${SKIN_PENUMBRA_WIDTH.toFixed(3)};
39
+
40
+ /* What the surface gives every light: the fit's four terms per channel, squared where they are used so. */
41
+ vec3 sDistance;
42
+ vec3 sKappa;
43
+ vec3 sSpread;
44
+ vec3 sSoften2;
45
+ vec3 sFloor;
46
+ float sThickness;
47
+ /* What the last light left, for modelShade: the part lit from the front, and the part through. */
48
+ vec3 sFront;
49
+ vec3 sThrough;
50
+
51
+ void skinSurface() {
52
+ sDistance = max(uModelParams[0].xyz * uModelParams[0].w, vec3(1e-6));
53
+ /* The screen's curvature, taken here, where control flow is uniform, whether a map replaces it. */
54
+ float screen = length(fwidth(normalize(vNormal))) / max(length(fwidth(vWorldPos)), 1e-6);
55
+ float curvature = uModelParams[1].w > 0.0 ? mMap.g * 100.0 : screen;
56
+ sThickness = uModelParams[1].w > 0.0 ? mMap.r * 0.02 : 2.0 / max(curvature, 1e-3);
57
+ vec3 k = min(sDistance * curvature, vec3(${literal(SKIN_MAX_K)}));
58
+ /*
59
+ * Under the screen-space blur the diffuse half is Lambert's, k at 0: the blur spreads the light
60
+ * across the picture, curvature and all, and the fit as well would count that light twice.
61
+ */
62
+ if (SKIN_DIFFUSE) k = vec3(0.0);
63
+ vec3 k2 = k * k;
64
+ sKappa = pow(1.0 + ${literal(SKIN_FIT.kappa[0])} * k2 + ${literal(SKIN_FIT.kappa[1])} * k2 * k, vec3(-1.0 / 6.0));
65
+ sSpread = pow(1.0 + ${literal(SKIN_FIT.spread)} * k2 * k, vec3(-1.0 / 6.0));
66
+ vec3 soften = ${literal(SKIN_FIT.soften[0])} * k / (1.0 + ${literal(SKIN_FIT.soften[1])} * k);
67
+ sSoften2 = soften * soften;
68
+ vec3 given = 1.0 - sSpread;
69
+ sFloor = given * (${literal(SKIN_FIT.floor[0])} + ${literal(SKIN_FIT.floor[1])} * given);
70
+ }
71
+
72
+ void skinLight(vec3 l, float sourceRadius, float dist) {
73
+ float c = dot(mNormal, l);
74
+ vec3 ring = 0.5 * (sKappa * c + sSpread * sqrt(c * c + sSoften2) + sFloor);
75
+ vec3 through = uModelParams[1].x * exp(-sThickness / sDistance) * max(-c, 0.0);
76
+ sFront = mAlbedo * ring * (1.0 - mMetal);
77
+ sThrough = mAlbedo * through * (1.0 - mMetal);
78
+ mDiffuse = sFront + sThrough;
79
+
80
+ float ndl = max(c, 0.0);
81
+ vec3 h = normalize(l + mToEye);
82
+ float ndh = max(dot(mNormal, h), 0.0);
83
+ float ndv = max(dot(mNormal, mToEye), 1e-4);
84
+ /* A lamp's size widens both lobes; a normalised lobe keeps its energy as it widens. */
85
+ float grow = sourceRadius / max(2.0 * dist, 1e-3);
86
+ float alpha = min(max(mRoughness * mRoughness, MIN_LOBE_ALPHA) + grow, 1.0);
87
+ float oil = min(max(0.36 * mRoughness * mRoughness, MIN_LOBE_ALPHA) + grow, 1.0);
88
+ float f = SKIN_F0 + (1.0 - SKIN_F0) * pow(1.0 - max(dot(mToEye, h), 0.0), 5.0);
89
+ float masking = smithMasking(ndl, ndv, alpha);
90
+ float lobe = 0.85 * ggxLobe(ndh, alpha) + 0.15 * ggxLobe(ndh, oil);
91
+ /* π: a lamp here is π of unit irradiance, as hair's are. */
92
+ mSpecular = vec3(3.14159265 * f * masking * lobe * ndl);
93
+ /* Under the screen-space blur each pass keeps its half: models.ts. */
94
+ if (SKIN_SCREEN) mDiffuse = vec3(0.0);
95
+ if (SKIN_DIFFUSE) mSpecular = vec3(0.0);
96
+ }
97
+
98
+ /** Which profile the blur spreads this skin by, as the diffuse pass's alpha: (index + 1) / 8. */
99
+ float skinProfileCode() {
100
+ return (uModelParams[1].y + 1.0) / 8.0;
101
+ }
102
+
103
+ /** The front-lit part through the penumbra, each channel by how far it travels; the part through, whole. */
104
+ vec3 skinShade(float shadow) {
105
+ /* The blur carries light across a shadow's edge itself, so its half takes the shadow as it is. */
106
+ if (SKIN_DIFFUSE) return (sFront * max(shadow, 0.0) + sThrough) / max(mDiffuse, vec3(1e-6));
107
+ vec3 penumbra = pow(vec3(max(shadow, 0.0)), 1.0 / (1.0 + sDistance / SKIN_PENUMBRA_WIDTH));
108
+ return (sFront * penumbra + sThrough) / max(mDiffuse, vec3(1e-6));
109
+ }
110
+
111
+ /** The environment at the highlight's Fresnel, by the split sum's share. */
112
+ float skinReflectance() {
113
+ vec2 dfg = envBrdfApprox(max(dot(mNormal, mToEye), 0.0), mRoughness);
114
+ return SKIN_F0 * dfg.x + dfg.y;
115
+ }
116
+ `;
@@ -5,31 +5,31 @@
5
5
  * the next generation, and `npm run wgsl:check` fails the build when this is stale.
6
6
  */
7
7
 
8
- export 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: f32;\n\nfn cutoutAlpha_u0028_f1_u003b_vf2_u003b(alpha: 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 _e23 = (*texels);\n let _e24 = dpdx(_e23);\n dx = _e24;\n let _e25 = (*texels);\n let _e26 = dpdy(_e25);\n dy = _e26;\n let _e27 = dx;\n let _e28 = dx;\n let _e30 = dy;\n let _e31 = dy;\n level = max(0f, (0.5f * log2(max(dot(_e27, _e28), dot(_e30, _e31)))));\n let _e37 = (*alpha);\n let _e38 = level;\n return (_e37 * (1f + (_e38 * 0.25f)));\n}\n\nfn main_1() {\n var at: vec3<f32>;\n var alpha_1: f32;\n var param: f32;\n var param_1: vec2<f32>;\n var p: vec3<f32>;\n var uv: vec2<f32>;\n var previousDepth: f32;\n\n let _e25 = vUv_1;\n let _e26 = _e25.xy;\n let _e28 = vUv_1[2u];\n at = vec3<f32>(_e26.x, _e26.y, floor((_e28 + 0.5f)));\n let _e34 = at;\n let _e40 = textureSample(uCutoutMap_t, uCutoutMap_s, vec2<f32>(_e34.x, _e34.y), i32(_e34.z));\n let _e41 = vUv_1;\n let _e43 = textureDimensions(uCutoutMap_t, 0i);\n param = _e40.w;\n param_1 = (_e41.xy * vec2<f32>(vec2<i32>(_e43).xy));\n let _e49 = cutoutAlpha_u0028_f1_u003b_vf2_u003b((&param), (&param_1));\n alpha_1 = _e49;\n let _e51 = unnamed.uPeelShadowLayer;\n if (_e51 != 0i) {\n let _e53 = vLightPosition_1;\n let _e56 = vLightPosition_1[3u];\n p = (_e53.xyz / vec3(_e56));\n let _e59 = p;\n uv = ((_e59.xy * 0.5f) + vec2(0.5f));\n let _e64 = uv;\n let _e67 = vec3<f32>(_e64.x, _e64.y, 0f);\n let _e73 = textureSampleLevel(uPreviousShadowMap_t, uPreviousShadowMap_s, vec2<f32>(_e67.x, _e67.y), i32(_e67.z), 0f);\n previousDepth = _e73.x;\n let _e76 = gl_FragCoord_1[2u];\n let _e77 = previousDepth;\n if (_e76 <= (_e77 + 0.00001f)) {\n discard;\n }\n }\n let _e80 = alpha_1;\n let _e81 = vAlphaCutout_1;\n if (_e80 < _e81) {\n discard;\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: f32) {\n vUv_1 = vUv;\n vLightPosition_1 = vLightPosition;\n gl_FragCoord_1 = gl_FragCoord;\n vAlphaCutout_1 = vAlphaCutout;\n main_1();\n}\n";
8
+ export 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";
9
9
 
10
- export 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: 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: 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: 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";
10
+ export 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";
11
11
 
12
12
  export 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";
13
13
 
14
- export const DEPTH_INSTANCED_CUTOUT_VERT_WGSL = "struct Uniforms {\n uLightViewProj: mat4x4<f32>,\n uUvScale: vec2<f32>,\n uUvOffset: vec2<f32>,\n uAlphaCutout: 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: 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: f32;\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\n let _e23 = aPosition_1;\n local = vec4<f32>(_e23.x, _e23.y, _e23.z, 1f);\n let _e28 = aInstanceModel0_1;\n let _e29 = aInstanceModel1_1;\n let _e30 = aInstanceModel2_1;\n let _e31 = aInstanceModel3_1;\n model = mat4x4<f32>(vec4<f32>(_e28.x, _e28.y, _e28.z, _e28.w), 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));\n let _e53 = model;\n let _e54 = local;\n world = (_e53 * _e54);\n let _e56 = world;\n bent = _e56.xyz;\n let _e59 = unnamed.uLightViewProj;\n let _e60 = bent;\n let _e62 = world[3u];\n vLightPosition = (_e59 * vec4<f32>(_e60.x, _e60.y, _e60.z, _e62));\n let _e68 = vLightPosition;\n unnamed_1.gl_Position = _e68;\n let _e70 = aUv_1;\n let _e73 = unnamed.uUvScale;\n let _e76 = unnamed.uUvOffset;\n let _e77 = ((_e70.xy * _e73) + _e76);\n let _e79 = aUv_1[2u];\n vUv = vec3<f32>(_e77.x, _e77.y, _e79);\n let _e84 = unnamed.uAlphaCutout;\n vAlphaCutout = _e84;\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";
14
+ export 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 world: vec4<f32>;\n var bent: vec3<f32>;\n\n let _e23 = aPosition_1;\n local = vec4<f32>(_e23.x, _e23.y, _e23.z, 1f);\n let _e28 = aInstanceModel0_1;\n let _e29 = aInstanceModel1_1;\n let _e30 = aInstanceModel2_1;\n let _e31 = aInstanceModel3_1;\n model = mat4x4<f32>(vec4<f32>(_e28.x, _e28.y, _e28.z, _e28.w), 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));\n let _e53 = model;\n let _e54 = local;\n world = (_e53 * _e54);\n let _e56 = world;\n bent = _e56.xyz;\n let _e59 = unnamed.uLightViewProj;\n let _e60 = bent;\n let _e62 = world[3u];\n vLightPosition = (_e59 * vec4<f32>(_e60.x, _e60.y, _e60.z, _e62));\n let _e68 = vLightPosition;\n unnamed_1.gl_Position = _e68;\n let _e70 = aUv_1;\n let _e73 = unnamed.uUvScale;\n let _e76 = unnamed.uUvOffset;\n let _e77 = ((_e70.xy * _e73) + _e76);\n let _e79 = aUv_1[2u];\n vUv = vec3<f32>(_e77.x, _e77.y, _e79);\n let _e84 = unnamed.uAlphaCutout;\n vAlphaCutout = _e84;\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";
15
15
 
16
16
  export 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 world: vec4<f32>;\n var bent: vec3<f32>;\n\n let _e16 = aPosition_1;\n local = vec4<f32>(_e16.x, _e16.y, _e16.z, 1f);\n let _e21 = aInstanceModel0_1;\n let _e22 = aInstanceModel1_1;\n let _e23 = aInstanceModel2_1;\n let _e24 = aInstanceModel3_1;\n model = mat4x4<f32>(vec4<f32>(_e21.x, _e21.y, _e21.z, _e21.w), vec4<f32>(_e22.x, _e22.y, _e22.z, _e22.w), vec4<f32>(_e23.x, _e23.y, _e23.z, _e23.w), vec4<f32>(_e24.x, _e24.y, _e24.z, _e24.w));\n let _e46 = model;\n let _e47 = local;\n world = (_e46 * _e47);\n let _e49 = world;\n bent = _e49.xyz;\n let _e52 = unnamed.uLightViewProj;\n let _e53 = bent;\n let _e55 = world[3u];\n vLightPosition = (_e52 * vec4<f32>(_e53.x, _e53.y, _e53.z, _e55));\n let _e61 = vLightPosition;\n unnamed_1.gl_Position = _e61;\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";
17
17
 
18
- export 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@group(0) @binding(16) \nvar uJointPalette_t: texture_2d<f32>;\nvar<private> aJoints_1: vec4<f32>;\nvar<private> aWeights_1: vec4<f32>;\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\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 _e26 = (*sway);\n if (_e26 <= 0f) {\n let _e28 = (*worldPos);\n return _e28;\n }\n let _e29 = (*worldPos);\n let _e32 = unnamed.uWindSpatialPhase;\n let _e35 = unnamed.uWindTime;\n phase = (dot(_e29.xz, _e32) + _e35);\n let _e38 = unnamed.uWindSpeed;\n let _e40 = unnamed.uWindGust;\n let _e42 = phase;\n let _e45 = (*sway);\n bend = (((_e38 + _e40) * sin(_e42)) * _e45);\n let _e48 = (*worldPos)[0u];\n let _e51 = unnamed.uWindDirection[0u];\n let _e52 = bend;\n let _e56 = (*worldPos)[1u];\n let _e58 = (*worldPos)[2u];\n let _e61 = unnamed.uWindDirection[1u];\n let _e62 = bend;\n return vec3<f32>((_e48 + (_e51 * _e52)), _e56, (_e58 + (_e61 * _e62)));\n}\n\nfn jointMatrix_u0028_i1_u003b(index: ptr<function, i32>) -> mat4x4<f32> {\n var x: i32;\n\n let _e24 = (*index);\n x = (_e24 * 4i);\n let _e26 = x;\n let _e28 = textureLoad(uJointPalette_t, vec2<i32>(_e26, 0i), 0i);\n let _e29 = x;\n let _e32 = textureLoad(uJointPalette_t, vec2<i32>((_e29 + 1i), 0i), 0i);\n let _e33 = x;\n let _e36 = textureLoad(uJointPalette_t, vec2<i32>((_e33 + 2i), 0i), 0i);\n let _e37 = x;\n let _e40 = textureLoad(uJointPalette_t, vec2<i32>((_e37 + 3i), 0i), 0i);\n return mat4x4<f32>(vec4<f32>(_e28.x, _e28.y, _e28.z, _e28.w), vec4<f32>(_e32.x, _e32.y, _e32.z, _e32.w), vec4<f32>(_e36.x, _e36.y, _e36.z, _e36.w), vec4<f32>(_e40.x, _e40.y, _e40.z, _e40.w));\n}\n\nfn skinMatrix_u0028_() -> mat4x4<f32> {\n var param: i32;\n var param_1: i32;\n var param_2: i32;\n var param_3: i32;\n\n let _e27 = aJoints_1[0u];\n param = i32(_e27);\n let _e29 = jointMatrix_u0028_i1_u003b((&param));\n let _e31 = aWeights_1[0u];\n let _e32 = (_e29 * _e31);\n let _e34 = aJoints_1[1u];\n param_1 = i32(_e34);\n let _e36 = jointMatrix_u0028_i1_u003b((&param_1));\n let _e38 = aWeights_1[1u];\n let _e39 = (_e36 * _e38);\n let _e52 = mat4x4<f32>((_e32[0] + _e39[0]), (_e32[1] + _e39[1]), (_e32[2] + _e39[2]), (_e32[3] + _e39[3]));\n let _e54 = aJoints_1[2u];\n param_2 = i32(_e54);\n let _e56 = jointMatrix_u0028_i1_u003b((&param_2));\n let _e58 = aWeights_1[2u];\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[3u];\n param_3 = i32(_e74);\n let _e76 = jointMatrix_u0028_i1_u003b((&param_3));\n let _e78 = aWeights_1[3u];\n let _e79 = (_e76 * _e78);\n return mat4x4<f32>((_e72[0] + _e79[0]), (_e72[1] + _e79[1]), (_e72[2] + _e79[2]), (_e72[3] + _e79[3]));\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_4: vec3<f32>;\n var param_5: f32;\n\n let _e28 = skinMatrix_u0028_();\n let _e29 = aPosition_1;\n local = (_e28 * vec4<f32>(_e29.x, _e29.y, _e29.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_4 = _e40.xyz;\n let _e43 = aChannel_1[0u];\n param_5 = _e43;\n let _e44 = channelBend_u0028_vf3_u003b_f1_u003b((&param_4), (&param_5));\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 return;\n}\n\n@vertex \nfn main(@location(11) aJoints: vec4<f32>, @location(12) aWeights: vec4<f32>, @location(0) aPosition: vec3<f32>, @location(13) aChannel: vec4<f32>) -> VertexOutput {\n aJoints_1 = aJoints;\n aWeights_1 = aWeights;\n aPosition_1 = aPosition;\n aChannel_1 = aChannel;\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 return VertexOutput(_e14, _e15);\n}\n";
18
+ export 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";
19
19
 
20
20
  export const DEPTH_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@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\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 _e22 = (*sway);\n if (_e22 <= 0f) {\n let _e24 = (*worldPos);\n return _e24;\n }\n let _e25 = (*worldPos);\n let _e28 = unnamed.uWindSpatialPhase;\n let _e31 = unnamed.uWindTime;\n phase = (dot(_e25.xz, _e28) + _e31);\n let _e34 = unnamed.uWindSpeed;\n let _e36 = unnamed.uWindGust;\n let _e38 = phase;\n let _e41 = (*sway);\n bend = (((_e34 + _e36) * sin(_e38)) * _e41);\n let _e44 = (*worldPos)[0u];\n let _e47 = unnamed.uWindDirection[0u];\n let _e48 = bend;\n let _e52 = (*worldPos)[1u];\n let _e54 = (*worldPos)[2u];\n let _e57 = unnamed.uWindDirection[1u];\n let _e58 = bend;\n return vec3<f32>((_e44 + (_e47 * _e48)), _e52, (_e54 + (_e57 * _e58)));\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 _e24 = aPosition_1;\n local = vec4<f32>(_e24.x, _e24.y, _e24.z, 1f);\n let _e30 = unnamed.uModel;\n model = _e30;\n let _e31 = model;\n let _e32 = local;\n world = (_e31 * _e32);\n let _e34 = world;\n param = _e34.xyz;\n let _e37 = aChannel_1[0u];\n param_1 = _e37;\n let _e38 = channelBend_u0028_vf3_u003b_f1_u003b((&param), (&param_1));\n bent = _e38;\n let _e40 = unnamed.uLightViewProj;\n let _e41 = bent;\n let _e43 = world[3u];\n vLightPosition = (_e40 * vec4<f32>(_e41.x, _e41.y, _e41.z, _e43));\n let _e49 = vLightPosition;\n unnamed_1.gl_Position = _e49;\n return;\n}\n\n@vertex \nfn main(@location(0) aPosition: vec3<f32>, @location(13) aChannel: vec4<f32>) -> VertexOutput {\n aPosition_1 = aPosition;\n aChannel_1 = aChannel;\n main_1();\n let _e8 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e8);\n let _e10 = vLightPosition;\n let _e11 = unnamed_1.gl_Position;\n return VertexOutput(_e10, _e11);\n}\n";
21
21
 
22
- export const GLASS_TINT_CUTOUT_FRAG_WGSL = "struct Uniforms {\n uGlassPane: vec4<f32>,\n uGlassLight: vec4<f32>,\n}\n\nvar<private> vUv_1: vec3<f32>;\n@group(0) @binding(32) \nvar uCutoutMap_t: texture_2d_array<f32>;\n@group(0) @binding(33) \nvar uCutoutMap_s: sampler;\nvar<private> vGlassWorld_1: vec3<f32>;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> outTint: vec4<f32>;\nvar<private> vAlphaCutout_1: f32;\nvar<private> vLightPosition_1: vec4<f32>;\n\nfn cutoutAlpha_u0028_f1_u003b_vf2_u003b(alpha: 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 _e24 = (*texels);\n let _e25 = dpdx(_e24);\n dx = _e25;\n let _e26 = (*texels);\n let _e27 = dpdy(_e26);\n dy = _e27;\n let _e28 = dx;\n let _e29 = dx;\n let _e31 = dy;\n let _e32 = dy;\n level = max(0f, (0.5f * log2(max(dot(_e28, _e29), dot(_e31, _e32)))));\n let _e38 = (*alpha);\n let _e39 = level;\n return (_e38 * (1f + (_e39 * 0.25f)));\n}\n\nfn main_1() {\n var at: vec3<f32>;\n var alpha_1: f32;\n var param: f32;\n var param_1: vec2<f32>;\n var n: vec3<f32>;\n var toLight: vec3<f32>;\n var local: vec3<f32>;\n var cosLight: f32;\n var reflected: f32;\n\n let _e28 = vUv_1;\n let _e29 = _e28.xy;\n let _e31 = vUv_1[2u];\n at = vec3<f32>(_e29.x, _e29.y, floor((_e31 + 0.5f)));\n let _e37 = at;\n let _e43 = textureSample(uCutoutMap_t, uCutoutMap_s, vec2<f32>(_e37.x, _e37.y), i32(_e37.z));\n let _e44 = vUv_1;\n let _e46 = textureDimensions(uCutoutMap_t, 0i);\n param = _e43.w;\n param_1 = (_e44.xy * vec2<f32>(vec2<i32>(_e46).xy));\n let _e52 = cutoutAlpha_u0028_f1_u003b_vf2_u003b((&param), (&param_1));\n alpha_1 = _e52;\n let _e53 = vGlassWorld_1;\n let _e54 = dpdx(_e53);\n let _e55 = vGlassWorld_1;\n let _e56 = dpdy(_e55);\n n = normalize(cross(_e54, _e56));\n let _e61 = unnamed.uGlassLight[3u];\n if (_e61 > 0.5f) {\n let _e64 = unnamed.uGlassLight;\n let _e66 = vGlassWorld_1;\n local = normalize((_e64.xyz - _e66));\n } else {\n let _e70 = unnamed.uGlassLight;\n local = _e70.xyz;\n }\n let _e72 = local;\n toLight = _e72;\n let _e73 = n;\n let _e74 = toLight;\n cosLight = abs(dot(_e73, _e74));\n let _e77 = cosLight;\n reflected = (0.04f + (0.96f * pow((1f - _e77), 5f)));\n let _e83 = unnamed.uGlassPane;\n let _e85 = reflected;\n let _e87 = (_e83.xyz * (1f - _e85));\n let _e90 = unnamed.uGlassPane[3u];\n outTint = vec4<f32>(_e87.x, _e87.y, _e87.z, _e90);\n let _e95 = alpha_1;\n let _e96 = vAlphaCutout_1;\n if (_e95 < _e96) {\n discard;\n }\n return;\n}\n\n@fragment \nfn main(@location(1) vUv: vec3<f32>, @location(3) vGlassWorld: vec3<f32>, @location(2) @interpolate(flat) vAlphaCutout: f32, @location(0) vLightPosition: vec4<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n vGlassWorld_1 = vGlassWorld;\n vAlphaCutout_1 = vAlphaCutout;\n vLightPosition_1 = vLightPosition;\n main_1();\n let _e9 = outTint;\n return _e9;\n}\n";
22
+ export const GLASS_TINT_CUTOUT_FRAG_WGSL = "struct Uniforms {\n uGlassPane: vec4<f32>,\n uGlassLight: vec4<f32>,\n}\n\nvar<private> vUv_1: vec3<f32>;\n@group(0) @binding(32) \nvar uCutoutMap_t: texture_2d_array<f32>;\n@group(0) @binding(33) \nvar uCutoutMap_s: sampler;\nvar<private> vGlassWorld_1: vec3<f32>;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> outTint: vec4<f32>;\nvar<private> vAlphaCutout_1: vec2<f32>;\nvar<private> gl_FragCoord_1: vec4<f32>;\nvar<private> vLightPosition_1: vec4<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 _e34 = (*pixel);\n let _e35 = (*frame);\n p = (_e34 + vec2((5.588238f * _e35)));\n let _e39 = p;\n noise = fract((52.982918f * fract(dot(_e39, vec2<f32>(0.06711056f, 0.00583715f)))));\n let _e44 = (*share);\n let _e45 = noise;\n return (_e44 > _e45);\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 _e32 = (*cutoff);\n let _e33 = (*cutoff);\n band = max((2f * min(_e32, (1f - _e33))), 0.0001f);\n let _e38 = (*alpha);\n let _e39 = (*cutoff);\n let _e41 = band;\n return clamp((((_e38 - _e39) / _e41) + 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 _e34 = (*texels);\n let _e35 = dpdx(_e34);\n dx = _e35;\n let _e36 = (*texels);\n let _e37 = dpdy(_e36);\n dy = _e37;\n let _e38 = dx;\n let _e39 = dx;\n let _e41 = dy;\n let _e42 = dy;\n level = max(0f, (0.5f * log2(max(dot(_e38, _e39), dot(_e41, _e42)))));\n let _e48 = (*alpha_1);\n let _e49 = level;\n return (_e48 * (1f + (_e49 * 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 n: vec3<f32>;\n var toLight: vec3<f32>;\n var local: vec3<f32>;\n var cosLight: f32;\n var reflected: 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 _e43 = vUv_1;\n let _e44 = _e43.xy;\n let _e46 = vUv_1[2u];\n at = vec3<f32>(_e44.x, _e44.y, floor((_e46 + 0.5f)));\n let _e52 = at;\n let _e58 = textureSample(uCutoutMap_t, uCutoutMap_s, vec2<f32>(_e52.x, _e52.y), i32(_e52.z));\n let _e59 = vUv_1;\n let _e61 = textureDimensions(uCutoutMap_t, 0i);\n param = _e58.w;\n param_1 = (_e59.xy * vec2<f32>(vec2<i32>(_e61).xy));\n let _e67 = cutoutAlpha_u0028_f1_u003b_vf2_u003b((&param), (&param_1));\n alpha_2 = _e67;\n let _e68 = vGlassWorld_1;\n let _e69 = dpdx(_e68);\n let _e70 = vGlassWorld_1;\n let _e71 = dpdy(_e70);\n n = normalize(cross(_e69, _e71));\n let _e76 = unnamed.uGlassLight[3u];\n if (_e76 > 0.5f) {\n let _e79 = unnamed.uGlassLight;\n let _e81 = vGlassWorld_1;\n local = normalize((_e79.xyz - _e81));\n } else {\n let _e85 = unnamed.uGlassLight;\n local = _e85.xyz;\n }\n let _e87 = local;\n toLight = _e87;\n let _e88 = n;\n let _e89 = toLight;\n cosLight = abs(dot(_e88, _e89));\n let _e92 = cosLight;\n reflected = (0.04f + (0.96f * pow((1f - _e92), 5f)));\n let _e98 = unnamed.uGlassPane;\n let _e100 = reflected;\n let _e102 = (_e98.xyz * (1f - _e100));\n let _e105 = unnamed.uGlassPane[3u];\n outTint = vec4<f32>(_e102.x, _e102.y, _e102.z, _e105);\n let _e111 = vAlphaCutout_1[1u];\n if (_e111 > 0.5f) {\n let _e113 = alpha_2;\n param_2 = _e113;\n let _e115 = vAlphaCutout_1[0u];\n param_3 = _e115;\n let _e116 = cutoutShare_u0028_f1_u003b_f1_u003b((&param_2), (&param_3));\n param_4 = _e116;\n let _e117 = gl_FragCoord_1;\n param_5 = _e117.xy;\n param_6 = 0f;\n let _e119 = cutoutKeeps_u0028_f1_u003b_vf2_u003b_f1_u003b((&param_4), (&param_5), (&param_6));\n if !(_e119) {\n discard;\n }\n } else {\n let _e121 = alpha_2;\n let _e123 = vAlphaCutout_1[0u];\n if (_e121 < _e123) {\n discard;\n }\n }\n return;\n}\n\n@fragment \nfn main(@location(1) vUv: vec3<f32>, @location(3) vGlassWorld: vec3<f32>, @location(2) @interpolate(flat) vAlphaCutout: vec2<f32>, @builtin(position) gl_FragCoord: vec4<f32>, @location(0) vLightPosition: vec4<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n vGlassWorld_1 = vGlassWorld;\n vAlphaCutout_1 = vAlphaCutout;\n gl_FragCoord_1 = gl_FragCoord;\n vLightPosition_1 = vLightPosition;\n main_1();\n let _e11 = outTint;\n return _e11;\n}\n";
23
23
 
24
- export const GLASS_TINT_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: 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: f32,\n @location(3) member_3: vec3<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: f32;\nvar<private> vGlassWorld: vec3<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 _e29 = (*sway);\n if (_e29 <= 0f) {\n let _e31 = (*worldPos);\n return _e31;\n }\n let _e32 = (*worldPos);\n let _e35 = unnamed.uWindSpatialPhase;\n let _e38 = unnamed.uWindTime;\n phase = (dot(_e32.xz, _e35) + _e38);\n let _e41 = unnamed.uWindSpeed;\n let _e43 = unnamed.uWindGust;\n let _e45 = phase;\n let _e48 = (*sway);\n bend = (((_e41 + _e43) * sin(_e45)) * _e48);\n let _e51 = (*worldPos)[0u];\n let _e54 = unnamed.uWindDirection[0u];\n let _e55 = bend;\n let _e59 = (*worldPos)[1u];\n let _e61 = (*worldPos)[2u];\n let _e64 = unnamed.uWindDirection[1u];\n let _e65 = bend;\n return vec3<f32>((_e51 + (_e54 * _e55)), _e59, (_e61 + (_e64 * _e65)));\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 _e31 = aPosition_1;\n local = vec4<f32>(_e31.x, _e31.y, _e31.z, 1f);\n let _e37 = unnamed.uModel;\n model = _e37;\n let _e38 = model;\n let _e39 = local;\n world = (_e38 * _e39);\n let _e41 = world;\n param = _e41.xyz;\n let _e44 = aChannel_1[0u];\n param_1 = _e44;\n let _e45 = channelBend_u0028_vf3_u003b_f1_u003b((&param), (&param_1));\n bent = _e45;\n let _e47 = unnamed.uLightViewProj;\n let _e48 = bent;\n let _e50 = world[3u];\n vLightPosition = (_e47 * vec4<f32>(_e48.x, _e48.y, _e48.z, _e50));\n let _e56 = vLightPosition;\n unnamed_1.gl_Position = _e56;\n let _e58 = aUv_1;\n let _e61 = unnamed.uUvScale;\n let _e64 = unnamed.uUvOffset;\n let _e65 = ((_e58.xy * _e61) + _e64);\n let _e67 = aUv_1[2u];\n vUv = vec3<f32>(_e65.x, _e65.y, _e67);\n let _e72 = unnamed.uAlphaCutout;\n vAlphaCutout = _e72;\n let _e73 = bent;\n vGlassWorld = _e73;\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 _e13 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e13);\n let _e15 = vLightPosition;\n let _e16 = unnamed_1.gl_Position;\n let _e17 = vUv;\n let _e18 = vAlphaCutout;\n let _e19 = vGlassWorld;\n return VertexOutput(_e15, _e16, _e17, _e18, _e19);\n}\n";
24
+ export const GLASS_TINT_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 @location(3) member_3: vec3<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>;\nvar<private> vGlassWorld: vec3<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 _e29 = (*sway);\n if (_e29 <= 0f) {\n let _e31 = (*worldPos);\n return _e31;\n }\n let _e32 = (*worldPos);\n let _e35 = unnamed.uWindSpatialPhase;\n let _e38 = unnamed.uWindTime;\n phase = (dot(_e32.xz, _e35) + _e38);\n let _e41 = unnamed.uWindSpeed;\n let _e43 = unnamed.uWindGust;\n let _e45 = phase;\n let _e48 = (*sway);\n bend = (((_e41 + _e43) * sin(_e45)) * _e48);\n let _e51 = (*worldPos)[0u];\n let _e54 = unnamed.uWindDirection[0u];\n let _e55 = bend;\n let _e59 = (*worldPos)[1u];\n let _e61 = (*worldPos)[2u];\n let _e64 = unnamed.uWindDirection[1u];\n let _e65 = bend;\n return vec3<f32>((_e51 + (_e54 * _e55)), _e59, (_e61 + (_e64 * _e65)));\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 _e31 = aPosition_1;\n local = vec4<f32>(_e31.x, _e31.y, _e31.z, 1f);\n let _e37 = unnamed.uModel;\n model = _e37;\n let _e38 = model;\n let _e39 = local;\n world = (_e38 * _e39);\n let _e41 = world;\n param = _e41.xyz;\n let _e44 = aChannel_1[0u];\n param_1 = _e44;\n let _e45 = channelBend_u0028_vf3_u003b_f1_u003b((&param), (&param_1));\n bent = _e45;\n let _e47 = unnamed.uLightViewProj;\n let _e48 = bent;\n let _e50 = world[3u];\n vLightPosition = (_e47 * vec4<f32>(_e48.x, _e48.y, _e48.z, _e50));\n let _e56 = vLightPosition;\n unnamed_1.gl_Position = _e56;\n let _e58 = aUv_1;\n let _e61 = unnamed.uUvScale;\n let _e64 = unnamed.uUvOffset;\n let _e65 = ((_e58.xy * _e61) + _e64);\n let _e67 = aUv_1[2u];\n vUv = vec3<f32>(_e65.x, _e65.y, _e67);\n let _e72 = unnamed.uAlphaCutout;\n vAlphaCutout = _e72;\n let _e73 = bent;\n vGlassWorld = _e73;\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 _e13 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e13);\n let _e15 = vLightPosition;\n let _e16 = unnamed_1.gl_Position;\n let _e17 = vUv;\n let _e18 = vAlphaCutout;\n let _e19 = vGlassWorld;\n return VertexOutput(_e15, _e16, _e17, _e18, _e19);\n}\n";
25
25
 
26
26
  export const GLASS_TINT_FRAG_WGSL = "struct Uniforms {\n uGlassPane: vec4<f32>,\n uGlassLight: vec4<f32>,\n}\n\nvar<private> vGlassWorld_1: vec3<f32>;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> outTint: vec4<f32>;\nvar<private> vLightPosition_1: vec4<f32>;\n\nfn main_1() {\n var n: vec3<f32>;\n var toLight: vec3<f32>;\n var local: vec3<f32>;\n var cosLight: f32;\n var reflected: f32;\n\n let _e17 = vGlassWorld_1;\n let _e18 = dpdx(_e17);\n let _e19 = vGlassWorld_1;\n let _e20 = dpdy(_e19);\n n = normalize(cross(_e18, _e20));\n let _e25 = unnamed.uGlassLight[3u];\n if (_e25 > 0.5f) {\n let _e28 = unnamed.uGlassLight;\n let _e30 = vGlassWorld_1;\n local = normalize((_e28.xyz - _e30));\n } else {\n let _e34 = unnamed.uGlassLight;\n local = _e34.xyz;\n }\n let _e36 = local;\n toLight = _e36;\n let _e37 = n;\n let _e38 = toLight;\n cosLight = abs(dot(_e37, _e38));\n let _e41 = cosLight;\n reflected = (0.04f + (0.96f * pow((1f - _e41), 5f)));\n let _e47 = unnamed.uGlassPane;\n let _e49 = reflected;\n let _e51 = (_e47.xyz * (1f - _e49));\n let _e54 = unnamed.uGlassPane[3u];\n outTint = vec4<f32>(_e51.x, _e51.y, _e51.z, _e54);\n return;\n}\n\n@fragment \nfn main(@location(1) vGlassWorld: vec3<f32>, @location(0) vLightPosition: vec4<f32>) -> @location(0) vec4<f32> {\n vGlassWorld_1 = vGlassWorld;\n vLightPosition_1 = vLightPosition;\n main_1();\n let _e5 = outTint;\n return _e5;\n}\n";
27
27
 
28
- export const GLASS_TINT_INSTANCED_CUTOUT_VERT_WGSL = "struct Uniforms {\n uLightViewProj: mat4x4<f32>,\n uUvScale: vec2<f32>,\n uUvOffset: vec2<f32>,\n uAlphaCutout: 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: f32,\n @location(3) member_3: vec3<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: f32;\nvar<private> vGlassWorld: vec3<f32>;\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\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 _e54 = model;\n let _e55 = local;\n world = (_e54 * _e55);\n let _e57 = world;\n bent = _e57.xyz;\n let _e60 = unnamed.uLightViewProj;\n let _e61 = bent;\n let _e63 = world[3u];\n vLightPosition = (_e60 * vec4<f32>(_e61.x, _e61.y, _e61.z, _e63));\n let _e69 = vLightPosition;\n unnamed_1.gl_Position = _e69;\n let _e71 = aUv_1;\n let _e74 = unnamed.uUvScale;\n let _e77 = unnamed.uUvOffset;\n let _e78 = ((_e71.xy * _e74) + _e77);\n let _e80 = aUv_1[2u];\n vUv = vec3<f32>(_e78.x, _e78.y, _e80);\n let _e85 = unnamed.uAlphaCutout;\n vAlphaCutout = _e85;\n let _e86 = bent;\n vGlassWorld = _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>, @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 _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 let _e23 = vUv;\n let _e24 = vAlphaCutout;\n let _e25 = vGlassWorld;\n return VertexOutput(_e21, _e22, _e23, _e24, _e25);\n}\n";
28
+ export const GLASS_TINT_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 @location(3) member_3: vec3<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>;\nvar<private> vGlassWorld: vec3<f32>;\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\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 _e54 = model;\n let _e55 = local;\n world = (_e54 * _e55);\n let _e57 = world;\n bent = _e57.xyz;\n let _e60 = unnamed.uLightViewProj;\n let _e61 = bent;\n let _e63 = world[3u];\n vLightPosition = (_e60 * vec4<f32>(_e61.x, _e61.y, _e61.z, _e63));\n let _e69 = vLightPosition;\n unnamed_1.gl_Position = _e69;\n let _e71 = aUv_1;\n let _e74 = unnamed.uUvScale;\n let _e77 = unnamed.uUvOffset;\n let _e78 = ((_e71.xy * _e74) + _e77);\n let _e80 = aUv_1[2u];\n vUv = vec3<f32>(_e78.x, _e78.y, _e80);\n let _e85 = unnamed.uAlphaCutout;\n vAlphaCutout = _e85;\n let _e86 = bent;\n vGlassWorld = _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>, @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 _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 let _e23 = vUv;\n let _e24 = vAlphaCutout;\n let _e25 = vGlassWorld;\n return VertexOutput(_e21, _e22, _e23, _e24, _e25);\n}\n";
29
29
 
30
30
  export const GLASS_TINT_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 @location(1) member_1: vec3<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> vGlassWorld: vec3<f32>;\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\n let _e17 = aPosition_1;\n local = vec4<f32>(_e17.x, _e17.y, _e17.z, 1f);\n let _e22 = aInstanceModel0_1;\n let _e23 = aInstanceModel1_1;\n let _e24 = aInstanceModel2_1;\n let _e25 = aInstanceModel3_1;\n model = mat4x4<f32>(vec4<f32>(_e22.x, _e22.y, _e22.z, _e22.w), vec4<f32>(_e23.x, _e23.y, _e23.z, _e23.w), vec4<f32>(_e24.x, _e24.y, _e24.z, _e24.w), vec4<f32>(_e25.x, _e25.y, _e25.z, _e25.w));\n let _e47 = model;\n let _e48 = local;\n world = (_e47 * _e48);\n let _e50 = world;\n bent = _e50.xyz;\n let _e53 = unnamed.uLightViewProj;\n let _e54 = bent;\n let _e56 = world[3u];\n vLightPosition = (_e53 * vec4<f32>(_e54.x, _e54.y, _e54.z, _e56));\n let _e62 = vLightPosition;\n unnamed_1.gl_Position = _e62;\n let _e64 = bent;\n vGlassWorld = _e64;\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 _e15 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e15);\n let _e17 = vLightPosition;\n let _e18 = unnamed_1.gl_Position;\n let _e19 = vGlassWorld;\n return VertexOutput(_e17, _e18, _e19);\n}\n";
31
31
 
32
- export const GLASS_TINT_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 @location(1) member_1: vec3<f32>,\n}\n\n@group(0) @binding(16) \nvar uJointPalette_t: texture_2d<f32>;\nvar<private> aJoints_1: vec4<f32>;\nvar<private> aWeights_1: vec4<f32>;\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> vGlassWorld: vec3<f32>;\n@group(0) @binding(17) \nvar uJointPalette_s: sampler;\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 _e27 = (*sway);\n if (_e27 <= 0f) {\n let _e29 = (*worldPos);\n return _e29;\n }\n let _e30 = (*worldPos);\n let _e33 = unnamed.uWindSpatialPhase;\n let _e36 = unnamed.uWindTime;\n phase = (dot(_e30.xz, _e33) + _e36);\n let _e39 = unnamed.uWindSpeed;\n let _e41 = unnamed.uWindGust;\n let _e43 = phase;\n let _e46 = (*sway);\n bend = (((_e39 + _e41) * sin(_e43)) * _e46);\n let _e49 = (*worldPos)[0u];\n let _e52 = unnamed.uWindDirection[0u];\n let _e53 = bend;\n let _e57 = (*worldPos)[1u];\n let _e59 = (*worldPos)[2u];\n let _e62 = unnamed.uWindDirection[1u];\n let _e63 = bend;\n return vec3<f32>((_e49 + (_e52 * _e53)), _e57, (_e59 + (_e62 * _e63)));\n}\n\nfn jointMatrix_u0028_i1_u003b(index: ptr<function, i32>) -> mat4x4<f32> {\n var x: i32;\n\n let _e25 = (*index);\n x = (_e25 * 4i);\n let _e27 = x;\n let _e29 = textureLoad(uJointPalette_t, vec2<i32>(_e27, 0i), 0i);\n let _e30 = x;\n let _e33 = textureLoad(uJointPalette_t, vec2<i32>((_e30 + 1i), 0i), 0i);\n let _e34 = x;\n let _e37 = textureLoad(uJointPalette_t, vec2<i32>((_e34 + 2i), 0i), 0i);\n let _e38 = x;\n let _e41 = textureLoad(uJointPalette_t, vec2<i32>((_e38 + 3i), 0i), 0i);\n return mat4x4<f32>(vec4<f32>(_e29.x, _e29.y, _e29.z, _e29.w), vec4<f32>(_e33.x, _e33.y, _e33.z, _e33.w), vec4<f32>(_e37.x, _e37.y, _e37.z, _e37.w), vec4<f32>(_e41.x, _e41.y, _e41.z, _e41.w));\n}\n\nfn skinMatrix_u0028_() -> mat4x4<f32> {\n var param: i32;\n var param_1: i32;\n var param_2: i32;\n var param_3: i32;\n\n let _e28 = aJoints_1[0u];\n param = i32(_e28);\n let _e30 = jointMatrix_u0028_i1_u003b((&param));\n let _e32 = aWeights_1[0u];\n let _e33 = (_e30 * _e32);\n let _e35 = aJoints_1[1u];\n param_1 = i32(_e35);\n let _e37 = jointMatrix_u0028_i1_u003b((&param_1));\n let _e39 = aWeights_1[1u];\n let _e40 = (_e37 * _e39);\n let _e53 = mat4x4<f32>((_e33[0] + _e40[0]), (_e33[1] + _e40[1]), (_e33[2] + _e40[2]), (_e33[3] + _e40[3]));\n let _e55 = aJoints_1[2u];\n param_2 = i32(_e55);\n let _e57 = jointMatrix_u0028_i1_u003b((&param_2));\n let _e59 = aWeights_1[2u];\n let _e60 = (_e57 * _e59);\n let _e73 = mat4x4<f32>((_e53[0] + _e60[0]), (_e53[1] + _e60[1]), (_e53[2] + _e60[2]), (_e53[3] + _e60[3]));\n let _e75 = aJoints_1[3u];\n param_3 = i32(_e75);\n let _e77 = jointMatrix_u0028_i1_u003b((&param_3));\n let _e79 = aWeights_1[3u];\n let _e80 = (_e77 * _e79);\n return mat4x4<f32>((_e73[0] + _e80[0]), (_e73[1] + _e80[1]), (_e73[2] + _e80[2]), (_e73[3] + _e80[3]));\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_4: vec3<f32>;\n var param_5: f32;\n\n let _e29 = skinMatrix_u0028_();\n let _e30 = aPosition_1;\n local = (_e29 * vec4<f32>(_e30.x, _e30.y, _e30.z, 1f));\n let _e37 = unnamed.uModel;\n model = _e37;\n let _e38 = model;\n let _e39 = local;\n world = (_e38 * _e39);\n let _e41 = world;\n param_4 = _e41.xyz;\n let _e44 = aChannel_1[0u];\n param_5 = _e44;\n let _e45 = channelBend_u0028_vf3_u003b_f1_u003b((&param_4), (&param_5));\n bent = _e45;\n let _e47 = unnamed.uLightViewProj;\n let _e48 = bent;\n let _e50 = world[3u];\n vLightPosition = (_e47 * vec4<f32>(_e48.x, _e48.y, _e48.z, _e50));\n let _e56 = vLightPosition;\n unnamed_1.gl_Position = _e56;\n let _e58 = bent;\n vGlassWorld = _e58;\n return;\n}\n\n@vertex \nfn main(@location(11) aJoints: vec4<f32>, @location(12) aWeights: vec4<f32>, @location(0) aPosition: vec3<f32>, @location(13) aChannel: vec4<f32>) -> VertexOutput {\n aJoints_1 = aJoints;\n aWeights_1 = aWeights;\n aPosition_1 = aPosition;\n aChannel_1 = aChannel;\n main_1();\n let _e13 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e13);\n let _e15 = vLightPosition;\n let _e16 = unnamed_1.gl_Position;\n let _e17 = vGlassWorld;\n return VertexOutput(_e15, _e16, _e17);\n}\n";
32
+ export const GLASS_TINT_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 @location(1) member_1: vec3<f32>,\n}\n\n@id(0) override SKIN_EIGHT: 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(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> vGlassWorld: vec3<f32>;\n@group(0) @binding(17) \nvar uJointPalette_s: sampler;\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 _e30 = (*sway);\n if (_e30 <= 0f) {\n let _e32 = (*worldPos);\n return _e32;\n }\n let _e33 = (*worldPos);\n let _e36 = unnamed.uWindSpatialPhase;\n let _e39 = unnamed.uWindTime;\n phase = (dot(_e33.xz, _e36) + _e39);\n let _e42 = unnamed.uWindSpeed;\n let _e44 = unnamed.uWindGust;\n let _e46 = phase;\n let _e49 = (*sway);\n bend = (((_e42 + _e44) * sin(_e46)) * _e49);\n let _e52 = (*worldPos)[0u];\n let _e55 = unnamed.uWindDirection[0u];\n let _e56 = bend;\n let _e60 = (*worldPos)[1u];\n let _e62 = (*worldPos)[2u];\n let _e65 = unnamed.uWindDirection[1u];\n let _e66 = bend;\n return vec3<f32>((_e52 + (_e55 * _e56)), _e60, (_e62 + (_e65 * _e66)));\n}\n\nfn jointMatrix_u0028_i1_u003b(index: ptr<function, i32>) -> mat4x4<f32> {\n var x: i32;\n\n let _e28 = (*index);\n x = (_e28 * 4i);\n let _e30 = x;\n let _e32 = textureLoad(uJointPalette_t, vec2<i32>(_e30, 0i), 0i);\n let _e33 = x;\n let _e36 = textureLoad(uJointPalette_t, vec2<i32>((_e33 + 1i), 0i), 0i);\n let _e37 = x;\n let _e40 = textureLoad(uJointPalette_t, vec2<i32>((_e37 + 2i), 0i), 0i);\n let _e41 = x;\n let _e44 = textureLoad(uJointPalette_t, vec2<i32>((_e41 + 3i), 0i), 0i);\n return mat4x4<f32>(vec4<f32>(_e32.x, _e32.y, _e32.z, _e32.w), vec4<f32>(_e36.x, _e36.y, _e36.z, _e36.w), vec4<f32>(_e40.x, _e40.y, _e40.z, _e40.w), vec4<f32>(_e44.x, _e44.y, _e44.z, _e44.w));\n}\n\nfn skinMatrix_u0028_() -> mat4x4<f32> {\n var m: mat4x4<f32>;\n var param: i32;\n var param_1: i32;\n var param_2: i32;\n var param_3: i32;\n var param_4: i32;\n var param_5: i32;\n var param_6: i32;\n var param_7: i32;\n\n let _e36 = aJoints_1[0u];\n param = i32(_e36);\n let _e38 = jointMatrix_u0028_i1_u003b((&param));\n let _e40 = aWeights_1[0u];\n let _e41 = (_e38 * _e40);\n let _e43 = aJoints_1[1u];\n param_1 = i32(_e43);\n let _e45 = jointMatrix_u0028_i1_u003b((&param_1));\n let _e47 = aWeights_1[1u];\n let _e48 = (_e45 * _e47);\n let _e61 = mat4x4<f32>((_e41[0] + _e48[0]), (_e41[1] + _e48[1]), (_e41[2] + _e48[2]), (_e41[3] + _e48[3]));\n let _e63 = aJoints_1[2u];\n param_2 = i32(_e63);\n let _e65 = jointMatrix_u0028_i1_u003b((&param_2));\n let _e67 = aWeights_1[2u];\n let _e68 = (_e65 * _e67);\n let _e81 = mat4x4<f32>((_e61[0] + _e68[0]), (_e61[1] + _e68[1]), (_e61[2] + _e68[2]), (_e61[3] + _e68[3]));\n let _e83 = aJoints_1[3u];\n param_3 = i32(_e83);\n let _e85 = jointMatrix_u0028_i1_u003b((&param_3));\n let _e87 = aWeights_1[3u];\n let _e88 = (_e85 * _e87);\n m = mat4x4<f32>((_e81[0] + _e88[0]), (_e81[1] + _e88[1]), (_e81[2] + _e88[2]), (_e81[3] + _e88[3]));\n if SKIN_EIGHT {\n let _e103 = aJoints2_1[0u];\n param_4 = i32(_e103);\n let _e105 = jointMatrix_u0028_i1_u003b((&param_4));\n let _e107 = aWeights2_1[0u];\n let _e108 = (_e105 * _e107);\n let _e110 = aJoints2_1[1u];\n param_5 = i32(_e110);\n let _e112 = jointMatrix_u0028_i1_u003b((&param_5));\n let _e114 = aWeights2_1[1u];\n let _e115 = (_e112 * _e114);\n let _e128 = mat4x4<f32>((_e108[0] + _e115[0]), (_e108[1] + _e115[1]), (_e108[2] + _e115[2]), (_e108[3] + _e115[3]));\n let _e130 = aJoints2_1[2u];\n param_6 = i32(_e130);\n let _e132 = jointMatrix_u0028_i1_u003b((&param_6));\n let _e134 = aWeights2_1[2u];\n let _e135 = (_e132 * _e134);\n let _e148 = mat4x4<f32>((_e128[0] + _e135[0]), (_e128[1] + _e135[1]), (_e128[2] + _e135[2]), (_e128[3] + _e135[3]));\n let _e150 = aJoints2_1[3u];\n param_7 = i32(_e150);\n let _e152 = jointMatrix_u0028_i1_u003b((&param_7));\n let _e154 = aWeights2_1[3u];\n let _e155 = (_e152 * _e154);\n let _e168 = mat4x4<f32>((_e148[0] + _e155[0]), (_e148[1] + _e155[1]), (_e148[2] + _e155[2]), (_e148[3] + _e155[3]));\n let _e169 = m;\n m = mat4x4<f32>((_e169[0] + _e168[0]), (_e169[1] + _e168[1]), (_e169[2] + _e168[2]), (_e169[3] + _e168[3]));\n }\n let _e183 = m;\n return _e183;\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_8: vec3<f32>;\n var param_9: f32;\n\n let _e32 = skinMatrix_u0028_();\n let _e33 = aPosition_1;\n local = (_e32 * vec4<f32>(_e33.x, _e33.y, _e33.z, 1f));\n let _e40 = unnamed.uModel;\n model = _e40;\n let _e41 = model;\n let _e42 = local;\n world = (_e41 * _e42);\n let _e44 = world;\n param_8 = _e44.xyz;\n let _e47 = aChannel_1[0u];\n param_9 = _e47;\n let _e48 = channelBend_u0028_vf3_u003b_f1_u003b((&param_8), (&param_9));\n bent = _e48;\n let _e50 = unnamed.uLightViewProj;\n let _e51 = bent;\n let _e53 = world[3u];\n vLightPosition = (_e50 * vec4<f32>(_e51.x, _e51.y, _e51.z, _e53));\n let _e59 = vLightPosition;\n unnamed_1.gl_Position = _e59;\n let _e61 = bent;\n vGlassWorld = _e61;\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>, @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 aPosition_1 = aPosition;\n aChannel_1 = aChannel;\n main_1();\n let _e17 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e17);\n let _e19 = vLightPosition;\n let _e20 = unnamed_1.gl_Position;\n let _e21 = vGlassWorld;\n return VertexOutput(_e19, _e20, _e21);\n}\n";
33
33
 
34
34
  export const GLASS_TINT_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 @location(1) member_1: vec3<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> vGlassWorld: vec3<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 _e23 = (*sway);\n if (_e23 <= 0f) {\n let _e25 = (*worldPos);\n return _e25;\n }\n let _e26 = (*worldPos);\n let _e29 = unnamed.uWindSpatialPhase;\n let _e32 = unnamed.uWindTime;\n phase = (dot(_e26.xz, _e29) + _e32);\n let _e35 = unnamed.uWindSpeed;\n let _e37 = unnamed.uWindGust;\n let _e39 = phase;\n let _e42 = (*sway);\n bend = (((_e35 + _e37) * sin(_e39)) * _e42);\n let _e45 = (*worldPos)[0u];\n let _e48 = unnamed.uWindDirection[0u];\n let _e49 = bend;\n let _e53 = (*worldPos)[1u];\n let _e55 = (*worldPos)[2u];\n let _e58 = unnamed.uWindDirection[1u];\n let _e59 = bend;\n return vec3<f32>((_e45 + (_e48 * _e49)), _e53, (_e55 + (_e58 * _e59)));\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 _e25 = aPosition_1;\n local = vec4<f32>(_e25.x, _e25.y, _e25.z, 1f);\n let _e31 = unnamed.uModel;\n model = _e31;\n let _e32 = model;\n let _e33 = local;\n world = (_e32 * _e33);\n let _e35 = world;\n param = _e35.xyz;\n let _e38 = aChannel_1[0u];\n param_1 = _e38;\n let _e39 = channelBend_u0028_vf3_u003b_f1_u003b((&param), (&param_1));\n bent = _e39;\n let _e41 = unnamed.uLightViewProj;\n let _e42 = bent;\n let _e44 = world[3u];\n vLightPosition = (_e41 * vec4<f32>(_e42.x, _e42.y, _e42.z, _e44));\n let _e50 = vLightPosition;\n unnamed_1.gl_Position = _e50;\n let _e52 = bent;\n vGlassWorld = _e52;\n return;\n}\n\n@vertex \nfn main(@location(0) aPosition: vec3<f32>, @location(13) aChannel: vec4<f32>) -> VertexOutput {\n aPosition_1 = aPosition;\n aChannel_1 = aChannel;\n main_1();\n let _e9 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e9);\n let _e11 = vLightPosition;\n let _e12 = unnamed_1.gl_Position;\n let _e13 = vGlassWorld;\n return VertexOutput(_e11, _e12, _e13);\n}\n";
35
35
 
@@ -113,8 +113,8 @@ export const DEPTH_BINDINGS = {
113
113
  },
114
114
  "uAlphaCutout": {
115
115
  "offset": 176,
116
- "size": 4,
117
- "type": "float"
116
+ "size": 8,
117
+ "type": "vec2"
118
118
  }
119
119
  },
120
120
  "textures": {}
@@ -158,8 +158,8 @@ export const DEPTH_BINDINGS = {
158
158
  },
159
159
  "uAlphaCutout": {
160
160
  "offset": 80,
161
- "size": 4,
162
- "type": "float"
161
+ "size": 8,
162
+ "type": "vec2"
163
163
  }
164
164
  },
165
165
  "textures": {}
@@ -221,7 +221,26 @@ export const DEPTH_BINDINGS = {
221
221
  "texture": 16,
222
222
  "sampler": 17,
223
223
  "type": "sampler2D"
224
+ },
225
+ "uClothBinding": {
226
+ "texture": 18,
227
+ "sampler": 19,
228
+ "type": "sampler2D"
229
+ },
230
+ "uClothParticles": {
231
+ "texture": 20,
232
+ "sampler": 21,
233
+ "type": "sampler2D"
234
+ },
235
+ "uClothRest": {
236
+ "texture": 22,
237
+ "sampler": 23,
238
+ "type": "sampler2D"
224
239
  }
240
+ },
241
+ "overrides": {
242
+ "SKIN_EIGHT": 0,
243
+ "CLOTH_BOUND": 1
225
244
  }
226
245
  },
227
246
  "DEPTH_VERT": {
@@ -340,8 +359,8 @@ export const DEPTH_BINDINGS = {
340
359
  },
341
360
  "uAlphaCutout": {
342
361
  "offset": 176,
343
- "size": 4,
344
- "type": "float"
362
+ "size": 8,
363
+ "type": "vec2"
345
364
  }
346
365
  },
347
366
  "textures": {}
@@ -384,8 +403,8 @@ export const DEPTH_BINDINGS = {
384
403
  },
385
404
  "uAlphaCutout": {
386
405
  "offset": 80,
387
- "size": 4,
388
- "type": "float"
406
+ "size": 8,
407
+ "type": "vec2"
389
408
  }
390
409
  },
391
410
  "textures": {}
@@ -448,6 +467,9 @@ export const DEPTH_BINDINGS = {
448
467
  "sampler": 17,
449
468
  "type": "sampler2D"
450
469
  }
470
+ },
471
+ "overrides": {
472
+ "SKIN_EIGHT": 0
451
473
  }
452
474
  },
453
475
  "GLASS_TINT_VERT": {