@driftengine/core 4.8.6 → 4.8.7

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 (139) hide show
  1. package/CHANGELOG.json +71 -0
  2. package/README.md +1 -1
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.js +1 -1
  5. package/dist/render/anisotropicLobe.d.ts +10 -0
  6. package/dist/render/anisotropicLobe.js +19 -0
  7. package/dist/render/areaLights.d.ts +35 -0
  8. package/dist/render/areaLights.js +35 -0
  9. package/dist/render/backend/api.d.ts +33 -3
  10. package/dist/render/backend/webgl2/renderer.d.ts +50 -14
  11. package/dist/render/backend/webgl2/renderer.js +141 -30
  12. package/dist/render/backend/webgl2/sceneCaptureTarget.d.ts +29 -0
  13. package/dist/render/backend/webgl2/sceneCaptureTarget.js +96 -0
  14. package/dist/render/backend/webgpu/particlePass.js +2 -1
  15. package/dist/render/backend/webgpu/renderer.d.ts +35 -1
  16. package/dist/render/backend/webgpu/renderer.js +155 -16
  17. package/dist/render/backend/webgpu/sceneCaptureTarget.d.ts +24 -0
  18. package/dist/render/backend/webgpu/sceneCaptureTarget.js +59 -0
  19. package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.d.ts +1 -1
  20. package/dist/render/backend/webgpu/surfaceTexturePass.d.ts +4 -1
  21. package/dist/render/backend/webgpu/surfaceTexturePass.js +34 -8
  22. package/dist/render/backend/webgpu/waterPass.d.ts +1 -1
  23. package/dist/render/clusteredLights.d.ts +23 -5
  24. package/dist/render/clusteredLights.js +35 -8
  25. package/dist/render/driftLight/bake.d.ts +2 -0
  26. package/dist/render/driftLight/bake.js +1 -1
  27. package/dist/render/driftLight/falloff.d.ts +4 -2
  28. package/dist/render/driftLight/falloff.js +8 -2
  29. package/dist/render/gi/bounceLights.d.ts +3 -2
  30. package/dist/render/gi/bounceLights.js +8 -3
  31. package/dist/render/instanceCull.js +5 -0
  32. package/dist/render/instances.d.ts +19 -5
  33. package/dist/render/instances.js +9 -3
  34. package/dist/render/lightBudget.d.ts +12 -1
  35. package/dist/render/lightBudget.js +23 -3
  36. package/dist/render/lightmap.d.ts +23 -9
  37. package/dist/render/lightmap.js +40 -18
  38. package/dist/render/particlePool.d.ts +21 -0
  39. package/dist/render/particlePool.js +7 -0
  40. package/dist/render/pointLightSelection.d.ts +13 -0
  41. package/dist/render/pointLightSelection.js +3 -1
  42. package/dist/render/renderQuality.d.ts +8 -7
  43. package/dist/render/rendererHarness.js +3 -0
  44. package/dist/render/rgb9e5.d.ts +22 -0
  45. package/dist/render/rgb9e5.js +47 -0
  46. package/dist/render/sceneCapture.d.ts +29 -0
  47. package/dist/render/sceneCapture.js +36 -0
  48. package/dist/render/screenSpaceReflection.d.ts +27 -1
  49. package/dist/render/screenSpaceReflection.js +9 -0
  50. package/dist/render/shaders/bolt.d.ts +1 -1
  51. package/dist/render/shaders/bolt.js +7 -1
  52. package/dist/render/shaders/depth.js +11 -0
  53. package/dist/render/shaders/flat/anisotropic.d.ts +1 -1
  54. package/dist/render/shaders/flat/anisotropic.js +37 -3
  55. package/dist/render/shaders/flat/areaLight.d.ts +1 -1
  56. package/dist/render/shaders/flat/areaLight.js +46 -0
  57. package/dist/render/shaders/flat/glassTint.d.ts +3 -2
  58. package/dist/render/shaders/flat/glassTint.js +3 -1
  59. package/dist/render/shaders/flat/index.d.ts +5 -0
  60. package/dist/render/shaders/flat/index.js +16 -2
  61. package/dist/render/shaders/flat/lobes.d.ts +6 -0
  62. package/dist/render/shaders/flat/lobes.js +49 -43
  63. package/dist/render/shaders/flat/main.d.ts +1 -1
  64. package/dist/render/shaders/flat/main.js +57 -22
  65. package/dist/render/shaders/flat/models.d.ts +5 -2
  66. package/dist/render/shaders/flat/models.js +100 -16
  67. package/dist/render/shaders/flat/preamble.js +10 -3
  68. package/dist/render/shaders/generated/bolt.wgsl.d.ts +1 -1
  69. package/dist/render/shaders/generated/bolt.wgsl.js +1 -1
  70. package/dist/render/shaders/generated/depth.wgsl.d.ts +4 -4
  71. package/dist/render/shaders/generated/depth.wgsl.js +4 -4
  72. package/dist/render/shaders/generated/flat.wgsl.d.ts +16 -0
  73. package/dist/render/shaders/generated/flat.wgsl.js +54 -38
  74. package/dist/render/shaders/generated/ssrTrace.wgsl.d.ts +11 -6
  75. package/dist/render/shaders/generated/ssrTrace.wgsl.js +11 -6
  76. package/dist/render/shaders/generated/water.wgsl.d.ts +23 -16
  77. package/dist/render/shaders/generated/water.wgsl.js +23 -16
  78. package/dist/render/shaders/gi/probeBake.wgsl.js +9 -5
  79. package/dist/render/shaders/recon/motion.wgsl.d.ts +1 -1
  80. package/dist/render/shaders/recon/motion.wgsl.js +13 -2
  81. package/dist/render/shaders/ssrTrace.js +20 -1
  82. package/dist/render/shaders/water.d.ts +1 -1
  83. package/dist/render/shaders/water.js +12 -3
  84. package/dist/render/skinScatter.d.ts +3 -1
  85. package/dist/render/skinScatter.js +3 -1
  86. package/dist/render/ssrPass.js +1 -0
  87. package/dist/render/surfaceModel.d.ts +29 -8
  88. package/dist/render/surfaceModel.js +33 -9
  89. package/dist/render/surfaceTexture.d.ts +25 -1
  90. package/dist/render/surfaceTexture.js +27 -5
  91. package/package.json +6 -6
  92. package/src/index.ts +6 -2
  93. package/src/render/anisotropicLobe.ts +29 -0
  94. package/src/render/areaLights.ts +58 -0
  95. package/src/render/backend/api.ts +49 -2
  96. package/src/render/backend/webgl2/renderer.ts +192 -38
  97. package/src/render/backend/webgl2/sceneCaptureTarget.ts +130 -0
  98. package/src/render/backend/webgpu/particlePass.ts +2 -1
  99. package/src/render/backend/webgpu/renderer.ts +194 -19
  100. package/src/render/backend/webgpu/sceneCaptureTarget.ts +63 -0
  101. package/src/render/backend/webgpu/surfaceTexturePass.ts +44 -14
  102. package/src/render/clusteredLights.ts +41 -8
  103. package/src/render/driftLight/bake.ts +3 -1
  104. package/src/render/driftLight/falloff.ts +13 -2
  105. package/src/render/gi/bounceLights.ts +12 -3
  106. package/src/render/instanceCull.ts +4 -0
  107. package/src/render/instances.ts +26 -6
  108. package/src/render/lightBudget.ts +40 -2
  109. package/src/render/lightmap.ts +64 -23
  110. package/src/render/particlePool.ts +23 -0
  111. package/src/render/pointLightSelection.ts +20 -1
  112. package/src/render/renderQuality.ts +8 -7
  113. package/src/render/rendererHarness.ts +3 -0
  114. package/src/render/rgb9e5.ts +52 -0
  115. package/src/render/sceneCapture.ts +56 -0
  116. package/src/render/screenSpaceReflection.ts +33 -1
  117. package/src/render/shaders/bolt.ts +7 -1
  118. package/src/render/shaders/depth.ts +11 -0
  119. package/src/render/shaders/flat/anisotropic.ts +37 -3
  120. package/src/render/shaders/flat/areaLight.ts +46 -0
  121. package/src/render/shaders/flat/glassTint.ts +9 -2
  122. package/src/render/shaders/flat/index.ts +21 -2
  123. package/src/render/shaders/flat/lobes.ts +50 -43
  124. package/src/render/shaders/flat/main.ts +57 -22
  125. package/src/render/shaders/flat/models.ts +100 -16
  126. package/src/render/shaders/flat/preamble.ts +10 -3
  127. package/src/render/shaders/generated/bolt.wgsl.ts +1 -1
  128. package/src/render/shaders/generated/depth.wgsl.ts +4 -4
  129. package/src/render/shaders/generated/flat.wgsl.ts +54 -38
  130. package/src/render/shaders/generated/ssrTrace.wgsl.ts +11 -6
  131. package/src/render/shaders/generated/water.wgsl.ts +23 -16
  132. package/src/render/shaders/gi/probeBake.wgsl.ts +9 -5
  133. package/src/render/shaders/recon/motion.wgsl.ts +13 -2
  134. package/src/render/shaders/ssrTrace.ts +20 -1
  135. package/src/render/shaders/water.ts +12 -3
  136. package/src/render/skinScatter.ts +3 -1
  137. package/src/render/ssrPass.ts +1 -0
  138. package/src/render/surfaceModel.ts +47 -10
  139. package/src/render/surfaceTexture.ts +69 -9
@@ -543,7 +543,7 @@ export const MAIN_GLSL = `void main() {
543
543
  * specularLobe's header argues for at length.
544
544
  */
545
545
  float sunVoH = max(dot(normalize(uCameraPos - vWorldPos), halfway), 0.0);
546
- vec3 sunSpec = mix(specColor, vec3(1.0), pow(1.0 - sunVoH, 5.0) * metal);
546
+ vec3 sunSpec = highlightTint(specColor, sunVoH, metal);
547
547
  /*
548
548
  * **Held back until after the environment blend, because that blend is a mix and would
549
549
  * otherwise erase this.**
@@ -562,8 +562,12 @@ export const MAIN_GLSL = `void main() {
562
562
  * Zero for the whole world that carries no specular attribute and no metalness, exactly as
563
563
  * before: \`sunSpec\` is \`vec3(vSpecular)\` at metal 0 and \`vSpecular\` defaults to 0.
564
564
  */
565
- vec3 sunHighlight =
566
- sunColor * specularLobe(max(dot(n, halfway), 0.0), surfaceRoughness) * sunSpec * sunShade * sunFacing;
565
+ /* GGX's own where the surface asks (\`physicalSpecular\`): the sun is a point, so nothing widens it. */
566
+ float sunNdh = max(dot(n, halfway), 0.0);
567
+ float sunLobe = physicalSpecular()
568
+ ? physicalLobe(sunNdh, ndl, dot(n, normalize(uCameraPos - vWorldPos)), surfaceRoughness, 0.0, 1.0)
569
+ : specularLobe(sunNdh, surfaceRoughness);
570
+ vec3 sunHighlight = sunColor * sunLobe * sunSpec * sunShade * sunFacing;
567
571
  if (modelled) sunHighlight = sunModelSpecular;
568
572
  /*
569
573
  * The dielectric's share goes in here, where it has always gone, so the environment blend
@@ -1067,6 +1071,10 @@ export const MAIN_GLSL = `void main() {
1067
1071
  float cookie;
1068
1072
  /* The light's lighting channels, a mask: 1 unless it names others. See \`uLightIesAxis\`. */
1069
1073
  float lightChannels = 1.0;
1074
+ /* The light's own falloff exponent, or 0 for the frame's falloff. See \`uLightCone\`. */
1075
+ float lightExponent = 0.0;
1076
+ /* A clustered rectangle's barn doors: their cosine and length, none at 0. See \`areaBarnDoors\`. */
1077
+ vec2 areaDoors = vec2(0.0);
1070
1078
  /*
1071
1079
  * **A rectangle in the froxel table** — one past the fixed arm's \`maxAreaLights\` — which
1072
1080
  * its record says with a negative radius, its reach negated. Its fields come out of the
@@ -1117,8 +1125,8 @@ export const MAIN_GLSL = `void main() {
1117
1125
  lightWeight = sizeAndWeight.y;
1118
1126
  /*
1119
1127
  * **The fixture, read only for a light that has one.** What a plain light's record holds in
1120
- * the last three texels is exactly these values, so a light carrying no shadow slot, cone,
1121
- * profile or cookie shades the same whether they are read or assumed, and at heavy overlap
1128
+ * the last four texels is exactly these values, so a light carrying no shadow slot, cone,
1129
+ * profile, cookie, channels or falloff of its own shades the same whether they are read or assumed, and at heavy overlap
1122
1130
  * reading them was a third of the pass. A branch on a value from a texture around
1123
1131
  * \`texelFetch\` is not the 2026-08-07 case: an integer fetch takes no derivative.
1124
1132
  *
@@ -1138,6 +1146,7 @@ export const MAIN_GLSL = `void main() {
1138
1146
  uvec4 rec2 = clusterTexel(record + 2);
1139
1147
  uvec4 rec3 = clusterTexel(record + 3);
1140
1148
  uvec4 rec4 = clusterTexel(record + 4);
1149
+ uvec4 rec5 = clusterTexel(record + 5);
1141
1150
  shadowSlot = clusteredArea ? -1 : int(uintBitsToFloat(rec2.x));
1142
1151
  areaTwoSided = uintBitsToFloat(rec2.x);
1143
1152
  lightDir = vec3(
@@ -1150,6 +1159,8 @@ export const MAIN_GLSL = `void main() {
1150
1159
  iesAxis = vec3(
1151
1160
  uintBitsToFloat(rec4.x), uintBitsToFloat(rec4.y), uintBitsToFloat(rec4.z));
1152
1161
  lightChannels = uintBitsToFloat(rec4.w);
1162
+ lightExponent = uintBitsToFloat(rec5.x);
1163
+ areaDoors = vec2(uintBitsToFloat(rec5.y), uintBitsToFloat(rec5.z));
1153
1164
  }
1154
1165
  }
1155
1166
  } else {
@@ -1162,7 +1173,8 @@ export const MAIN_GLSL = `void main() {
1162
1173
  lightWeight = uLightWeight[i];
1163
1174
  shadowSlot = i;
1164
1175
  lightDir = uLightDir[i];
1165
- lightCone = uLightCone[i];
1176
+ lightCone = uLightCone[i].xy;
1177
+ lightExponent = uLightCone[i].z;
1166
1178
  iesProfile = uLightIesProfile[i];
1167
1179
  iesAxis = uLightIesAxis[i].xyz;
1168
1180
  lightChannels = uLightIesAxis[i].w;
@@ -1188,12 +1200,15 @@ export const MAIN_GLSL = `void main() {
1188
1200
  * froxel it is binned into has no edge in the picture.
1189
1201
  */
1190
1202
  if (clusteredArea) {
1191
- float areaForm = areaSignedForm(n, lightPos, lightDir, iesAxis, lightCone);
1203
+ vec3 seenCentre = lightPos;
1204
+ vec2 seenHalf = lightCone;
1205
+ if (!areaBarnDoors(seenCentre, lightDir, iesAxis, seenHalf, areaDoors)) continue;
1206
+ float areaForm = areaSignedForm(n, seenCentre, lightDir, iesAxis, seenHalf);
1192
1207
  float areaWindow = clamp(1.0 - pow(length(lightPos - vWorldPos) / max(lightRadius, 1e-4), 4.0), 0.0, 1.0);
1193
1208
  areaForm = mix(max(0.0, areaForm), abs(areaForm), areaTwoSided);
1194
1209
  if (areaForm > 0.0) {
1195
1210
  areaLightAdd(
1196
- lightPos, lightDir, iesAxis, lightCone, lightColor * (areaWindow * areaWindow), areaForm,
1211
+ seenCentre, lightDir, iesAxis, seenHalf, lightColor * (areaWindow * areaWindow), areaForm,
1197
1212
  1.0, vec3(1.0), n, albedo, metal, specColor, surfaceRoughness, modelled,
1198
1213
  lampOpen, lampShadowed
1199
1214
  );
@@ -1244,7 +1259,16 @@ export const MAIN_GLSL = `void main() {
1244
1259
  * same way three.js windows its own, so the light still ends where it says it does.
1245
1260
  */
1246
1261
  float falloff;
1247
- if (uLightFalloff == 1) {
1262
+ /*
1263
+ * **A light may name its own falloff, and then it is Unreal's for a light without
1264
+ * inverse-square falloff**: \`(1 - (d/R)^2)^n\` with no distance term, so a fill authored to
1265
+ * light a whole hall across a hundred metres does, where the inverse square would have it
1266
+ * gone a few metres out. Zero is the frame's own rule below, which every light was before.
1267
+ */
1268
+ if (lightExponent > 0.0) {
1269
+ float reach = dist / max(lightRadius, 1e-4);
1270
+ falloff = pow(clamp(1.0 - reach * reach, 0.0, 1.0), lightExponent);
1271
+ } else if (uLightFalloff == 1) {
1248
1272
  float window = clamp(1.0 - pow(dist / max(lightRadius, 1e-4), 4.0), 0.0, 1.0);
1249
1273
  falloff = window * window / max(dist * dist, 0.01);
1250
1274
  } else {
@@ -1507,7 +1531,11 @@ export const MAIN_GLSL = `void main() {
1507
1531
  photometric = mix(1.0, iesGain, step(0.0, iesProfile));
1508
1532
  }
1509
1533
 
1510
- float shape = (uLightFalloff == 1 ? falloff : falloff * falloff) * coneFalloff * photometric;
1534
+ /* A light's own exponent already is its whole curve; the frame's smooth rule squares its own. */
1535
+ float shape =
1536
+ (lightExponent > 0.0 || uLightFalloff == 1 ? falloff : falloff * falloff) *
1537
+ coneFalloff *
1538
+ photometric;
1511
1539
  glassGlow += lightColor * backNdl * shape * lightWeight * shaded * lampGlass;
1512
1540
  if (ndl <= 0.0 && !modelledBehind) continue;
1513
1541
  /*
@@ -1584,16 +1612,15 @@ export const MAIN_GLSL = `void main() {
1584
1612
  if (vSpecular > 0.0 || metal > 0.0) {
1585
1613
  vec3 toEyeLamp = normalize(uCameraPos - vWorldPos);
1586
1614
  vec3 lampHalfway = normalize(toLight / max(dist, 1e-4) + toEyeLamp);
1587
- /* The same grazing whitening the sun's highlight takes, and zero at metal 0. */
1588
- vec3 lampSpec = mix(
1589
- specColor,
1590
- vec3(1.0),
1591
- pow(1.0 - max(dot(toEyeLamp, lampHalfway), 0.0), 5.0) * metal
1592
- );
1615
+ /* The same grazing whitening the sun's highlight takes, and zero at metal 0 for the look. */
1616
+ vec3 lampSpec = highlightTint(specColor, max(dot(toEyeLamp, lampHalfway), 0.0), metal);
1617
+ /* The look's lobe, or GGX's own where the surface asks for it: see \`physicalLobe\`. */
1618
+ float lampNdh = max(dot(n, lampHalfway), 0.0);
1619
+ float lampLobe = physicalSpecular()
1620
+ ? physicalLobe(lampNdh, ndl, dot(n, toEyeLamp), surfaceRoughness, lightSourceRadius, dist)
1621
+ : sphereLobe(lampNdh, surfaceRoughness, lightSourceRadius, dist);
1593
1622
  /* Held back with the diffuse half, and shadowed by the same term it always was. */
1594
- vec3 lampHighlight =
1595
- lightColor * sphereLobe(max(dot(n, lampHalfway), 0.0), surfaceRoughness, lightSourceRadius, dist)
1596
- * lampSpec * shape * lightWeight;
1623
+ vec3 lampHighlight = lightColor * lampLobe * lampSpec * shape * lightWeight;
1597
1624
  lampOpen += lampHighlight;
1598
1625
  lampShadowed += lampHighlight * shaded * lampGlass;
1599
1626
  }
@@ -1637,10 +1664,18 @@ export const MAIN_GLSL = `void main() {
1637
1664
  vec3 centre = uAreaLightPos[a];
1638
1665
  vec3 right = uAreaLightRight[a];
1639
1666
  vec3 up = uAreaLightUp[a];
1640
- vec2 halfSize = uAreaLightSize[a];
1667
+ vec2 halfSize = uAreaLightSize[a].xy;
1668
+ /*
1669
+ * **The part of the rectangle this fragment sees past its barn doors** (\`areaBarnDoors\`),
1670
+ * which its light and highlight come from. Its shadow keeps the whole rectangle's centre and
1671
+ * size below, because that is what its map was baked from.
1672
+ */
1673
+ vec3 seenCentre = centre;
1674
+ vec2 seenHalf = halfSize;
1675
+ if (!areaBarnDoors(seenCentre, right, up, seenHalf, uAreaLightSize[a].zw)) continue;
1641
1676
 
1642
1677
  /* The form factor and its sign, which is the sidedness: see \`areaSignedForm\`. */
1643
- float signedForm = areaSignedForm(n, centre, right, up, halfSize);
1678
+ float signedForm = areaSignedForm(n, seenCentre, right, up, seenHalf);
1644
1679
  float form = mix(max(0.0, signedForm), abs(signedForm), uAreaLightTwoSided[a]);
1645
1680
  /* The form factor is linear in the normal, so the one seen from behind is its negation. */
1646
1681
  float backForm = glassTransmission > 0.0
@@ -1757,7 +1792,7 @@ export const MAIN_GLSL = `void main() {
1757
1792
  if (form <= 0.0) continue;
1758
1793
  /* The diffuse, the model's answer or the lobe integrated over the rectangle: see areaLight.ts. */
1759
1794
  areaLightAdd(
1760
- centre, right, up, halfSize, uAreaLightColor[a], form, areaOccl, areaGlass,
1795
+ seenCentre, right, up, seenHalf, uAreaLightColor[a], form, areaOccl, areaGlass,
1761
1796
  n, albedo, metal, specColor, surfaceRoughness, modelled, lampOpen, lampShadowed
1762
1797
  );
1763
1798
  }
@@ -48,6 +48,12 @@ const bool SKIN_ALBEDO = false; // wgsl:override
48
48
  * Declared after skin's halves so that every switch before it keeps the id it shipped with.
49
49
  */
50
50
  const bool MODEL_LIGHTMAP = false; // wgsl:override
51
+ /*
52
+ * Not a model either: whether this program carries GGX's own highlight for a material that asks
53
+ * (\`SurfaceMaterial.physicalSpecular\`). A lit switch, off until a material first asks and then
54
+ * on for good, as \`litSwitchesGlsl\`'s are; declared last so every switch before it keeps its id.
55
+ */
56
+ const bool PHYSICAL_SPECULAR = PHYSICAL_SPECULAR_ON; // wgsl:override
51
57
 
52
58
  /*
53
59
  * A model's numbers, two vectors a material — the lit stage's uniform budget has no more room
@@ -126,15 +132,57 @@ float smithMasking(float ndl, float ndv, float alpha) {
126
132
  );
127
133
  }
128
134
 
135
+ /*
136
+ * Whether this surface's highlights are GGX's own (\`SurfaceMaterial.physicalSpecular\`), from the
137
+ * lane the standard, lightmap and anisotropic models leave free (\`packModel\`). Skin, hair and the
138
+ * eye shade their own highlights, and the eye's axis holds that lane, so they are never asked. The
139
+ * lit switch first, so a program built before any material asked carries none of it.
140
+ */
141
+ bool physicalSpecular() {
142
+ if (PHYSICAL_SPECULAR) {
143
+ if (MODEL_HAIR) return false;
144
+ if (MODEL_SKIN) return false;
145
+ if (MODEL_EYE) return false;
146
+ return uModelParams[1].z > 0.5;
147
+ }
148
+ return false;
149
+ }
150
+
151
+ /**
152
+ * GGX as a BRDF in this engine's light units, \`π · D · Vis · N·L\` with Fresnel left to the caller:
153
+ * the term skin's and the eye's highlights are, for a surface that asks for it. Its peak is
154
+ * \`1 / (4 α²)\` of the light head-on, against the look's 1. A lamp's size widens α as \`sphereLobe\`
155
+ * widens it, and a normalised distribution keeps its energy as it widens.
156
+ */
157
+ float physicalLobe(float ndh, float ndl, float ndv, float roughness, float sourceRadius, float dist) {
158
+ float grow = sourceRadius / max(2.0 * dist, 1e-3);
159
+ float alpha = min(max(roughness * roughness, MIN_LOBE_ALPHA) + grow, 1.0);
160
+ return 3.14159265 * ggxLobe(ndh, alpha) * smithMasking(ndl, max(ndv, 1e-4), alpha) * ndl;
161
+ }
162
+
163
+ /**
164
+ * A highlight's colour: Schlick's Fresnel from the surface's reflectance toward white at a grazing
165
+ * \`voh\`. On a metal alone for the look, whose dielectric attribute is a strength rather than a
166
+ * reflectance; on every surface where the highlight is physical, whose attribute is its F0 — but
167
+ * one reflecting nothing head-on keeps nothing, as the lamps' gate on that attribute has it.
168
+ */
169
+ vec3 highlightTint(vec3 specColor, float voh, float metal) {
170
+ float edge = pow(1.0 - voh, 5.0);
171
+ bool reflects = max(max(specColor.r, specColor.g), specColor.b) > 0.0;
172
+ return mix(specColor, vec3(1.0), physicalSpecular() && reflects ? edge : edge * metal);
173
+ }
174
+
129
175
  /** The standard model's answer to one light, which a model falls back to for what it does not change. */
130
176
  void standardLight(vec3 l, float sourceRadius, float dist) {
131
177
  float ndl = max(dot(mNormal, l), 0.0);
132
178
  vec3 h = normalize(l + mToEye);
133
179
  float ndh = max(dot(mNormal, h), 0.0);
134
- float lobe = sourceRadius > 0.0
135
- ? sphereLobe(ndh, mRoughness, sourceRadius, dist)
136
- : specularLobe(ndh, mRoughness);
137
- vec3 tint = mix(mSpecColor, vec3(1.0), pow(1.0 - max(dot(mToEye, h), 0.0), 5.0) * mMetal);
180
+ float lobe = physicalSpecular()
181
+ ? physicalLobe(ndh, ndl, dot(mNormal, mToEye), mRoughness, sourceRadius, dist)
182
+ : sourceRadius > 0.0
183
+ ? sphereLobe(ndh, mRoughness, sourceRadius, dist)
184
+ : specularLobe(ndh, mRoughness);
185
+ vec3 tint = highlightTint(mSpecColor, max(dot(mToEye, h), 0.0), mMetal);
138
186
  mDiffuse = mAlbedo * ndl * (1.0 - mMetal);
139
187
  mSpecular = ndl > 0.0 ? tint * lobe : vec3(0.0);
140
188
  }
@@ -253,20 +301,51 @@ vec3 modelEnvironment(vec3 environment) {
253
301
  return environment;
254
302
  }
255
303
 
304
+ /**
305
+ * One texel of a page's irradiance layer: its four bytes put back into the rgb9e5 word they are,
306
+ * lowest first, and decoded — three 9-bit mantissas over the exponent in the top five bits.
307
+ */
308
+ vec3 bakedIrradianceAt(ivec3 texel) {
309
+ uvec4 bytes = uvec4(texelFetch(uModelMap, texel, 0) * 255.0 + 0.5);
310
+ uint word = bytes.x | (bytes.y << 8u) | (bytes.z << 16u) | (bytes.w << 24u);
311
+ float scale = exp2(float(word >> 27u) - 24.0);
312
+ return vec3(float(word & 511u), float((word >> 9u) & 511u), float((word >> 18u) & 511u)) * scale;
313
+ }
314
+
256
315
  /**
257
316
  * What a baked page adds to this surface's diffuse: nothing in any pipeline but a lightmapped one,
258
317
  * nor in one whose page is missing. The page's two layers at the surface's second coordinates, which
259
318
  * ride the grain and relief lanes as \`-1 - uv\` (lightmap.ts) and are placed by the material's
260
319
  * region: the irradiance, and the first-order harmonic its direction is, answered by the shading
261
320
  * normal.
262
- * **An explicit level**, because the page has one and nothing here needs a derivative.
321
+ *
322
+ * **Filtered here, because the page cannot be filtered as it is stored**: the irradiance is a
323
+ * shared-exponent word in four bytes, and a blend of two words is not the blend of their colours.
324
+ * So the four texels around the sample are fetched, decoded and blended, as a bilinear sampler
325
+ * clamped at the page's edge would. Fetches need no derivative, so the branch costs nothing there.
263
326
  */
264
327
  vec3 modelBaked(vec3 n, vec3 albedo, float metal) {
265
328
  if (MODEL_LIGHTMAP) {
266
329
  if (uModelParams[1].w <= 0.0) return vec3(0.0);
267
330
  vec2 at = (vec2(-1.0) - vec2(vGrain, vRelief)) * uModelParams[0].xy + uModelParams[0].zw;
268
- vec3 irradiance = textureLod(uModelMap, vec3(at, 0.0), 0.0).rgb;
269
- vec4 d = textureLod(uModelMap, vec3(at, 1.0), 0.0) * 2.0 - 1.0;
331
+ ivec2 size = textureSize(uModelMap, 0).xy;
332
+ vec2 texel = at * vec2(size) - 0.5;
333
+ vec2 corner = floor(texel);
334
+ vec2 f = texel - corner;
335
+ ivec2 last = size - 1;
336
+ ivec2 lo = clamp(ivec2(corner), ivec2(0), last);
337
+ ivec2 hi = clamp(ivec2(corner) + 1, ivec2(0), last);
338
+ vec3 irradiance = mix(
339
+ mix(bakedIrradianceAt(ivec3(lo.x, lo.y, 0)), bakedIrradianceAt(ivec3(hi.x, lo.y, 0)), f.x),
340
+ mix(bakedIrradianceAt(ivec3(lo.x, hi.y, 0)), bakedIrradianceAt(ivec3(hi.x, hi.y, 0)), f.x),
341
+ f.y
342
+ );
343
+ vec4 direction = mix(
344
+ mix(texelFetch(uModelMap, ivec3(lo.x, lo.y, 1), 0), texelFetch(uModelMap, ivec3(hi.x, lo.y, 1), 0), f.x),
345
+ mix(texelFetch(uModelMap, ivec3(lo.x, hi.y, 1), 0), texelFetch(uModelMap, ivec3(hi.x, hi.y, 1), 0), f.x),
346
+ f.y
347
+ );
348
+ vec4 d = direction * 2.0 - 1.0;
270
349
  return albedo * (1.0 - metal) * irradiance * max(dot(d.xyz, n) + d.w, 0.0);
271
350
  }
272
351
  return vec3(0.0);
@@ -289,15 +368,20 @@ float modelReflectance(float standard) {
289
368
  }
290
369
  `;
291
370
 
292
- /** The models' whole chunk, at depth zero before `main`: see `flatFrag`. */
293
- export const MODELS_GLSL = [
294
- MODELS_HEAD,
295
- ANISOTROPIC_GLSL,
296
- HAIR_GLSL,
297
- SKIN_GLSL,
298
- EYE_GLSL,
299
- MODELS_DISPATCH,
300
- ].join('\n');
371
+ /**
372
+ * The models' whole chunk, at depth zero before `main`: see `flatFrag`. `physicalSpecular` is the
373
+ * \`PHYSICAL_SPECULAR\` lit switch's value, written in as \`litSwitchesGlsl\` writes the others.
374
+ */
375
+ export function modelsGlsl(physicalSpecular: boolean): string {
376
+ return [
377
+ MODELS_HEAD.replace('PHYSICAL_SPECULAR_ON', physicalSpecular ? 'true' : 'false'),
378
+ ANISOTROPIC_GLSL,
379
+ HAIR_GLSL,
380
+ SKIN_GLSL,
381
+ EYE_GLSL,
382
+ MODELS_DISPATCH,
383
+ ].join('\n');
384
+ }
301
385
 
302
386
  /**
303
387
  * Which half of a skin a lit pipeline draws under `skinScattering: 'screen-space'`: the whole
@@ -784,13 +784,15 @@ uniform float uLightWeight[MAX_LIGHTS];
784
784
  */
785
785
  uniform vec3 uLightDir[MAX_LIGHTS];
786
786
  /**
787
- * The cosine of each light's inner cone angle, then of its outer.
787
+ * The cosine of each light's inner cone angle, then of its outer, and in z the light's own falloff
788
+ * exponent, 0 for the frame's falloff (\`PointLightSource.falloffExponent\`): a \`vec2\` array cost
789
+ * a whole row a light anyway, so the exponent spends no row of its own.
788
790
  *
789
791
  * A light with no cone carries -1 and -2, which makes \`smoothstep(outer, inner, dot)\` exactly 1
790
792
  * for every direction on the sphere. See \`POINT_LIGHT_COS_OUTER\`: the pair is chosen so a point
791
793
  * light collapses to the arithmetic it had rather than to something very close to it.
792
794
  */
793
- uniform vec2 uLightCone[MAX_LIGHTS];
795
+ uniform vec4 uLightCone[MAX_LIGHTS];
794
796
  /**
795
797
  * Which row of the photometric atlas each light uses, or a negative index for none.
796
798
  *
@@ -895,7 +897,12 @@ uniform vec3 uAreaLightColor[MAX_AREA_LIGHTS];
895
897
  /** The rectangle's in-plane axes, unit length, and its half extents along each. */
896
898
  uniform vec3 uAreaLightRight[MAX_AREA_LIGHTS];
897
899
  uniform vec3 uAreaLightUp[MAX_AREA_LIGHTS];
898
- uniform vec2 uAreaLightSize[MAX_AREA_LIGHTS];
900
+ /*
901
+ * Each rectangle's half extents, and in zw its barn doors: the cosine of their angle from its normal
902
+ * and their length, 0 for none (\`areaBarnDoors\`). A \`vec2\` array costs a whole row a rectangle
903
+ * anyway, so the doors spend no row of their own.
904
+ */
905
+ uniform vec4 uAreaLightSize[MAX_AREA_LIGHTS];
899
906
  /**
900
907
  * Whether the rectangle emits from both faces, 1 or 0.
901
908
  *
@@ -5,7 +5,7 @@
5
5
  * the next generation, and `npm run wgsl:check` fails the build when this is stale.
6
6
  */
7
7
 
8
- export const BOLT_FRAG_WGSL = "struct Uniforms {\n uTime: f32,\n uCoreColor: vec3<f32>,\n uEdgeColor: vec3<f32>,\n uCoreGain: f32,\n uFogColor: vec3<f32>,\n uFogDensity: f32,\n uFogHeightFalloff: f32,\n uFogEyeY: f32,\n uUnderwaterColor: vec3<f32>,\n uUnderwaterFogDensity: f32,\n uUnderwaterFactor: f32,\n uFogMode: i32,\n uFogNear: f32,\n uFogFar: f32,\n uCameraPos: vec3<f32>,\n}\n\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vSide_1: f32;\nvar<private> vSeed_1: f32;\nvar<private> vAlong_1: f32;\nvar<private> vFade_1: f32;\nvar<private> vGain_1: f32;\nvar<private> vWorldPos_1: vec3<f32>;\nvar<private> outColor: vec4<f32>;\n\nfn mediumFog_u0028_f1_u003b_f1_u003b(dist: ptr<function, f32>, pointY: ptr<function, f32>) -> f32 {\n var span: f32;\n var ramp: f32;\n var wetLinear: f32;\n var t: f32;\n var denom: f32;\n var air: f32;\n var wet: f32;\n\n let _e48 = unnamed.uFogMode;\n if (_e48 == 1i) {\n let _e51 = unnamed.uFogFar;\n let _e53 = unnamed.uFogNear;\n span = max((_e51 - _e53), 0.0001f);\n let _e56 = (*dist);\n let _e58 = unnamed.uFogNear;\n let _e60 = span;\n ramp = clamp(((_e56 - _e58) / _e60), 0f, 1f);\n let _e64 = unnamed.uUnderwaterFactor;\n if (_e64 <= 0f) {\n let _e66 = ramp;\n return _e66;\n }\n let _e68 = unnamed.uUnderwaterFogDensity;\n let _e69 = (*dist);\n wetLinear = (_e68 * _e69);\n let _e71 = ramp;\n let _e72 = wetLinear;\n let _e74 = wetLinear;\n let _e80 = unnamed.uUnderwaterFactor;\n return mix(_e71, (1f - exp2(((-(_e72) * _e74) * 1.442695f))), _e80);\n }\n let _e82 = (*pointY);\n let _e84 = unnamed.uFogEyeY;\n let _e87 = unnamed.uFogHeightFalloff;\n t = ((_e82 - _e84) * _e87);\n let _e89 = t;\n let _e92 = t;\n denom = select(_e92, 0.0001f, (abs(_e89) < 0.0001f));\n let _e95 = unnamed.uFogDensity;\n let _e97 = (*dist);\n let _e99 = denom;\n let _e104 = denom;\n air = (1f - exp((((-(_e95) * _e97) * (1f - exp(-(_e99)))) / _e104)));\n let _e109 = unnamed.uUnderwaterFactor;\n if (_e109 <= 0f) {\n let _e111 = air;\n return _e111;\n }\n let _e113 = unnamed.uUnderwaterFogDensity;\n let _e114 = (*dist);\n wet = (_e113 * _e114);\n let _e116 = air;\n let _e117 = wet;\n let _e119 = wet;\n let _e125 = unnamed.uUnderwaterFactor;\n return mix(_e116, (1f - exp2(((-(_e117) * _e119) * 1.442695f))), _e125);\n}\n\nfn hash11_u0028_f1_u003b(p: ptr<function, f32>) -> f32 {\n let _e39 = (*p);\n return fract((sin((_e39 * 12.9898f)) * 43758.547f));\n}\n\nfn main_1() {\n var across: f32;\n var core: f32;\n var glow: f32;\n var t_1: f32;\n var stutter: f32;\n var param: f32;\n var param_1: f32;\n var taper: f32;\n var energy: f32;\n var lit: vec3<f32>;\n var fog: f32;\n var param_2: f32;\n var param_3: f32;\n\n let _e51 = vSide_1;\n across = (1f - abs(_e51));\n let _e54 = across;\n core = pow(_e54, 10f);\n let _e56 = across;\n glow = pow(_e56, 1.1f);\n let _e59 = unnamed.uTime;\n let _e61 = vSeed_1;\n t_1 = ((_e59 * 47f) + (_e61 * 17f));\n let _e64 = t_1;\n param = floor(_e64);\n let _e66 = hash11_u0028_f1_u003b((&param));\n let _e68 = t_1;\n param_1 = floor((_e68 * 2.37f));\n let _e71 = hash11_u0028_f1_u003b((&param_1));\n stutter = (0.78f + (0.22f * ((_e66 * 0.6f) + (_e71 * 0.4f))));\n let _e76 = vAlong_1;\n taper = (1f - (_e76 * 0.55f));\n let _e79 = vFade_1;\n let _e80 = stutter;\n let _e82 = taper;\n let _e84 = vGain_1;\n energy = (((_e79 * _e80) * _e82) * _e84);\n let _e87 = unnamed.uEdgeColor;\n let _e88 = glow;\n let _e91 = unnamed.uCoreColor;\n let _e92 = core;\n let _e95 = unnamed.uCoreGain;\n lit = ((_e87 * _e88) + ((_e91 * _e92) * _e95));\n let _e98 = vWorldPos_1;\n let _e100 = unnamed.uCameraPos;\n param_2 = distance(_e98, _e100);\n let _e103 = vWorldPos_1[1u];\n param_3 = _e103;\n let _e104 = mediumFog_u0028_f1_u003b_f1_u003b((&param_2), (&param_3));\n fog = _e104;\n let _e105 = lit;\n let _e106 = energy;\n let _e108 = fog;\n let _e110 = ((_e105 * _e106) * (1f - _e108));\n outColor = vec4<f32>(_e110.x, _e110.y, _e110.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vSide: f32, @location(3) vSeed: f32, @location(1) vAlong: f32, @location(2) vFade: f32, @location(4) vGain: f32, @location(5) vWorldPos: vec3<f32>) -> @location(0) vec4<f32> {\n vSide_1 = vSide;\n vSeed_1 = vSeed;\n vAlong_1 = vAlong;\n vFade_1 = vFade;\n vGain_1 = vGain;\n vWorldPos_1 = vWorldPos;\n main_1();\n let _e13 = outColor;\n return _e13;\n}\n";
8
+ export const BOLT_FRAG_WGSL = "struct Uniforms {\n uTime: f32,\n uCoreColor: vec3<f32>,\n uEdgeColor: vec3<f32>,\n uCoreGain: f32,\n uFogColor: vec3<f32>,\n uFogDensity: f32,\n uFogHeightFalloff: f32,\n uFogEyeY: f32,\n uUnderwaterColor: vec3<f32>,\n uUnderwaterFogDensity: f32,\n uUnderwaterFactor: f32,\n uFogMode: i32,\n uFogNear: f32,\n uFogFar: f32,\n uCameraPos: vec3<f32>,\n}\n\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vSide_1: f32;\nvar<private> vSeed_1: f32;\nvar<private> vAlong_1: f32;\nvar<private> vFade_1: f32;\nvar<private> vGain_1: f32;\nvar<private> vWorldPos_1: vec3<f32>;\nvar<private> outColor: vec4<f32>;\n\nfn mediumFog_u0028_f1_u003b_f1_u003b(dist: ptr<function, f32>, pointY: ptr<function, f32>) -> f32 {\n var span: f32;\n var ramp: f32;\n var wetLinear: f32;\n var t: f32;\n var denom: f32;\n var air: f32;\n var wet: f32;\n\n let _e48 = unnamed.uFogMode;\n if (_e48 == 1i) {\n let _e51 = unnamed.uFogFar;\n let _e53 = unnamed.uFogNear;\n span = max((_e51 - _e53), 0.0001f);\n let _e56 = (*dist);\n let _e58 = unnamed.uFogNear;\n let _e60 = span;\n ramp = clamp(((_e56 - _e58) / _e60), 0f, 1f);\n let _e64 = unnamed.uUnderwaterFactor;\n if (_e64 <= 0f) {\n let _e66 = ramp;\n return _e66;\n }\n let _e68 = unnamed.uUnderwaterFogDensity;\n let _e69 = (*dist);\n wetLinear = (_e68 * _e69);\n let _e71 = ramp;\n let _e72 = wetLinear;\n let _e74 = wetLinear;\n let _e80 = unnamed.uUnderwaterFactor;\n return mix(_e71, (1f - exp2(((-(_e72) * _e74) * 1.442695f))), _e80);\n }\n let _e82 = (*pointY);\n let _e84 = unnamed.uFogEyeY;\n let _e87 = unnamed.uFogHeightFalloff;\n t = ((_e82 - _e84) * _e87);\n let _e89 = t;\n let _e92 = t;\n denom = select(_e92, 0.0001f, (abs(_e89) < 0.0001f));\n let _e95 = unnamed.uFogDensity;\n let _e97 = (*dist);\n let _e99 = denom;\n let _e104 = denom;\n air = (1f - exp((((-(_e95) * _e97) * (1f - exp(-(_e99)))) / _e104)));\n let _e109 = unnamed.uUnderwaterFactor;\n if (_e109 <= 0f) {\n let _e111 = air;\n return _e111;\n }\n let _e113 = unnamed.uUnderwaterFogDensity;\n let _e114 = (*dist);\n wet = (_e113 * _e114);\n let _e116 = air;\n let _e117 = wet;\n let _e119 = wet;\n let _e125 = unnamed.uUnderwaterFactor;\n return mix(_e116, (1f - exp2(((-(_e117) * _e119) * 1.442695f))), _e125);\n}\n\nfn hash11_u0028_f1_u003b(p: ptr<function, f32>) -> f32 {\n let _e39 = (*p);\n return fract((sin((_e39 * 12.9898f)) * 43758.547f));\n}\n\nfn main_1() {\n var across: f32;\n var core: f32;\n var glow: f32;\n var t_1: f32;\n var stutter: f32;\n var param: f32;\n var param_1: f32;\n var taper: f32;\n var energy: f32;\n var lit: vec3<f32>;\n var fog: f32;\n var param_2: f32;\n var param_3: f32;\n\n let _e51 = vSide_1;\n across = clamp((1f - abs(_e51)), 0f, 1f);\n let _e55 = across;\n core = pow(_e55, 10f);\n let _e57 = across;\n glow = pow(_e57, 1.1f);\n let _e60 = unnamed.uTime;\n let _e62 = vSeed_1;\n t_1 = ((_e60 * 47f) + (_e62 * 17f));\n let _e65 = t_1;\n param = floor(_e65);\n let _e67 = hash11_u0028_f1_u003b((&param));\n let _e69 = t_1;\n param_1 = floor((_e69 * 2.37f));\n let _e72 = hash11_u0028_f1_u003b((&param_1));\n stutter = (0.78f + (0.22f * ((_e67 * 0.6f) + (_e72 * 0.4f))));\n let _e77 = vAlong_1;\n taper = (1f - (_e77 * 0.55f));\n let _e80 = vFade_1;\n let _e81 = stutter;\n let _e83 = taper;\n let _e85 = vGain_1;\n energy = (((_e80 * _e81) * _e83) * _e85);\n let _e88 = unnamed.uEdgeColor;\n let _e89 = glow;\n let _e92 = unnamed.uCoreColor;\n let _e93 = core;\n let _e96 = unnamed.uCoreGain;\n lit = ((_e88 * _e89) + ((_e92 * _e93) * _e96));\n let _e99 = vWorldPos_1;\n let _e101 = unnamed.uCameraPos;\n param_2 = distance(_e99, _e101);\n let _e104 = vWorldPos_1[1u];\n param_3 = _e104;\n let _e105 = mediumFog_u0028_f1_u003b_f1_u003b((&param_2), (&param_3));\n fog = _e105;\n let _e106 = lit;\n let _e107 = energy;\n let _e109 = fog;\n let _e111 = ((_e106 * _e107) * (1f - _e109));\n outColor = vec4<f32>(_e111.x, _e111.y, _e111.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vSide: f32, @location(3) vSeed: f32, @location(1) vAlong: f32, @location(2) vFade: f32, @location(4) vGain: f32, @location(5) vWorldPos: vec3<f32>) -> @location(0) vec4<f32> {\n vSide_1 = vSide;\n vSeed_1 = vSeed;\n vAlong_1 = vAlong;\n vFade_1 = vFade;\n vGain_1 = vGain;\n vWorldPos_1 = vWorldPos;\n main_1();\n let _e13 = outColor;\n return _e13;\n}\n";
9
9
 
10
10
  export const BOLT_VERT_WGSL = "struct Uniforms {\n uViewProj: mat4x4<f32>,\n uCameraPos: vec3<f32>,\n uWidth: f32,\n uMinWidthPerMetre: 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: f32,\n @location(1) member_1: f32,\n @location(2) member_2: f32,\n @location(3) member_3: f32,\n @location(4) member_4: f32,\n @location(5) member_5: vec3<f32>,\n @builtin(position) gl_Position: vec4<f32>,\n}\n\nvar<private> aFrom_1: vec3<f32>;\nvar<private> aTo_1: vec3<f32>;\nvar<private> aCorner_1: vec2<f32>;\n@group(0) @binding(0) \nvar<uniform> unnamed: Uniforms;\nvar<private> vSide: f32;\nvar<private> vAlong: f32;\nvar<private> aArc_1: vec4<f32>;\nvar<private> vFade: f32;\nvar<private> vSeed: f32;\nvar<private> vGain: f32;\nvar<private> vWorldPos: vec3<f32>;\nvar<private> unnamed_1: gl_PerVertex = gl_PerVertex(vec4<f32>(0f, 0f, 0f, 1f), 1f);\n\nfn main_1() {\n var mid: vec3<f32>;\n var dir: vec3<f32>;\n var len: f32;\n var local: vec3<f32>;\n var view: vec3<f32>;\n var dist: f32;\n var local_1: vec3<f32>;\n var across: vec3<f32>;\n var span: f32;\n var local_2: vec3<f32>;\n var halfWidth: f32;\n var world: vec3<f32>;\n\n let _e40 = aFrom_1;\n let _e41 = aTo_1;\n let _e43 = aCorner_1[0u];\n mid = mix(_e40, _e41, vec3(_e43));\n let _e46 = aTo_1;\n let _e47 = aFrom_1;\n dir = (_e46 - _e47);\n let _e49 = dir;\n len = length(_e49);\n let _e51 = len;\n if (_e51 > 0.000001f) {\n let _e53 = dir;\n let _e54 = len;\n local = (_e53 / vec3(_e54));\n } else {\n local = vec3<f32>(0f, 1f, 0f);\n }\n let _e57 = local;\n dir = _e57;\n let _e58 = mid;\n let _e60 = unnamed.uCameraPos;\n view = (_e58 - _e60);\n let _e62 = view;\n dist = length(_e62);\n let _e64 = dist;\n if (_e64 > 0.000001f) {\n let _e66 = view;\n let _e67 = dist;\n local_1 = (_e66 / vec3(_e67));\n } else {\n local_1 = vec3<f32>(0f, 0f, 1f);\n }\n let _e70 = local_1;\n view = _e70;\n let _e71 = dir;\n let _e72 = view;\n across = cross(_e71, _e72);\n let _e74 = across;\n span = length(_e74);\n let _e76 = span;\n if (_e76 > 0.0001f) {\n let _e78 = across;\n let _e79 = span;\n local_2 = (_e78 / vec3(_e79));\n } else {\n let _e82 = dir;\n local_2 = normalize((cross(_e82, vec3<f32>(0f, 1f, 0f)) + vec3<f32>(0.001f, 0.001f, 0.001f)));\n }\n let _e86 = local_2;\n across = _e86;\n let _e88 = unnamed.uWidth;\n let _e89 = dist;\n let _e91 = unnamed.uMinWidthPerMetre;\n halfWidth = max(_e88, (_e89 * _e91));\n let _e94 = mid;\n let _e95 = across;\n let _e97 = aCorner_1[1u];\n let _e99 = halfWidth;\n world = (_e94 + ((_e95 * _e97) * _e99));\n let _e103 = aCorner_1[1u];\n vSide = _e103;\n let _e105 = aArc_1[0u];\n vAlong = _e105;\n let _e107 = aArc_1[1u];\n vFade = _e107;\n let _e109 = aArc_1[2u];\n vSeed = _e109;\n let _e111 = aArc_1[3u];\n vGain = _e111;\n let _e112 = world;\n vWorldPos = _e112;\n let _e114 = unnamed.uViewProj;\n let _e115 = world;\n unnamed_1.gl_Position = (_e114 * vec4<f32>(_e115.x, _e115.y, _e115.z, 1f));\n return;\n}\n\n@vertex \nfn main(@location(0) aFrom: vec3<f32>, @location(1) aTo: vec3<f32>, @location(2) aCorner: vec2<f32>, @location(3) aArc: vec4<f32>) -> VertexOutput {\n aFrom_1 = aFrom;\n aTo_1 = aTo;\n aCorner_1 = aCorner;\n aArc_1 = aArc;\n main_1();\n let _e17 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e17);\n let _e19 = vSide;\n let _e20 = vAlong;\n let _e21 = vFade;\n let _e22 = vSeed;\n let _e23 = vGain;\n let _e24 = vWorldPos;\n let _e25 = unnamed_1.gl_Position;\n return VertexOutput(_e19, _e20, _e21, _e22, _e23, _e24, _e25);\n}\n";
11
11
 
@@ -11,9 +11,9 @@ export const DEPTH_CUTOUT_VERT_WGSL = "struct Uniforms {\n uLightViewProj: ma
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: 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";
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 instanceCell: vec4<f32>;\n var world: vec4<f32>;\n var bent: vec3<f32>;\n\n let _e24 = aPosition_1;\n local = vec4<f32>(_e24.x, _e24.y, _e24.z, 1f);\n let _e29 = aInstanceModel0_1;\n let _e30 = aInstanceModel1_1;\n let _e31 = aInstanceModel2_1;\n let _e32 = aInstanceModel3_1;\n model = mat4x4<f32>(vec4<f32>(_e29.x, _e29.y, _e29.z, _e29.w), vec4<f32>(_e30.x, _e30.y, _e30.z, _e30.w), vec4<f32>(_e31.x, _e31.y, _e31.z, _e31.w), vec4<f32>(_e32.x, _e32.y, _e32.z, _e32.w));\n let _e56 = model[0][3u];\n let _e59 = model[1][3u];\n let _e62 = model[2][3u];\n let _e65 = model[3][3u];\n instanceCell = vec4<f32>(_e56, _e59, _e62, _e65);\n model[0][3u] = 0f;\n model[1][3u] = 0f;\n model[2][3u] = 0f;\n model[3][3u] = 1f;\n let _e75 = model;\n let _e76 = local;\n world = (_e75 * _e76);\n let _e78 = world;\n bent = _e78.xyz;\n let _e81 = unnamed.uLightViewProj;\n let _e82 = bent;\n let _e84 = world[3u];\n vLightPosition = (_e81 * vec4<f32>(_e82.x, _e82.y, _e82.z, _e84));\n let _e90 = vLightPosition;\n unnamed_1.gl_Position = _e90;\n let _e92 = aUv_1;\n let _e94 = instanceCell;\n let _e97 = instanceCell;\n let _e101 = unnamed.uUvScale;\n let _e104 = unnamed.uUvOffset;\n let _e105 = ((((_e92.xy * _e94.xy) + _e97.zw) * _e101) + _e104);\n let _e107 = aUv_1[2u];\n vUv = vec3<f32>(_e105.x, _e105.y, _e107);\n let _e112 = unnamed.uAlphaCutout;\n vAlphaCutout = _e112;\n return;\n}\n\n@vertex \nfn main(@location(0) aPosition: vec3<f32>, @location(11) aInstanceModel0_: vec4<f32>, @location(12) aInstanceModel1_: vec4<f32>, @location(13) aInstanceModel2_: vec4<f32>, @location(14) aInstanceModel3_: vec4<f32>, @location(5) aUv: vec3<f32>) -> VertexOutput {\n aPosition_1 = aPosition;\n aInstanceModel0_1 = aInstanceModel0_;\n aInstanceModel1_1 = aInstanceModel1_;\n aInstanceModel2_1 = aInstanceModel2_;\n aInstanceModel3_1 = aInstanceModel3_;\n aUv_1 = aUv;\n main_1();\n let _e18 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e18);\n let _e20 = vLightPosition;\n let _e21 = unnamed_1.gl_Position;\n let _e22 = vUv;\n let _e23 = vAlphaCutout;\n return VertexOutput(_e20, _e21, _e22, _e23);\n}\n";
15
15
 
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";
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 instanceCell: vec4<f32>;\n var world: vec4<f32>;\n var bent: vec3<f32>;\n\n let _e20 = aPosition_1;\n local = vec4<f32>(_e20.x, _e20.y, _e20.z, 1f);\n let _e25 = aInstanceModel0_1;\n let _e26 = aInstanceModel1_1;\n let _e27 = aInstanceModel2_1;\n let _e28 = aInstanceModel3_1;\n model = mat4x4<f32>(vec4<f32>(_e25.x, _e25.y, _e25.z, _e25.w), vec4<f32>(_e26.x, _e26.y, _e26.z, _e26.w), vec4<f32>(_e27.x, _e27.y, _e27.z, _e27.w), vec4<f32>(_e28.x, _e28.y, _e28.z, _e28.w));\n let _e52 = model[0][3u];\n let _e55 = model[1][3u];\n let _e58 = model[2][3u];\n let _e61 = model[3][3u];\n instanceCell = vec4<f32>(_e52, _e55, _e58, _e61);\n model[0][3u] = 0f;\n model[1][3u] = 0f;\n model[2][3u] = 0f;\n model[3][3u] = 1f;\n let _e71 = model;\n let _e72 = local;\n world = (_e71 * _e72);\n let _e74 = world;\n bent = _e74.xyz;\n let _e77 = unnamed.uLightViewProj;\n let _e78 = bent;\n let _e80 = world[3u];\n vLightPosition = (_e77 * vec4<f32>(_e78.x, _e78.y, _e78.z, _e80));\n let _e86 = vLightPosition;\n unnamed_1.gl_Position = _e86;\n return;\n}\n\n@vertex \nfn main(@location(0) aPosition: vec3<f32>, @location(11) aInstanceModel0_: vec4<f32>, @location(12) aInstanceModel1_: vec4<f32>, @location(13) aInstanceModel2_: vec4<f32>, @location(14) aInstanceModel3_: vec4<f32>) -> VertexOutput {\n aPosition_1 = aPosition;\n aInstanceModel0_1 = aInstanceModel0_;\n aInstanceModel1_1 = aInstanceModel1_;\n aInstanceModel2_1 = aInstanceModel2_;\n aInstanceModel3_1 = aInstanceModel3_;\n main_1();\n let _e14 = unnamed_1.gl_Position.y;\n unnamed_1.gl_Position.y = -(_e14);\n let _e16 = vLightPosition;\n let _e17 = unnamed_1.gl_Position;\n return VertexOutput(_e16, _e17);\n}\n";
17
17
 
18
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
 
@@ -25,9 +25,9 @@ export const GLASS_TINT_CUTOUT_VERT_WGSL = "struct Uniforms {\n uLightViewPro
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: 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";
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 instanceCell: vec4<f32>;\n var world: vec4<f32>;\n var bent: vec3<f32>;\n\n let _e25 = aPosition_1;\n local = vec4<f32>(_e25.x, _e25.y, _e25.z, 1f);\n let _e30 = aInstanceModel0_1;\n let _e31 = aInstanceModel1_1;\n let _e32 = aInstanceModel2_1;\n let _e33 = aInstanceModel3_1;\n model = mat4x4<f32>(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), vec4<f32>(_e33.x, _e33.y, _e33.z, _e33.w));\n let _e57 = model[0][3u];\n let _e60 = model[1][3u];\n let _e63 = model[2][3u];\n let _e66 = model[3][3u];\n instanceCell = vec4<f32>(_e57, _e60, _e63, _e66);\n model[0][3u] = 0f;\n model[1][3u] = 0f;\n model[2][3u] = 0f;\n model[3][3u] = 1f;\n let _e76 = model;\n let _e77 = local;\n world = (_e76 * _e77);\n let _e79 = world;\n bent = _e79.xyz;\n let _e82 = unnamed.uLightViewProj;\n let _e83 = bent;\n let _e85 = world[3u];\n vLightPosition = (_e82 * vec4<f32>(_e83.x, _e83.y, _e83.z, _e85));\n let _e91 = vLightPosition;\n unnamed_1.gl_Position = _e91;\n let _e93 = aUv_1;\n let _e95 = instanceCell;\n let _e98 = instanceCell;\n let _e102 = unnamed.uUvScale;\n let _e105 = unnamed.uUvOffset;\n let _e106 = ((((_e93.xy * _e95.xy) + _e98.zw) * _e102) + _e105);\n let _e108 = aUv_1[2u];\n vUv = vec3<f32>(_e106.x, _e106.y, _e108);\n let _e113 = unnamed.uAlphaCutout;\n vAlphaCutout = _e113;\n let _e114 = bent;\n vGlassWorld = _e114;\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
- 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";
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 instanceCell: vec4<f32>;\n var world: vec4<f32>;\n var bent: vec3<f32>;\n\n let _e21 = aPosition_1;\n local = vec4<f32>(_e21.x, _e21.y, _e21.z, 1f);\n let _e26 = aInstanceModel0_1;\n let _e27 = aInstanceModel1_1;\n let _e28 = aInstanceModel2_1;\n let _e29 = aInstanceModel3_1;\n model = mat4x4<f32>(vec4<f32>(_e26.x, _e26.y, _e26.z, _e26.w), vec4<f32>(_e27.x, _e27.y, _e27.z, _e27.w), vec4<f32>(_e28.x, _e28.y, _e28.z, _e28.w), vec4<f32>(_e29.x, _e29.y, _e29.z, _e29.w));\n let _e53 = model[0][3u];\n let _e56 = model[1][3u];\n let _e59 = model[2][3u];\n let _e62 = model[3][3u];\n instanceCell = vec4<f32>(_e53, _e56, _e59, _e62);\n model[0][3u] = 0f;\n model[1][3u] = 0f;\n model[2][3u] = 0f;\n model[3][3u] = 1f;\n let _e72 = model;\n let _e73 = local;\n world = (_e72 * _e73);\n let _e75 = world;\n bent = _e75.xyz;\n let _e78 = unnamed.uLightViewProj;\n let _e79 = bent;\n let _e81 = world[3u];\n vLightPosition = (_e78 * vec4<f32>(_e79.x, _e79.y, _e79.z, _e81));\n let _e87 = vLightPosition;\n unnamed_1.gl_Position = _e87;\n let _e89 = bent;\n vGlassWorld = _e89;\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
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