@driftengine/core 4.8.5 → 4.8.6

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 (136) hide show
  1. package/CHANGELOG.json +4321 -4250
  2. package/dist/index.d.ts +10 -2
  3. package/dist/index.js +11 -1
  4. package/dist/render/ambientHarmonics.d.ts +46 -0
  5. package/dist/render/ambientHarmonics.js +80 -0
  6. package/dist/render/areaLights.d.ts +19 -0
  7. package/dist/render/areaLights.js +20 -0
  8. package/dist/render/backend/api.d.ts +13 -2
  9. package/dist/render/backend/webgl2/instanced.d.ts +2 -0
  10. package/dist/render/backend/webgl2/instanced.js +11 -2
  11. package/dist/render/backend/webgl2/renderer.d.ts +74 -1
  12. package/dist/render/backend/webgl2/renderer.js +229 -37
  13. package/dist/render/backend/webgl2/skinScatter.d.ts +14 -0
  14. package/dist/render/backend/webgl2/skinScatter.js +88 -26
  15. package/dist/render/backend/webgpu/buffers.js +2 -1
  16. package/dist/render/backend/webgpu/clusterBinner.js +3 -2
  17. package/dist/render/backend/webgpu/flatPass.d.ts +7 -5
  18. package/dist/render/backend/webgpu/flatPass.js +15 -13
  19. package/dist/render/backend/webgpu/particlePass.d.ts +37 -4
  20. package/dist/render/backend/webgpu/particlePass.js +80 -12
  21. package/dist/render/backend/webgpu/postPass.d.ts +6 -1
  22. package/dist/render/backend/webgpu/postPass.js +7 -2
  23. package/dist/render/backend/webgpu/renderer.d.ts +58 -7
  24. package/dist/render/backend/webgpu/renderer.js +329 -78
  25. package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.d.ts +1 -1
  26. package/dist/render/backend/webgpu/shaders/clusterBin.wgsl.js +41 -1
  27. package/dist/render/backend/webgpu/skinPaletteRing.d.ts +40 -28
  28. package/dist/render/backend/webgpu/skinPaletteRing.js +69 -32
  29. package/dist/render/backend/webgpu/skinScatterPass.d.ts +10 -2
  30. package/dist/render/backend/webgpu/skinScatterPass.js +59 -9
  31. package/dist/render/backend/webgpu/surfaceTexturePass.d.ts +2 -1
  32. package/dist/render/backend/webgpu/surfaceTexturePass.js +18 -4
  33. package/dist/render/bloomChain.d.ts +44 -0
  34. package/dist/render/bloomChain.js +28 -0
  35. package/dist/render/bloomPass.d.ts +3 -1
  36. package/dist/render/bloomPass.js +16 -2
  37. package/dist/render/clusteredLights.d.ts +55 -1
  38. package/dist/render/clusteredLights.js +182 -8
  39. package/dist/render/fixtureAtlas.js +1 -1
  40. package/dist/render/instanceCull.js +7 -0
  41. package/dist/render/instances.d.ts +32 -10
  42. package/dist/render/instances.js +17 -8
  43. package/dist/render/lightBudget.d.ts +26 -1
  44. package/dist/render/lightBudget.js +26 -3
  45. package/dist/render/lightmap.d.ts +102 -0
  46. package/dist/render/lightmap.js +118 -0
  47. package/dist/render/mesh.js +2 -1
  48. package/dist/render/particleBatch.d.ts +59 -3
  49. package/dist/render/particleBatch.js +53 -2
  50. package/dist/render/particleMaterial.d.ts +6 -1
  51. package/dist/render/particleMaterial.js +10 -2
  52. package/dist/render/particlePool.d.ts +11 -0
  53. package/dist/render/particlePool.js +2 -0
  54. package/dist/render/particleSort.d.ts +34 -0
  55. package/dist/render/particleSort.js +96 -0
  56. package/dist/render/sceneTarget.d.ts +5 -0
  57. package/dist/render/sceneTarget.js +8 -1
  58. package/dist/render/shaders/bloom.d.ts +8 -4
  59. package/dist/render/shaders/bloom.js +20 -3
  60. package/dist/render/shaders/flat/areaLight.d.ts +10 -0
  61. package/dist/render/shaders/flat/areaLight.js +96 -0
  62. package/dist/render/shaders/flat/index.js +30 -4
  63. package/dist/render/shaders/flat/main.d.ts +1 -1
  64. package/dist/render/shaders/flat/main.js +107 -105
  65. package/dist/render/shaders/flat/models.d.ts +16 -4
  66. package/dist/render/shaders/flat/models.js +64 -4
  67. package/dist/render/shaders/flat/normalMap.d.ts +10 -0
  68. package/dist/render/shaders/flat/normalMap.js +25 -0
  69. package/dist/render/shaders/flat/preamble.js +74 -37
  70. package/dist/render/shaders/flat/skin.js +6 -5
  71. package/dist/render/shaders/generated/bloom.wgsl.d.ts +13 -3
  72. package/dist/render/shaders/generated/bloom.wgsl.js +13 -3
  73. package/dist/render/shaders/generated/flat.wgsl.d.ts +1631 -2044
  74. package/dist/render/shaders/generated/flat.wgsl.js +1669 -2082
  75. package/dist/render/shaders/generated/particle.wgsl.d.ts +115 -1
  76. package/dist/render/shaders/generated/particle.wgsl.js +115 -1
  77. package/dist/render/shaders/generated/skinBlur.wgsl.d.ts +12 -2
  78. package/dist/render/shaders/generated/skinBlur.wgsl.js +12 -2
  79. package/dist/render/shaders/particle.d.ts +17 -1
  80. package/dist/render/shaders/particle.js +133 -1
  81. package/dist/render/shaders/skinBlur.js +25 -3
  82. package/dist/render/skinBlur.d.ts +8 -5
  83. package/dist/render/skinBlur.js +8 -5
  84. package/dist/render/surfaceModel.d.ts +21 -1
  85. package/dist/render/surfaceModel.js +22 -0
  86. package/dist/render/surfaceTexture.d.ts +14 -1
  87. package/dist/render/surfaceTexture.js +15 -2
  88. package/package.json +6 -6
  89. package/src/index.ts +20 -1
  90. package/src/render/ambientHarmonics.ts +92 -0
  91. package/src/render/areaLights.ts +39 -0
  92. package/src/render/backend/api.ts +14 -1
  93. package/src/render/backend/webgl2/instanced.ts +12 -2
  94. package/src/render/backend/webgl2/renderer.ts +292 -35
  95. package/src/render/backend/webgl2/skinScatter.ts +120 -43
  96. package/src/render/backend/webgpu/buffers.ts +2 -1
  97. package/src/render/backend/webgpu/clusterBinner.ts +3 -1
  98. package/src/render/backend/webgpu/flatPass.ts +18 -13
  99. package/src/render/backend/webgpu/particlePass.ts +118 -12
  100. package/src/render/backend/webgpu/postPass.ts +7 -2
  101. package/src/render/backend/webgpu/renderer.ts +396 -95
  102. package/src/render/backend/webgpu/shaders/clusterBin.wgsl.ts +41 -1
  103. package/src/render/backend/webgpu/skinPaletteRing.ts +65 -33
  104. package/src/render/backend/webgpu/skinScatterPass.ts +59 -9
  105. package/src/render/backend/webgpu/surfaceTexturePass.ts +26 -5
  106. package/src/render/bloomChain.ts +69 -0
  107. package/src/render/bloomPass.ts +26 -2
  108. package/src/render/clusteredLights.ts +221 -7
  109. package/src/render/fixtureAtlas.ts +1 -1
  110. package/src/render/instanceCull.ts +5 -0
  111. package/src/render/instances.ts +40 -11
  112. package/src/render/lightBudget.ts +48 -2
  113. package/src/render/lightmap.ts +202 -0
  114. package/src/render/mesh.ts +2 -1
  115. package/src/render/particleBatch.ts +95 -4
  116. package/src/render/particleMaterial.ts +11 -1
  117. package/src/render/particlePool.ts +13 -0
  118. package/src/render/particleSort.ts +133 -0
  119. package/src/render/sceneTarget.ts +18 -1
  120. package/src/render/shaders/bloom.ts +20 -3
  121. package/src/render/shaders/flat/areaLight.ts +96 -0
  122. package/src/render/shaders/flat/index.ts +30 -4
  123. package/src/render/shaders/flat/main.ts +107 -105
  124. package/src/render/shaders/flat/models.ts +73 -8
  125. package/src/render/shaders/flat/normalMap.ts +25 -0
  126. package/src/render/shaders/flat/preamble.ts +74 -37
  127. package/src/render/shaders/flat/skin.ts +6 -5
  128. package/src/render/shaders/generated/bloom.wgsl.ts +13 -3
  129. package/src/render/shaders/generated/flat.wgsl.ts +1669 -2082
  130. package/src/render/shaders/generated/particle.wgsl.ts +116 -1
  131. package/src/render/shaders/generated/skinBlur.wgsl.ts +12 -2
  132. package/src/render/shaders/particle.ts +134 -1
  133. package/src/render/shaders/skinBlur.ts +25 -3
  134. package/src/render/skinBlur.ts +8 -5
  135. package/src/render/surfaceModel.ts +36 -1
  136. package/src/render/surfaceTexture.ts +41 -3
@@ -156,10 +156,38 @@ uniform ivec4 uMaterialFlags;
156
156
  *
157
157
  * **Four numbers in one row**: x is the cutoff, y how this frame resolves the edge (0 the hard test,
158
158
  * 1 a dither the temporal resolve averages, 2 alpha-to-coverage; see \`cutoutDither.ts\`), z the
159
- * frame the dither's pattern is offset by, w spare. One vector rather than a float and two more,
160
- * because every loose scalar is a row of WebGL2's 224 that the light budget gives up.
159
+ * frame the dither's pattern is offset by, w the material's lighting channels — a mask a light
160
+ * shades it only where its own shares a bit with (\`SurfaceMaterial.lightChannels\`, 1 unless a
161
+ * material names others). One vector rather than a float and three more, because every loose
162
+ * scalar is a row of WebGL2's 224 that the light budget gives up.
161
163
  */
162
164
  uniform vec4 uCutout;
165
+ /**
166
+ * A draw's own ambient, as nine spherical-harmonic coefficients of incoming radiance, red green blue
167
+ * in turn, twenty-seven floats, and in the last of the twenty-eight a 1 where they are on — 0 is the
168
+ * frame's own ambient, the sky's gradient or the probes'. \`ambientHarmonics.ts\` is the arithmetic
169
+ * and the basis, and its tests hold this to it. Seven rows of the material block, which is per draw
170
+ * as far as anything here is: \`setAmbientSH\` moves it between two draws as \`setMaterial\` does.
171
+ */
172
+ uniform vec4 uAmbientSH[7];
173
+
174
+ /** The ambient a surface facing \`n\` receives from \`uAmbientSH\`: \`ambientFromSH\`'s arithmetic. */
175
+ vec3 ambientHarmonics(vec3 n) {
176
+ vec3 c0 = uAmbientSH[0].xyz;
177
+ vec3 c1 = vec3(uAmbientSH[0].w, uAmbientSH[1].xy);
178
+ vec3 c2 = vec3(uAmbientSH[1].zw, uAmbientSH[2].x);
179
+ vec3 c3 = uAmbientSH[2].yzw;
180
+ vec3 c4 = uAmbientSH[3].xyz;
181
+ vec3 c5 = vec3(uAmbientSH[3].w, uAmbientSH[4].xy);
182
+ vec3 c6 = vec3(uAmbientSH[4].zw, uAmbientSH[5].x);
183
+ vec3 c7 = uAmbientSH[5].yzw;
184
+ vec3 c8 = uAmbientSH[6].xyz;
185
+ /* The bands over pi after the cosine convolution: 1, 2/3 and 1/4. */
186
+ vec3 band1 = (0.488603 * 2.0 / 3.0) * (c1 * n.y + c2 * n.z + c3 * n.x);
187
+ vec3 band2 = 0.25 * (1.092548 * (c4 * n.x * n.y + c5 * n.y * n.z + c7 * n.x * n.z)
188
+ + 0.315392 * c6 * (3.0 * n.z * n.z - 1.0) + 0.546274 * c8 * (n.x * n.x - n.y * n.y));
189
+ return max(0.282095 * c0 + band1 + band2, vec3(0.0));
190
+ }
163
191
  /**
164
192
  * The albedo array's per-layer effects table: six texels a layer, read with \`texelFetch\` at the
165
193
  * layer a vertex carries. A 1×1 stand-in where the array has none, which the size test below reads
@@ -220,8 +248,12 @@ uniform vec3 uOrmScale;
220
248
  *
221
249
  * A uniform rather than a permutation flag, following the ORM map's in \`uMaterialFlags\`: a fifth boolean doubles the
222
250
  * generated WGSL every consumer bundles as source, and this is a few multiply-adds.
251
+ *
252
+ * **x of \`uEnvironmentDials\`**, beside the two below: one row where three floats were three
253
+ * (\`uniformVectorBudget.ts\`). y is how much of the environment the material mirrors, z how
254
+ * bright what it mirrors is.
223
255
  */
224
- uniform float uEnvironmentPrefiltered;
256
+ uniform vec3 uEnvironmentDials;
225
257
 
226
258
  /**
227
259
  * Where a surface glows, and in what colour.
@@ -325,8 +357,12 @@ uniform vec4 uClipPlane;
325
357
  * One row for all four, paid for by the flag the clip plane no longer needs.
326
358
  */
327
359
  uniform vec4 uSurfaceScene;
328
- uniform float uEmissiveGain;
329
- uniform float uNightFactor;
360
+ /**
361
+ * What emission is multiplied by: x the gain (\`setEmissiveGain\`, the environment's own until a
362
+ * draw moves it), y the night factor emission is gated on. One row where two floats were two
363
+ * (\`uniformVectorBudget.ts\`).
364
+ */
365
+ uniform vec2 uEmission;
330
366
  #if NIGHT_EMISSIVE
331
367
  /**
332
368
  * Emission that only shows where the dominant light does not reach. 0 is off and is the default.
@@ -455,10 +491,9 @@ uniform float uGrain;
455
491
  * Two numbers rather than one because they are what separates the surfaces this exists for.
456
492
  * Asphalt is coarse and deep, orange peel on paint is fine and shallow, cast concrete sits
457
493
  * between them, and the geometry carrying them is identical in all three cases. See
458
- * Renderer.setSurfaceRelief.
494
+ * Renderer.setSurfaceRelief. x is the strength and y the bumps to a metre, in one row.
459
495
  */
460
- uniform float uRelief;
461
- uniform float uReliefCycles;
496
+ uniform vec2 uRelief;
462
497
  /**
463
498
  * How hard the bound surface texture's own luminance turns the shading normal, 0 for not at all.
464
499
  *
@@ -491,9 +526,8 @@ uniform float uTextureRelief;
491
526
  * how tight the lobe was made, because what makes a car body look wet is mostly the world
492
527
  * in it rather than the lights on it.
493
528
  *
494
- * Off by default, so every scene written before it is unchanged.
529
+ * Off by default, so every scene written before it is unchanged. **y of \`uEnvironmentDials\`.**
495
530
  */
496
- uniform float uReflectivity;
497
531
  /**
498
532
  * How bright the environment these surfaces reflect is, as a multiplier on it.
499
533
  *
@@ -513,9 +547,8 @@ uniform float uReflectivity;
513
547
  *
514
548
  * Applies to whatever the surface reflects, probe or hemispheric approximation alike, and to the
515
549
  * probe's own irradiance where a caller asked for that. **1 is the default and the identity**, so
516
- * every scene written before this is unchanged.
550
+ * every scene written before this is unchanged. **z of \`uEnvironmentDials\`.**
517
551
  */
518
- uniform float uEnvironmentGain;
519
552
  /**
520
553
  * The room itself, as a cubemap baked from one point, and whether one exists.
521
554
  *
@@ -615,10 +648,12 @@ uniform float uProbeGridAmbient;
615
648
  */
616
649
  uniform vec3 uProbeGridSets;
617
650
  #endif
618
- /** A world-space box that lights up regardless of time of day (run finished). */
651
+ /**
652
+ * A world-space box that lights up regardless of time of day: its corners, and in the far corner's
653
+ * w the gain — one row where a loose float was another (\`uniformVectorBudget.ts\`).
654
+ */
619
655
  uniform vec3 uHighlightMin;
620
- uniform vec3 uHighlightMax;
621
- uniform float uHighlightGain;
656
+ uniform vec4 uHighlightMax;
622
657
 
623
658
  /*
624
659
  * The froxel table, and the numbers needed to find a fragment's place in it.
@@ -762,8 +797,13 @@ uniform float uLightIesProfile[MAX_LIGHTS];
762
797
  * tangent to a sphere, so any reference built from the aim alone flips somewhere — and the obvious
763
798
  * constructions put that flip exactly where these fixtures point, \`cross(worldUp, dir)\` being
764
799
  * singular for a light aimed straight down.
800
+ *
801
+ * **w is the light's lighting channels**, a mask compared with the material's (\`uCutout.w\`): a
802
+ * light shades a surface only where the two share a bit. In the lane the axis left, because an
803
+ * array of its own would be a row a light of a budget with none to spare; the froxel record keeps
804
+ * it beside the axis too, in the slot that was spare there.
765
805
  */
766
- uniform vec3 uLightIesAxis[MAX_LIGHTS];
806
+ uniform vec4 uLightIesAxis[MAX_LIGHTS];
767
807
  /**
768
808
  * Which tile of the cookie atlas each light projects, or a negative index for none.
769
809
  *
@@ -781,32 +821,29 @@ uniform float uLightCookie[MAX_LIGHTS];
781
821
  * single row of ones, the multiplicative identity, because a declared sampler needs a complete
782
822
  * texture whether or not the branch reads it and a row of zeros would switch off every light.
783
823
  */
784
- /** Rows of profile in the fixture atlas, below its cookies. At least 1. */
785
- uniform float uIesAtlasRows;
786
824
  /**
787
- * Horizontal planes each profile occupies, so a row is \`profile * planes + plane\`.
788
- *
789
- * **1 for an atlas with nothing asymmetric in it**, which is nearly every atlas, and the whole
790
- * plane path is branched away on that — see \`photometric\` in \`main.ts\`. One count for the atlas
791
- * rather than one per profile, because a per-profile count would need a second number in a light's
792
- * record to divide by, and a light's record is where space is expensive.
793
- */
794
- uniform float uIesPlaneCount;
795
- /**
796
- * Cookies: one row of square tiles, one tile a fixture's mask.
797
- *
798
- * **0 when no consumer has loaded one, and the whole projection is branched away on it** — a
799
- * \`uniform float\` is provably uniform control flow, so a scene with no cookie performs no
800
- * arithmetic and no fetch. With none loaded this holds a single white texel, the multiplicative
801
- * identity, because a declared sampler needs a complete texture whether or not the branch reads it
802
- * and a black stand-in would switch off every light that reached it.
803
- */
804
- uniform float uCookieTiles;
825
+ * The fixture atlas's shape, three numbers in one row — a row each would be three of a budget that
826
+ * has none to give (\`uniformVectorBudget.ts\`):
827
+ *
828
+ * - **x, rows of profile** below its cookies. At least 1.
829
+ * - **y, horizontal planes each profile occupies**, so a row is \`profile * planes + plane\`. 1 for
830
+ * an atlas with nothing asymmetric in it, which is nearly every atlas, and the whole plane path is
831
+ * branched away on that — see \`photometric\` in \`main.ts\`. One count for the atlas rather
832
+ * than one per profile, because a per-profile count would need a second number in a light's
833
+ * record to divide by, and a light's record is where space is expensive.
834
+ * - **z, cookie tiles**: one row of square tiles, one a fixture's mask. 0 when no consumer has
835
+ * loaded one, and the whole projection is branched away on it — a uniform is provably uniform
836
+ * control flow, so a scene with no cookie performs no arithmetic and no fetch. With none loaded
837
+ * the atlas holds a single white texel, the multiplicative identity, because a declared sampler
838
+ * needs a complete texture whether or not the branch reads it and a black stand-in would switch
839
+ * off every light that reached it.
840
+ */
841
+ uniform vec3 uFixtureShape;
805
842
  /**
806
843
  * Both tables in one texture: the cookies' row of tiles in the top band, the profiles' rows below.
807
844
  * One sampler for the two since 2026-09-30, because the lit stage bound fifteen of the sixteen
808
845
  * WebGL2 guarantees; see \`fixtureAtlas.ts\`. The bands are found from \`textureSize\` and
809
- * \`uIesAtlasRows\`, so the fold cost no uniform.
846
+ * \`uFixtureShape.x\`, so the fold cost no uniform.
810
847
  */
811
848
  uniform sampler2D uFixtureAtlas;
812
849
  /**
@@ -17,11 +17,12 @@
17
17
  * behind both, still glows. The shadow map's depth at the receiver would separate the two, and the
18
18
  * lamp loop reads a visibility rather than a depth.
19
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.
20
+ * **Under \`skinScattering: 'screen-space'\`** the surface is drawn in halves: the frame's without
21
+ * its diffuse; the diffuse's light alone into the blur's target, shaded on a white surface —
22
+ * Lambert's, with the shadow as it is, because the blur that follows carries light across curvature
23
+ * and shadow edges in the picture and the fit as well would count it twice — keeping the
24
+ * transmission, which the picture cannot see; and the colour alone, which the spread light is
25
+ * multiplied by. \`skinBlur.ts\` is the rest.
25
26
  *
26
27
  * **The highlight** is two GGX lobes — 0.85 at the material's roughness and 0.15 at 0.6 of it, for
27
28
  * the skin's oil — normalised, with Smith's masking and the Fresnel of index 1.4, in lamp units, so
@@ -1,6 +1,6 @@
1
1
  export declare const BLOOM_DOWNSAMPLE_FRAG_WGSL = "struct Uniforms {\n uTexel: vec2<f32>,\n}\n\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn fetch_u0028_vf2_u003b(uv: ptr<function, vec2<f32>>) -> vec3<f32> {\n let _e27 = (*uv);\n let _e28 = textureSampleLevel(uSource_t, uSource_s, _e27, 0f);\n return _e28.xyz;\n}\n\nfn main_1() {\n var t: vec2<f32>;\n var a: vec3<f32>;\n var param: vec2<f32>;\n var b: vec3<f32>;\n var param_1: vec2<f32>;\n var c: vec3<f32>;\n var param_2: vec2<f32>;\n var d: vec3<f32>;\n var param_3: vec2<f32>;\n var e: vec3<f32>;\n var param_4: vec2<f32>;\n var f: vec3<f32>;\n var param_5: vec2<f32>;\n var g: vec3<f32>;\n var param_6: vec2<f32>;\n var h: vec3<f32>;\n var param_7: vec2<f32>;\n var i: vec3<f32>;\n var param_8: vec2<f32>;\n var j: vec3<f32>;\n var param_9: vec2<f32>;\n var k: vec3<f32>;\n var param_10: vec2<f32>;\n var l: vec3<f32>;\n var param_11: vec2<f32>;\n var m: vec3<f32>;\n var param_12: vec2<f32>;\n var box0_: vec3<f32>;\n var box1_: vec3<f32>;\n var box2_: vec3<f32>;\n var box3_: vec3<f32>;\n var box4_: vec3<f32>;\n\n let _e59 = unnamed.uTexel;\n t = _e59;\n let _e60 = vUv_1;\n let _e61 = t;\n param = (_e60 + (vec2<f32>(-2f, 2f) * _e61));\n let _e64 = fetch_u0028_vf2_u003b((&param));\n a = _e64;\n let _e65 = vUv_1;\n let _e66 = t;\n param_1 = (_e65 + (vec2<f32>(0f, 2f) * _e66));\n let _e69 = fetch_u0028_vf2_u003b((&param_1));\n b = _e69;\n let _e70 = vUv_1;\n let _e71 = t;\n param_2 = (_e70 + (vec2<f32>(2f, 2f) * _e71));\n let _e74 = fetch_u0028_vf2_u003b((&param_2));\n c = _e74;\n let _e75 = vUv_1;\n let _e76 = t;\n param_3 = (_e75 + (vec2<f32>(-2f, 0f) * _e76));\n let _e79 = fetch_u0028_vf2_u003b((&param_3));\n d = _e79;\n let _e80 = vUv_1;\n param_4 = _e80;\n let _e81 = fetch_u0028_vf2_u003b((&param_4));\n e = _e81;\n let _e82 = vUv_1;\n let _e83 = t;\n param_5 = (_e82 + (vec2<f32>(2f, 0f) * _e83));\n let _e86 = fetch_u0028_vf2_u003b((&param_5));\n f = _e86;\n let _e87 = vUv_1;\n let _e88 = t;\n param_6 = (_e87 + (vec2<f32>(-2f, -2f) * _e88));\n let _e91 = fetch_u0028_vf2_u003b((&param_6));\n g = _e91;\n let _e92 = vUv_1;\n let _e93 = t;\n param_7 = (_e92 + (vec2<f32>(0f, -2f) * _e93));\n let _e96 = fetch_u0028_vf2_u003b((&param_7));\n h = _e96;\n let _e97 = vUv_1;\n let _e98 = t;\n param_8 = (_e97 + (vec2<f32>(2f, -2f) * _e98));\n let _e101 = fetch_u0028_vf2_u003b((&param_8));\n i = _e101;\n let _e102 = vUv_1;\n let _e103 = t;\n param_9 = (_e102 + (vec2<f32>(-1f, 1f) * _e103));\n let _e106 = fetch_u0028_vf2_u003b((&param_9));\n j = _e106;\n let _e107 = vUv_1;\n let _e108 = t;\n param_10 = (_e107 + (vec2<f32>(1f, 1f) * _e108));\n let _e111 = fetch_u0028_vf2_u003b((&param_10));\n k = _e111;\n let _e112 = vUv_1;\n let _e113 = t;\n param_11 = (_e112 + (vec2<f32>(-1f, -1f) * _e113));\n let _e116 = fetch_u0028_vf2_u003b((&param_11));\n l = _e116;\n let _e117 = vUv_1;\n let _e118 = t;\n param_12 = (_e117 + (vec2<f32>(1f, -1f) * _e118));\n let _e121 = fetch_u0028_vf2_u003b((&param_12));\n m = _e121;\n let _e122 = a;\n let _e123 = b;\n let _e125 = d;\n let _e127 = e;\n box0_ = ((((_e122 + _e123) + _e125) + _e127) * 0.25f);\n let _e130 = b;\n let _e131 = c;\n let _e133 = e;\n let _e135 = f;\n box1_ = ((((_e130 + _e131) + _e133) + _e135) * 0.25f);\n let _e138 = d;\n let _e139 = e;\n let _e141 = g;\n let _e143 = h;\n box2_ = ((((_e138 + _e139) + _e141) + _e143) * 0.25f);\n let _e146 = e;\n let _e147 = f;\n let _e149 = h;\n let _e151 = i;\n box3_ = ((((_e146 + _e147) + _e149) + _e151) * 0.25f);\n let _e154 = j;\n let _e155 = k;\n let _e157 = l;\n let _e159 = m;\n box4_ = ((((_e154 + _e155) + _e157) + _e159) * 0.25f);\n let _e162 = box4_;\n let _e164 = box0_;\n let _e165 = box1_;\n let _e167 = box2_;\n let _e169 = box3_;\n let _e172 = ((_e162 * 0.5f) + ((((_e164 + _e165) + _e167) + _e169) * 0.125f));\n fragColor = vec4<f32>(_e172.x, _e172.y, _e172.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
2
- export declare const BLOOM_PREFILTER_FRAG_WGSL = "struct Uniforms {\n uTexel: vec2<f32>,\n uThreshold: f32,\n}\n\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn brightness_u0028_vf3_u003b(c: ptr<function, vec3<f32>>) -> f32 {\n let _e35 = (*c)[0u];\n let _e37 = (*c)[1u];\n let _e39 = (*c)[2u];\n return max(_e35, max(_e37, _e39));\n}\n\nfn firefly_u0028_vf3_u003b(c_1: ptr<function, vec3<f32>>) -> f32 {\n var param: vec3<f32>;\n\n let _e35 = (*c_1);\n param = _e35;\n let _e36 = brightness_u0028_vf3_u003b((&param));\n return (1f / (1f + _e36));\n}\n\nfn fetch_u0028_vf2_u003b(uv: ptr<function, vec2<f32>>) -> vec3<f32> {\n var c_2: vec3<f32>;\n var bright: f32;\n var param_1: vec3<f32>;\n\n let _e37 = (*uv);\n let _e38 = textureSampleLevel(uSource_t, uSource_s, _e37, 0f);\n c_2 = min(_e38.xyz, vec3<f32>(256f, 256f, 256f));\n let _e41 = c_2;\n param_1 = _e41;\n let _e42 = brightness_u0028_vf3_u003b((&param_1));\n bright = _e42;\n let _e43 = c_2;\n let _e44 = bright;\n let _e46 = unnamed.uThreshold;\n let _e49 = bright;\n return (_e43 * (max((_e44 - _e46), 0f) / max(_e49, 0.0001f)));\n}\n\nfn main_1() {\n var t: vec2<f32>;\n var a: vec3<f32>;\n var param_2: vec2<f32>;\n var b: vec3<f32>;\n var param_3: vec2<f32>;\n var c_3: vec3<f32>;\n var param_4: vec2<f32>;\n var d: vec3<f32>;\n var param_5: vec2<f32>;\n var e: vec3<f32>;\n var param_6: vec2<f32>;\n var f: vec3<f32>;\n var param_7: vec2<f32>;\n var g: vec3<f32>;\n var param_8: vec2<f32>;\n var h: vec3<f32>;\n var param_9: vec2<f32>;\n var i: vec3<f32>;\n var param_10: vec2<f32>;\n var j: vec3<f32>;\n var param_11: vec2<f32>;\n var k: vec3<f32>;\n var param_12: vec2<f32>;\n var l: vec3<f32>;\n var param_13: vec2<f32>;\n var m: vec3<f32>;\n var param_14: vec2<f32>;\n var box0_: vec3<f32>;\n var box1_: vec3<f32>;\n var box2_: vec3<f32>;\n var box3_: vec3<f32>;\n var box4_: vec3<f32>;\n var w0_: f32;\n var param_15: vec3<f32>;\n var w1_: f32;\n var param_16: vec3<f32>;\n var w2_: f32;\n var param_17: vec3<f32>;\n var w3_: f32;\n var param_18: vec3<f32>;\n var w4_: f32;\n var param_19: vec3<f32>;\n var sum: vec3<f32>;\n\n let _e77 = unnamed.uTexel;\n t = _e77;\n let _e78 = vUv_1;\n let _e79 = t;\n param_2 = (_e78 + (vec2<f32>(-2f, 2f) * _e79));\n let _e82 = fetch_u0028_vf2_u003b((&param_2));\n a = _e82;\n let _e83 = vUv_1;\n let _e84 = t;\n param_3 = (_e83 + (vec2<f32>(0f, 2f) * _e84));\n let _e87 = fetch_u0028_vf2_u003b((&param_3));\n b = _e87;\n let _e88 = vUv_1;\n let _e89 = t;\n param_4 = (_e88 + (vec2<f32>(2f, 2f) * _e89));\n let _e92 = fetch_u0028_vf2_u003b((&param_4));\n c_3 = _e92;\n let _e93 = vUv_1;\n let _e94 = t;\n param_5 = (_e93 + (vec2<f32>(-2f, 0f) * _e94));\n let _e97 = fetch_u0028_vf2_u003b((&param_5));\n d = _e97;\n let _e98 = vUv_1;\n param_6 = _e98;\n let _e99 = fetch_u0028_vf2_u003b((&param_6));\n e = _e99;\n let _e100 = vUv_1;\n let _e101 = t;\n param_7 = (_e100 + (vec2<f32>(2f, 0f) * _e101));\n let _e104 = fetch_u0028_vf2_u003b((&param_7));\n f = _e104;\n let _e105 = vUv_1;\n let _e106 = t;\n param_8 = (_e105 + (vec2<f32>(-2f, -2f) * _e106));\n let _e109 = fetch_u0028_vf2_u003b((&param_8));\n g = _e109;\n let _e110 = vUv_1;\n let _e111 = t;\n param_9 = (_e110 + (vec2<f32>(0f, -2f) * _e111));\n let _e114 = fetch_u0028_vf2_u003b((&param_9));\n h = _e114;\n let _e115 = vUv_1;\n let _e116 = t;\n param_10 = (_e115 + (vec2<f32>(2f, -2f) * _e116));\n let _e119 = fetch_u0028_vf2_u003b((&param_10));\n i = _e119;\n let _e120 = vUv_1;\n let _e121 = t;\n param_11 = (_e120 + (vec2<f32>(-1f, 1f) * _e121));\n let _e124 = fetch_u0028_vf2_u003b((&param_11));\n j = _e124;\n let _e125 = vUv_1;\n let _e126 = t;\n param_12 = (_e125 + (vec2<f32>(1f, 1f) * _e126));\n let _e129 = fetch_u0028_vf2_u003b((&param_12));\n k = _e129;\n let _e130 = vUv_1;\n let _e131 = t;\n param_13 = (_e130 + (vec2<f32>(-1f, -1f) * _e131));\n let _e134 = fetch_u0028_vf2_u003b((&param_13));\n l = _e134;\n let _e135 = vUv_1;\n let _e136 = t;\n param_14 = (_e135 + (vec2<f32>(1f, -1f) * _e136));\n let _e139 = fetch_u0028_vf2_u003b((&param_14));\n m = _e139;\n let _e140 = a;\n let _e141 = b;\n let _e143 = d;\n let _e145 = e;\n box0_ = ((((_e140 + _e141) + _e143) + _e145) * 0.25f);\n let _e148 = b;\n let _e149 = c_3;\n let _e151 = e;\n let _e153 = f;\n box1_ = ((((_e148 + _e149) + _e151) + _e153) * 0.25f);\n let _e156 = d;\n let _e157 = e;\n let _e159 = g;\n let _e161 = h;\n box2_ = ((((_e156 + _e157) + _e159) + _e161) * 0.25f);\n let _e164 = e;\n let _e165 = f;\n let _e167 = h;\n let _e169 = i;\n box3_ = ((((_e164 + _e165) + _e167) + _e169) * 0.25f);\n let _e172 = j;\n let _e173 = k;\n let _e175 = l;\n let _e177 = m;\n box4_ = ((((_e172 + _e173) + _e175) + _e177) * 0.25f);\n let _e180 = box0_;\n param_15 = _e180;\n let _e181 = firefly_u0028_vf3_u003b((&param_15));\n w0_ = (_e181 * 0.125f);\n let _e183 = box1_;\n param_16 = _e183;\n let _e184 = firefly_u0028_vf3_u003b((&param_16));\n w1_ = (_e184 * 0.125f);\n let _e186 = box2_;\n param_17 = _e186;\n let _e187 = firefly_u0028_vf3_u003b((&param_17));\n w2_ = (_e187 * 0.125f);\n let _e189 = box3_;\n param_18 = _e189;\n let _e190 = firefly_u0028_vf3_u003b((&param_18));\n w3_ = (_e190 * 0.125f);\n let _e192 = box4_;\n param_19 = _e192;\n let _e193 = firefly_u0028_vf3_u003b((&param_19));\n w4_ = (_e193 * 0.5f);\n let _e195 = box0_;\n let _e196 = w0_;\n let _e198 = box1_;\n let _e199 = w1_;\n let _e202 = box2_;\n let _e203 = w2_;\n let _e206 = box3_;\n let _e207 = w3_;\n let _e210 = box4_;\n let _e211 = w4_;\n sum = (((((_e195 * _e196) + (_e198 * _e199)) + (_e202 * _e203)) + (_e206 * _e207)) + (_e210 * _e211));\n let _e214 = sum;\n let _e215 = w0_;\n let _e216 = w1_;\n let _e218 = w2_;\n let _e220 = w3_;\n let _e222 = w4_;\n let _e226 = (_e214 / vec3(max(((((_e215 + _e216) + _e218) + _e220) + _e222), 0.0001f)));\n fragColor = vec4<f32>(_e226.x, _e226.y, _e226.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
3
- export declare const BLOOM_UPSAMPLE_FRAG_WGSL = "struct Uniforms {\n uRadius: f32,\n}\n\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn main_1() {\n var r: f32;\n var a: vec3<f32>;\n var b: vec3<f32>;\n var c: vec3<f32>;\n var d: vec3<f32>;\n var e: vec3<f32>;\n var f: vec3<f32>;\n var g: vec3<f32>;\n var h: vec3<f32>;\n var i: vec3<f32>;\n var sum: vec3<f32>;\n\n let _e23 = unnamed.uRadius;\n r = _e23;\n let _e24 = vUv_1;\n let _e25 = r;\n let _e27 = r;\n let _e30 = textureSampleLevel(uSource_t, uSource_s, (_e24 + vec2<f32>(-(_e25), _e27)), 0f);\n a = _e30.xyz;\n let _e32 = vUv_1;\n let _e33 = r;\n let _e36 = textureSampleLevel(uSource_t, uSource_s, (_e32 + vec2<f32>(0f, _e33)), 0f);\n b = _e36.xyz;\n let _e38 = vUv_1;\n let _e39 = r;\n let _e40 = r;\n let _e43 = textureSampleLevel(uSource_t, uSource_s, (_e38 + vec2<f32>(_e39, _e40)), 0f);\n c = _e43.xyz;\n let _e45 = vUv_1;\n let _e46 = r;\n let _e50 = textureSampleLevel(uSource_t, uSource_s, (_e45 + vec2<f32>(-(_e46), 0f)), 0f);\n d = _e50.xyz;\n let _e52 = vUv_1;\n let _e53 = textureSampleLevel(uSource_t, uSource_s, _e52, 0f);\n e = _e53.xyz;\n let _e55 = vUv_1;\n let _e56 = r;\n let _e59 = textureSampleLevel(uSource_t, uSource_s, (_e55 + vec2<f32>(_e56, 0f)), 0f);\n f = _e59.xyz;\n let _e61 = vUv_1;\n let _e62 = r;\n let _e64 = r;\n let _e68 = textureSampleLevel(uSource_t, uSource_s, (_e61 + vec2<f32>(-(_e62), -(_e64))), 0f);\n g = _e68.xyz;\n let _e70 = vUv_1;\n let _e71 = r;\n let _e75 = textureSampleLevel(uSource_t, uSource_s, (_e70 + vec2<f32>(0f, -(_e71))), 0f);\n h = _e75.xyz;\n let _e77 = vUv_1;\n let _e78 = r;\n let _e79 = r;\n let _e83 = textureSampleLevel(uSource_t, uSource_s, (_e77 + vec2<f32>(_e78, -(_e79))), 0f);\n i = _e83.xyz;\n let _e85 = e;\n let _e87 = b;\n let _e88 = d;\n let _e90 = f;\n let _e92 = h;\n let _e96 = a;\n let _e97 = c;\n let _e99 = g;\n let _e101 = i;\n sum = (((_e85 * 4f) + ((((_e87 + _e88) + _e90) + _e92) * 2f)) + (((_e96 + _e97) + _e99) + _e101));\n let _e104 = sum;\n let _e105 = (_e104 * 0.0625f);\n fragColor = vec4<f32>(_e105.x, _e105.y, _e105.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
2
+ export declare const BLOOM_PREFILTER_FRAG_WGSL = "struct Uniforms {\n uTexel: vec2<f32>,\n uThreshold: f32,\n uRamp: f32,\n}\n\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn brightness_u0028_vf3_u003b(c: ptr<function, vec3<f32>>) -> f32 {\n let _e36 = (*c)[0u];\n let _e38 = (*c)[1u];\n let _e40 = (*c)[2u];\n return max(_e36, max(_e38, _e40));\n}\n\nfn firefly_u0028_vf3_u003b(c_1: ptr<function, vec3<f32>>) -> f32 {\n var param: vec3<f32>;\n\n let _e36 = (*c_1);\n param = _e36;\n let _e37 = brightness_u0028_vf3_u003b((&param));\n return (1f / (1f + _e37));\n}\n\nfn fetch_u0028_vf2_u003b(uv: ptr<function, vec2<f32>>) -> vec3<f32> {\n var c_2: vec3<f32>;\n var bright: f32;\n var param_1: vec3<f32>;\n\n let _e38 = (*uv);\n let _e39 = textureSampleLevel(uSource_t, uSource_s, _e38, 0f);\n c_2 = min(_e39.xyz, vec3<f32>(256f, 256f, 256f));\n let _e42 = c_2;\n param_1 = _e42;\n let _e43 = brightness_u0028_vf3_u003b((&param_1));\n bright = _e43;\n let _e45 = unnamed.uRamp;\n if (_e45 > 0f) {\n let _e47 = c_2;\n let _e48 = bright;\n let _e50 = unnamed.uThreshold;\n let _e53 = unnamed.uRamp;\n return (_e47 * clamp(((_e48 - _e50) / _e53), 0f, 1f));\n }\n let _e57 = c_2;\n let _e58 = bright;\n let _e60 = unnamed.uThreshold;\n let _e63 = bright;\n return (_e57 * (max((_e58 - _e60), 0f) / max(_e63, 0.0001f)));\n}\n\nfn main_1() {\n var t: vec2<f32>;\n var a: vec3<f32>;\n var param_2: vec2<f32>;\n var b: vec3<f32>;\n var param_3: vec2<f32>;\n var c_3: vec3<f32>;\n var param_4: vec2<f32>;\n var d: vec3<f32>;\n var param_5: vec2<f32>;\n var e: vec3<f32>;\n var param_6: vec2<f32>;\n var f: vec3<f32>;\n var param_7: vec2<f32>;\n var g: vec3<f32>;\n var param_8: vec2<f32>;\n var h: vec3<f32>;\n var param_9: vec2<f32>;\n var i: vec3<f32>;\n var param_10: vec2<f32>;\n var j: vec3<f32>;\n var param_11: vec2<f32>;\n var k: vec3<f32>;\n var param_12: vec2<f32>;\n var l: vec3<f32>;\n var param_13: vec2<f32>;\n var m: vec3<f32>;\n var param_14: vec2<f32>;\n var box0_: vec3<f32>;\n var box1_: vec3<f32>;\n var box2_: vec3<f32>;\n var box3_: vec3<f32>;\n var box4_: vec3<f32>;\n var w0_: f32;\n var param_15: vec3<f32>;\n var w1_: f32;\n var param_16: vec3<f32>;\n var w2_: f32;\n var param_17: vec3<f32>;\n var w3_: f32;\n var param_18: vec3<f32>;\n var w4_: f32;\n var param_19: vec3<f32>;\n var sum: vec3<f32>;\n\n let _e78 = unnamed.uTexel;\n t = _e78;\n let _e79 = vUv_1;\n let _e80 = t;\n param_2 = (_e79 + (vec2<f32>(-2f, 2f) * _e80));\n let _e83 = fetch_u0028_vf2_u003b((&param_2));\n a = _e83;\n let _e84 = vUv_1;\n let _e85 = t;\n param_3 = (_e84 + (vec2<f32>(0f, 2f) * _e85));\n let _e88 = fetch_u0028_vf2_u003b((&param_3));\n b = _e88;\n let _e89 = vUv_1;\n let _e90 = t;\n param_4 = (_e89 + (vec2<f32>(2f, 2f) * _e90));\n let _e93 = fetch_u0028_vf2_u003b((&param_4));\n c_3 = _e93;\n let _e94 = vUv_1;\n let _e95 = t;\n param_5 = (_e94 + (vec2<f32>(-2f, 0f) * _e95));\n let _e98 = fetch_u0028_vf2_u003b((&param_5));\n d = _e98;\n let _e99 = vUv_1;\n param_6 = _e99;\n let _e100 = fetch_u0028_vf2_u003b((&param_6));\n e = _e100;\n let _e101 = vUv_1;\n let _e102 = t;\n param_7 = (_e101 + (vec2<f32>(2f, 0f) * _e102));\n let _e105 = fetch_u0028_vf2_u003b((&param_7));\n f = _e105;\n let _e106 = vUv_1;\n let _e107 = t;\n param_8 = (_e106 + (vec2<f32>(-2f, -2f) * _e107));\n let _e110 = fetch_u0028_vf2_u003b((&param_8));\n g = _e110;\n let _e111 = vUv_1;\n let _e112 = t;\n param_9 = (_e111 + (vec2<f32>(0f, -2f) * _e112));\n let _e115 = fetch_u0028_vf2_u003b((&param_9));\n h = _e115;\n let _e116 = vUv_1;\n let _e117 = t;\n param_10 = (_e116 + (vec2<f32>(2f, -2f) * _e117));\n let _e120 = fetch_u0028_vf2_u003b((&param_10));\n i = _e120;\n let _e121 = vUv_1;\n let _e122 = t;\n param_11 = (_e121 + (vec2<f32>(-1f, 1f) * _e122));\n let _e125 = fetch_u0028_vf2_u003b((&param_11));\n j = _e125;\n let _e126 = vUv_1;\n let _e127 = t;\n param_12 = (_e126 + (vec2<f32>(1f, 1f) * _e127));\n let _e130 = fetch_u0028_vf2_u003b((&param_12));\n k = _e130;\n let _e131 = vUv_1;\n let _e132 = t;\n param_13 = (_e131 + (vec2<f32>(-1f, -1f) * _e132));\n let _e135 = fetch_u0028_vf2_u003b((&param_13));\n l = _e135;\n let _e136 = vUv_1;\n let _e137 = t;\n param_14 = (_e136 + (vec2<f32>(1f, -1f) * _e137));\n let _e140 = fetch_u0028_vf2_u003b((&param_14));\n m = _e140;\n let _e141 = a;\n let _e142 = b;\n let _e144 = d;\n let _e146 = e;\n box0_ = ((((_e141 + _e142) + _e144) + _e146) * 0.25f);\n let _e149 = b;\n let _e150 = c_3;\n let _e152 = e;\n let _e154 = f;\n box1_ = ((((_e149 + _e150) + _e152) + _e154) * 0.25f);\n let _e157 = d;\n let _e158 = e;\n let _e160 = g;\n let _e162 = h;\n box2_ = ((((_e157 + _e158) + _e160) + _e162) * 0.25f);\n let _e165 = e;\n let _e166 = f;\n let _e168 = h;\n let _e170 = i;\n box3_ = ((((_e165 + _e166) + _e168) + _e170) * 0.25f);\n let _e173 = j;\n let _e174 = k;\n let _e176 = l;\n let _e178 = m;\n box4_ = ((((_e173 + _e174) + _e176) + _e178) * 0.25f);\n let _e181 = box0_;\n param_15 = _e181;\n let _e182 = firefly_u0028_vf3_u003b((&param_15));\n w0_ = (_e182 * 0.125f);\n let _e184 = box1_;\n param_16 = _e184;\n let _e185 = firefly_u0028_vf3_u003b((&param_16));\n w1_ = (_e185 * 0.125f);\n let _e187 = box2_;\n param_17 = _e187;\n let _e188 = firefly_u0028_vf3_u003b((&param_17));\n w2_ = (_e188 * 0.125f);\n let _e190 = box3_;\n param_18 = _e190;\n let _e191 = firefly_u0028_vf3_u003b((&param_18));\n w3_ = (_e191 * 0.125f);\n let _e193 = box4_;\n param_19 = _e193;\n let _e194 = firefly_u0028_vf3_u003b((&param_19));\n w4_ = (_e194 * 0.5f);\n let _e196 = box0_;\n let _e197 = w0_;\n let _e199 = box1_;\n let _e200 = w1_;\n let _e203 = box2_;\n let _e204 = w2_;\n let _e207 = box3_;\n let _e208 = w3_;\n let _e211 = box4_;\n let _e212 = w4_;\n sum = (((((_e196 * _e197) + (_e199 * _e200)) + (_e203 * _e204)) + (_e207 * _e208)) + (_e211 * _e212));\n let _e215 = sum;\n let _e216 = w0_;\n let _e217 = w1_;\n let _e219 = w2_;\n let _e221 = w3_;\n let _e223 = w4_;\n let _e227 = (_e215 / vec3(max(((((_e216 + _e217) + _e219) + _e221) + _e223), 0.0001f)));\n fragColor = vec4<f32>(_e227.x, _e227.y, _e227.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
3
+ export declare const BLOOM_UPSAMPLE_FRAG_WGSL = "struct Uniforms {\n uScale: vec3<f32>,\n uRadius: f32,\n}\n\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn main_1() {\n var r: f32;\n var a: vec3<f32>;\n var b: vec3<f32>;\n var c: vec3<f32>;\n var d: vec3<f32>;\n var e: vec3<f32>;\n var f: vec3<f32>;\n var g: vec3<f32>;\n var h: vec3<f32>;\n var i: vec3<f32>;\n var sum: vec3<f32>;\n\n let _e24 = unnamed.uRadius;\n r = _e24;\n let _e25 = vUv_1;\n let _e26 = r;\n let _e28 = r;\n let _e31 = textureSampleLevel(uSource_t, uSource_s, (_e25 + vec2<f32>(-(_e26), _e28)), 0f);\n a = _e31.xyz;\n let _e33 = vUv_1;\n let _e34 = r;\n let _e37 = textureSampleLevel(uSource_t, uSource_s, (_e33 + vec2<f32>(0f, _e34)), 0f);\n b = _e37.xyz;\n let _e39 = vUv_1;\n let _e40 = r;\n let _e41 = r;\n let _e44 = textureSampleLevel(uSource_t, uSource_s, (_e39 + vec2<f32>(_e40, _e41)), 0f);\n c = _e44.xyz;\n let _e46 = vUv_1;\n let _e47 = r;\n let _e51 = textureSampleLevel(uSource_t, uSource_s, (_e46 + vec2<f32>(-(_e47), 0f)), 0f);\n d = _e51.xyz;\n let _e53 = vUv_1;\n let _e54 = textureSampleLevel(uSource_t, uSource_s, _e53, 0f);\n e = _e54.xyz;\n let _e56 = vUv_1;\n let _e57 = r;\n let _e60 = textureSampleLevel(uSource_t, uSource_s, (_e56 + vec2<f32>(_e57, 0f)), 0f);\n f = _e60.xyz;\n let _e62 = vUv_1;\n let _e63 = r;\n let _e65 = r;\n let _e69 = textureSampleLevel(uSource_t, uSource_s, (_e62 + vec2<f32>(-(_e63), -(_e65))), 0f);\n g = _e69.xyz;\n let _e71 = vUv_1;\n let _e72 = r;\n let _e76 = textureSampleLevel(uSource_t, uSource_s, (_e71 + vec2<f32>(0f, -(_e72))), 0f);\n h = _e76.xyz;\n let _e78 = vUv_1;\n let _e79 = r;\n let _e80 = r;\n let _e84 = textureSampleLevel(uSource_t, uSource_s, (_e78 + vec2<f32>(_e79, -(_e80))), 0f);\n i = _e84.xyz;\n let _e86 = e;\n let _e88 = b;\n let _e89 = d;\n let _e91 = f;\n let _e93 = h;\n let _e97 = a;\n let _e98 = c;\n let _e100 = g;\n let _e102 = i;\n sum = (((_e86 * 4f) + ((((_e88 + _e89) + _e91) + _e93) * 2f)) + (((_e97 + _e98) + _e100) + _e102));\n let _e105 = sum;\n let _e108 = unnamed.uScale;\n let _e109 = ((_e105 * 0.0625f) * _e108);\n fragColor = vec4<f32>(_e109.x, _e109.y, _e109.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
4
4
  /**
5
5
  * What the transform assigned, so the renderer binds the same numbers.
6
6
  *
@@ -39,6 +39,11 @@ export declare const BLOOM_BINDINGS: {
39
39
  readonly size: 4;
40
40
  readonly type: "float";
41
41
  };
42
+ readonly uRamp: {
43
+ readonly offset: 12;
44
+ readonly size: 4;
45
+ readonly type: "float";
46
+ };
42
47
  };
43
48
  readonly textures: {
44
49
  readonly uSource: {
@@ -52,8 +57,13 @@ export declare const BLOOM_BINDINGS: {
52
57
  readonly uniforms: 1;
53
58
  readonly uniformSize: 16;
54
59
  readonly fields: {
55
- readonly uRadius: {
60
+ readonly uScale: {
56
61
  readonly offset: 0;
62
+ readonly size: 12;
63
+ readonly type: "vec3";
64
+ };
65
+ readonly uRadius: {
66
+ readonly offset: 12;
57
67
  readonly size: 4;
58
68
  readonly type: "float";
59
69
  };
@@ -5,8 +5,8 @@
5
5
  * the next generation, and `npm run wgsl:check` fails the build when this is stale.
6
6
  */
7
7
  export const BLOOM_DOWNSAMPLE_FRAG_WGSL = "struct Uniforms {\n uTexel: vec2<f32>,\n}\n\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn fetch_u0028_vf2_u003b(uv: ptr<function, vec2<f32>>) -> vec3<f32> {\n let _e27 = (*uv);\n let _e28 = textureSampleLevel(uSource_t, uSource_s, _e27, 0f);\n return _e28.xyz;\n}\n\nfn main_1() {\n var t: vec2<f32>;\n var a: vec3<f32>;\n var param: vec2<f32>;\n var b: vec3<f32>;\n var param_1: vec2<f32>;\n var c: vec3<f32>;\n var param_2: vec2<f32>;\n var d: vec3<f32>;\n var param_3: vec2<f32>;\n var e: vec3<f32>;\n var param_4: vec2<f32>;\n var f: vec3<f32>;\n var param_5: vec2<f32>;\n var g: vec3<f32>;\n var param_6: vec2<f32>;\n var h: vec3<f32>;\n var param_7: vec2<f32>;\n var i: vec3<f32>;\n var param_8: vec2<f32>;\n var j: vec3<f32>;\n var param_9: vec2<f32>;\n var k: vec3<f32>;\n var param_10: vec2<f32>;\n var l: vec3<f32>;\n var param_11: vec2<f32>;\n var m: vec3<f32>;\n var param_12: vec2<f32>;\n var box0_: vec3<f32>;\n var box1_: vec3<f32>;\n var box2_: vec3<f32>;\n var box3_: vec3<f32>;\n var box4_: vec3<f32>;\n\n let _e59 = unnamed.uTexel;\n t = _e59;\n let _e60 = vUv_1;\n let _e61 = t;\n param = (_e60 + (vec2<f32>(-2f, 2f) * _e61));\n let _e64 = fetch_u0028_vf2_u003b((&param));\n a = _e64;\n let _e65 = vUv_1;\n let _e66 = t;\n param_1 = (_e65 + (vec2<f32>(0f, 2f) * _e66));\n let _e69 = fetch_u0028_vf2_u003b((&param_1));\n b = _e69;\n let _e70 = vUv_1;\n let _e71 = t;\n param_2 = (_e70 + (vec2<f32>(2f, 2f) * _e71));\n let _e74 = fetch_u0028_vf2_u003b((&param_2));\n c = _e74;\n let _e75 = vUv_1;\n let _e76 = t;\n param_3 = (_e75 + (vec2<f32>(-2f, 0f) * _e76));\n let _e79 = fetch_u0028_vf2_u003b((&param_3));\n d = _e79;\n let _e80 = vUv_1;\n param_4 = _e80;\n let _e81 = fetch_u0028_vf2_u003b((&param_4));\n e = _e81;\n let _e82 = vUv_1;\n let _e83 = t;\n param_5 = (_e82 + (vec2<f32>(2f, 0f) * _e83));\n let _e86 = fetch_u0028_vf2_u003b((&param_5));\n f = _e86;\n let _e87 = vUv_1;\n let _e88 = t;\n param_6 = (_e87 + (vec2<f32>(-2f, -2f) * _e88));\n let _e91 = fetch_u0028_vf2_u003b((&param_6));\n g = _e91;\n let _e92 = vUv_1;\n let _e93 = t;\n param_7 = (_e92 + (vec2<f32>(0f, -2f) * _e93));\n let _e96 = fetch_u0028_vf2_u003b((&param_7));\n h = _e96;\n let _e97 = vUv_1;\n let _e98 = t;\n param_8 = (_e97 + (vec2<f32>(2f, -2f) * _e98));\n let _e101 = fetch_u0028_vf2_u003b((&param_8));\n i = _e101;\n let _e102 = vUv_1;\n let _e103 = t;\n param_9 = (_e102 + (vec2<f32>(-1f, 1f) * _e103));\n let _e106 = fetch_u0028_vf2_u003b((&param_9));\n j = _e106;\n let _e107 = vUv_1;\n let _e108 = t;\n param_10 = (_e107 + (vec2<f32>(1f, 1f) * _e108));\n let _e111 = fetch_u0028_vf2_u003b((&param_10));\n k = _e111;\n let _e112 = vUv_1;\n let _e113 = t;\n param_11 = (_e112 + (vec2<f32>(-1f, -1f) * _e113));\n let _e116 = fetch_u0028_vf2_u003b((&param_11));\n l = _e116;\n let _e117 = vUv_1;\n let _e118 = t;\n param_12 = (_e117 + (vec2<f32>(1f, -1f) * _e118));\n let _e121 = fetch_u0028_vf2_u003b((&param_12));\n m = _e121;\n let _e122 = a;\n let _e123 = b;\n let _e125 = d;\n let _e127 = e;\n box0_ = ((((_e122 + _e123) + _e125) + _e127) * 0.25f);\n let _e130 = b;\n let _e131 = c;\n let _e133 = e;\n let _e135 = f;\n box1_ = ((((_e130 + _e131) + _e133) + _e135) * 0.25f);\n let _e138 = d;\n let _e139 = e;\n let _e141 = g;\n let _e143 = h;\n box2_ = ((((_e138 + _e139) + _e141) + _e143) * 0.25f);\n let _e146 = e;\n let _e147 = f;\n let _e149 = h;\n let _e151 = i;\n box3_ = ((((_e146 + _e147) + _e149) + _e151) * 0.25f);\n let _e154 = j;\n let _e155 = k;\n let _e157 = l;\n let _e159 = m;\n box4_ = ((((_e154 + _e155) + _e157) + _e159) * 0.25f);\n let _e162 = box4_;\n let _e164 = box0_;\n let _e165 = box1_;\n let _e167 = box2_;\n let _e169 = box3_;\n let _e172 = ((_e162 * 0.5f) + ((((_e164 + _e165) + _e167) + _e169) * 0.125f));\n fragColor = vec4<f32>(_e172.x, _e172.y, _e172.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
8
- export const BLOOM_PREFILTER_FRAG_WGSL = "struct Uniforms {\n uTexel: vec2<f32>,\n uThreshold: f32,\n}\n\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn brightness_u0028_vf3_u003b(c: ptr<function, vec3<f32>>) -> f32 {\n let _e35 = (*c)[0u];\n let _e37 = (*c)[1u];\n let _e39 = (*c)[2u];\n return max(_e35, max(_e37, _e39));\n}\n\nfn firefly_u0028_vf3_u003b(c_1: ptr<function, vec3<f32>>) -> f32 {\n var param: vec3<f32>;\n\n let _e35 = (*c_1);\n param = _e35;\n let _e36 = brightness_u0028_vf3_u003b((&param));\n return (1f / (1f + _e36));\n}\n\nfn fetch_u0028_vf2_u003b(uv: ptr<function, vec2<f32>>) -> vec3<f32> {\n var c_2: vec3<f32>;\n var bright: f32;\n var param_1: vec3<f32>;\n\n let _e37 = (*uv);\n let _e38 = textureSampleLevel(uSource_t, uSource_s, _e37, 0f);\n c_2 = min(_e38.xyz, vec3<f32>(256f, 256f, 256f));\n let _e41 = c_2;\n param_1 = _e41;\n let _e42 = brightness_u0028_vf3_u003b((&param_1));\n bright = _e42;\n let _e43 = c_2;\n let _e44 = bright;\n let _e46 = unnamed.uThreshold;\n let _e49 = bright;\n return (_e43 * (max((_e44 - _e46), 0f) / max(_e49, 0.0001f)));\n}\n\nfn main_1() {\n var t: vec2<f32>;\n var a: vec3<f32>;\n var param_2: vec2<f32>;\n var b: vec3<f32>;\n var param_3: vec2<f32>;\n var c_3: vec3<f32>;\n var param_4: vec2<f32>;\n var d: vec3<f32>;\n var param_5: vec2<f32>;\n var e: vec3<f32>;\n var param_6: vec2<f32>;\n var f: vec3<f32>;\n var param_7: vec2<f32>;\n var g: vec3<f32>;\n var param_8: vec2<f32>;\n var h: vec3<f32>;\n var param_9: vec2<f32>;\n var i: vec3<f32>;\n var param_10: vec2<f32>;\n var j: vec3<f32>;\n var param_11: vec2<f32>;\n var k: vec3<f32>;\n var param_12: vec2<f32>;\n var l: vec3<f32>;\n var param_13: vec2<f32>;\n var m: vec3<f32>;\n var param_14: vec2<f32>;\n var box0_: vec3<f32>;\n var box1_: vec3<f32>;\n var box2_: vec3<f32>;\n var box3_: vec3<f32>;\n var box4_: vec3<f32>;\n var w0_: f32;\n var param_15: vec3<f32>;\n var w1_: f32;\n var param_16: vec3<f32>;\n var w2_: f32;\n var param_17: vec3<f32>;\n var w3_: f32;\n var param_18: vec3<f32>;\n var w4_: f32;\n var param_19: vec3<f32>;\n var sum: vec3<f32>;\n\n let _e77 = unnamed.uTexel;\n t = _e77;\n let _e78 = vUv_1;\n let _e79 = t;\n param_2 = (_e78 + (vec2<f32>(-2f, 2f) * _e79));\n let _e82 = fetch_u0028_vf2_u003b((&param_2));\n a = _e82;\n let _e83 = vUv_1;\n let _e84 = t;\n param_3 = (_e83 + (vec2<f32>(0f, 2f) * _e84));\n let _e87 = fetch_u0028_vf2_u003b((&param_3));\n b = _e87;\n let _e88 = vUv_1;\n let _e89 = t;\n param_4 = (_e88 + (vec2<f32>(2f, 2f) * _e89));\n let _e92 = fetch_u0028_vf2_u003b((&param_4));\n c_3 = _e92;\n let _e93 = vUv_1;\n let _e94 = t;\n param_5 = (_e93 + (vec2<f32>(-2f, 0f) * _e94));\n let _e97 = fetch_u0028_vf2_u003b((&param_5));\n d = _e97;\n let _e98 = vUv_1;\n param_6 = _e98;\n let _e99 = fetch_u0028_vf2_u003b((&param_6));\n e = _e99;\n let _e100 = vUv_1;\n let _e101 = t;\n param_7 = (_e100 + (vec2<f32>(2f, 0f) * _e101));\n let _e104 = fetch_u0028_vf2_u003b((&param_7));\n f = _e104;\n let _e105 = vUv_1;\n let _e106 = t;\n param_8 = (_e105 + (vec2<f32>(-2f, -2f) * _e106));\n let _e109 = fetch_u0028_vf2_u003b((&param_8));\n g = _e109;\n let _e110 = vUv_1;\n let _e111 = t;\n param_9 = (_e110 + (vec2<f32>(0f, -2f) * _e111));\n let _e114 = fetch_u0028_vf2_u003b((&param_9));\n h = _e114;\n let _e115 = vUv_1;\n let _e116 = t;\n param_10 = (_e115 + (vec2<f32>(2f, -2f) * _e116));\n let _e119 = fetch_u0028_vf2_u003b((&param_10));\n i = _e119;\n let _e120 = vUv_1;\n let _e121 = t;\n param_11 = (_e120 + (vec2<f32>(-1f, 1f) * _e121));\n let _e124 = fetch_u0028_vf2_u003b((&param_11));\n j = _e124;\n let _e125 = vUv_1;\n let _e126 = t;\n param_12 = (_e125 + (vec2<f32>(1f, 1f) * _e126));\n let _e129 = fetch_u0028_vf2_u003b((&param_12));\n k = _e129;\n let _e130 = vUv_1;\n let _e131 = t;\n param_13 = (_e130 + (vec2<f32>(-1f, -1f) * _e131));\n let _e134 = fetch_u0028_vf2_u003b((&param_13));\n l = _e134;\n let _e135 = vUv_1;\n let _e136 = t;\n param_14 = (_e135 + (vec2<f32>(1f, -1f) * _e136));\n let _e139 = fetch_u0028_vf2_u003b((&param_14));\n m = _e139;\n let _e140 = a;\n let _e141 = b;\n let _e143 = d;\n let _e145 = e;\n box0_ = ((((_e140 + _e141) + _e143) + _e145) * 0.25f);\n let _e148 = b;\n let _e149 = c_3;\n let _e151 = e;\n let _e153 = f;\n box1_ = ((((_e148 + _e149) + _e151) + _e153) * 0.25f);\n let _e156 = d;\n let _e157 = e;\n let _e159 = g;\n let _e161 = h;\n box2_ = ((((_e156 + _e157) + _e159) + _e161) * 0.25f);\n let _e164 = e;\n let _e165 = f;\n let _e167 = h;\n let _e169 = i;\n box3_ = ((((_e164 + _e165) + _e167) + _e169) * 0.25f);\n let _e172 = j;\n let _e173 = k;\n let _e175 = l;\n let _e177 = m;\n box4_ = ((((_e172 + _e173) + _e175) + _e177) * 0.25f);\n let _e180 = box0_;\n param_15 = _e180;\n let _e181 = firefly_u0028_vf3_u003b((&param_15));\n w0_ = (_e181 * 0.125f);\n let _e183 = box1_;\n param_16 = _e183;\n let _e184 = firefly_u0028_vf3_u003b((&param_16));\n w1_ = (_e184 * 0.125f);\n let _e186 = box2_;\n param_17 = _e186;\n let _e187 = firefly_u0028_vf3_u003b((&param_17));\n w2_ = (_e187 * 0.125f);\n let _e189 = box3_;\n param_18 = _e189;\n let _e190 = firefly_u0028_vf3_u003b((&param_18));\n w3_ = (_e190 * 0.125f);\n let _e192 = box4_;\n param_19 = _e192;\n let _e193 = firefly_u0028_vf3_u003b((&param_19));\n w4_ = (_e193 * 0.5f);\n let _e195 = box0_;\n let _e196 = w0_;\n let _e198 = box1_;\n let _e199 = w1_;\n let _e202 = box2_;\n let _e203 = w2_;\n let _e206 = box3_;\n let _e207 = w3_;\n let _e210 = box4_;\n let _e211 = w4_;\n sum = (((((_e195 * _e196) + (_e198 * _e199)) + (_e202 * _e203)) + (_e206 * _e207)) + (_e210 * _e211));\n let _e214 = sum;\n let _e215 = w0_;\n let _e216 = w1_;\n let _e218 = w2_;\n let _e220 = w3_;\n let _e222 = w4_;\n let _e226 = (_e214 / vec3(max(((((_e215 + _e216) + _e218) + _e220) + _e222), 0.0001f)));\n fragColor = vec4<f32>(_e226.x, _e226.y, _e226.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
9
- export const BLOOM_UPSAMPLE_FRAG_WGSL = "struct Uniforms {\n uRadius: f32,\n}\n\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn main_1() {\n var r: f32;\n var a: vec3<f32>;\n var b: vec3<f32>;\n var c: vec3<f32>;\n var d: vec3<f32>;\n var e: vec3<f32>;\n var f: vec3<f32>;\n var g: vec3<f32>;\n var h: vec3<f32>;\n var i: vec3<f32>;\n var sum: vec3<f32>;\n\n let _e23 = unnamed.uRadius;\n r = _e23;\n let _e24 = vUv_1;\n let _e25 = r;\n let _e27 = r;\n let _e30 = textureSampleLevel(uSource_t, uSource_s, (_e24 + vec2<f32>(-(_e25), _e27)), 0f);\n a = _e30.xyz;\n let _e32 = vUv_1;\n let _e33 = r;\n let _e36 = textureSampleLevel(uSource_t, uSource_s, (_e32 + vec2<f32>(0f, _e33)), 0f);\n b = _e36.xyz;\n let _e38 = vUv_1;\n let _e39 = r;\n let _e40 = r;\n let _e43 = textureSampleLevel(uSource_t, uSource_s, (_e38 + vec2<f32>(_e39, _e40)), 0f);\n c = _e43.xyz;\n let _e45 = vUv_1;\n let _e46 = r;\n let _e50 = textureSampleLevel(uSource_t, uSource_s, (_e45 + vec2<f32>(-(_e46), 0f)), 0f);\n d = _e50.xyz;\n let _e52 = vUv_1;\n let _e53 = textureSampleLevel(uSource_t, uSource_s, _e52, 0f);\n e = _e53.xyz;\n let _e55 = vUv_1;\n let _e56 = r;\n let _e59 = textureSampleLevel(uSource_t, uSource_s, (_e55 + vec2<f32>(_e56, 0f)), 0f);\n f = _e59.xyz;\n let _e61 = vUv_1;\n let _e62 = r;\n let _e64 = r;\n let _e68 = textureSampleLevel(uSource_t, uSource_s, (_e61 + vec2<f32>(-(_e62), -(_e64))), 0f);\n g = _e68.xyz;\n let _e70 = vUv_1;\n let _e71 = r;\n let _e75 = textureSampleLevel(uSource_t, uSource_s, (_e70 + vec2<f32>(0f, -(_e71))), 0f);\n h = _e75.xyz;\n let _e77 = vUv_1;\n let _e78 = r;\n let _e79 = r;\n let _e83 = textureSampleLevel(uSource_t, uSource_s, (_e77 + vec2<f32>(_e78, -(_e79))), 0f);\n i = _e83.xyz;\n let _e85 = e;\n let _e87 = b;\n let _e88 = d;\n let _e90 = f;\n let _e92 = h;\n let _e96 = a;\n let _e97 = c;\n let _e99 = g;\n let _e101 = i;\n sum = (((_e85 * 4f) + ((((_e87 + _e88) + _e90) + _e92) * 2f)) + (((_e96 + _e97) + _e99) + _e101));\n let _e104 = sum;\n let _e105 = (_e104 * 0.0625f);\n fragColor = vec4<f32>(_e105.x, _e105.y, _e105.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
8
+ export const BLOOM_PREFILTER_FRAG_WGSL = "struct Uniforms {\n uTexel: vec2<f32>,\n uThreshold: f32,\n uRamp: f32,\n}\n\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn brightness_u0028_vf3_u003b(c: ptr<function, vec3<f32>>) -> f32 {\n let _e36 = (*c)[0u];\n let _e38 = (*c)[1u];\n let _e40 = (*c)[2u];\n return max(_e36, max(_e38, _e40));\n}\n\nfn firefly_u0028_vf3_u003b(c_1: ptr<function, vec3<f32>>) -> f32 {\n var param: vec3<f32>;\n\n let _e36 = (*c_1);\n param = _e36;\n let _e37 = brightness_u0028_vf3_u003b((&param));\n return (1f / (1f + _e37));\n}\n\nfn fetch_u0028_vf2_u003b(uv: ptr<function, vec2<f32>>) -> vec3<f32> {\n var c_2: vec3<f32>;\n var bright: f32;\n var param_1: vec3<f32>;\n\n let _e38 = (*uv);\n let _e39 = textureSampleLevel(uSource_t, uSource_s, _e38, 0f);\n c_2 = min(_e39.xyz, vec3<f32>(256f, 256f, 256f));\n let _e42 = c_2;\n param_1 = _e42;\n let _e43 = brightness_u0028_vf3_u003b((&param_1));\n bright = _e43;\n let _e45 = unnamed.uRamp;\n if (_e45 > 0f) {\n let _e47 = c_2;\n let _e48 = bright;\n let _e50 = unnamed.uThreshold;\n let _e53 = unnamed.uRamp;\n return (_e47 * clamp(((_e48 - _e50) / _e53), 0f, 1f));\n }\n let _e57 = c_2;\n let _e58 = bright;\n let _e60 = unnamed.uThreshold;\n let _e63 = bright;\n return (_e57 * (max((_e58 - _e60), 0f) / max(_e63, 0.0001f)));\n}\n\nfn main_1() {\n var t: vec2<f32>;\n var a: vec3<f32>;\n var param_2: vec2<f32>;\n var b: vec3<f32>;\n var param_3: vec2<f32>;\n var c_3: vec3<f32>;\n var param_4: vec2<f32>;\n var d: vec3<f32>;\n var param_5: vec2<f32>;\n var e: vec3<f32>;\n var param_6: vec2<f32>;\n var f: vec3<f32>;\n var param_7: vec2<f32>;\n var g: vec3<f32>;\n var param_8: vec2<f32>;\n var h: vec3<f32>;\n var param_9: vec2<f32>;\n var i: vec3<f32>;\n var param_10: vec2<f32>;\n var j: vec3<f32>;\n var param_11: vec2<f32>;\n var k: vec3<f32>;\n var param_12: vec2<f32>;\n var l: vec3<f32>;\n var param_13: vec2<f32>;\n var m: vec3<f32>;\n var param_14: vec2<f32>;\n var box0_: vec3<f32>;\n var box1_: vec3<f32>;\n var box2_: vec3<f32>;\n var box3_: vec3<f32>;\n var box4_: vec3<f32>;\n var w0_: f32;\n var param_15: vec3<f32>;\n var w1_: f32;\n var param_16: vec3<f32>;\n var w2_: f32;\n var param_17: vec3<f32>;\n var w3_: f32;\n var param_18: vec3<f32>;\n var w4_: f32;\n var param_19: vec3<f32>;\n var sum: vec3<f32>;\n\n let _e78 = unnamed.uTexel;\n t = _e78;\n let _e79 = vUv_1;\n let _e80 = t;\n param_2 = (_e79 + (vec2<f32>(-2f, 2f) * _e80));\n let _e83 = fetch_u0028_vf2_u003b((&param_2));\n a = _e83;\n let _e84 = vUv_1;\n let _e85 = t;\n param_3 = (_e84 + (vec2<f32>(0f, 2f) * _e85));\n let _e88 = fetch_u0028_vf2_u003b((&param_3));\n b = _e88;\n let _e89 = vUv_1;\n let _e90 = t;\n param_4 = (_e89 + (vec2<f32>(2f, 2f) * _e90));\n let _e93 = fetch_u0028_vf2_u003b((&param_4));\n c_3 = _e93;\n let _e94 = vUv_1;\n let _e95 = t;\n param_5 = (_e94 + (vec2<f32>(-2f, 0f) * _e95));\n let _e98 = fetch_u0028_vf2_u003b((&param_5));\n d = _e98;\n let _e99 = vUv_1;\n param_6 = _e99;\n let _e100 = fetch_u0028_vf2_u003b((&param_6));\n e = _e100;\n let _e101 = vUv_1;\n let _e102 = t;\n param_7 = (_e101 + (vec2<f32>(2f, 0f) * _e102));\n let _e105 = fetch_u0028_vf2_u003b((&param_7));\n f = _e105;\n let _e106 = vUv_1;\n let _e107 = t;\n param_8 = (_e106 + (vec2<f32>(-2f, -2f) * _e107));\n let _e110 = fetch_u0028_vf2_u003b((&param_8));\n g = _e110;\n let _e111 = vUv_1;\n let _e112 = t;\n param_9 = (_e111 + (vec2<f32>(0f, -2f) * _e112));\n let _e115 = fetch_u0028_vf2_u003b((&param_9));\n h = _e115;\n let _e116 = vUv_1;\n let _e117 = t;\n param_10 = (_e116 + (vec2<f32>(2f, -2f) * _e117));\n let _e120 = fetch_u0028_vf2_u003b((&param_10));\n i = _e120;\n let _e121 = vUv_1;\n let _e122 = t;\n param_11 = (_e121 + (vec2<f32>(-1f, 1f) * _e122));\n let _e125 = fetch_u0028_vf2_u003b((&param_11));\n j = _e125;\n let _e126 = vUv_1;\n let _e127 = t;\n param_12 = (_e126 + (vec2<f32>(1f, 1f) * _e127));\n let _e130 = fetch_u0028_vf2_u003b((&param_12));\n k = _e130;\n let _e131 = vUv_1;\n let _e132 = t;\n param_13 = (_e131 + (vec2<f32>(-1f, -1f) * _e132));\n let _e135 = fetch_u0028_vf2_u003b((&param_13));\n l = _e135;\n let _e136 = vUv_1;\n let _e137 = t;\n param_14 = (_e136 + (vec2<f32>(1f, -1f) * _e137));\n let _e140 = fetch_u0028_vf2_u003b((&param_14));\n m = _e140;\n let _e141 = a;\n let _e142 = b;\n let _e144 = d;\n let _e146 = e;\n box0_ = ((((_e141 + _e142) + _e144) + _e146) * 0.25f);\n let _e149 = b;\n let _e150 = c_3;\n let _e152 = e;\n let _e154 = f;\n box1_ = ((((_e149 + _e150) + _e152) + _e154) * 0.25f);\n let _e157 = d;\n let _e158 = e;\n let _e160 = g;\n let _e162 = h;\n box2_ = ((((_e157 + _e158) + _e160) + _e162) * 0.25f);\n let _e165 = e;\n let _e166 = f;\n let _e168 = h;\n let _e170 = i;\n box3_ = ((((_e165 + _e166) + _e168) + _e170) * 0.25f);\n let _e173 = j;\n let _e174 = k;\n let _e176 = l;\n let _e178 = m;\n box4_ = ((((_e173 + _e174) + _e176) + _e178) * 0.25f);\n let _e181 = box0_;\n param_15 = _e181;\n let _e182 = firefly_u0028_vf3_u003b((&param_15));\n w0_ = (_e182 * 0.125f);\n let _e184 = box1_;\n param_16 = _e184;\n let _e185 = firefly_u0028_vf3_u003b((&param_16));\n w1_ = (_e185 * 0.125f);\n let _e187 = box2_;\n param_17 = _e187;\n let _e188 = firefly_u0028_vf3_u003b((&param_17));\n w2_ = (_e188 * 0.125f);\n let _e190 = box3_;\n param_18 = _e190;\n let _e191 = firefly_u0028_vf3_u003b((&param_18));\n w3_ = (_e191 * 0.125f);\n let _e193 = box4_;\n param_19 = _e193;\n let _e194 = firefly_u0028_vf3_u003b((&param_19));\n w4_ = (_e194 * 0.5f);\n let _e196 = box0_;\n let _e197 = w0_;\n let _e199 = box1_;\n let _e200 = w1_;\n let _e203 = box2_;\n let _e204 = w2_;\n let _e207 = box3_;\n let _e208 = w3_;\n let _e211 = box4_;\n let _e212 = w4_;\n sum = (((((_e196 * _e197) + (_e199 * _e200)) + (_e203 * _e204)) + (_e207 * _e208)) + (_e211 * _e212));\n let _e215 = sum;\n let _e216 = w0_;\n let _e217 = w1_;\n let _e219 = w2_;\n let _e221 = w3_;\n let _e223 = w4_;\n let _e227 = (_e215 / vec3(max(((((_e216 + _e217) + _e219) + _e221) + _e223), 0.0001f)));\n fragColor = vec4<f32>(_e227.x, _e227.y, _e227.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
9
+ export const BLOOM_UPSAMPLE_FRAG_WGSL = "struct Uniforms {\n uScale: vec3<f32>,\n uRadius: f32,\n}\n\n@group(0) @binding(1) \nvar<uniform> unnamed: Uniforms;\n@group(0) @binding(32) \nvar uSource_t: texture_2d<f32>;\n@group(0) @binding(33) \nvar uSource_s: sampler;\nvar<private> vUv_1: vec2<f32>;\nvar<private> fragColor: vec4<f32>;\n\nfn main_1() {\n var r: f32;\n var a: vec3<f32>;\n var b: vec3<f32>;\n var c: vec3<f32>;\n var d: vec3<f32>;\n var e: vec3<f32>;\n var f: vec3<f32>;\n var g: vec3<f32>;\n var h: vec3<f32>;\n var i: vec3<f32>;\n var sum: vec3<f32>;\n\n let _e24 = unnamed.uRadius;\n r = _e24;\n let _e25 = vUv_1;\n let _e26 = r;\n let _e28 = r;\n let _e31 = textureSampleLevel(uSource_t, uSource_s, (_e25 + vec2<f32>(-(_e26), _e28)), 0f);\n a = _e31.xyz;\n let _e33 = vUv_1;\n let _e34 = r;\n let _e37 = textureSampleLevel(uSource_t, uSource_s, (_e33 + vec2<f32>(0f, _e34)), 0f);\n b = _e37.xyz;\n let _e39 = vUv_1;\n let _e40 = r;\n let _e41 = r;\n let _e44 = textureSampleLevel(uSource_t, uSource_s, (_e39 + vec2<f32>(_e40, _e41)), 0f);\n c = _e44.xyz;\n let _e46 = vUv_1;\n let _e47 = r;\n let _e51 = textureSampleLevel(uSource_t, uSource_s, (_e46 + vec2<f32>(-(_e47), 0f)), 0f);\n d = _e51.xyz;\n let _e53 = vUv_1;\n let _e54 = textureSampleLevel(uSource_t, uSource_s, _e53, 0f);\n e = _e54.xyz;\n let _e56 = vUv_1;\n let _e57 = r;\n let _e60 = textureSampleLevel(uSource_t, uSource_s, (_e56 + vec2<f32>(_e57, 0f)), 0f);\n f = _e60.xyz;\n let _e62 = vUv_1;\n let _e63 = r;\n let _e65 = r;\n let _e69 = textureSampleLevel(uSource_t, uSource_s, (_e62 + vec2<f32>(-(_e63), -(_e65))), 0f);\n g = _e69.xyz;\n let _e71 = vUv_1;\n let _e72 = r;\n let _e76 = textureSampleLevel(uSource_t, uSource_s, (_e71 + vec2<f32>(0f, -(_e72))), 0f);\n h = _e76.xyz;\n let _e78 = vUv_1;\n let _e79 = r;\n let _e80 = r;\n let _e84 = textureSampleLevel(uSource_t, uSource_s, (_e78 + vec2<f32>(_e79, -(_e80))), 0f);\n i = _e84.xyz;\n let _e86 = e;\n let _e88 = b;\n let _e89 = d;\n let _e91 = f;\n let _e93 = h;\n let _e97 = a;\n let _e98 = c;\n let _e100 = g;\n let _e102 = i;\n sum = (((_e86 * 4f) + ((((_e88 + _e89) + _e91) + _e93) * 2f)) + (((_e97 + _e98) + _e100) + _e102));\n let _e105 = sum;\n let _e108 = unnamed.uScale;\n let _e109 = ((_e105 * 0.0625f) * _e108);\n fragColor = vec4<f32>(_e109.x, _e109.y, _e109.z, 1f);\n return;\n}\n\n@fragment \nfn main(@location(0) vUv: vec2<f32>) -> @location(0) vec4<f32> {\n vUv_1 = vUv;\n main_1();\n let _e3 = fragColor;\n return _e3;\n}\n";
10
10
  /**
11
11
  * What the transform assigned, so the renderer binds the same numbers.
12
12
  *
@@ -44,6 +44,11 @@ export const BLOOM_BINDINGS = {
44
44
  "offset": 8,
45
45
  "size": 4,
46
46
  "type": "float"
47
+ },
48
+ "uRamp": {
49
+ "offset": 12,
50
+ "size": 4,
51
+ "type": "float"
47
52
  }
48
53
  },
49
54
  "textures": {
@@ -58,8 +63,13 @@ export const BLOOM_BINDINGS = {
58
63
  "uniforms": 1,
59
64
  "uniformSize": 16,
60
65
  "fields": {
61
- "uRadius": {
66
+ "uScale": {
62
67
  "offset": 0,
68
+ "size": 12,
69
+ "type": "vec3"
70
+ },
71
+ "uRadius": {
72
+ "offset": 12,
63
73
  "size": 4,
64
74
  "type": "float"
65
75
  }