@takram/three-geospatial 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/build/index.cjs +1 -1
  3. package/build/index.cjs.map +1 -1
  4. package/build/index.js +359 -373
  5. package/build/index.js.map +1 -1
  6. package/build/r3f.cjs.map +1 -1
  7. package/build/r3f.js.map +1 -1
  8. package/build/shaders.cjs.map +1 -1
  9. package/build/shaders.js.map +1 -1
  10. package/build/shared.cjs.map +1 -1
  11. package/build/shared.js.map +1 -1
  12. package/build/shared2.cjs +1 -1
  13. package/build/shared2.cjs.map +1 -1
  14. package/build/shared2.js +55 -61
  15. package/build/shared2.js.map +1 -1
  16. package/build/shared3.cjs.map +1 -1
  17. package/build/shared3.js.map +1 -1
  18. package/build/webgpu.cjs +1 -1
  19. package/build/webgpu.cjs.map +1 -1
  20. package/build/webgpu.js +511 -630
  21. package/build/webgpu.js.map +1 -1
  22. package/package.json +1 -2
  23. package/src/EXR3DTextureLoader.ts +1 -1
  24. package/src/EXRTextureLoader.ts +1 -1
  25. package/src/webgpu/DownsampleThresholdNode.ts +3 -4
  26. package/src/webgpu/DualMipmapFilterNode.ts +1 -1
  27. package/src/webgpu/FnLayout.ts +5 -5
  28. package/src/webgpu/GaussianBlurNode.ts +3 -3
  29. package/src/webgpu/HighpVelocityNode.ts +8 -4
  30. package/src/webgpu/KawaseBlurNode.ts +3 -3
  31. package/src/webgpu/LensFlareNode.ts +10 -19
  32. package/src/webgpu/LensGlareNode.ts +8 -11
  33. package/src/webgpu/MipmapBlurNode.ts +7 -7
  34. package/src/webgpu/MipmapSurfaceBlurNode.ts +5 -6
  35. package/src/webgpu/OutputTexture3DNode.ts +1 -5
  36. package/src/webgpu/OutputTextureNode.ts +1 -4
  37. package/src/webgpu/RTTextureNode.ts +6 -8
  38. package/src/webgpu/TemporalAntialiasNode.ts +20 -23
  39. package/src/webgpu/accessors.ts +8 -10
  40. package/src/webgpu/generators.ts +7 -9
  41. package/src/webgpu/math.ts +13 -13
  42. package/src/webgpu/node.ts +3 -6
  43. package/src/webgpu/sampling.ts +3 -51
  44. package/src/webgpu/transformations.ts +30 -35
  45. package/src/webgpu/utils.ts +9 -9
  46. package/types/webgpu/DownsampleThresholdNode.d.ts +4 -4
  47. package/types/webgpu/DualMipmapFilterNode.d.ts +2 -2
  48. package/types/webgpu/FnLayout.d.ts +3 -3
  49. package/types/webgpu/GaussianBlurNode.d.ts +2 -2
  50. package/types/webgpu/HighpVelocityNode.d.ts +2 -3
  51. package/types/webgpu/KawaseBlurNode.d.ts +2 -2
  52. package/types/webgpu/LensFlareNode.d.ts +4 -4
  53. package/types/webgpu/LensGhostNode.d.ts +1 -1
  54. package/types/webgpu/LensGlareNode.d.ts +5 -5
  55. package/types/webgpu/LensHaloNode.d.ts +2 -2
  56. package/types/webgpu/MipmapBlurNode.d.ts +4 -4
  57. package/types/webgpu/MipmapSurfaceBlurNode.d.ts +3 -3
  58. package/types/webgpu/OutputTexture3DNode.d.ts +1 -2
  59. package/types/webgpu/OutputTextureNode.d.ts +1 -2
  60. package/types/webgpu/RTTextureNode.d.ts +2 -3
  61. package/types/webgpu/SeparableFilterNode.d.ts +2 -2
  62. package/types/webgpu/SingleFilterNode.d.ts +1 -1
  63. package/types/webgpu/TemporalAntialiasNode.d.ts +6 -6
  64. package/types/webgpu/accessors.d.ts +8 -8
  65. package/types/webgpu/generators.d.ts +4 -4
  66. package/types/webgpu/node.d.ts +4 -5
  67. package/types/webgpu/sampling.d.ts +0 -1
  68. package/types/webgpu/transformations.d.ts +8 -8
  69. package/types/webgpu/utils.d.ts +1 -2
package/build/webgpu.js CHANGED
@@ -1,86 +1,85 @@
1
- import { Vector3 as Ze, Mesh as Y, Scene as Qe, Camera as Ke, RenderTarget as Me, RGBAFormat as be, HalfFloatType as Re, LinearFilter as Q, Vector2 as B, Matrix4 as W, AdditiveBlending as Je, PlaneGeometry as Ye, PerspectiveCamera as _e, SRGBColorSpace as Xe, CanvasTexture as et, DepthTexture as tt } from "three";
2
- import { reference as $, uniform as y, vec4 as f, positionGeometry as Ve, nodeObject as b, texture as q, uv as P, vec2 as h, add as M, luminance as st, smoothstep as ze, Fn as A, screenCoordinate as Be, time as ot, vec3 as w, equirectUV as rt, fwidth as nt, abs as Ce, nodeImmutable as it, positionLocal as at, positionPrevious as ut, sub as C, instancedArray as le, struct as re, storage as lt, uvec2 as Pe, If as I, globalId as ee, Return as ct, atomicAdd as dt, instanceIndex as pt, mat3 as Ae, min as ht, mul as mt, fract as gt, distance as xt, mix as se, dot as K, sqrt as _, color as ft, mat4 as vt, mat2 as yt, bvec4 as wt, uvec4 as Tt, ivec4 as St, bvec3 as Nt, uvec3 as Mt, ivec3 as bt, bvec2 as Rt, ivec2 as N, bool as Vt, uint as zt, int as H, float as ne, textureSize as Fe, logarithmicDepthToViewZ as De, perspectiveDepthToViewZ as je, orthographicDepthToViewZ as Bt, viewZToPerspectiveDepth as Ct, viewZToLogarithmicDepth as Ue, PI2 as Pt, PI as At, cos as ce, sin as de, screenUV as Ft, step as Dt, and as jt, screenSize as Ut, max as Ie, select as It } from "three/tsl";
3
- import { NodeMaterial as j, TextureNode as oe, TempNode as G, NodeUpdateType as U, RendererUtils as L, QuadMesh as Z, Vector2 as kt, RenderTarget as Ot, RGBAFormat as Et, HalfFloatType as $t, LinearFilter as pe, StorageBufferAttribute as Gt, MeshBasicNodeMaterial as Lt, NodeBuilder as Wt, Texture3DNode as Ht } from "three/webgpu";
4
- import { Q as ie } from "./shared3.js";
5
- import { i as v } from "./shared.js";
6
- import { hash as ke } from "three/src/nodes/core/NodeUtils.js";
7
- let te;
8
- function k(o, e, t) {
9
- te ??= /* @__PURE__ */ new WeakMap();
10
- let s = te.get(o);
11
- return s == null && (s = {}, te.set(o, s)), s[e] ??= t();
1
+ import { Vector3 as qe, Mesh as J, Scene as Ze, Camera as Qe, RenderTarget as Ne, RGBAFormat as Me, HalfFloatType as Re, LinearFilter as Z, Vector2 as V, Matrix4 as W, AdditiveBlending as Ke, PlaneGeometry as Je, PerspectiveCamera as Ye, SRGBColorSpace as _e, CanvasTexture as Xe, DepthTexture as et } from "three";
2
+ import { reference as $, uniform as v, vec4 as w, positionGeometry as be, texture as I, uv as B, vec2 as p, add as S, luminance as tt, smoothstep as Ve, Fn as C, screenCoordinate as ze, time as st, vec3 as y, equirectUV as ot, fwidth as rt, abs as Be, nodeImmutable as nt, positionLocal as it, positionPrevious as at, sub as k, instancedArray as ue, struct as oe, storage as ut, uvec2 as Ce, If as F, globalId as X, Return as lt, atomicAdd as ct, instanceIndex as ht, mat3 as Pe, min as dt, mul as pt, fract as mt, distance as gt, mix as te, dot as Q, sqrt as Y, color as xt, mat4 as ft, mat2 as vt, bvec4 as yt, uvec4 as wt, ivec4 as Tt, bvec3 as St, uvec3 as Nt, ivec3 as Mt, bvec2 as Rt, ivec2 as T, bool as bt, uint as Vt, int as H, float as re, textureSize as Ae, logarithmicDepthToViewZ as Fe, perspectiveDepthToViewZ as De, orthographicDepthToViewZ as zt, viewZToPerspectiveDepth as Bt, viewZToLogarithmicDepth as je, PI2 as Ct, PI as Pt, cos as le, sin as ce, screenUV as At, step as Ft, and as Dt, screenSize as jt, max as Ue, select as Ut } from "three/tsl";
3
+ import { NodeMaterial as P, TextureNode as se, TempNode as E, NodeUpdateType as A, RendererUtils as O, QuadMesh as q, Vector2 as It, RenderTarget as kt, RGBAFormat as $t, HalfFloatType as Et, LinearFilter as he, StorageBufferAttribute as Ot, MeshBasicNodeMaterial as Gt, NodeBuilder as Lt, Node as Wt, Texture3DNode as Ht } from "three/webgpu";
4
+ import { Q as ne } from "./shared3.js";
5
+ import { i as f } from "./shared.js";
6
+ import { hash as Ie } from "three/src/nodes/core/NodeUtils.js";
7
+ let ee;
8
+ function D(o, e, t) {
9
+ ee ??= /* @__PURE__ */ new WeakMap();
10
+ let s = ee.get(o);
11
+ return s == null && (s = {}, ee.set(o, s)), s[e] ??= t();
12
12
  }
13
- const Gs = (o) => k(
13
+ const Os = (o) => D(
14
14
  o,
15
15
  "projectionMatrix",
16
16
  () => $("projectionMatrix", "mat4", o).setName("projectionMatrix")
17
- ), Ls = (o) => k(
17
+ ), Gs = (o) => D(
18
18
  o,
19
19
  "viewMatrix",
20
20
  () => $("matrixWorldInverse", "mat4", o).setName("viewMatrix")
21
- ), Ws = (o) => k(
21
+ ), Ls = (o) => D(
22
22
  o,
23
23
  "inverseProjectionMatrix",
24
24
  () => $("projectionMatrixInverse", "mat4", o).setName(
25
25
  "inverseProjectionMatrix"
26
26
  )
27
- ), Hs = (o) => k(
27
+ ), Ws = (o) => D(
28
28
  o,
29
29
  "inverseViewMatrix",
30
30
  () => $("matrixWorld", "mat4", o).setName("inverseViewMatrix")
31
- ), qs = (o) => k(
31
+ ), Hs = (o) => D(
32
32
  o,
33
33
  "cameraPositionWorld",
34
- () => y(new Ze()).setName("cameraPositionWorld").onRenderUpdate((e, { value: t }) => {
34
+ () => v(new qe()).setName("cameraPositionWorld").onRenderUpdate((e, { value: t }) => {
35
35
  t.setFromMatrixPosition(o.matrixWorld);
36
36
  })
37
- ), he = (o) => k(
37
+ ), de = (o) => D(
38
38
  o,
39
39
  "cameraNear",
40
40
  () => $("near", "float", o).setName("cameraNear")
41
- ), me = (o) => k(
41
+ ), pe = (o) => D(
42
42
  o,
43
43
  "cameraFar",
44
44
  () => $("far", "float", o).setName("cameraFar")
45
45
  );
46
- async function ae(o, e) {
47
- return await o.debug.getShaderAsync(new Qe(), new Ke(), e).then((t) => t).catch((t) => (console.error(t), { fragmentShader: null, vertexShader: null }));
46
+ async function ie(o, e) {
47
+ return await o.debug.getShaderAsync(new Ze(), new Qe(), e).then((t) => t).catch((t) => (console.error(t), { fragmentShader: null, vertexShader: null }));
48
48
  }
49
- function Zs(o, e) {
50
- const t = new Y(new ie(), e);
51
- ae(o, t).then((s) => {
49
+ function qs(o, e) {
50
+ const t = new J(new ne(), e);
51
+ ie(o, t).then((s) => {
52
52
  console.log(s.fragmentShader);
53
53
  }).finally(() => {
54
54
  t.geometry.dispose();
55
55
  });
56
56
  }
57
- function Qs(o, e) {
58
- const t = new Y(new ie(), e);
59
- ae(o, t).then((s) => {
57
+ function Zs(o, e) {
58
+ const t = new J(new ne(), e);
59
+ ie(o, t).then((s) => {
60
60
  console.log(s.vertexShader);
61
61
  }).finally(() => {
62
62
  t.geometry.dispose();
63
63
  });
64
64
  }
65
- function Ks(o, e) {
66
- const t = new j();
67
- t.vertexNode = f(Ve.xy, 0, 1), t.fragmentNode = e;
68
- const s = new Y(new ie(), t);
69
- ae(o, s).then((r) => {
65
+ function Qs(o, e) {
66
+ const t = new P();
67
+ t.vertexNode = w(be.xy, 0, 1), t.fragmentNode = e;
68
+ const s = new J(new ne(), t);
69
+ ie(o, s).then((r) => {
70
70
  console.log(r.fragmentShader);
71
71
  }).finally(() => {
72
72
  t.dispose(), s.geometry.dispose();
73
73
  });
74
74
  }
75
- function Js(o, e, t) {
75
+ function Ks(o, e, t) {
76
76
  const s = o[e];
77
77
  return o[e] = ((...r) => (t(...r), s.apply(o, r))), o;
78
78
  }
79
- class qt extends oe {
79
+ class qt extends se {
80
80
  static get type() {
81
81
  return "OutputTextureNode";
82
82
  }
83
- owner;
84
83
  constructor(e, t) {
85
84
  super(t), this.owner = e, this.setUpdateMatrix(!1);
86
85
  }
@@ -91,30 +90,26 @@ class qt extends oe {
91
90
  return new this.constructor(this.owner, this.value);
92
91
  }
93
92
  }
94
- const Oe = (...o) => b(new qt(...o));
95
- class X extends G {
93
+ const ke = (...o) => new qt(...o);
94
+ class _ extends E {
95
+ constructor(e) {
96
+ super("vec4"), this.resolutionScale = 1, this.renderTargets = [], this.inputNode = e, this.updateBeforeType = A.FRAME;
97
+ }
96
98
  static get type() {
97
99
  return "FilterNode";
98
100
  }
99
- inputNode;
100
- resolutionScale = 1;
101
- textureNode;
102
- renderTargets = [];
103
- constructor(e) {
104
- super("vec4"), this.inputNode = e, this.updateBeforeType = U.FRAME;
105
- }
106
101
  createRenderTarget(e) {
107
- const t = new Me(1, 1, {
102
+ const t = new Ne(1, 1, {
108
103
  depthBuffer: !1,
109
104
  type: Re,
110
- format: be
105
+ format: Me
111
106
  }), s = t.texture;
112
- s.minFilter = Q, s.magFilter = Q, s.generateMipmaps = !1;
107
+ s.minFilter = Z, s.magFilter = Z, s.generateMipmaps = !1;
113
108
  const r = this.constructor.type;
114
109
  return s.name = e != null ? `${r}.${e}` : r, this.renderTargets.push(t), t;
115
110
  }
116
111
  getTextureNode() {
117
- return v(
112
+ return f(
118
113
  this.textureNode != null,
119
114
  "outputTexture must be specified before getTextureNode() is called."
120
115
  ), this.textureNode;
@@ -123,14 +118,14 @@ class X extends G {
123
118
  return this.textureNode?.value ?? null;
124
119
  }
125
120
  set outputTexture(e) {
126
- this.textureNode = e != null ? Oe(this, e) : void 0;
121
+ this.textureNode = e != null ? ke(this, e) : void 0;
127
122
  }
128
123
  setup(e) {
129
124
  const { inputNode: t, textureNode: s } = this;
130
- return v(
125
+ return f(
131
126
  t != null,
132
127
  "inputNode must be specified before being setup."
133
- ), v(
128
+ ), f(
134
129
  s != null,
135
130
  "outputTexture must be specified before being setup."
136
131
  ), s.uvNode = t.uvNode, s;
@@ -141,18 +136,10 @@ class X extends G {
141
136
  super.dispose();
142
137
  }
143
138
  }
144
- const { resetRendererState: Zt, restoreRendererState: Qt } = L;
145
- class ue extends X {
146
- downsampleRTs = [];
147
- upsampleRTs = [];
148
- downsampleMaterial = new j();
149
- upsampleMaterial = new j();
150
- mesh = new Z();
151
- rendererState;
152
- inputTexelSize = y(new B());
153
- downsampleNode = q(null);
139
+ const { resetRendererState: Zt, restoreRendererState: Qt } = O;
140
+ class ae extends _ {
154
141
  constructor(e, t) {
155
- super(e);
142
+ super(e), this.downsampleRTs = [], this.upsampleRTs = [], this.downsampleMaterial = new P(), this.upsampleMaterial = new P(), this.mesh = new q(), this.inputTexelSize = v(new V()), this.downsampleNode = I();
156
143
  for (let s = 0; s < t; ++s)
157
144
  this.downsampleRTs[s] = this.createRenderTarget(`Downsample${s}`), s < t - 1 && (this.upsampleRTs[s] = this.createRenderTarget(`Upsample${s}`));
158
145
  this.outputTexture = this.upsampleRTs[0].texture;
@@ -176,25 +163,25 @@ class ue extends X {
176
163
  inputTexelSize: i,
177
164
  downsampleNode: u
178
165
  } = this;
179
- v(n != null);
180
- const { width: a, height: d } = n.value;
181
- this.setSize(a, d);
182
- const l = n.value;
166
+ f(n != null);
167
+ const { width: a, height: h } = n.value;
168
+ this.setSize(a, h);
169
+ const c = n.value;
183
170
  this.rendererState = Zt(e, this.rendererState), r.material = this.downsampleMaterial;
184
- for (const c of t) {
185
- const { width: p, height: m } = n.value;
186
- i.value.set(1 / p, 1 / m), e.setRenderTarget(c), r.render(e), n.value = c.texture;
171
+ for (const l of t) {
172
+ const { width: d, height: m } = n.value;
173
+ i.value.set(1 / d, 1 / m), e.setRenderTarget(l), r.render(e), n.value = l.texture;
187
174
  }
188
175
  r.material = this.upsampleMaterial;
189
- for (let c = s.length - 1; c >= 0; --c) {
190
- const p = s[c], { width: m, height: g } = n.value;
191
- i.value.set(1 / m, 1 / g), u.value = t[c].texture, e.setRenderTarget(p), r.render(e), n.value = p.texture;
176
+ for (let l = s.length - 1; l >= 0; --l) {
177
+ const d = s[l], { width: m, height: g } = n.value;
178
+ i.value.set(1 / m, 1 / g), u.value = t[l].texture, e.setRenderTarget(d), r.render(e), n.value = d.texture;
192
179
  }
193
- Qt(e, this.rendererState), n.value = l;
180
+ Qt(e, this.rendererState), n.value = c;
194
181
  }
195
182
  setup(e) {
196
183
  const { inputNode: t } = this;
197
- v(t != null);
184
+ f(t != null);
198
185
  const { downsampleMaterial: s, upsampleMaterial: r } = this;
199
186
  return s.fragmentNode = this.setupDownsampleNode(e), r.fragmentNode = this.setupUpsampleNode(e), s.needsUpdate = !0, r.needsUpdate = !0, super.setup(e);
200
187
  }
@@ -206,48 +193,48 @@ class ue extends X {
206
193
  this.downsampleMaterial.dispose(), this.upsampleMaterial.dispose(), this.mesh.geometry.dispose(), super.dispose();
207
194
  }
208
195
  }
209
- const Ee = (o, e) => {
210
- const t = P(), s = f(1, 1, -1, -1).mul(e.xyxy).add(t.xyxy), r = f(2, 2, -2, -2).mul(e.xyxy).add(t.xyxy), n = s.zy.toVertexStage(), i = s.xy.toVertexStage(), u = s.zw.toVertexStage(), a = s.xw.toVertexStage(), d = h(t.x, r.y).toVertexStage(), l = h(r.z, t.y).toVertexStage(), c = h(r.x, t.y).toVertexStage(), p = h(t.x, r.w).toVertexStage(), m = r.zy.toVertexStage(), g = r.xy.toVertexStage(), x = r.zw.toVertexStage(), T = r.xw.toVertexStage();
211
- return M(
212
- M(
196
+ const $e = (o, e) => {
197
+ const t = B(), s = w(1, 1, -1, -1).mul(e.xyxy).add(t.xyxy), r = w(2, 2, -2, -2).mul(e.xyxy).add(t.xyxy), n = s.zy.toVertexStage(), i = s.xy.toVertexStage(), u = s.zw.toVertexStage(), a = s.xw.toVertexStage(), h = p(t.x, r.y).toVertexStage(), c = p(r.z, t.y).toVertexStage(), l = p(r.x, t.y).toVertexStage(), d = p(t.x, r.w).toVertexStage(), m = r.zy.toVertexStage(), g = r.xy.toVertexStage(), x = r.zw.toVertexStage(), R = r.xw.toVertexStage();
198
+ return S(
199
+ S(
213
200
  o.sample(t),
214
201
  o.sample(n),
215
202
  o.sample(i),
216
203
  o.sample(u),
217
204
  o.sample(a)
218
205
  ).mul(1 / 8),
219
- M(
220
- o.sample(d),
221
- o.sample(l),
206
+ S(
207
+ o.sample(h),
222
208
  o.sample(c),
223
- o.sample(p)
209
+ o.sample(l),
210
+ o.sample(d)
224
211
  ).mul(1 / 16),
225
- M(
212
+ S(
226
213
  o.sample(m),
227
214
  o.sample(g),
228
215
  o.sample(x),
229
- o.sample(T)
216
+ o.sample(R)
230
217
  ).mul(1 / 32)
231
218
  );
232
219
  }, Kt = (o, e) => {
233
- const t = P(), s = f(1, 1, -1, -1).mul(e.xyxy).add(t.xyxy), r = h(t.x, s.y).toVertexStage(), n = h(s.z, t.y).toVertexStage(), i = h(s.x, t.y).toVertexStage(), u = h(t.x, s.w).toVertexStage(), a = s.zy.toVertexStage(), d = s.xy.toVertexStage(), l = s.zw.toVertexStage(), c = s.xw.toVertexStage();
234
- return M(
220
+ const t = B(), s = w(1, 1, -1, -1).mul(e.xyxy).add(t.xyxy), r = p(t.x, s.y).toVertexStage(), n = p(s.z, t.y).toVertexStage(), i = p(s.x, t.y).toVertexStage(), u = p(t.x, s.w).toVertexStage(), a = s.zy.toVertexStage(), h = s.xy.toVertexStage(), c = s.zw.toVertexStage(), l = s.xw.toVertexStage();
221
+ return S(
235
222
  o.sample(t).mul(0.25),
236
- M(
223
+ S(
237
224
  o.sample(r),
238
225
  o.sample(n),
239
226
  o.sample(i),
240
227
  o.sample(u)
241
228
  ).mul(0.125),
242
- M(
229
+ S(
243
230
  o.sample(a),
244
- o.sample(d),
245
- o.sample(l),
246
- o.sample(c)
231
+ o.sample(h),
232
+ o.sample(c),
233
+ o.sample(l)
247
234
  ).mul(0.0625)
248
235
  );
249
236
  };
250
- class Jt extends ue {
237
+ class Jt extends ae {
251
238
  static get type() {
252
239
  return "MipmapBlurNode";
253
240
  }
@@ -255,21 +242,16 @@ class Jt extends ue {
255
242
  super(e, t), this.resolutionScale = 0.5;
256
243
  }
257
244
  setupDownsampleNode(e) {
258
- return v(this.inputNode != null), Ee(this.inputNode, this.inputTexelSize);
245
+ return f(this.inputNode != null), $e(this.inputNode, this.inputTexelSize);
259
246
  }
260
247
  setupUpsampleNode(e) {
261
- return v(this.inputNode != null), Kt(this.inputNode, this.inputTexelSize);
248
+ return f(this.inputNode != null), Kt(this.inputNode, this.inputTexelSize);
262
249
  }
263
250
  }
264
- const Ys = (...o) => b(new Jt(...o)), { resetRendererState: Yt, restoreRendererState: _t } = L;
265
- class Xt extends X {
266
- renderTarget;
267
- material = new j();
268
- mesh = new Z(this.material);
269
- rendererState;
270
- inputTexelSize = y(new B());
251
+ const Js = (...o) => new Jt(...o), { resetRendererState: Yt, restoreRendererState: _t } = O;
252
+ class Xt extends _ {
271
253
  constructor(e) {
272
- super(e), this.renderTarget = this.createRenderTarget(), this.outputTexture = this.renderTarget.texture;
254
+ super(e), this.material = new P(), this.mesh = new q(this.material), this.inputTexelSize = v(new V()), this.renderTarget = this.createRenderTarget(), this.outputTexture = this.renderTarget.texture;
273
255
  }
274
256
  setSize(e, t) {
275
257
  const { resolutionScale: s } = this, r = Math.max(Math.round(e * s), 1), n = Math.max(Math.round(t * s), 1);
@@ -279,13 +261,13 @@ class Xt extends X {
279
261
  if (e == null)
280
262
  return;
281
263
  const { inputNode: t } = this;
282
- v(t != null);
264
+ f(t != null);
283
265
  const { width: s, height: r } = t.value;
284
266
  this.setSize(s, r), this.inputTexelSize.value.set(1 / s, 1 / r), this.rendererState = Yt(e, this.rendererState), e.setRenderTarget(this.renderTarget), this.mesh.render(e), _t(e, this.rendererState);
285
267
  }
286
268
  setup(e) {
287
269
  const { inputNode: t } = this;
288
- v(t != null);
270
+ f(t != null);
289
271
  const { material: s } = this;
290
272
  return s.fragmentNode = this.setupOutputNode(e), s.needsUpdate = !0, super.setup(e);
291
273
  }
@@ -293,65 +275,55 @@ class Xt extends X {
293
275
  this.renderTarget.dispose(), this.material.dispose(), this.mesh.geometry.dispose(), super.dispose();
294
276
  }
295
277
  }
296
- class $e extends Xt {
278
+ class Ee extends Xt {
279
+ constructor(e) {
280
+ super(e), this.thresholdLevel = v(5), this.thresholdRange = v(1), this.resolutionScale = 0.5;
281
+ }
297
282
  static get type() {
298
283
  return "DownsampleThresholdNode";
299
284
  }
300
- thresholdLevel = y(5);
301
- thresholdRange = y(1);
302
- constructor(e) {
303
- super(e), this.resolutionScale = 0.5;
304
- }
305
285
  setupOutputNode() {
306
286
  const { inputNode: e, thresholdLevel: t, thresholdRange: s, inputTexelSize: r } = this;
307
- v(e != null);
308
- const n = Ee(e, r), i = st(n.rgb), u = ze(
287
+ f(e != null);
288
+ const n = $e(e, r), i = tt(n.rgb), u = Ve(
309
289
  t,
310
290
  t.add(s),
311
291
  i
312
292
  );
313
- return f(n.rgb, i).mul(u);
293
+ return w(n.rgb, i).mul(u);
314
294
  }
315
295
  }
316
- const _s = (...o) => b(new $e(...o));
317
- function ge(o) {
296
+ const Ys = (...o) => new Ee(...o);
297
+ function me(o) {
318
298
  if (typeof o == "string")
319
299
  return o;
320
300
  if (o.layout.name == null)
321
301
  throw new Error("Struct name is required.");
322
302
  return o.layout.name;
323
303
  }
324
- function J({
304
+ function K({
325
305
  typeOnly: o = !1,
326
306
  ...e
327
307
  }) {
328
- return o ? (t) => A(t) : (t) => A(t).setLayout({
308
+ return o ? (t) => C(t) : (t) => C(t).setLayout({
329
309
  ...e,
330
- type: ge(e.type),
310
+ type: me(e.type),
331
311
  inputs: e.inputs?.map((s) => ({
332
312
  ...s,
333
- type: ge(s.type)
313
+ type: me(s.type)
334
314
  })) ?? []
335
315
  });
336
316
  }
337
- function O(o) {
338
- return A((e, t) => {
317
+ function G(o) {
318
+ return C((e, t) => {
339
319
  const s = o(...e);
340
320
  return typeof s == "function" ? s(t) : s;
341
321
  });
342
322
  }
343
- const { resetRendererState: es, restoreRendererState: ts } = L;
344
- class ss extends X {
345
- iterations = 1;
346
- horizontalRT;
347
- verticalRT;
348
- material = new j();
349
- mesh = new Z(this.material);
350
- rendererState;
351
- inputTexelSize = y(new B());
352
- direction = y(new B());
323
+ const { resetRendererState: es, restoreRendererState: ts } = O;
324
+ class ss extends _ {
353
325
  constructor(e) {
354
- super(e), this.horizontalRT = this.createRenderTarget("Horizontal"), this.verticalRT = this.createRenderTarget("Vertical"), this.outputTexture = this.verticalRT.texture;
326
+ super(e), this.iterations = 1, this.material = new P(), this.mesh = new q(this.material), this.inputTexelSize = v(new V()), this.direction = v(new V()), this.horizontalRT = this.createRenderTarget("Horizontal"), this.verticalRT = this.createRenderTarget("Vertical"), this.outputTexture = this.verticalRT.texture;
355
327
  }
356
328
  setSize(e, t) {
357
329
  const { resolutionScale: s } = this, r = Math.max(Math.round(e * s), 1), n = Math.max(Math.round(t * s), 1);
@@ -361,18 +333,18 @@ class ss extends X {
361
333
  if (e == null)
362
334
  return;
363
335
  const { horizontalRT: t, verticalRT: s, mesh: r, inputNode: n, direction: i } = this;
364
- v(n != null);
336
+ f(n != null);
365
337
  const { width: u, height: a } = n.value;
366
338
  this.setSize(u, a), this.inputTexelSize.value.set(1 / u, 1 / a);
367
- const d = n.value;
339
+ const h = n.value;
368
340
  this.rendererState = es(e, this.rendererState);
369
- for (let l = 0; l < this.iterations; ++l)
341
+ for (let c = 0; c < this.iterations; ++c)
370
342
  i.value.set(1, 0), e.setRenderTarget(t), r.render(e), n.value = t.texture, i.value.set(0, 1), e.setRenderTarget(s), r.render(e), n.value = s.texture;
371
- ts(e, this.rendererState), n.value = d;
343
+ ts(e, this.rendererState), n.value = h;
372
344
  }
373
345
  setup(e) {
374
346
  const { inputNode: t } = this;
375
- v(t != null);
347
+ f(t != null);
376
348
  const { material: s } = this;
377
349
  return s.fragmentNode = this.setupOutputNode(e), s.needsUpdate = !0, super.setup(e);
378
350
  }
@@ -380,8 +352,8 @@ class ss extends X {
380
352
  this.horizontalRT.dispose(), this.verticalRT.dispose(), this.material.dispose(), this.mesh.geometry.dispose(), super.dispose();
381
353
  }
382
354
  }
383
- function xe(o) {
384
- if (v(o >= 0), o === 0)
355
+ function ge(o) {
356
+ if (f(o >= 0), o === 0)
385
357
  return new Float64Array(0);
386
358
  if (o === 1)
387
359
  return new Float64Array([1]);
@@ -394,71 +366,64 @@ function xe(o) {
394
366
  return s;
395
367
  }
396
368
  function os(o, e = 2) {
397
- v(o >= 3);
398
- const t = o + e * 2, s = e > 0 ? xe(t).slice(e, -e) : xe(t), r = Math.floor((s.length - 1) / 2), n = s.reduce((c, p) => c + p, 0), i = s.slice(r), u = [...Array(r + 1).keys()], a = new Float64Array(Math.floor(u.length / 2)), d = new Float64Array(a.length);
369
+ f(o >= 3);
370
+ const t = o + e * 2, s = e > 0 ? ge(t).slice(e, -e) : ge(t), r = Math.floor((s.length - 1) / 2), n = s.reduce((l, d) => l + d, 0), i = s.slice(r), u = [...Array(r + 1).keys()], a = new Float64Array(Math.floor(u.length / 2)), h = new Float64Array(a.length);
399
371
  a[0] = i[0] / n;
400
- for (let c = 1, p = 1; c < u.length - 1; c += 2, ++p) {
401
- const m = u[c], g = u[c + 1], x = i[c], T = i[c + 1], S = x + T, V = (m * x + g * T) / S;
402
- a[p] = S / n, d[p] = V;
372
+ for (let l = 1, d = 1; l < u.length - 1; l += 2, ++d) {
373
+ const m = u[l], g = u[l + 1], x = i[l], R = i[l + 1], N = x + R, z = (m * x + g * R) / N;
374
+ a[d] = N / n, h[d] = z;
403
375
  }
404
- const l = (a.reduce((c, p) => c + p, 0) - a[0] * 0.5) * 2;
405
- if (l !== 0) {
406
- const c = 1 / l;
407
- for (let p = 0; p < a.length; ++p)
408
- a[p] *= c;
376
+ const c = (a.reduce((l, d) => l + d, 0) - a[0] * 0.5) * 2;
377
+ if (c !== 0) {
378
+ const l = 1 / c;
379
+ for (let d = 0; d < a.length; ++d)
380
+ a[d] *= l;
409
381
  }
410
382
  return {
411
- offsets: d,
383
+ offsets: h,
412
384
  weights: a
413
385
  };
414
386
  }
415
- class Ge extends ss {
387
+ class Oe extends ss {
416
388
  static get type() {
417
389
  return "GaussianBlurNode";
418
390
  }
419
- kernelSize;
420
391
  constructor(e, t = 35) {
421
392
  super(e), this.kernelSize = t;
422
393
  }
423
394
  setupOutputNode(e) {
424
395
  const { inputNode: t, inputTexelSize: s, direction: r } = this;
425
- v(t != null);
396
+ f(t != null);
426
397
  const { offsets: n, weights: i } = os(this.kernelSize);
427
- return A(() => {
428
- const u = P(), a = r.mul(s).toVertexStage(), d = t.sample(u).mul(i[0]);
429
- for (let l = 1; l < n.length; ++l) {
430
- const c = a.mul(n[l]);
431
- d.addAssign(
432
- M(
433
- t.sample(u.add(c)),
434
- t.sample(u.sub(c))
435
- ).mul(i[l])
398
+ return C(() => {
399
+ const u = B(), a = r.mul(s).toVertexStage(), h = t.sample(u).mul(i[0]);
400
+ for (let c = 1; c < n.length; ++c) {
401
+ const l = a.mul(n[c]);
402
+ h.addAssign(
403
+ S(
404
+ t.sample(u.add(l)),
405
+ t.sample(u.sub(l))
406
+ ).mul(i[c])
436
407
  );
437
408
  }
438
- return d;
409
+ return h;
439
410
  })();
440
411
  }
441
412
  }
442
- const Xs = (...o) => b(new Ge(...o)), rs = (o) => o.dot(h(0.06711056, 583715e-8)).fract().mul(52.9829189).fract(), eo = /* @__PURE__ */ A(() => {
443
- const o = h(Be.xy).add(ot.fract().mul(1337)), e = rs(o);
444
- return w(e, e.oneMinus(), e).sub(0.5).div(255);
445
- }).once()(), to = (o, e, t = h(90, 45)) => {
446
- const s = rt(o), r = nt(s), n = e.mul(r).mul(0.5), i = Ce(s.mul(t).fract().sub(0.5)).div(t), u = ze(n, n.add(r), i).oneMinus();
413
+ const _s = (...o) => new Oe(...o), rs = (o) => o.dot(p(0.06711056, 583715e-8)).fract().mul(52.9829189).fract(), Xs = /* @__PURE__ */ C(() => {
414
+ const o = p(ze.xy).add(st.fract().mul(1337)), e = rs(o);
415
+ return y(e, e.oneMinus(), e).sub(0.5).div(255);
416
+ }).once()(), eo = (o, e, t = p(90, 45)) => {
417
+ const s = ot(o), r = rt(s), n = e.mul(r).mul(0.5), i = Be(s.mul(t).fract().sub(0.5)).div(t), u = Ve(n, n.add(r), i).oneMinus();
447
418
  return u.x.add(u.y).clamp(0, 1);
448
419
  };
449
- class ns extends G {
420
+ class ns extends E {
421
+ constructor() {
422
+ super("vec3"), this.currentProjectionMatrix = v(new W()), this.previousProjectionMatrix = v("mat4"), this.currentModelViewMatrix = v(new W()), this.previousModelViewMatrix = v("mat4"), this.objectModelViewMatrices = /* @__PURE__ */ new WeakMap(), this.updateType = A.FRAME, this.updateBeforeType = A.OBJECT, this.updateAfterType = A.OBJECT;
423
+ }
450
424
  static get type() {
451
425
  return "HighpVelocityNode";
452
426
  }
453
- projectionMatrix;
454
- currentProjectionMatrix = y(new W());
455
- previousProjectionMatrix = y("mat4");
456
- currentModelViewMatrix = y(new W());
457
- previousModelViewMatrix = y("mat4");
458
- objectModelViewMatrices = /* @__PURE__ */ new WeakMap();
459
- constructor() {
460
- super("vec3"), this.updateType = U.FRAME, this.updateBeforeType = U.OBJECT, this.updateAfterType = U.OBJECT;
461
- }
462
427
  // Executed once per frame:
463
428
  update({ camera: e }) {
464
429
  if (e == null)
@@ -495,12 +460,12 @@ class ns extends G {
495
460
  r == null && (r = new W(), s.set(e, r)), r.copy(t.value);
496
461
  }
497
462
  setup(e) {
498
- const t = this.currentProjectionMatrix.mul(this.currentModelViewMatrix).mul(at).toVertexStage(), s = this.previousProjectionMatrix.mul(this.previousModelViewMatrix).mul(ut).toVertexStage(), r = t.xyz.div(t.w), n = s.xyz.div(s.w);
499
- return C(r, n);
463
+ const t = this.currentProjectionMatrix.mul(this.currentModelViewMatrix).mul(it).toVertexStage(), s = this.previousProjectionMatrix.mul(this.previousModelViewMatrix).mul(at).toVertexStage(), r = t.xyz.div(t.w), n = s.xyz.div(s.w);
464
+ return k(r, n);
500
465
  }
501
466
  }
502
- const so = /* @__PURE__ */ it(ns);
503
- class is extends ue {
467
+ const to = /* @__PURE__ */ nt(ns);
468
+ class is extends ae {
504
469
  static get type() {
505
470
  return "KawaseBlurNode";
506
471
  }
@@ -509,50 +474,48 @@ class is extends ue {
509
474
  }
510
475
  setupDownsampleNode(e) {
511
476
  const { inputNode: t, inputTexelSize: s } = this;
512
- v(t != null);
513
- const r = P(), n = f(1, 1, -1, -1).mul(s.xyxy.mul(0.5)).add(r.xyxy), i = n.zy.toVertexStage(), u = n.xy.toVertexStage(), a = n.xw.toVertexStage(), d = n.zw.toVertexStage();
514
- return M(
477
+ f(t != null);
478
+ const r = B(), n = w(1, 1, -1, -1).mul(s.xyxy.mul(0.5)).add(r.xyxy), i = n.zy.toVertexStage(), u = n.xy.toVertexStage(), a = n.xw.toVertexStage(), h = n.zw.toVertexStage();
479
+ return S(
515
480
  t.sample(r).mul(4),
516
481
  t.sample(i),
517
482
  t.sample(u),
518
483
  t.sample(a),
519
- t.sample(d)
484
+ t.sample(h)
520
485
  ).mul(1 / 8);
521
486
  }
522
487
  setupUpsampleNode(e) {
523
488
  const { inputNode: t, inputTexelSize: s } = this;
524
- v(t != null);
525
- const r = P(), n = f(1, 1, -1, -1).mul(s.xyxy.mul(0.5)).add(r.xyxy), i = n.zy.toVertexStage(), u = n.xy.toVertexStage(), a = n.xw.toVertexStage(), d = n.zw.toVertexStage(), l = h(n.z, r.y).toVertexStage(), c = h(n.x, r.y).toVertexStage(), p = h(r.x, n.y).toVertexStage(), m = h(r.x, n.w).toVertexStage();
526
- return M(
527
- M(
489
+ f(t != null);
490
+ const r = B(), n = w(1, 1, -1, -1).mul(s.xyxy.mul(0.5)).add(r.xyxy), i = n.zy.toVertexStage(), u = n.xy.toVertexStage(), a = n.xw.toVertexStage(), h = n.zw.toVertexStage(), c = p(n.z, r.y).toVertexStage(), l = p(n.x, r.y).toVertexStage(), d = p(r.x, n.y).toVertexStage(), m = p(r.x, n.w).toVertexStage();
491
+ return S(
492
+ S(
528
493
  t.sample(i),
529
494
  t.sample(u),
530
495
  t.sample(a),
531
- t.sample(d)
496
+ t.sample(h)
532
497
  ).mul(1 / 12),
533
- M(
534
- t.sample(l),
498
+ S(
535
499
  t.sample(c),
536
- t.sample(p),
500
+ t.sample(l),
501
+ t.sample(d),
537
502
  t.sample(m)
538
503
  ).mul(1 / 6)
539
504
  );
540
505
  }
541
506
  }
542
- const oo = (...o) => b(new is(...o));
543
- class as extends G {
507
+ const so = (...o) => new is(...o);
508
+ class as extends E {
509
+ constructor(e) {
510
+ super("vec3"), this.intensity = v(1e-5), this.inputNode = e;
511
+ }
544
512
  static get type() {
545
513
  return "LensGhostNode";
546
514
  }
547
- inputNode;
548
- intensity = y(1e-5);
549
- constructor(e) {
550
- super("vec3"), this.inputNode = e;
551
- }
552
515
  setup(e) {
553
516
  const { inputNode: t, intensity: s } = this;
554
- v(t != null);
555
- const r = J({
517
+ f(t != null);
518
+ const r = K({
556
519
  name: "sampleGhost",
557
520
  type: "vec3",
558
521
  inputs: [
@@ -561,46 +524,40 @@ class as extends G {
561
524
  { name: "color", type: "vec3" },
562
525
  { name: "offset", type: "float" }
563
526
  ]
564
- })(([a, d, l, c]) => {
565
- const p = d.mul(c).add(a.oneMinus()).saturate(), m = t.sample(p).rgb.mul(l), g = C(0.5, p).length().mul(1 / (Math.SQRT2 / 4)).saturate();
527
+ })(([a, h, c, l]) => {
528
+ const d = h.mul(l).add(a.oneMinus()).saturate(), m = t.sample(d).rgb.mul(c), g = k(0.5, d).length().mul(1 / (Math.SQRT2 / 4)).saturate();
566
529
  return m.mulAssign(g.oneMinus().pow(3)), m;
567
- }), n = P(), i = n.sub(0.5);
568
- return M(
569
- r(n, i, w(0.8, 0.8, 1), -5),
570
- r(n, i, w(1, 0.8, 0.4), -1.5),
571
- r(n, i, w(0.9, 1, 0.8), -0.4),
572
- r(n, i, w(1, 0.8, 0.4), -0.2),
573
- r(n, i, w(0.9, 0.7, 0.7), -0.1),
574
- r(n, i, w(0.5, 1, 0.4), 0.7),
575
- r(n, i, w(0.5, 0.5, 0.5), 1),
576
- r(n, i, w(1, 1, 0.6), 2.5),
577
- r(n, i, w(0.5, 0.8, 1), 10)
530
+ }), n = B(), i = n.sub(0.5);
531
+ return S(
532
+ r(n, i, y(0.8, 0.8, 1), -5),
533
+ r(n, i, y(1, 0.8, 0.4), -1.5),
534
+ r(n, i, y(0.9, 1, 0.8), -0.4),
535
+ r(n, i, y(1, 0.8, 0.4), -0.2),
536
+ r(n, i, y(0.9, 0.7, 0.7), -0.1),
537
+ r(n, i, y(0.5, 1, 0.4), 0.7),
538
+ r(n, i, y(0.5, 0.5, 0.5), 1),
539
+ r(n, i, y(1, 1, 0.6), 2.5),
540
+ r(n, i, y(0.5, 0.8, 1), 10)
578
541
  ).mul(s);
579
542
  }
580
543
  }
581
- const { resetRendererState: us, restoreRendererState: ls } = L;
544
+ const { resetRendererState: us, restoreRendererState: ls } = O;
582
545
  function cs() {
583
- const o = new Ot(1, 1, {
546
+ const o = new kt(1, 1, {
584
547
  depthBuffer: !1,
585
- type: $t,
586
- format: Et
548
+ type: Et,
549
+ format: $t
587
550
  }), e = o.texture;
588
- return e.minFilter = pe, e.magFilter = pe, e.generateMipmaps = !1, o;
551
+ return e.minFilter = he, e.magFilter = he, e.generateMipmaps = !1, o;
589
552
  }
590
- const ds = /* @__PURE__ */ new kt();
591
- class Le extends oe {
592
- static get type() {
593
- return "RTTextureNode";
594
- }
595
- node;
596
- resolutionScale = 1;
597
- renderTarget;
598
- material = new j();
599
- mesh = new Z(this.material);
600
- rendererState;
553
+ const hs = /* @__PURE__ */ new It();
554
+ class Ge extends se {
601
555
  constructor(e, t) {
602
556
  const s = cs();
603
- super(s.texture, t != null ? b(t) : P()), this.node = e, this.renderTarget = s, this.updateBeforeType = U.FRAME;
557
+ super(s.texture, t ?? B()), this.resolutionScale = 1, this.material = new P(), this.mesh = new q(this.material), this.node = e, this.renderTarget = s, this.updateBeforeType = A.FRAME;
558
+ }
559
+ static get type() {
560
+ return "RTTextureNode";
604
561
  }
605
562
  setSize(e, t) {
606
563
  const { resolutionScale: s } = this, r = Math.max(Math.round(e * s), 1), n = Math.max(Math.round(t * s), 1);
@@ -609,35 +566,35 @@ class Le extends oe {
609
566
  updateBefore({ renderer: e }) {
610
567
  if (e == null)
611
568
  return;
612
- const t = e.getDrawingBufferSize(ds);
569
+ const t = e.getDrawingBufferSize(hs);
613
570
  this.setSize(t.x, t.y), this.rendererState = us(e, this.rendererState), e.setRenderTarget(this.renderTarget), this.mesh.render(e), ls(e, this.rendererState);
614
571
  }
615
572
  setup(e) {
616
573
  const { material: t } = this;
617
- return t.fragmentNode = b(this.node).context(e.getContext()), t.needsUpdate = !0, super.setup(e);
574
+ return t.fragmentNode = this.node.context(e.getContext()), t.needsUpdate = !0, super.setup(e);
618
575
  }
619
576
  dispose() {
620
577
  this.renderTarget.dispose(), this.material.dispose(), this.mesh.geometry.dispose(), super.dispose();
621
578
  }
622
579
  // @ts-expect-error Ignore
623
580
  clone() {
624
- const e = new oe(this.value, this.uvNode, this.levelNode);
581
+ const e = new se(this.value, this.uvNode, this.levelNode);
625
582
  return e.sampler = this.sampler, e.referenceNode = this, e;
626
583
  }
627
584
  }
628
- const ps = (...o) => b(new Le(...o)), We = (o, e) => {
585
+ const ds = (...o) => new Ge(...o), Le = (o, e) => {
629
586
  let t;
630
- return o.isTextureNode === !0 || o.isSampleNode === !0 ? t = o : o.getTextureNode != null ? t = o.getTextureNode() : (t = new Le(o), e != null && (t.value.name = e)), b(t);
631
- }, { resetRendererState: hs, restoreRendererState: ms } = L;
587
+ return o.isTextureNode === !0 || o.isSampleNode === !0 ? t = o : o.getTextureNode != null ? t = o.getTextureNode() : (t = new Ge(o), e != null && (t.value.name = e)), t;
588
+ }, { resetRendererState: ps, restoreRendererState: ms } = O;
632
589
  function gs() {
633
590
  const s = document.createElement("canvas");
634
591
  s.width = 256, s.height = 32;
635
592
  const r = s.getContext("2d");
636
- v(r != null), r.beginPath(), r.moveTo(0, 32 / 2), r.lineTo(256 / 2, 5), r.lineTo(256, 32 / 2), r.lineTo(256 / 2, 27), r.closePath();
593
+ f(r != null), r.beginPath(), r.moveTo(0, 32 / 2), r.lineTo(256 / 2, 5), r.lineTo(256, 32 / 2), r.lineTo(256 / 2, 27), r.closePath();
637
594
  const n = r.createLinearGradient(0, 0, 256, 0);
638
- return n.addColorStop(0, "#000000"), n.addColorStop(0.5, "#ffffff"), n.addColorStop(1, "#000000"), r.fillStyle = n, r.fill(), new et(s);
595
+ return n.addColorStop(0, "#000000"), n.addColorStop(0.5, "#ffffff"), n.addColorStop(1, "#000000"), r.fillStyle = n, r.fill(), new Xe(s);
639
596
  }
640
- const fe = /* @__PURE__ */ re({
597
+ const xe = /* @__PURE__ */ oe({
641
598
  color: "vec3",
642
599
  luminance: "float",
643
600
  position: "vec2",
@@ -645,58 +602,41 @@ const fe = /* @__PURE__ */ re({
645
602
  sin: "float",
646
603
  cos: "float"
647
604
  });
648
- class xs extends X {
649
- spikeNode;
650
- spikePairCount = 6;
651
- wireframe = !1;
652
- intensity = y(1e-5);
653
- sizeScale = y(new B(1.5, 0.01));
654
- luminanceThreshold = y(100);
655
- computeNode;
656
- counterBuffer = new Gt(1, 1);
657
- instanceBuffer = le(1, fe);
658
- renderTarget = this.createRenderTarget();
659
- material = new Lt({
660
- depthTest: !1,
661
- depthWrite: !1,
662
- transparent: !0,
663
- blending: Je
664
- });
665
- mesh = new Y(new Ye(1, 1), this.material);
666
- camera = new _e();
667
- rendererState;
668
- inputTexelSize = y(new B());
669
- outputTexelSize = y(new B());
670
- geometryRatio = y(new B());
605
+ class xs extends _ {
671
606
  constructor(e) {
672
- super(e), this.inputNode = e, this.resolutionScale = 0.5, this.outputTexture = this.renderTarget.texture;
607
+ super(e), this.spikePairCount = 6, this.wireframe = !1, this.intensity = v(1e-5), this.sizeScale = v(new V(1.5, 0.01)), this.luminanceThreshold = v(100), this.counterBuffer = new Ot(1, 1), this.instanceBuffer = ue(1, xe), this.renderTarget = this.createRenderTarget(), this.material = new Gt({
608
+ depthTest: !1,
609
+ depthWrite: !1,
610
+ transparent: !0,
611
+ blending: Ke
612
+ }), this.mesh = new J(new Je(1, 1), this.material), this.camera = new Ye(), this.inputTexelSize = v(new V()), this.outputTexelSize = v(new V()), this.geometryRatio = v(new V()), this.inputNode = e, this.resolutionScale = 0.5, this.outputTexture = this.renderTarget.texture;
673
613
  }
674
614
  customCacheKey() {
675
- return ke(this.spikePairCount, +this.wireframe);
615
+ return Ie(this.spikePairCount, +this.wireframe);
676
616
  }
677
617
  setSize(e, t) {
678
618
  const { resolutionScale: s } = this, r = Math.max(Math.round(e * s), 1), n = Math.max(Math.round(t * s), 1);
679
619
  this.renderTarget.setSize(r, n);
680
620
  const i = Math.floor(r / 2), u = Math.floor(n / 2), a = i * u;
681
- return this.instanceBuffer.bufferCount < a && (this.instanceBuffer.dispose(), this.instanceBuffer = le(a, fe), this.setupCompute(i, u), this.setupMaterial()), this;
621
+ return this.instanceBuffer.bufferCount < a && (this.instanceBuffer.dispose(), this.instanceBuffer = ue(a, xe), this.setupCompute(i, u), this.setupMaterial()), this;
682
622
  }
683
623
  updateBefore({ renderer: e }) {
684
624
  if (e == null)
685
625
  return;
686
626
  const { inputNode: t } = this;
687
- v(t != null);
627
+ f(t != null);
688
628
  const { width: s, height: r } = t.value;
689
629
  this.setSize(s, r);
690
630
  const { computeNode: n, counterBuffer: i, renderTarget: u } = this;
691
- v(n != null), this.inputTexelSize.value.set(1 / s, 1 / r);
631
+ f(n != null), this.inputTexelSize.value.set(1 / s, 1 / r);
692
632
  const a = s / r;
693
633
  a > 1 ? this.geometryRatio.value.set(1 / a, 1) : this.geometryRatio.value.set(1, a);
694
- const { width: d, height: l } = u;
695
- this.outputTexelSize.value.set(1 / d, 1 / l), i.array[0] = 0, i.needsUpdate = !0, e.compute(n), e.getArrayBufferAsync(i).then((c) => {
696
- this.mesh.count = new Uint32Array(c)[0];
697
- }).catch((c) => {
698
- console.error(c);
699
- }), this.rendererState = hs(e, this.rendererState), e.setRenderTarget(u), e.render(this.mesh, this.camera), ms(e, this.rendererState);
634
+ const { width: h, height: c } = u;
635
+ this.outputTexelSize.value.set(1 / h, 1 / c), i.array[0] = 0, i.needsUpdate = !0, e.compute(n), e.getArrayBufferAsync(i).then((l) => {
636
+ this.mesh.count = new Uint32Array(l)[0];
637
+ }).catch((l) => {
638
+ console.error(l);
639
+ }), this.rendererState = ps(e, this.rendererState), e.setRenderTarget(u), e.render(this.mesh, this.camera), ms(e, this.rendererState);
700
640
  }
701
641
  setupCompute(e, t) {
702
642
  const {
@@ -706,25 +646,25 @@ class xs extends X {
706
646
  instanceBuffer: i,
707
647
  outputTexelSize: u
708
648
  } = this;
709
- v(r != null);
710
- const a = lt(
649
+ f(r != null);
650
+ const a = ut(
711
651
  n,
712
652
  "uint",
713
653
  n.count
714
654
  ).toAtomic();
715
- this.computeNode = A(() => {
716
- const d = Pe(e, t);
717
- I(ee.xy.greaterThanEqual(d).any(), () => {
718
- ct();
655
+ this.computeNode = C(() => {
656
+ const h = Ce(e, t);
657
+ F(X.xy.greaterThanEqual(h).any(), () => {
658
+ lt();
719
659
  });
720
- const l = h(ee.xy).mul(u).mul(2), c = r.sample(l), p = c.a;
721
- I(p.greaterThan(0.1), () => {
722
- const m = dt(a.element(0), s);
660
+ const c = p(X.xy).mul(u).mul(2), l = r.sample(c), d = l.a;
661
+ F(d.greaterThan(0.1), () => {
662
+ const m = ct(a.element(0), s);
723
663
  for (let g = 0; g < s; ++g) {
724
664
  const x = i.element(m.add(g));
725
- x.get("color").assign(c.rgb), x.get("luminance").assign(p), x.get("position").assign(ee.xy), x.get("scale").assign(g % 2 === 0 ? 1 : 0.5);
726
- const T = Math.PI * (3 - Math.sqrt(5)), S = Math.PI / s * g + T;
727
- x.get("sin").assign(Math.sin(S)), x.get("cos").assign(Math.cos(S));
665
+ x.get("color").assign(l.rgb), x.get("luminance").assign(d), x.get("position").assign(X.xy), x.get("scale").assign(g % 2 === 0 ? 1 : 0.5);
666
+ const R = Math.PI * (3 - Math.sqrt(5)), N = Math.PI / s * g + R;
667
+ x.get("sin").assign(Math.sin(N)), x.get("cos").assign(Math.cos(N));
728
668
  }
729
669
  });
730
670
  })().compute(
@@ -744,22 +684,22 @@ class xs extends X {
744
684
  outputTexelSize: u,
745
685
  geometryRatio: a
746
686
  } = this;
747
- v(e != null), v(t != null);
748
- const d = s.element(pt);
749
- this.material.colorNode = this.wireframe ? f(1) : b(t).mul(d.get("color").mul(n)), this.material.vertexNode = A(() => {
750
- const l = d.get("sin"), c = d.get("cos"), p = Ae(c, l, 0, l.negate(), c, 0, 0, 0, 1), g = d.get("position").mul(u).mul(2), x = g.flipY().mul(2).sub(1), S = d.get("luminance").div(r).saturate(), V = h(S, 1).mul(
751
- d.get("scale"),
687
+ f(e != null), f(t != null);
688
+ const h = s.element(ht);
689
+ this.material.colorNode = this.wireframe ? w(1) : t.mul(h.get("color").mul(n)), this.material.vertexNode = C(() => {
690
+ const c = h.get("sin"), l = h.get("cos"), d = Pe(l, c, 0, c.negate(), l, 0, 0, 0, 1), g = h.get("position").mul(u).mul(2), x = g.flipY().mul(2).sub(1), N = h.get("luminance").div(r).saturate(), z = p(N, 1).mul(
691
+ h.get("scale"),
752
692
  i,
753
693
  // Make the spike to shrink at screen borders:
754
694
  g.sub(0.5).length().mul(2).oneMinus().mul(0.5).add(0.5)
755
- ), D = p.mul(Ve.mul(f(V, 1, 1))).mul(a).add(w(x, 0));
756
- return f(D, 1);
695
+ ), L = d.mul(be.mul(w(z, 1, 1))).mul(a).add(y(x, 0));
696
+ return w(L, 1);
757
697
  })(), this.material.wireframe = this.wireframe, this.material.needsUpdate = !0;
758
698
  }
759
699
  setup(e) {
760
700
  if (this.spikeNode == null) {
761
701
  const t = gs();
762
- t.colorSpace = Xe, this.spikeNode = q(t);
702
+ t.colorSpace = _e, this.spikeNode = I(t);
763
703
  }
764
704
  return this.setupMaterial(), super.setup(e);
765
705
  }
@@ -767,18 +707,14 @@ class xs extends X {
767
707
  this.renderTarget.dispose(), this.material.dispose(), this.mesh.geometry.dispose(), super.dispose();
768
708
  }
769
709
  }
770
- const fs = /* @__PURE__ */ new B();
771
- class vs extends G {
710
+ const fs = /* @__PURE__ */ new V();
711
+ class vs extends E {
712
+ constructor(e) {
713
+ super("vec3"), this.intensity = v(1e-5), this.chromaticAberration = v(5e-3), this.aspectRatio = v(0), this.inputNode = e, this.updateBeforeType = A.FRAME;
714
+ }
772
715
  static get type() {
773
716
  return "LensHaloNode";
774
717
  }
775
- inputNode;
776
- intensity = y(1e-5);
777
- chromaticAberration = y(5e-3);
778
- aspectRatio = y(0);
779
- constructor(e) {
780
- super("vec3"), this.inputNode = e, this.updateBeforeType = U.FRAME;
781
- }
782
718
  updateBefore({ renderer: e }) {
783
719
  if (e == null)
784
720
  return;
@@ -787,8 +723,8 @@ class vs extends G {
787
723
  }
788
724
  setup(e) {
789
725
  const { inputNode: t, intensity: s, chromaticAberration: r, aspectRatio: n } = this;
790
- v(t != null);
791
- const i = J({
726
+ f(t != null);
727
+ const i = K({
792
728
  name: "cubicRingMask",
793
729
  type: "float",
794
730
  inputs: [
@@ -796,116 +732,105 @@ class vs extends G {
796
732
  { name: "radius", type: "float" },
797
733
  { name: "thickness", type: "float" }
798
734
  ]
799
- })(([l, c, p]) => {
800
- const m = ht(Ce(l.sub(c)).div(p), 1);
801
- return mt(m, m, C(3, m.mul(2))).oneMinus();
802
- }), u = J({
735
+ })(([c, l, d]) => {
736
+ const m = dt(Be(c.sub(l)).div(d), 1);
737
+ return pt(m, m, k(3, m.mul(2))).oneMinus();
738
+ }), u = K({
803
739
  name: "sampleHalo",
804
740
  type: "vec3",
805
741
  inputs: [
806
742
  { name: "uv", type: "vec2" },
807
743
  { name: "radius", type: "float" }
808
744
  ]
809
- })(([l, c]) => {
810
- const p = h(n, 1), m = l.sub(0.5).mul(p).normalize().div(p), g = w(r).mul(w(-1, 0, 1)), x = gt(m.mul(c).add(l.oneMinus())), T = w(
745
+ })(([c, l]) => {
746
+ const d = p(n, 1), m = c.sub(0.5).mul(d).normalize().div(d), g = y(r).mul(y(-1, 0, 1)), x = mt(m.mul(l).add(c.oneMinus())), R = y(
811
747
  t.sample(m.mul(g.r).add(x)).r,
812
748
  t.sample(m.mul(g.g).add(x)).g,
813
749
  t.sample(m.mul(g.b).add(x)).b
814
- ), S = l.sub(h(0.5, 0)).mul(p).add(h(0.5, 0)), V = xt(S, h(0.5)).saturate();
815
- return T.mulAssign(i(V, 0.45, 0.25)), T;
816
- }), a = P();
750
+ ), N = c.sub(p(0.5, 0)).mul(d).add(p(0.5, 0)), z = gt(N, p(0.5)).saturate();
751
+ return R.mulAssign(i(z, 0.45, 0.25)), R;
752
+ }), a = B();
817
753
  return u(a, 0.3).mul(s);
818
754
  }
819
755
  }
820
- const z = (o) => o.greaterThanEqual(0).all().and(o.lessThanEqual(1).all()).toFloat();
821
- class He extends ue {
756
+ const b = (o) => o.greaterThanEqual(0).all().and(o.lessThanEqual(1).all()).toFloat();
757
+ class We extends ae {
758
+ constructor(e, t = 4) {
759
+ super(e, t), this.blendAmount = v(0.85), this.resolutionScale = 0.5;
760
+ }
822
761
  static get type() {
823
762
  return "MipmapSurfaceBlurNode";
824
763
  }
825
- blendAmount = y(0.85);
826
- constructor(e, t = 4) {
827
- super(e, t), this.resolutionScale = 0.5;
828
- }
829
764
  setupDownsampleNode(e) {
830
765
  const { inputNode: t, inputTexelSize: s } = this;
831
- return v(t != null), A(() => {
832
- const r = P(), n = f(1, 1, -1, -1).mul(s.xyxy).add(r.xyxy), i = f(2, 2, -2, -2).mul(s.xyxy).add(r.xyxy), u = n.zy.toVertexStage(), a = n.xy.toVertexStage(), d = n.zw.toVertexStage(), l = n.xw.toVertexStage(), c = i.zy.toVertexStage(), p = i.xy.toVertexStage(), m = i.zw.toVertexStage(), g = i.xw.toVertexStage(), x = h(r.x, i.y).toVertexStage(), T = h(i.z, r.y).toVertexStage(), S = h(i.x, r.y).toVertexStage(), V = h(r.x, i.w).toVertexStage(), D = 1 / 4 / 2, F = 1 / 9 / 2, E = t.sample(r).mul(F);
833
- let R;
834
- return R = f(
835
- z(u),
836
- z(a),
837
- z(d),
838
- z(l)
839
- ).mul(D), E.addAssign(
840
- t.sample(u).mul(R.x),
841
- t.sample(a).mul(R.y),
842
- t.sample(d).mul(R.z),
843
- t.sample(l).mul(R.w)
844
- ), R = f(
845
- z(c),
846
- z(p),
847
- z(m),
848
- z(g)
849
- ).mul(F), E.addAssign(
850
- t.sample(c).mul(R.x),
851
- t.sample(p).mul(R.y),
852
- t.sample(m).mul(R.z),
853
- t.sample(g).mul(R.w)
854
- ), R = f(
855
- z(x),
856
- z(T),
857
- z(S),
858
- z(V)
859
- ).mul(F), E.addAssign(
860
- t.sample(x).mul(R.x),
861
- t.sample(T).mul(R.y),
862
- t.sample(S).mul(R.z),
863
- t.sample(V).mul(R.w)
864
- ), E;
766
+ return f(t != null), C(() => {
767
+ const r = B(), n = w(1, 1, -1, -1).mul(s.xyxy).add(r.xyxy), i = w(2, 2, -2, -2).mul(s.xyxy).add(r.xyxy), u = n.zy.toVertexStage(), a = n.xy.toVertexStage(), h = n.zw.toVertexStage(), c = n.xw.toVertexStage(), l = i.zy.toVertexStage(), d = i.xy.toVertexStage(), m = i.zw.toVertexStage(), g = i.xw.toVertexStage(), x = p(r.x, i.y).toVertexStage(), R = p(i.z, r.y).toVertexStage(), N = p(i.x, r.y).toVertexStage(), z = p(r.x, i.w).toVertexStage(), L = 1 / 4 / 2, j = 1 / 9 / 2, U = t.sample(r).mul(j);
768
+ let M;
769
+ return M = w(
770
+ b(u),
771
+ b(a),
772
+ b(h),
773
+ b(c)
774
+ ).mul(L), U.addAssign(
775
+ t.sample(u).mul(M.x),
776
+ t.sample(a).mul(M.y),
777
+ t.sample(h).mul(M.z),
778
+ t.sample(c).mul(M.w)
779
+ ), M = w(
780
+ b(l),
781
+ b(d),
782
+ b(m),
783
+ b(g)
784
+ ).mul(j), U.addAssign(
785
+ t.sample(l).mul(M.x),
786
+ t.sample(d).mul(M.y),
787
+ t.sample(m).mul(M.z),
788
+ t.sample(g).mul(M.w)
789
+ ), M = w(
790
+ b(x),
791
+ b(R),
792
+ b(N),
793
+ b(z)
794
+ ).mul(j), U.addAssign(
795
+ t.sample(x).mul(M.x),
796
+ t.sample(R).mul(M.y),
797
+ t.sample(N).mul(M.z),
798
+ t.sample(z).mul(M.w)
799
+ ), U;
865
800
  })();
866
801
  }
867
802
  setupUpsampleNode(e) {
868
803
  const { inputNode: t, inputTexelSize: s, downsampleNode: r } = this;
869
- v(t != null);
870
- const n = P(), i = f(1, 1, -1, -1).mul(s.xyxy).add(n.xyxy), u = h(n.x, i.y).toVertexStage(), a = h(i.z, n.y).toVertexStage(), d = h(i.x, n.y).toVertexStage(), l = h(n.x, i.w).toVertexStage(), c = i.zy.toVertexStage(), p = i.xy.toVertexStage(), m = i.zw.toVertexStage(), g = i.xw.toVertexStage(), x = M(
804
+ f(t != null);
805
+ const n = B(), i = w(1, 1, -1, -1).mul(s.xyxy).add(n.xyxy), u = p(n.x, i.y).toVertexStage(), a = p(i.z, n.y).toVertexStage(), h = p(i.x, n.y).toVertexStage(), c = p(n.x, i.w).toVertexStage(), l = i.zy.toVertexStage(), d = i.xy.toVertexStage(), m = i.zw.toVertexStage(), g = i.xw.toVertexStage(), x = S(
871
806
  t.sample(n).mul(1 / 4),
872
- M(
807
+ S(
873
808
  t.sample(u),
874
809
  t.sample(a),
875
- t.sample(d),
876
- t.sample(l)
810
+ t.sample(h),
811
+ t.sample(c)
877
812
  ).mul(1 / 8),
878
- M(
879
- t.sample(c),
880
- t.sample(p),
813
+ S(
814
+ t.sample(l),
815
+ t.sample(d),
881
816
  t.sample(m),
882
817
  t.sample(g)
883
818
  ).mul(1 / 16)
884
819
  );
885
- return se(r.sample(n), x, this.blendAmount);
820
+ return te(r.sample(n), x, this.blendAmount);
886
821
  }
887
822
  }
888
- const ro = (...o) => b(new He(...o));
889
- function qe(o) {
890
- const e = o instanceof Wt ? o.renderer : o;
891
- return ("backend" in e ? e.backend : o).isWebGPUBackend === !0;
823
+ const oo = (...o) => new We(...o);
824
+ function He(o) {
825
+ return (o instanceof Lt ? o.renderer.backend : "backend" in o ? o.backend : o).isWebGPUBackend === !0;
892
826
  }
893
- class ys extends G {
827
+ class ys extends E {
828
+ constructor(e) {
829
+ super("vec4"), this.bloomIntensity = v(0.05), this.inputNode = e, this.thresholdNode = new Ee(), this.blurNode = new Oe(), this.ghostNode = new as(), this.haloNode = new vs(), this.bloomNode = new We(null, 8), this.glareNode = new xs(), this.featuresNode = ds(S(this.ghostNode, this.haloNode)), this.featuresNode.value.name = "LensFlareNode.Features", this.featuresNode.resolutionScale = 0.5, this.blurNode.resolutionScale = 1, this.bloomNode.resolutionScale = 1, this.glareNode.resolutionScale = 1;
830
+ }
894
831
  static get type() {
895
832
  return "LensFlareNode";
896
833
  }
897
- inputNode;
898
- thresholdNode;
899
- blurNode;
900
- ghostNode;
901
- haloNode;
902
- bloomNode;
903
- glareNode;
904
- bloomIntensity = y(0.05);
905
- featuresNode;
906
- constructor(e) {
907
- super("vec4"), this.inputNode = e, this.thresholdNode = new $e(), this.blurNode = new Ge(), this.ghostNode = new as(), this.haloNode = new vs(), this.bloomNode = new He(null, 8), this.glareNode = new xs(), this.featuresNode = ps(M(this.ghostNode, this.haloNode)), this.featuresNode.value.name = "LensFlareNode.Features", this.featuresNode.resolutionScale = 0.5, this.blurNode.resolutionScale = 1, this.bloomNode.resolutionScale = 1, this.glareNode.resolutionScale = 1;
908
- }
909
834
  setup(e) {
910
835
  const {
911
836
  inputNode: t,
@@ -915,76 +840,72 @@ class ys extends G {
915
840
  haloNode: i,
916
841
  bloomNode: u,
917
842
  featuresNode: a,
918
- glareNode: d
843
+ glareNode: h
919
844
  } = this;
920
- v(t != null);
921
- const l = s.getTextureNode(), c = r.getTextureNode();
922
- s.inputNode = t, r.inputNode = l, n.inputNode = c, i.inputNode = c, u.inputNode = l, d.inputNode = l;
923
- const p = b(u.getTextureNode()).mul(
924
- this.bloomIntensity
925
- ), m = d.getTextureNode();
926
- return A(() => {
927
- const g = b(t);
928
- return g.addAssign(p), qe(e) && g.addAssign(m), g.add(a);
845
+ f(t != null);
846
+ const c = s.getTextureNode(), l = r.getTextureNode();
847
+ s.inputNode = t, r.inputNode = c, n.inputNode = l, i.inputNode = l, u.inputNode = c, h.inputNode = c;
848
+ const d = u.getTextureNode().mul(this.bloomIntensity), m = h.getTextureNode();
849
+ return C(() => {
850
+ const g = t;
851
+ return g.addAssign(d), He(e) && g.addAssign(m), g.add(a);
929
852
  })();
930
853
  }
931
854
  dispose() {
932
855
  this.thresholdNode.dispose(), this.blurNode.dispose(), this.ghostNode.dispose(), this.haloNode.dispose(), this.bloomNode.dispose(), this.glareNode.dispose(), this.featuresNode.dispose(), super.dispose();
933
856
  }
934
857
  }
935
- const no = (o) => b(
936
- new ys(
937
- o != null ? We(o, "LensFlareNode.Input") : null
938
- )
939
- ), io = /* @__PURE__ */ O(
858
+ const ro = (o) => new ys(
859
+ o != null ? Le(o, "LensFlareNode.Input") : null
860
+ ), no = /* @__PURE__ */ G(
940
861
  (o, e, t, s) => {
941
- const r = o.sub(t), n = K(e, r), i = K(r, r).sub(s.pow2()), u = n.pow2().sub(i).toVar(), a = h(-1);
942
- return I(u.greaterThanEqual(0), () => {
943
- const d = _(u);
944
- a.assign(h(n.negate().sub(d), n.negate().add(d)));
862
+ const r = o.sub(t), n = Q(e, r), i = Q(r, r).sub(s.pow2()), u = n.pow2().sub(i).toVar(), a = p(-1);
863
+ return F(u.greaterThanEqual(0), () => {
864
+ const h = Y(u);
865
+ a.assign(p(n.negate().sub(h), n.negate().add(h)));
945
866
  }), a;
946
867
  }
947
- ), ws = /* @__PURE__ */ re(
868
+ ), ws = /* @__PURE__ */ oe(
948
869
  { near: "vec4", far: "vec4" },
949
870
  "raySpheresIntersections"
950
- ), ao = /* @__PURE__ */ O(
871
+ ), io = /* @__PURE__ */ G(
951
872
  (o, e, t, s) => {
952
- const r = o.sub(t), n = K(e, r), i = K(r, r).sub(s.pow2()), u = n.pow2().sub(i).toVar(), a = f(-1), d = f(-1);
953
- return I(u.greaterThanEqual(0), () => {
954
- const l = _(u);
955
- a.assign(n.negate().sub(l)), d.assign(n.negate().add(l));
956
- }), ws(a, d);
873
+ const r = o.sub(t), n = Q(e, r), i = Q(r, r).sub(s.pow2()), u = n.pow2().sub(i).toVar(), a = w(-1), h = w(-1);
874
+ return F(u.greaterThanEqual(0), () => {
875
+ const c = Y(u);
876
+ a.assign(n.negate().sub(c)), h.assign(n.negate().add(c));
877
+ }), ws(a, h);
957
878
  }
958
- ), uo = /* @__PURE__ */ O(
879
+ ), ao = /* @__PURE__ */ G(
959
880
  (o, e, t) => {
960
- const s = o.div(t), r = e.div(t), n = r.dot(r), i = s.dot(r), u = s.dot(s), a = i.pow2().sub(n.mul(u.sub(1))).toVar(), d = h(-1);
961
- return I(a.greaterThanEqual(0), () => {
962
- const l = _(a);
963
- d.assign(h(i.negate().sub(l), i.negate().add(l)).div(n));
964
- }), d;
881
+ const s = o.div(t), r = e.div(t), n = r.dot(r), i = s.dot(r), u = s.dot(s), a = i.pow2().sub(n.mul(u.sub(1))).toVar(), h = p(-1);
882
+ return F(a.greaterThanEqual(0), () => {
883
+ const c = Y(a);
884
+ h.assign(p(i.negate().sub(c), i.negate().add(c)).div(n));
885
+ }), h;
965
886
  }
966
887
  ), Ts = {
967
- float: ne,
888
+ float: re,
968
889
  int: H,
969
- uint: zt,
970
- bool: Vt,
971
- vec2: h,
972
- ivec2: N,
973
- uvec2: Pe,
890
+ uint: Vt,
891
+ bool: bt,
892
+ vec2: p,
893
+ ivec2: T,
894
+ uvec2: Ce,
974
895
  bvec2: Rt,
975
- vec3: w,
976
- ivec3: bt,
977
- uvec3: Mt,
978
- bvec3: Nt,
979
- vec4: f,
980
- ivec4: St,
981
- uvec4: Tt,
982
- bvec4: wt,
983
- mat2: yt,
984
- mat3: Ae,
985
- mat4: vt,
986
- color: ft
987
- };
896
+ vec3: y,
897
+ ivec3: Mt,
898
+ uvec3: Nt,
899
+ bvec3: St,
900
+ vec4: w,
901
+ ivec4: Tt,
902
+ uvec4: wt,
903
+ bvec4: yt,
904
+ mat2: vt,
905
+ mat3: Pe,
906
+ mat4: ft,
907
+ color: xt
908
+ }, uo = Wt;
988
909
  function lo(o) {
989
910
  return Ts[o];
990
911
  }
@@ -992,7 +913,6 @@ class Ss extends Ht {
992
913
  static get type() {
993
914
  return "OutputTexture3DNode";
994
915
  }
995
- owner;
996
916
  constructor(e, t) {
997
917
  super(t), this.owner = e, this.setUpdateMatrix(!1);
998
918
  }
@@ -1003,69 +923,58 @@ class Ss extends Ht {
1003
923
  return new this.constructor(this.owner, this.value);
1004
924
  }
1005
925
  }
1006
- const co = (...o) => b(new Ss(...o)), Ns = /* @__PURE__ */ O(
1007
- (o, e, t = 0.4) => {
1008
- const s = h(Fe(o)), r = s.reciprocal(), n = s.mul(e), i = n.sub(0.5).floor().add(0.5), u = n.sub(i), a = u.mul(u), d = u.mul(a), l = b(t), c = l.mul(u), p = l.negate().mul(d).add(l.mul(2).mul(a).sub(c)), m = C(2, l).mul(d).sub(C(3, l).mul(a)).add(1), g = C(2, l).negate().mul(d).add(C(3, l.mul(2)).mul(a)).add(c), x = l.mul(d).sub(l.mul(a)), T = m.add(g), S = r.mul(i.add(g.div(T))), V = o.sample(S).rgb, D = r.mul(i.sub(1)), F = r.mul(i.add(2));
1009
- return M(
1010
- f(o.sample(h(S.x, D.y)).rgb, 1).mul(T.x.mul(p.y)),
1011
- f(o.sample(h(D.x, S.y)).rgb, 1).mul(p.x.mul(T.y)),
1012
- f(V, 1).mul(T.x.mul(T.y)),
1013
- f(o.sample(h(F.x, S.y)).rgb, 1).mul(x.x.mul(T.y)),
1014
- f(o.sample(h(S.x, F.y)).rgb, 1).mul(T.x.mul(x.y))
1015
- );
1016
- }
1017
- ), po = /* @__PURE__ */ O(
926
+ const co = (...o) => new Ss(...o), ho = /* @__PURE__ */ G(
1018
927
  (o, e) => {
1019
- const t = h(Fe(o)), s = t.reciprocal(), r = e.mul(t), n = r.sub(0.5).floor().add(0.5), i = r.sub(n), u = i.mul(i.mul(i.mul(0.5).oneMinus()).sub(0.5)), a = i.mul(i).mul(i.mul(1.5).sub(2.5)).add(1), d = i.mul(i.mul(C(2, i.mul(1.5))).add(0.5)), l = i.mul(i).mul(i.mul(0.5).sub(0.5)), c = a.add(d), p = d.div(a.add(d)), m = n.sub(1).mul(s), g = n.add(2).mul(s), x = n.add(p).mul(s);
1020
- return M(
1021
- o.sample(h(m.x, m.y)).mul(u.x).mul(u.y),
1022
- o.sample(h(x.x, m.y)).mul(c.x).mul(u.y),
1023
- o.sample(h(g.x, m.y)).mul(l.x).mul(u.y),
1024
- o.sample(h(m.x, x.y)).mul(u.x).mul(c.y),
1025
- o.sample(h(x.x, x.y)).mul(c.x).mul(c.y),
1026
- o.sample(h(g.x, x.y)).mul(l.x).mul(c.y),
1027
- o.sample(h(m.x, g.y)).mul(u.x).mul(l.y),
1028
- o.sample(h(x.x, g.y)).mul(c.x).mul(l.y),
1029
- o.sample(h(g.x, g.y)).mul(l.x).mul(l.y)
928
+ const t = p(Ae(o)), s = t.reciprocal(), r = e.mul(t), n = r.sub(0.5).floor().add(0.5), i = r.sub(n), u = i.mul(i.mul(i.mul(0.5).oneMinus()).sub(0.5)), a = i.mul(i).mul(i.mul(1.5).sub(2.5)).add(1), h = i.mul(i.mul(k(2, i.mul(1.5))).add(0.5)), c = i.mul(i).mul(i.mul(0.5).sub(0.5)), l = a.add(h), d = h.div(a.add(h)), m = n.sub(1).mul(s), g = n.add(2).mul(s), x = n.add(d).mul(s);
929
+ return S(
930
+ o.sample(p(m.x, m.y)).mul(u.x).mul(u.y),
931
+ o.sample(p(x.x, m.y)).mul(l.x).mul(u.y),
932
+ o.sample(p(g.x, m.y)).mul(c.x).mul(u.y),
933
+ o.sample(p(m.x, x.y)).mul(u.x).mul(l.y),
934
+ o.sample(p(x.x, x.y)).mul(l.x).mul(l.y),
935
+ o.sample(p(g.x, x.y)).mul(c.x).mul(l.y),
936
+ o.sample(p(m.x, g.y)).mul(u.x).mul(c.y),
937
+ o.sample(p(x.x, g.y)).mul(l.x).mul(c.y),
938
+ o.sample(p(g.x, g.y)).mul(c.x).mul(c.y)
1030
939
  );
1031
940
  }
1032
941
  );
1033
- function ve(o, e) {
942
+ function fe(o, e) {
1034
943
  let t = 1, s = 0;
1035
944
  for (; o > 0; )
1036
945
  t /= e, s += t * (o % e), o = Math.floor(o / e);
1037
946
  return s;
1038
947
  }
1039
- const ye = /* @__PURE__ */ Array.from(
948
+ const ve = /* @__PURE__ */ Array.from(
1040
949
  { length: 16 },
1041
- (o, e) => new B(ve(e + 1, 2), ve(e + 1, 3))
1042
- ), Ms = (o, e, t, { perspective: s = !0, logarithmic: r = !1 } = {}) => r ? De(o, e, t) : s ? je(o, e, t) : Bt(o, e, t), we = (o, e, t) => {
950
+ (o, e) => new V(fe(e + 1, 2), fe(e + 1, 3))
951
+ ), Ns = (o, e, t, { perspective: s = !0, logarithmic: r = !1 } = {}) => r ? Fe(o, e, t) : s ? De(o, e, t) : zt(o, e, t), ye = (o, e, t) => {
952
+ const s = Fe(o, e, t);
953
+ return Bt(s, e, t);
954
+ }, po = (o, e, t) => {
1043
955
  const s = De(o, e, t);
1044
- return Ct(s, e, t);
1045
- }, ho = (o, e, t) => {
1046
- const s = b(je(o, e, t));
1047
- return Ue(s, e, t);
956
+ return je(s, e, t);
1048
957
  }, mo = (o, e, t, s, r) => {
1049
- const n = s.element(H(2)).element(H(3)), i = s.element(H(3)).element(H(3)), a = f(w(o.flipY(), e).mul(2).sub(1), 1).mul(t.mul(n).add(i));
958
+ const n = s.element(H(2)).element(H(3)), i = s.element(H(3)).element(H(3)), a = w(y(o.flipY(), e).mul(2).sub(1), 1).mul(t.mul(n).add(i));
1050
959
  return r.mul(a).xyz;
1051
- }, Te = [
1052
- /* @__PURE__ */ w(58.1375, 2.7747, 26.8183),
1053
- /* @__PURE__ */ w(-150.5666, 4.2109, -88.5066),
1054
- /* @__PURE__ */ w(130.5887, -14.0195, 109.0745),
1055
- /* @__PURE__ */ w(-42.3277, 4.8052, -60.1097),
1056
- /* @__PURE__ */ w(4.5974, 2.1856, 12.5925),
1057
- /* @__PURE__ */ w(0.1357, 0.0914, 0.1067)
1058
- ], bs = (o) => Te.slice(1).reduce((e, t) => t.add(o.mul(e)), Te[0]), go = (o, e, t, s) => {
1059
- const r = Ms(o, e, t, s);
1060
- return bs(Ue(r, e, t));
960
+ }, we = [
961
+ /* @__PURE__ */ y(58.1375, 2.7747, 26.8183),
962
+ /* @__PURE__ */ y(-150.5666, 4.2109, -88.5066),
963
+ /* @__PURE__ */ y(130.5887, -14.0195, 109.0745),
964
+ /* @__PURE__ */ y(-42.3277, 4.8052, -60.1097),
965
+ /* @__PURE__ */ y(4.5974, 2.1856, 12.5925),
966
+ /* @__PURE__ */ y(0.1357, 0.0914, 0.1067)
967
+ ], Ms = (o) => we.slice(1).reduce((e, t) => t.add(o.mul(e)), we[0]), go = (o, e, t, s) => {
968
+ const r = Ns(o, e, t, s);
969
+ return Ms(je(r, e, t));
1061
970
  }, xo = (o) => {
1062
- const e = C(0.5, o.x).mul(Pt), t = C(o.y, 0.5).mul(At), s = ce(t);
1063
- return w(s.mul(ce(e)), de(t), s.mul(de(e)));
1064
- }, { resetRendererState: Rs, restoreRendererState: Vs } = L;
1065
- function zs(o) {
971
+ const e = k(0.5, o.x).mul(Ct), t = k(o.y, 0.5).mul(Pt), s = le(t);
972
+ return y(s.mul(le(e)), ce(t), s.mul(ce(e)));
973
+ }, { resetRendererState: Rs, restoreRendererState: bs } = O;
974
+ function Vs(o) {
1066
975
  return o.isPerspectiveCamera === !0 || o.isOrthographicCamera === !0 || "updateProjectionMatrix" in o && "setViewOffset" in o && "clearViewOffset" in o;
1067
976
  }
1068
- const Bs = /* @__PURE__ */ J({
977
+ const zs = /* @__PURE__ */ K({
1069
978
  name: "clipAABB",
1070
979
  type: "vec4",
1071
980
  inputs: [
@@ -1075,101 +984,75 @@ const Bs = /* @__PURE__ */ J({
1075
984
  { name: "maxColor", type: "vec4" }
1076
985
  ]
1077
986
  })(([o, e, t, s]) => {
1078
- const r = s.rgb.add(t.rgb).mul(0.5), n = s.rgb.sub(t.rgb).mul(0.5).add(1e-7), i = e.sub(f(r, o.a)), a = i.xyz.div(n).abs(), d = Ie(a.x, a.y, a.z);
1079
- return It(
1080
- d.greaterThan(1),
1081
- f(r, o.a).add(i.div(d)),
987
+ const r = s.rgb.add(t.rgb).mul(0.5), n = s.rgb.sub(t.rgb).mul(0.5).add(1e-7), i = e.sub(w(r, o.a)), a = i.xyz.div(n).abs(), h = Ue(a.x, a.y, a.z);
988
+ return Ut(
989
+ h.greaterThan(1),
990
+ w(r, o.a).add(i.div(h)),
1082
991
  e
1083
992
  );
1084
- }), Se = [
1085
- /* @__PURE__ */ N(-1, -1),
1086
- /* @__PURE__ */ N(-1, 1),
1087
- /* @__PURE__ */ N(1, -1),
1088
- /* @__PURE__ */ N(1, 1),
1089
- /* @__PURE__ */ N(1, 0),
1090
- /* @__PURE__ */ N(0, -1),
1091
- /* @__PURE__ */ N(0, 1),
1092
- /* @__PURE__ */ N(-1, 0)
1093
- ], Cs = /* @__PURE__ */ O(
993
+ }), Te = [
994
+ /* @__PURE__ */ T(-1, -1),
995
+ /* @__PURE__ */ T(-1, 1),
996
+ /* @__PURE__ */ T(1, -1),
997
+ /* @__PURE__ */ T(1, 1),
998
+ /* @__PURE__ */ T(1, 0),
999
+ /* @__PURE__ */ T(0, -1),
1000
+ /* @__PURE__ */ T(0, 1),
1001
+ /* @__PURE__ */ T(-1, 0)
1002
+ ], Bs = /* @__PURE__ */ G(
1094
1003
  (o, e, t, s, r) => {
1095
1004
  const n = t.toVar(), i = t.pow2().toVar();
1096
- for (const p of Se) {
1097
- const m = o.load(e.add(p));
1005
+ for (const d of Te) {
1006
+ const m = o.load(e.add(d));
1098
1007
  n.addAssign(m), i.addAssign(m.pow2());
1099
1008
  }
1100
- const u = ne(Se.length + 1), a = n.div(u), d = _(i.div(u).sub(a.pow2()).max(0)).mul(r), l = a.sub(d), c = a.add(d);
1101
- return Bs(a.clamp(l, c), s, l, c);
1102
- }
1103
- ), Ps = [
1104
- /* @__PURE__ */ N(-1, -1),
1105
- /* @__PURE__ */ N(-1, 0),
1106
- /* @__PURE__ */ N(-1, 1),
1107
- /* @__PURE__ */ N(0, -1),
1108
- /* @__PURE__ */ N(0, 0),
1109
- /* @__PURE__ */ N(0, 1),
1110
- /* @__PURE__ */ N(1, -1),
1111
- /* @__PURE__ */ N(1, 0),
1112
- /* @__PURE__ */ N(1, 1)
1113
- ], As = /* @__PURE__ */ re({
1009
+ const u = re(Te.length + 1), a = n.div(u), h = Y(i.div(u).sub(a.pow2()).max(0)).mul(r), c = a.sub(h), l = a.add(h);
1010
+ return zs(a.clamp(c, l), s, c, l);
1011
+ }
1012
+ ), Cs = [
1013
+ /* @__PURE__ */ T(-1, -1),
1014
+ /* @__PURE__ */ T(-1, 0),
1015
+ /* @__PURE__ */ T(-1, 1),
1016
+ /* @__PURE__ */ T(0, -1),
1017
+ /* @__PURE__ */ T(0, 0),
1018
+ /* @__PURE__ */ T(0, 1),
1019
+ /* @__PURE__ */ T(1, -1),
1020
+ /* @__PURE__ */ T(1, 0),
1021
+ /* @__PURE__ */ T(1, 1)
1022
+ ], Ps = /* @__PURE__ */ oe({
1114
1023
  coord: "ivec2",
1115
1024
  depth: "float"
1116
- }), Fs = /* @__PURE__ */ O(
1025
+ }), As = /* @__PURE__ */ G(
1117
1026
  (o, e) => {
1118
- const t = ne(1), s = N(0);
1119
- for (const r of Ps) {
1027
+ const t = re(1), s = T(0);
1028
+ for (const r of Cs) {
1120
1029
  const n = e.add(r).toVar(), i = o.load(n).toVar();
1121
- I(i.r.lessThan(t), () => {
1030
+ F(i.r.lessThan(t), () => {
1122
1031
  s.assign(n), t.assign(i.r);
1123
1032
  });
1124
1033
  }
1125
- return As(s, t);
1034
+ return Ps(s, t);
1126
1035
  }
1127
- ), Ne = /* @__PURE__ */ new B(), Ds = /* @__PURE__ */ new tt(1, 1);
1128
- class js extends G {
1129
- static get type() {
1130
- return "TemporalAntialiasNode";
1131
- }
1132
- velocityNodeImmutable;
1133
- inputNode;
1134
- depthNode;
1135
- velocityNode;
1136
- camera;
1137
- temporalAlpha = y(0.05);
1138
- varianceGamma = y(1);
1139
- velocityThreshold = y(0.1);
1140
- depthError = y(1e-3);
1141
- // Static options:
1142
- debugShowRejection = !1;
1143
- textureNode;
1144
- resolveRT = this.createRenderTarget("Resolve");
1145
- historyRT = this.createRenderTarget("History");
1146
- previousDepthTexture;
1147
- resolveMaterial = new j();
1148
- copyMaterial = new j();
1149
- mesh = new Z();
1150
- rendererState;
1151
- needsSyncPostProcessing = !1;
1152
- needsClearHistory = !1;
1153
- resolveNode = q(this.resolveRT.texture);
1154
- historyNode = q(this.historyRT.texture);
1155
- previousDepthNode = q(Ds);
1156
- originalProjectionMatrix = new W();
1157
- jitterIndex = 0;
1036
+ ), Se = /* @__PURE__ */ new V(), Fs = /* @__PURE__ */ new et(1, 1);
1037
+ class Ds extends E {
1158
1038
  constructor(e, t, s, r, n) {
1159
- if (super("vec4"), this.velocityNodeImmutable = e, this.inputNode = t, this.depthNode = s, this.velocityNode = r, !zs(n))
1039
+ if (super("vec4"), this.temporalAlpha = v(0.05), this.varianceGamma = v(1), this.velocityThreshold = v(0.1), this.depthError = v(1e-3), this.debugShowRejection = !1, this.resolveRT = this.createRenderTarget("Resolve"), this.historyRT = this.createRenderTarget("History"), this.resolveMaterial = new P(), this.copyMaterial = new P(), this.mesh = new q(), this.needsSyncPostProcessing = !1, this.needsClearHistory = !1, this.resolveNode = I(this.resolveRT.texture), this.historyNode = I(this.historyRT.texture), this.previousDepthNode = I(Fs), this.originalProjectionMatrix = new W(), this.jitterIndex = 0, this.velocityNodeImmutable = e, this.inputNode = t, this.depthNode = s, this.velocityNode = r, !Vs(n))
1160
1040
  throw new Error("The provided camera is not supported.");
1161
- this.camera = n, this.textureNode = Oe(this, this.resolveRT.texture), this.updateBeforeType = U.FRAME;
1041
+ this.camera = n, this.textureNode = ke(this, this.resolveRT.texture), this.updateBeforeType = A.FRAME;
1042
+ }
1043
+ static get type() {
1044
+ return "TemporalAntialiasNode";
1162
1045
  }
1163
1046
  customCacheKey() {
1164
- return ke(this.camera.id, +this.debugShowRejection);
1047
+ return Ie(this.camera.id, +this.debugShowRejection);
1165
1048
  }
1166
1049
  createRenderTarget(e) {
1167
- const t = new Me(1, 1, {
1050
+ const t = new Ne(1, 1, {
1168
1051
  depthBuffer: !1,
1169
1052
  type: Re,
1170
- format: be
1053
+ format: Me
1171
1054
  }), s = t.texture;
1172
- s.minFilter = Q, s.magFilter = Q, s.generateMipmaps = !1;
1055
+ s.minFilter = Z, s.magFilter = Z, s.generateMipmaps = !1;
1173
1056
  const r = this.constructor.type;
1174
1057
  return s.name = e != null ? `${r}.${e}` : r, t;
1175
1058
  }
@@ -1190,11 +1073,11 @@ class js extends G {
1190
1073
  setViewOffset(e, t) {
1191
1074
  const { camera: s } = this;
1192
1075
  s.updateProjectionMatrix(), this.originalProjectionMatrix.copy(s.projectionMatrix), this.setProjectionMatrix(this.originalProjectionMatrix);
1193
- const r = ye[this.jitterIndex], n = r.x - 0.5, i = r.y - 0.5;
1076
+ const r = ve[this.jitterIndex], n = r.x - 0.5, i = r.y - 0.5;
1194
1077
  s.setViewOffset(e, t, n, i, e, t);
1195
1078
  }
1196
1079
  clearViewOffset() {
1197
- this.camera.clearViewOffset(), this.setProjectionMatrix(null), this.jitterIndex = (this.jitterIndex + 1) % ye.length;
1080
+ this.camera.clearViewOffset(), this.setProjectionMatrix(null), this.jitterIndex = (this.jitterIndex + 1) % ve.length;
1198
1081
  }
1199
1082
  copyDepthTexture(e) {
1200
1083
  const t = this.depthNode.value, s = this.previousDepthTexture ??= t.clone();
@@ -1207,46 +1090,46 @@ class js extends G {
1207
1090
  updateBefore({ renderer: e }) {
1208
1091
  if (e == null)
1209
1092
  return;
1210
- const t = e.getDrawingBufferSize(Ne);
1211
- this.setSize(t.x, t.y), this.rendererState = Rs(e, this.rendererState), this.needsClearHistory && this.clearHistory(e), e.setRenderTarget(this.resolveRT), this.mesh.material = this.resolveMaterial, this.mesh.render(e), Vs(e, this.rendererState), qe(e) && this.copyDepthTexture(e), this.swapBuffers(), this.needsSyncPostProcessing && this.clearViewOffset();
1093
+ const t = e.getDrawingBufferSize(Se);
1094
+ this.setSize(t.x, t.y), this.rendererState = Rs(e, this.rendererState), this.needsClearHistory && this.clearHistory(e), e.setRenderTarget(this.resolveRT), this.mesh.material = this.resolveMaterial, this.mesh.render(e), bs(e, this.rendererState), He(e) && this.copyDepthTexture(e), this.swapBuffers(), this.needsSyncPostProcessing && this.clearViewOffset();
1212
1095
  }
1213
1096
  setupResolveNode({ renderer: e }) {
1214
1097
  const t = (s) => {
1215
- const { previousDepthNode: r } = this, n = r.load(N(s.mul(r.size(0)).sub(0.5))).toVar();
1216
- return e.logarithmicDepthBuffer ? we(
1098
+ const { previousDepthNode: r } = this, n = r.load(T(s.mul(Ae(r)).sub(0.5))).toVar();
1099
+ return e.logarithmicDepthBuffer ? ye(
1217
1100
  n,
1218
- he(this.camera),
1219
- me(this.camera)
1101
+ de(this.camera),
1102
+ pe(this.camera)
1220
1103
  ) : n;
1221
1104
  };
1222
- return A(() => {
1223
- const s = N(Be), r = Ft, n = this.inputNode.load(s), i = Fs(this.depthNode, s), u = i.get("coord"), a = this.velocityNode.load(u).xyz.mul(w(0.5, -0.5, 0.5)).toVar(), d = a.xy.length().div(this.velocityThreshold).oneMinus().saturate(), l = r.sub(a.xy).toVar(), c = t(l), p = e.logarithmicDepthBuffer ? we(
1105
+ return C(() => {
1106
+ const s = T(ze), r = At, n = this.inputNode.load(s), i = As(this.depthNode, s), u = i.get("coord"), a = this.velocityNode.load(u).xyz.mul(y(0.5, -0.5, 0.5)).toVar(), h = a.xy.length().div(this.velocityThreshold).oneMinus().saturate(), c = r.sub(a.xy).toVar(), l = t(c), d = e.logarithmicDepthBuffer ? ye(
1224
1107
  i.get("depth"),
1225
- he(this.camera),
1226
- me(this.camera)
1227
- ) : i.get("depth"), m = Dt(
1228
- p.add(a.z),
1229
- c.add(this.depthError)
1230
- ), g = d.mul(m), x = jt(
1231
- l.greaterThanEqual(0).all(),
1232
- l.lessThanEqual(1).all()
1233
- ).toFloat(), T = i.get("depth").notEqual(1).toFloat(), S = f(0).toVar();
1234
- return I(x.mul(T).mul(g).greaterThan(0), () => {
1235
- const V = Ns(this.historyNode, l), D = Cs(
1108
+ de(this.camera),
1109
+ pe(this.camera)
1110
+ ) : i.get("depth"), m = Ft(
1111
+ d.add(a.z),
1112
+ l.add(this.depthError)
1113
+ ), g = h.mul(m), x = Dt(
1114
+ c.greaterThanEqual(0).all(),
1115
+ c.lessThanEqual(1).all()
1116
+ ).toFloat(), R = i.get("depth").notEqual(1).toFloat(), N = w(0).toVar();
1117
+ return F(x.mul(R).mul(g).greaterThan(0), () => {
1118
+ const z = I(this.historyNode, c), L = Bs(
1236
1119
  this.inputNode,
1237
1120
  s,
1238
1121
  n,
1239
- V,
1122
+ z,
1240
1123
  this.varianceGamma
1241
- ), F = a.xy.abs().mul(Ut), E = Ie(F.x, F.y).fract().mul(0.5), R = se(
1124
+ ), j = a.xy.abs().mul(jt), U = Ue(j.x, j.y).fract().mul(0.5), M = te(
1242
1125
  this.temporalAlpha,
1243
1126
  0.8,
1244
- E
1127
+ U
1245
1128
  ).saturate();
1246
- S.assign(se(D, n, R));
1129
+ N.assign(te(L, n, M));
1247
1130
  }).Else(() => {
1248
- S.assign(n), this.debugShowRejection && S.assign(w(1, 0, 0));
1249
- }), S;
1131
+ N.assign(n), this.debugShowRejection && N.assign(y(1, 0, 0));
1132
+ }), N;
1250
1133
  })();
1251
1134
  }
1252
1135
  setup(e) {
@@ -1255,7 +1138,7 @@ class js extends G {
1255
1138
  const { onBeforePostProcessing: n } = t;
1256
1139
  t.onBeforePostProcessing = () => {
1257
1140
  n?.();
1258
- const i = e.renderer.getDrawingBufferSize(Ne);
1141
+ const i = e.renderer.getDrawingBufferSize(Se);
1259
1142
  this.setViewOffset(i.width, i.height);
1260
1143
  }, this.needsSyncPostProcessing = !0;
1261
1144
  }
@@ -1266,71 +1149,69 @@ class js extends G {
1266
1149
  this.resolveRT.dispose(), this.historyRT.dispose(), this.previousDepthTexture?.dispose(), this.resolveMaterial.dispose(), this.copyMaterial.dispose(), this.mesh.geometry.dispose(), super.dispose();
1267
1150
  }
1268
1151
  }
1269
- const fo = (o) => (e, t, s, r) => b(
1270
- new js(
1271
- o,
1272
- We(e, "TemporalAntialiasNode.Input"),
1273
- t,
1274
- s,
1275
- r
1276
- )
1152
+ const fo = (o) => (e, t, s, r) => new Ds(
1153
+ o,
1154
+ Le(e, "TemporalAntialiasNode.Input"),
1155
+ t,
1156
+ s,
1157
+ r
1277
1158
  );
1278
1159
  export {
1279
- $e as DownsampleThresholdNode,
1280
- J as FnLayout,
1281
- O as FnVar,
1282
- Ge as GaussianBlurNode,
1160
+ Ee as DownsampleThresholdNode,
1161
+ K as FnLayout,
1162
+ G as FnVar,
1163
+ Oe as GaussianBlurNode,
1283
1164
  ns as HighpVelocityNode,
1284
1165
  is as KawaseBlurNode,
1285
1166
  ys as LensFlareNode,
1286
1167
  Jt as MipmapBlurNode,
1287
- He as MipmapSurfaceBlurNode,
1168
+ We as MipmapSurfaceBlurNode,
1169
+ uo as Node,
1288
1170
  Ss as OutputTexture3DNode,
1289
1171
  qt as OutputTextureNode,
1290
- Le as RTTextureNode,
1291
- js as TemporalAntialiasNode,
1292
- me as cameraFar,
1293
- he as cameraNear,
1294
- qs as cameraPositionWorld,
1295
- We as convertToTexture,
1296
- Zs as debugFragmentNode,
1297
- Ks as debugNode,
1298
- Qs as debugVertexNode,
1172
+ Ge as RTTextureNode,
1173
+ Ds as TemporalAntialiasNode,
1174
+ pe as cameraFar,
1175
+ de as cameraNear,
1176
+ Hs as cameraPositionWorld,
1177
+ Le as convertToTexture,
1178
+ qs as debugFragmentNode,
1179
+ Qs as debugNode,
1180
+ Zs as debugVertexNode,
1299
1181
  go as depthToColor,
1300
- Ms as depthToViewZ,
1301
- eo as dithering,
1302
- _s as downsampleThreshold,
1303
- to as equirectGrid,
1182
+ Ns as depthToViewZ,
1183
+ Xs as dithering,
1184
+ Ys as downsampleThreshold,
1185
+ eo as equirectGrid,
1304
1186
  xo as equirectToDirectionWorld,
1305
- Xs as gaussianBlur,
1306
- so as highpVelocity,
1307
- Js as hookFunction,
1187
+ _s as gaussianBlur,
1188
+ to as highpVelocity,
1189
+ Ks as hookFunction,
1308
1190
  rs as interleavedGradientNoise,
1309
- Ws as inverseProjectionMatrix,
1310
- Hs as inverseViewMatrix,
1311
- qe as isWebGPU,
1312
- oo as kawaseBlur,
1313
- no as lensFlare,
1314
- we as logarithmicToPerspectiveDepth,
1315
- Ys as mipmapBlur,
1316
- Ee as mipmapBlurDownsample,
1191
+ Ls as inverseProjectionMatrix,
1192
+ Ws as inverseViewMatrix,
1193
+ He as isWebGPU,
1194
+ so as kawaseBlur,
1195
+ ro as lensFlare,
1196
+ ye as logarithmicToPerspectiveDepth,
1197
+ Js as mipmapBlur,
1198
+ $e as mipmapBlurDownsample,
1317
1199
  Kt as mipmapBlurUpsample,
1318
- ro as mipmapSurfaceBlur,
1200
+ oo as mipmapSurfaceBlur,
1319
1201
  lo as node,
1320
- Oe as outputTexture,
1202
+ ke as outputTexture,
1321
1203
  co as outputTexture3D,
1322
- ho as perspectiveToLogarithmicDepth,
1323
- Gs as projectionMatrix,
1324
- uo as rayEllipsoidIntersection,
1325
- io as raySphereIntersection,
1326
- ao as raySpheresIntersections,
1204
+ po as perspectiveToLogarithmicDepth,
1205
+ Os as projectionMatrix,
1206
+ ao as rayEllipsoidIntersection,
1207
+ no as raySphereIntersection,
1208
+ io as raySpheresIntersections,
1327
1209
  ws as raySpheresIntersectionsStruct,
1328
- ps as rtTexture,
1210
+ ds as rtTexture,
1329
1211
  mo as screenToPositionView,
1330
1212
  fo as temporalAntialias,
1331
- Ns as textureBicubic,
1332
- po as textureCatmullRom,
1333
- bs as turbo,
1334
- Ls as viewMatrix
1213
+ ho as textureCatmullRom,
1214
+ Ms as turbo,
1215
+ Gs as viewMatrix
1335
1216
  };
1336
1217
  //# sourceMappingURL=webgpu.js.map