@takram/three-geospatial 0.9.0 → 0.9.1

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.
package/build/webgpu.js CHANGED
@@ -1,136 +1,58 @@
1
- import { Fn as U, logarithmicDepthToViewZ as ct, perspectiveDepthToViewZ as ut, orthographicDepthToViewZ as Et, viewZToLogarithmicDepth as lt, sub as ie, PI2 as kt, PI as It, cos as Xe, vec3 as M, sin as Ze, viewZToPerspectiveDepth as Lt, int as K, vec4 as z, cameraNear as je, cameraFar as Ee, depth as Wt, cameraPosition as $t, cameraProjectionMatrixInverse as qt, cameraWorldMatrix as Gt, cameraProjectionMatrix as Ht, cameraViewMatrix as Yt, uniform as g, reference as le, positionGeometry as ht, texture as oe, uv as I, vec2 as f, add as B, luminance as Xt, smoothstep as dt, OnBeforeObjectUpdate as Zt, OnObjectUpdate as _t, screenCoordinate as ke, time as Kt, equirectUV as Qt, fwidth as Jt, abs as _, positionLocal as es, positionPrevious as ts, nodeImmutable as pt, instancedArray as _e, storage as ss, uvec2 as re, If as ae, globalId as Ae, Return as os, atomicAdd as ns, instanceIndex as is, mat3 as mt, struct as Ie, min as ft, mul as rs, fract as as, distance as cs, mix as ne, rtt as us, convertToTexture as Oe, overloadingFn as Le, sqrt as be, dot as Ne, bvec2 as xt, bvec3 as gt, uvec3 as pe, bvec4 as vt, uvec4 as me, bool as Me, color as ls, mat4 as hs, mat2 as ds, ivec4 as yt, ivec3 as ps, ivec2 as O, uint as ms, float as G, workgroupArray as fs, greaterThan as xs, invocationLocalIndex as we, workgroupBarrier as gs, textureStore as vs, workgroupId as Ke, and as wt, frameId as ys, screenUV as ws, step as Ts, textureSize as Ns, max as Tt } from "three/tsl";
2
- import { StructTypeNode as Ss, NodeMaterial as ce, TextureNode as bs, TempNode as Q, NodeUpdateType as H, RendererUtils as ge, QuadMesh as ze, IndirectStorageBufferAttribute as Ms, MeshBasicNodeMaterial as zs, NodeBuilder as Cs, Node as Rs, Texture3DNode as Nt, StorageTexture as Ds, Data3DTexture as Bs, RedFormat as As, NearestFilter as Qe, RepeatWrapping as Ve, StorageTextureNode as Vs } from "three/webgpu";
3
- import { Vector3 as St, Plane as Ps, Mesh as bt, Scene as Fs, Camera as Os, RenderTarget as Mt, RGBAFormat as zt, HalfFloatType as Ct, LinearFilter as ue, Matrix4 as Se, Vector2 as ve, AdditiveBlending as Us, PlaneGeometry as js, PerspectiveCamera as Es, SRGBColorSpace as ks, CanvasTexture as Is, NoColorSpace as Ls, Vector4 as Ws, DepthTexture as $s } from "three";
4
- import { CSMShadowNode as qs } from "three/examples/jsm/csm/CSMShadowNode.js";
5
- import { Q as Gs, D as Hs, S as Ys } from "./shared2.js";
1
+ import { Fn as U, positionView as jt, cameraFar as je, cameraNear as Ee, cameraPosition as Et, cameraProjectionMatrixInverse as kt, cameraWorldMatrix as It, cameraProjectionMatrix as Lt, cameraViewMatrix as Wt, reference as le, uniform as v, vec4 as z, positionGeometry as ct, texture as oe, uv as I, vec2 as f, add as B, luminance as $t, smoothstep as ut, OnBeforeObjectUpdate as qt, OnObjectUpdate as Gt, screenCoordinate as ke, time as Ht, vec3 as M, equirectUV as Yt, fwidth as Xt, abs as _, positionLocal as Zt, positionPrevious as _t, sub as ie, nodeImmutable as lt, instancedArray as Xe, storage as Kt, uvec2 as re, If as ae, globalId as Ae, Return as Qt, atomicAdd as Jt, instanceIndex as es, mat3 as dt, struct as Ie, min as ht, mul as ts, fract as ss, distance as os, mix as ne, rtt as ns, convertToTexture as Oe, overloadingFn as Le, sqrt as Se, dot as Te, bvec2 as pt, bvec3 as mt, uvec3 as pe, bvec4 as ft, uvec4 as me, bool as Me, color as is, mat4 as rs, mat2 as as, ivec4 as xt, ivec3 as cs, ivec2 as O, uint as us, int as K, float as G, viewZToLogarithmicDepth as vt, logarithmicDepthToViewZ as gt, perspectiveDepthToViewZ as yt, orthographicDepthToViewZ as ls, PI2 as ds, PI as hs, cos as Ze, sin as _e, viewZToPerspectiveDepth as ps, workgroupArray as ms, greaterThan as fs, invocationLocalIndex as we, workgroupBarrier as xs, textureStore as vs, workgroupId as Ke, and as wt, frameId as gs, screenUV as ys, step as ws, textureSize as Ns, max as Nt } from "three/tsl";
2
+ import { Vector3 as Tt, Plane as Ts, Mesh as bt, Scene as bs, Camera as Ss, RenderTarget as St, RGBAFormat as Mt, HalfFloatType as zt, LinearFilter as ce, Matrix4 as be, Vector2 as ve, AdditiveBlending as Ms, PlaneGeometry as zs, PerspectiveCamera as Cs, SRGBColorSpace as Rs, CanvasTexture as Ds, NoColorSpace as Bs, Vector4 as As, DepthTexture as Vs } from "three";
3
+ import { CSMShadowNode as Ps } from "three/examples/jsm/csm/CSMShadowNode.js";
4
+ import { NodeMaterial as ue, TextureNode as Fs, TempNode as Q, NodeUpdateType as H, RendererUtils as ge, QuadMesh as ze, StructTypeNode as Os, IndirectStorageBufferAttribute as Us, MeshBasicNodeMaterial as js, NodeBuilder as Es, Node as ks, Texture3DNode as Ct, StorageTexture as Is, Data3DTexture as Ls, RedFormat as Ws, NearestFilter as Qe, RepeatWrapping as Ve, StorageTextureNode as $s } from "three/webgpu";
5
+ import { Q as qs, D as Gs, S as Hs } from "./shared2.js";
6
6
  import { i as y } from "./shared.js";
7
- import { hash as We, hashString as Xs } from "three/src/nodes/core/NodeUtils.js";
8
- function Je(s) {
9
- if (typeof s == "string")
10
- return s;
11
- if ("layout" in s && s.layout instanceof Ss) {
12
- if (s.layout.name == null)
13
- throw new Error("Struct name is required.");
14
- return s.layout.name;
15
- }
16
- throw new Error(`Unsupported layout type: ${s}`);
17
- }
18
- function V({
19
- typeOnly: s = !1,
20
- ...e
21
- }) {
22
- return s ? (t) => U(t) : (t) => U(t).setLayout({
23
- ...e,
24
- type: Je(e.type),
25
- inputs: e.inputs?.map((o) => ({
26
- ...o,
27
- type: Je(o.type)
28
- })) ?? []
29
- });
30
- }
31
- function L(s) {
32
- return U((e, t) => {
33
- const o = s(...e);
34
- return typeof o == "function" ? o(t) : o;
35
- });
36
- }
37
- const Rt = /* @__PURE__ */ L(
38
- (s, e, t, o) => (n) => {
39
- t ??= fe(e), o ??= xe(e);
40
- const i = e?.isPerspectiveCamera === !0;
41
- return n.renderer.logarithmicDepthBuffer ? ct(s, t, o) : i ? ut(s, t, o) : Et(s, t, o);
42
- }
43
- ), Ue = (s, e, t) => {
44
- e ??= je, t ??= Ee;
45
- const o = ct(s, e, t);
46
- return Lt(o, e, t);
47
- }, un = (s, e, t) => {
48
- e ??= je, t ??= Ee;
49
- const o = ut(s, e, t);
50
- return lt(o, e, t);
51
- }, ln = (s, e, t, o, n) => {
52
- const i = o.element(K(2)).element(K(3)), r = o.element(K(3)).element(K(3)), a = z(M(s.flipY(), e).mul(2).sub(1), 1).mul(t.mul(i).add(r));
53
- return n.mul(a).xyz;
54
- }, Pe = [
55
- [58.1375, 2.7747, 26.8183],
56
- [-150.5666, 4.2109, -88.5066],
57
- [130.5887, -14.0195, 109.0745],
58
- [-42.3277, 4.8052, -60.1097],
59
- [4.5974, 2.1856, 12.5925],
60
- [0.1357, 0.0914, 0.1067]
61
- ], Zs = /* @__PURE__ */ V({
62
- name: "turbo",
63
- type: "vec3",
64
- inputs: [{ name: "x", type: "float" }]
65
- })(([s]) => {
66
- const e = M(...Pe[0]).toVar();
67
- for (let t = 1; t < Pe.length; ++t)
68
- e.assign(M(...Pe[t]).add(s.mul(e)));
69
- return e;
70
- }), hn = L(
71
- (s, e, t, o) => {
72
- t ??= fe(e), o ??= xe(e);
73
- const n = Rt(s, e, t, o);
74
- return Zs(lt(n, t, o));
75
- }
76
- ), dn = /* @__PURE__ */ V({
77
- name: "equirectToDirectionWorld",
78
- type: "vec3",
79
- inputs: [{ name: "uv", type: "vec2" }]
80
- })(([s]) => {
81
- const e = ie(0.5, s.x).mul(kt), t = ie(s.y, 0.5).mul(It), o = Xe(t);
82
- return M(o.mul(Xe(e)), Ze(t), o.mul(Ze(e)));
83
- });
84
- let Fe;
7
+ import { hash as We, hashString as Ys } from "three/src/nodes/core/NodeUtils.js";
8
+ let Pe;
85
9
  function J(s, e, t) {
86
- Fe ??= /* @__PURE__ */ new WeakMap();
87
- let o = Fe.get(s);
88
- return o == null && (o = {}, Fe.set(s, o)), o[e] ??= t();
10
+ Pe ??= /* @__PURE__ */ new WeakMap();
11
+ let o = Pe.get(s);
12
+ return o == null && (o = {}, Pe.set(s, o)), o[e] ??= t();
89
13
  }
90
- const pn = (s) => s != null ? J(
14
+ const un = (s) => s != null ? J(
91
15
  s,
92
16
  "projectionMatrix",
93
17
  () => le("projectionMatrix", "mat4", s).setName(
94
18
  "projectionMatrix"
95
19
  )
96
- ) : Ht, mn = (s) => s != null ? J(
20
+ ) : Lt, ln = (s) => s != null ? J(
97
21
  s,
98
22
  "viewMatrix",
99
23
  () => le("matrixWorldInverse", "mat4", s).setName("viewMatrix")
100
- ) : Yt, fn = (s) => s != null ? J(
24
+ ) : Wt, dn = (s) => s != null ? J(
101
25
  s,
102
26
  "inverseProjectionMatrix",
103
27
  () => le("projectionMatrixInverse", "mat4", s).setName(
104
28
  "inverseProjectionMatrix"
105
29
  )
106
- ) : qt, xn = (s) => s != null ? J(
30
+ ) : kt, hn = (s) => s != null ? J(
107
31
  s,
108
32
  "inverseViewMatrix",
109
33
  () => le("matrixWorld", "mat4", s).setName("inverseViewMatrix")
110
- ) : Gt, gn = (s) => s != null ? J(
34
+ ) : It, pn = (s) => s != null ? J(
111
35
  s,
112
36
  "cameraPositionWorld",
113
- () => g("vec3").setName("cameraPositionWorld").onRenderUpdate((e, { value: t }) => {
37
+ () => v("vec3").setName("cameraPositionWorld").onRenderUpdate((e, { value: t }) => {
114
38
  t.setFromMatrixPosition(s.matrixWorld);
115
39
  })
116
- ) : $t, fe = (s) => s != null ? J(
40
+ ) : Et, fe = (s) => s != null ? J(
117
41
  s,
118
42
  "cameraNear",
119
43
  () => le("near", "float", s).setName("cameraNear")
120
- ) : je, xe = (s) => s != null ? J(
44
+ ) : Ee, xe = (s) => s != null ? J(
121
45
  s,
122
46
  "cameraFar",
123
47
  () => le("far", "float", s).setName("cameraFar")
124
- ) : Ee, vn = U(
125
- ({ camera: s }) => Rt(Wt, s)
126
- ).once()().toVar("viewZ"), _s = /* @__PURE__ */ new St(), Ks = /* @__PURE__ */ new Ps();
127
- class yn extends qs {
48
+ ) : je, mn = U(() => jt.z).once()().toVar("viewZ"), Xs = /* @__PURE__ */ new Tt(), Zs = /* @__PURE__ */ new Ts();
49
+ class fn extends Ps {
128
50
  updateBefore(e) {
129
51
  super.updateBefore(e);
130
52
  const { lights: t } = this;
131
53
  if (t.length < 2)
132
54
  return;
133
- const o = t[t.length - 1], n = _s.subVectors(o.target.position, o.position).normalize(), i = Ks.setFromNormalAndCoplanarPoint(
55
+ const o = t[t.length - 1], n = Xs.subVectors(o.target.position, o.position).normalize(), i = Zs.setFromNormalAndCoplanarPoint(
134
56
  n,
135
57
  o.position
136
58
  );
@@ -141,16 +63,16 @@ class yn extends qs {
141
63
  }
142
64
  }
143
65
  async function Ce(s, e) {
144
- const t = new bt(new Gs(), e);
66
+ const t = new bt(new qs(), e);
145
67
  try {
146
- return await s.debug.getShaderAsync(new Fs(), new Os(), t);
68
+ return await s.debug.getShaderAsync(new bs(), new Ss(), t);
147
69
  } catch (o) {
148
70
  return console.error(o), { vertexShader: null, fragmentShader: null };
149
71
  } finally {
150
72
  t.geometry.dispose();
151
73
  }
152
74
  }
153
- async function wn(s, e) {
75
+ async function xn(s, e) {
154
76
  const { vertexShader: t, fragmentShader: o } = await Ce(s, e);
155
77
  return t != null && o != null ? `// Vertex shader
156
78
 
@@ -159,23 +81,23 @@ ${t}
159
81
 
160
82
  ${o}` : null;
161
83
  }
162
- async function Tn(s, e) {
84
+ async function vn(s, e) {
163
85
  return (await Ce(s, e)).vertexShader;
164
86
  }
165
- async function Nn(s, e) {
87
+ async function gn(s, e) {
166
88
  return (await Ce(s, e)).fragmentShader;
167
89
  }
168
- async function Sn(s, e) {
169
- const t = new ce();
170
- t.vertexNode = z(ht.xy, 0, 1), t.fragmentNode = e.toConst("debugNode");
90
+ async function yn(s, e) {
91
+ const t = new ue();
92
+ t.vertexNode = z(ct.xy, 0, 1), t.fragmentNode = e.toConst("debugNode");
171
93
  const o = await Ce(s, t);
172
94
  return t.dispose(), o.fragmentShader;
173
95
  }
174
- function bn(s, e, t) {
96
+ function wn(s, e, t) {
175
97
  const o = s[e];
176
98
  return s[e] = ((...n) => (t(...n), o.apply(s, n))), s;
177
99
  }
178
- class Qs extends bs {
100
+ class _s extends Fs {
179
101
  static get type() {
180
102
  return "OutputTextureNode";
181
103
  }
@@ -186,10 +108,11 @@ class Qs extends bs {
186
108
  return this.owner.build(e), super.setup(e);
187
109
  }
188
110
  clone() {
189
- return new this.constructor(this.owner, this.value);
111
+ const e = new this.constructor(this.owner, this.value);
112
+ return e.uvNode = this.uvNode, e.levelNode = this.levelNode, e.biasNode = this.biasNode, e.sampler = this.sampler, e.depthNode = this.depthNode, e.compareNode = this.compareNode, e.gradNode = this.gradNode, e.offsetNode = this.offsetNode, e;
190
113
  }
191
114
  }
192
- const $e = (...s) => new Qs(...s);
115
+ const $e = (...s) => new _s(...s);
193
116
  class Re extends Q {
194
117
  constructor(e) {
195
118
  super("vec4"), this.resolutionScale = 1, this.renderTargets = [], this.updateBeforeType = H.FRAME, this.inputNode = e;
@@ -198,12 +121,12 @@ class Re extends Q {
198
121
  return "FilterNode";
199
122
  }
200
123
  createRenderTarget(e) {
201
- const t = new Mt(1, 1, {
124
+ const t = new St(1, 1, {
202
125
  depthBuffer: !1,
203
- type: Ct,
204
- format: zt
126
+ type: zt,
127
+ format: Mt
205
128
  }), o = t.texture;
206
- o.minFilter = ue, o.magFilter = ue, o.generateMipmaps = !1;
129
+ o.minFilter = ce, o.magFilter = ce, o.generateMipmaps = !1;
207
130
  const n = this.constructor.type;
208
131
  return o.name = e != null ? `${n}_${e}` : n, this.renderTargets.push(t), t;
209
132
  }
@@ -235,10 +158,10 @@ class Re extends Q {
235
158
  super.dispose();
236
159
  }
237
160
  }
238
- const { resetRendererState: Js, restoreRendererState: eo } = ge;
161
+ const { resetRendererState: Ks, restoreRendererState: Qs } = ge;
239
162
  class qe extends Re {
240
163
  constructor(e, t) {
241
- super(e), this.downsampleRTs = [], this.upsampleRTs = [], this.downsampleMaterial = new ce(), this.upsampleMaterial = new ce(), this.mesh = new ze(), this.inputTexelSize = g("vec2"), this.downsampleNode = oe();
164
+ super(e), this.downsampleRTs = [], this.upsampleRTs = [], this.downsampleMaterial = new ue(), this.upsampleMaterial = new ue(), this.mesh = new ze(), this.inputTexelSize = v("vec2"), this.downsampleNode = oe();
242
165
  const o = this.constructor.type.replace(/Node$/, "");
243
166
  this.downsampleMaterial.name = `${o}_downsample`, this.upsampleMaterial.name = `${o}_upsample`, this.mesh.name = o;
244
167
  for (let n = 0; n < t; ++n)
@@ -265,20 +188,20 @@ class qe extends Re {
265
188
  downsampleNode: c
266
189
  } = this;
267
190
  y(i != null);
268
- const { width: a, height: h } = i.value;
269
- this.setSize(a, h);
191
+ const { width: a, height: d } = i.value;
192
+ this.setSize(a, d);
270
193
  const l = i.value;
271
- this.rendererState = Js(e, this.rendererState), n.material = this.downsampleMaterial;
194
+ this.rendererState = Ks(e, this.rendererState), n.material = this.downsampleMaterial;
272
195
  for (const u of t) {
273
- const { width: p, height: d } = i.value;
274
- r.value.set(1 / p, 1 / d), e.setRenderTarget(u), n.render(e), i.value = u.texture;
196
+ const { width: p, height: h } = i.value;
197
+ r.value.set(1 / p, 1 / h), e.setRenderTarget(u), n.render(e), i.value = u.texture;
275
198
  }
276
199
  n.material = this.upsampleMaterial;
277
200
  for (let u = o.length - 1; u >= 0; --u) {
278
- const p = o[u], { width: d, height: m } = i.value;
279
- r.value.set(1 / d, 1 / m), c.value = t[u].texture, e.setRenderTarget(p), n.render(e), i.value = p.texture;
201
+ const p = o[u], { width: h, height: m } = i.value;
202
+ r.value.set(1 / h, 1 / m), c.value = t[u].texture, e.setRenderTarget(p), n.render(e), i.value = p.texture;
280
203
  }
281
- eo(e, this.rendererState), i.value = l;
204
+ Qs(e, this.rendererState), i.value = l;
282
205
  }
283
206
  setup(e) {
284
207
  const { inputNode: t } = this;
@@ -294,8 +217,8 @@ class qe extends Re {
294
217
  this.downsampleMaterial.dispose(), this.upsampleMaterial.dispose(), this.mesh.geometry.dispose(), super.dispose();
295
218
  }
296
219
  }
297
- const Dt = (s, e) => {
298
- const t = I(), o = z(1, 1, -1, -1).mul(e.xyxy).add(t.xyxy).toVertexStage(), n = z(2, 2, -2, -2).mul(e.xyxy).add(t.xyxy).toVertexStage(), i = o.zy, r = o.xy, c = o.zw, a = o.xw, h = f(t.x, n.y), l = f(n.z, t.y), u = f(n.x, t.y), p = f(t.x, n.w), d = n.zy, m = n.xy, x = n.zw, w = n.xw;
220
+ const Rt = (s, e) => {
221
+ const t = I(), o = z(1, 1, -1, -1).mul(e.xyxy).add(t.xyxy).toVertexStage(), n = z(2, 2, -2, -2).mul(e.xyxy).add(t.xyxy).toVertexStage(), i = o.zy, r = o.xy, c = o.zw, a = o.xw, d = f(t.x, n.y), l = f(n.z, t.y), u = f(n.x, t.y), p = f(t.x, n.w), h = n.zy, m = n.xy, x = n.zw, w = n.xw;
299
222
  return B(
300
223
  B(
301
224
  s.sample(t),
@@ -305,20 +228,20 @@ const Dt = (s, e) => {
305
228
  s.sample(a)
306
229
  ).mul(1 / 8),
307
230
  B(
308
- s.sample(h),
231
+ s.sample(d),
309
232
  s.sample(l),
310
233
  s.sample(u),
311
234
  s.sample(p)
312
235
  ).mul(1 / 16),
313
236
  B(
314
- s.sample(d),
237
+ s.sample(h),
315
238
  s.sample(m),
316
239
  s.sample(x),
317
240
  s.sample(w)
318
241
  ).mul(1 / 32)
319
242
  );
320
- }, to = (s, e) => {
321
- const t = I(), o = z(1, 1, -1, -1).mul(e.xyxy).add(t.xyxy).toVertexStage(), n = f(t.x, o.y), i = f(o.z, t.y), r = f(o.x, t.y), c = f(t.x, o.w), a = o.zy, h = o.xy, l = o.zw, u = o.xw;
243
+ }, Js = (s, e) => {
244
+ const t = I(), o = z(1, 1, -1, -1).mul(e.xyxy).add(t.xyxy).toVertexStage(), n = f(t.x, o.y), i = f(o.z, t.y), r = f(o.x, t.y), c = f(t.x, o.w), a = o.zy, d = o.xy, l = o.zw, u = o.xw;
322
245
  return B(
323
246
  s.sample(t).mul(0.25),
324
247
  B(
@@ -329,13 +252,13 @@ const Dt = (s, e) => {
329
252
  ).mul(0.125),
330
253
  B(
331
254
  s.sample(a),
332
- s.sample(h),
255
+ s.sample(d),
333
256
  s.sample(l),
334
257
  s.sample(u)
335
258
  ).mul(0.0625)
336
259
  );
337
260
  };
338
- class so extends qe {
261
+ class eo extends qe {
339
262
  static get type() {
340
263
  return "MipmapBlurNode";
341
264
  }
@@ -343,16 +266,16 @@ class so extends qe {
343
266
  super(e, t), this.resolutionScale = 0.5;
344
267
  }
345
268
  setupDownsampleNode(e) {
346
- return y(this.inputNode != null), Dt(this.inputNode, this.inputTexelSize);
269
+ return y(this.inputNode != null), Rt(this.inputNode, this.inputTexelSize);
347
270
  }
348
271
  setupUpsampleNode(e) {
349
- return y(this.inputNode != null), to(this.inputNode, this.inputTexelSize);
272
+ return y(this.inputNode != null), Js(this.inputNode, this.inputTexelSize);
350
273
  }
351
274
  }
352
- const Mn = (...s) => new so(...s), { resetRendererState: oo, restoreRendererState: no } = ge;
353
- class io extends Re {
275
+ const Nn = (...s) => new eo(...s), { resetRendererState: to, restoreRendererState: so } = ge;
276
+ class oo extends Re {
354
277
  constructor(e) {
355
- super(e), this.material = new ce(), this.mesh = new ze(this.material), this.inputTexelSize = g("vec2");
278
+ super(e), this.material = new ue(), this.mesh = new ze(this.material), this.inputTexelSize = v("vec2");
356
279
  const t = this.constructor.type.replace(/Node$/, "");
357
280
  this.material.name = t, this.mesh.name = t, this.renderTarget = this.createRenderTarget(), this.outputTexture = this.renderTarget.texture;
358
281
  }
@@ -366,7 +289,7 @@ class io extends Re {
366
289
  const { inputNode: t } = this;
367
290
  y(t != null);
368
291
  const { width: o, height: n } = t.value;
369
- this.setSize(o, n), this.inputTexelSize.value.set(1 / o, 1 / n), this.rendererState = oo(e, this.rendererState), e.setRenderTarget(this.renderTarget), this.mesh.render(e), no(e, this.rendererState);
292
+ this.setSize(o, n), this.inputTexelSize.value.set(1 / o, 1 / n), this.rendererState = to(e, this.rendererState), e.setRenderTarget(this.renderTarget), this.mesh.render(e), so(e, this.rendererState);
370
293
  }
371
294
  setup(e) {
372
295
  const { inputNode: t } = this;
@@ -378,9 +301,9 @@ class io extends Re {
378
301
  this.renderTarget.dispose(), this.material.dispose(), this.mesh.geometry.dispose(), super.dispose();
379
302
  }
380
303
  }
381
- class Bt extends io {
304
+ class Dt extends oo {
382
305
  constructor(e) {
383
- super(e), this.thresholdLevel = g(5), this.thresholdRange = g(1), this.resolutionScale = 0.5;
306
+ super(e), this.thresholdLevel = v(5), this.thresholdRange = v(1), this.resolutionScale = 0.5;
384
307
  }
385
308
  static get type() {
386
309
  return "DownsampleThresholdNode";
@@ -388,7 +311,7 @@ class Bt extends io {
388
311
  setupOutputNode() {
389
312
  const { inputNode: e, thresholdLevel: t, thresholdRange: o, inputTexelSize: n } = this;
390
313
  y(e != null);
391
- const i = Dt(e, n), r = Xt(i.rgb), c = dt(
314
+ const i = Rt(e, n), r = $t(i.rgb), c = ut(
392
315
  t,
393
316
  t.add(o),
394
317
  r
@@ -396,16 +319,46 @@ class Bt extends io {
396
319
  return z(i.rgb, r).mul(c);
397
320
  }
398
321
  }
399
- const zn = (...s) => new Bt(...s), Cn = (s) => {
400
- const e = _t(s);
322
+ const Tn = (...s) => new Dt(...s), bn = (s) => {
323
+ const e = Gt(s);
401
324
  return e.updateType = H.NONE, e;
402
- }, Rn = (s) => {
403
- const e = Zt(s);
325
+ }, Sn = (s) => {
326
+ const e = qt(s);
404
327
  return e.updateBeforeType = H.FRAME, e;
405
- }, { resetRendererState: ro, restoreRendererState: ao } = ge;
406
- class co extends Re {
328
+ };
329
+ function Je(s) {
330
+ if (typeof s == "string")
331
+ return s;
332
+ if ("layout" in s && s.layout instanceof Os) {
333
+ if (s.layout.name == null)
334
+ throw new Error("Struct name is required.");
335
+ return s.layout.name;
336
+ }
337
+ throw new Error(`Unsupported layout type: ${s}`);
338
+ }
339
+ function V({
340
+ typeOnly: s = !1,
341
+ ...e
342
+ }) {
343
+ return s ? (t) => U(t) : (t) => U(t).setLayout({
344
+ ...e,
345
+ type: Je(e.type),
346
+ inputs: e.inputs?.map((o) => ({
347
+ ...o,
348
+ type: Je(o.type)
349
+ })) ?? []
350
+ });
351
+ }
352
+ function L(s) {
353
+ return U((e, t) => {
354
+ const o = s(...e);
355
+ return typeof o == "function" ? o(t) : o;
356
+ });
357
+ }
358
+ const { resetRendererState: no, restoreRendererState: io } = ge;
359
+ class ro extends Re {
407
360
  constructor(e) {
408
- super(e), this.iterations = 1, this.material = new ce(), this.mesh = new ze(this.material), this.inputTexelSize = g("vec2"), this.direction = g("vec2");
361
+ super(e), this.iterations = 1, this.material = new ue(), this.mesh = new ze(this.material), this.inputTexelSize = v("vec2"), this.direction = v("vec2");
409
362
  const t = this.constructor.type.replace(/Node$/, "");
410
363
  this.material.name = t, this.mesh.name = t, this.horizontalRT = this.createRenderTarget("horizontal"), this.verticalRT = this.createRenderTarget("vertical"), this.outputTexture = this.verticalRT.texture;
411
364
  }
@@ -420,11 +373,11 @@ class co extends Re {
420
373
  y(i != null);
421
374
  const { width: c, height: a } = i.value;
422
375
  this.setSize(c, a), this.inputTexelSize.value.set(1 / c, 1 / a);
423
- const h = i.value;
424
- this.rendererState = ro(e, this.rendererState);
376
+ const d = i.value;
377
+ this.rendererState = no(e, this.rendererState);
425
378
  for (let l = 0; l < this.iterations; ++l)
426
379
  r.value.set(1, 0), e.setRenderTarget(t), n.render(e), i.value = t.texture, r.value.set(0, 1), e.setRenderTarget(o), n.render(e), i.value = o.texture;
427
- ao(e, this.rendererState), i.value = h;
380
+ io(e, this.rendererState), i.value = d;
428
381
  }
429
382
  setup(e) {
430
383
  const { inputNode: t } = this;
@@ -449,13 +402,13 @@ function et(s) {
449
402
  }
450
403
  return o;
451
404
  }
452
- function uo(s, e = 2) {
405
+ function ao(s, e = 2) {
453
406
  y(s >= 3);
454
- const t = s + e * 2, o = e > 0 ? et(t).slice(e, -e) : et(t), n = Math.floor((o.length - 1) / 2), i = o.reduce((u, p) => u + p, 0), r = o.slice(n), c = [...Array(n + 1).keys()], a = new Float64Array(Math.floor(c.length / 2)), h = new Float64Array(a.length);
407
+ const t = s + e * 2, o = e > 0 ? et(t).slice(e, -e) : et(t), n = Math.floor((o.length - 1) / 2), i = o.reduce((u, p) => u + p, 0), r = o.slice(n), c = [...Array(n + 1).keys()], a = new Float64Array(Math.floor(c.length / 2)), d = new Float64Array(a.length);
455
408
  a[0] = r[0] / i;
456
409
  for (let u = 1, p = 1; u < c.length - 1; u += 2, ++p) {
457
- const d = c[u], m = c[u + 1], x = r[u], w = r[u + 1], T = x + w, C = (d * x + m * w) / T;
458
- a[p] = T / i, h[p] = C;
410
+ const h = c[u], m = c[u + 1], x = r[u], w = r[u + 1], N = x + w, C = (h * x + m * w) / N;
411
+ a[p] = N / i, d[p] = C;
459
412
  }
460
413
  const l = (a.reduce((u, p) => u + p, 0) - a[0] * 0.5) * 2;
461
414
  if (l !== 0) {
@@ -464,11 +417,11 @@ function uo(s, e = 2) {
464
417
  a[p] *= u;
465
418
  }
466
419
  return {
467
- offsets: h,
420
+ offsets: d,
468
421
  weights: a
469
422
  };
470
423
  }
471
- class At extends co {
424
+ class Bt extends ro {
472
425
  static get type() {
473
426
  return "GaussianBlurNode";
474
427
  }
@@ -478,32 +431,32 @@ class At extends co {
478
431
  setupOutputNode(e) {
479
432
  const { inputNode: t, inputTexelSize: o, direction: n } = this;
480
433
  y(t != null);
481
- const { offsets: i, weights: r } = uo(this.kernelSize);
434
+ const { offsets: i, weights: r } = ao(this.kernelSize);
482
435
  return U(() => {
483
- const c = I(), a = n.mul(o).toVertexStage(), h = t.sample(c).mul(r[0]);
436
+ const c = I(), a = n.mul(o).toVertexStage(), d = t.sample(c).mul(r[0]);
484
437
  for (let l = 1; l < i.length; ++l) {
485
438
  const u = a.mul(i[l]);
486
- h.addAssign(
439
+ d.addAssign(
487
440
  B(
488
441
  t.sample(c.add(u)),
489
442
  t.sample(c.sub(u))
490
443
  ).mul(r[l])
491
444
  );
492
445
  }
493
- return h;
446
+ return d;
494
447
  })();
495
448
  }
496
449
  }
497
- const Dn = (...s) => new At(...s), lo = (s) => s.dot(f(0.06711056, 583715e-8)).fract().mul(52.9829189).fract(), Bn = /* @__PURE__ */ U(() => {
498
- const s = f(ke.xy).add(Kt.fract().mul(1337)), e = lo(s);
450
+ const Mn = (...s) => new Bt(...s), co = (s) => s.dot(f(0.06711056, 583715e-8)).fract().mul(52.9829189).fract(), zn = /* @__PURE__ */ U(() => {
451
+ const s = f(ke.xy).add(Ht.fract().mul(1337)), e = co(s);
499
452
  return M(e, e.oneMinus(), e).sub(0.5).div(255);
500
- }).once()(), An = (s, e, t = f(90, 45)) => {
501
- const o = Qt(s), n = Jt(o), i = e.mul(n).mul(0.5), r = _(o.mul(t).fract().sub(0.5)).div(t), c = dt(i, i.add(n), r).oneMinus();
453
+ }).once()(), Cn = (s, e, t = f(90, 45)) => {
454
+ const o = Yt(s), n = Xt(o), i = e.mul(n).mul(0.5), r = _(o.mul(t).fract().sub(0.5)).div(t), c = ut(i, i.add(n), r).oneMinus();
502
455
  return c.x.add(c.y).clamp(0, 1);
503
456
  };
504
- class ho extends Q {
457
+ class uo extends Q {
505
458
  constructor() {
506
- super("vec3"), this.currentProjectionMatrix = g("mat4"), this.previousProjectionMatrix = g("mat4"), this.currentModelViewMatrix = g("mat4"), this.previousModelViewMatrix = g("mat4"), this.objectModelViewMatrices = /* @__PURE__ */ new WeakMap(), this.updateType = H.FRAME, this.updateBeforeType = H.OBJECT, this.updateAfterType = H.OBJECT;
459
+ super("vec3"), this.currentProjectionMatrix = v("mat4"), this.previousProjectionMatrix = v("mat4"), this.currentModelViewMatrix = v("mat4"), this.previousModelViewMatrix = v("mat4"), this.objectModelViewMatrices = /* @__PURE__ */ new WeakMap(), this.updateType = H.FRAME, this.updateBeforeType = H.OBJECT, this.updateAfterType = H.OBJECT;
507
460
  }
508
461
  static get type() {
509
462
  return "HighpVelocityNode";
@@ -519,7 +472,7 @@ class ho extends Q {
519
472
  currentProjectionMatrix: t,
520
473
  previousProjectionMatrix: o
521
474
  } = this, n = this.projectionMatrix ?? e.projectionMatrix;
522
- o.value == null ? o.value = new Se().copy(n) : o.value.copy(t.value), t.value.copy(n);
475
+ o.value == null ? o.value = new be().copy(n) : o.value.copy(t.value), t.value.copy(n);
523
476
  }
524
477
  // Executed once per object before rendering:
525
478
  updateBefore({ object: e, camera: t }) {
@@ -544,15 +497,15 @@ class ho extends Q {
544
497
  objectModelViewMatrices: o
545
498
  } = this;
546
499
  let n = o.get(e);
547
- n == null && (n = new Se(), o.set(e, n)), n.copy(t.value);
500
+ n == null && (n = new be(), o.set(e, n)), n.copy(t.value);
548
501
  }
549
502
  setup(e) {
550
- const t = this.currentProjectionMatrix.mul(this.currentModelViewMatrix).mul(es).toVertexStage(), o = this.previousProjectionMatrix.mul(this.previousModelViewMatrix).mul(ts).toVertexStage(), n = t.xyz.div(t.w), i = o.xyz.div(o.w);
503
+ const t = this.currentProjectionMatrix.mul(this.currentModelViewMatrix).mul(Zt).toVertexStage(), o = this.previousProjectionMatrix.mul(this.previousModelViewMatrix).mul(_t).toVertexStage(), n = t.xyz.div(t.w), i = o.xyz.div(o.w);
551
504
  return ie(n, i);
552
505
  }
553
506
  }
554
- const tt = /* @__PURE__ */ pt(ho);
555
- class po extends qe {
507
+ const tt = /* @__PURE__ */ lt(uo);
508
+ class lo extends qe {
556
509
  static get type() {
557
510
  return "KawaseBlurNode";
558
511
  }
@@ -562,39 +515,39 @@ class po extends qe {
562
515
  setupDownsampleNode(e) {
563
516
  const { inputNode: t, inputTexelSize: o } = this;
564
517
  y(t != null);
565
- const n = I(), i = z(1, 1, -1, -1).mul(o.xyxy.mul(0.5)).add(n.xyxy).toVertexStage(), r = i.zy, c = i.xy, a = i.xw, h = i.zw;
518
+ const n = I(), i = z(1, 1, -1, -1).mul(o.xyxy.mul(0.5)).add(n.xyxy).toVertexStage(), r = i.zy, c = i.xy, a = i.xw, d = i.zw;
566
519
  return B(
567
520
  t.sample(n).mul(4),
568
521
  t.sample(r),
569
522
  t.sample(c),
570
523
  t.sample(a),
571
- t.sample(h)
524
+ t.sample(d)
572
525
  ).mul(1 / 8);
573
526
  }
574
527
  setupUpsampleNode(e) {
575
528
  const { inputNode: t, inputTexelSize: o } = this;
576
529
  y(t != null);
577
- const n = I(), i = z(1, 1, -1, -1).mul(o.xyxy.mul(0.5)).add(n.xyxy).toVertexStage(), r = i.zy, c = i.xy, a = i.xw, h = i.zw, l = f(i.z, n.y), u = f(i.x, n.y), p = f(n.x, i.y), d = f(n.x, i.w);
530
+ const n = I(), i = z(1, 1, -1, -1).mul(o.xyxy.mul(0.5)).add(n.xyxy).toVertexStage(), r = i.zy, c = i.xy, a = i.xw, d = i.zw, l = f(i.z, n.y), u = f(i.x, n.y), p = f(n.x, i.y), h = f(n.x, i.w);
578
531
  return B(
579
532
  B(
580
533
  t.sample(r),
581
534
  t.sample(c),
582
535
  t.sample(a),
583
- t.sample(h)
536
+ t.sample(d)
584
537
  ).mul(1 / 12),
585
538
  B(
586
539
  t.sample(l),
587
540
  t.sample(u),
588
541
  t.sample(p),
589
- t.sample(d)
542
+ t.sample(h)
590
543
  ).mul(1 / 6)
591
544
  );
592
545
  }
593
546
  }
594
- const Vn = (...s) => new po(...s);
595
- class mo extends Q {
547
+ const Rn = (...s) => new lo(...s);
548
+ class ho extends Q {
596
549
  constructor(e) {
597
- super("vec3"), this.intensity = g(1e-5), this.inputNode = e;
550
+ super("vec3"), this.intensity = v(1e-5), this.inputNode = e;
598
551
  }
599
552
  static get type() {
600
553
  return "LensGhostNode";
@@ -611,9 +564,9 @@ class mo extends Q {
611
564
  { name: "color", type: "vec3" },
612
565
  { name: "offset", type: "float" }
613
566
  ]
614
- })(([a, h, l, u]) => {
615
- const p = h.mul(u).add(a.oneMinus()).saturate(), d = t.sample(p).rgb.mul(l), m = ie(0.5, p).length().mul(1 / (Math.SQRT2 / 4)).saturate();
616
- return d.mulAssign(m.oneMinus().pow(3)), d;
567
+ })(([a, d, l, u]) => {
568
+ const p = d.mul(u).add(a.oneMinus()).saturate(), h = t.sample(p).rgb.mul(l), m = ie(0.5, p).length().mul(1 / (Math.SQRT2 / 4)).saturate();
569
+ return h.mulAssign(m.oneMinus().pow(3)), h;
617
570
  }), i = I(), r = i.sub(0.5);
618
571
  return B(
619
572
  n(i, r, M(0.8, 0.8, 1), -5),
@@ -628,14 +581,14 @@ class mo extends Q {
628
581
  ).mul(o);
629
582
  }
630
583
  }
631
- const { resetRendererState: fo, restoreRendererState: xo } = ge;
632
- function go() {
584
+ const { resetRendererState: po, restoreRendererState: mo } = ge;
585
+ function fo() {
633
586
  const o = document.createElement("canvas");
634
587
  o.width = 256, o.height = 32;
635
588
  const n = o.getContext("2d");
636
589
  y(n != null), n.beginPath(), n.moveTo(0, 32 / 2), n.lineTo(256 / 2, 5), n.lineTo(256, 32 / 2), n.lineTo(256 / 2, 27), n.closePath();
637
590
  const i = n.createLinearGradient(0, 0, 256, 0);
638
- return i.addColorStop(0, "#000000"), i.addColorStop(0.5, "#ffffff"), i.addColorStop(1, "#000000"), n.fillStyle = i, n.fill(), new Is(o);
591
+ return i.addColorStop(0, "#000000"), i.addColorStop(0.5, "#ffffff"), i.addColorStop(1, "#000000"), n.fillStyle = i, n.fill(), new Ds(o);
639
592
  }
640
593
  const st = /* @__PURE__ */ Ie({
641
594
  color: "vec3",
@@ -645,17 +598,17 @@ const st = /* @__PURE__ */ Ie({
645
598
  sin: "float",
646
599
  cos: "float"
647
600
  });
648
- class vo extends Re {
601
+ class xo extends Re {
649
602
  constructor(e) {
650
- super(e), this.spikePairCount = 6, this.wireframe = !1, this.intensity = g(1e-5), this.sizeScale = g(new ve(1.5, 0.01)), this.luminanceThreshold = g(100), this.indirectBuffer = new Ms(
603
+ super(e), this.spikePairCount = 6, this.wireframe = !1, this.intensity = v(1e-5), this.sizeScale = v(new ve(1.5, 0.01)), this.luminanceThreshold = v(100), this.indirectBuffer = new Us(
651
604
  new Uint32Array([6, 0, 0, 0, 0]),
652
605
  1
653
- ), this.instanceBuffer = _e(1, st), this.renderTarget = this.createRenderTarget(), this.material = new zs({
606
+ ), this.instanceBuffer = Xe(1, st), this.renderTarget = this.createRenderTarget(), this.material = new js({
654
607
  depthTest: !1,
655
608
  depthWrite: !1,
656
609
  transparent: !0,
657
- blending: Us
658
- }), this.mesh = new bt(new js(1, 1), this.material), this.camera = new Es(), this.inputTexelSize = g("vec2"), this.outputTexelSize = g("vec2"), this.geometryRatio = g("vec2"), this.material.name = "LensGlare", this.inputNode = e, this.resolutionScale = 0.5, this.outputTexture = this.renderTarget.texture, this.mesh.geometry.indirect = this.indirectBuffer;
610
+ blending: Ms
611
+ }), this.mesh = new bt(new zs(1, 1), this.material), this.camera = new Cs(), this.inputTexelSize = v("vec2"), this.outputTexelSize = v("vec2"), this.geometryRatio = v("vec2"), this.material.name = "LensGlare", this.inputNode = e, this.resolutionScale = 0.5, this.outputTexture = this.renderTarget.texture, this.mesh.geometry.indirect = this.indirectBuffer;
659
612
  }
660
613
  customCacheKey() {
661
614
  return We(this.spikePairCount, +this.wireframe);
@@ -664,7 +617,7 @@ class vo extends Re {
664
617
  const { resolutionScale: o } = this, n = Math.max(Math.round(e * o), 1), i = Math.max(Math.round(t * o), 1);
665
618
  this.renderTarget.setSize(n, i);
666
619
  const r = Math.floor(n / 2), c = Math.floor(i / 2), a = r * c;
667
- return this.instanceBuffer.bufferCount < a && (this.instanceBuffer.dispose(), this.instanceBuffer = _e(a, st), this.setupCompute(r, c), this.setupMaterial()), this;
620
+ return this.instanceBuffer.bufferCount < a && (this.instanceBuffer.dispose(), this.instanceBuffer = Xe(a, st), this.setupCompute(r, c), this.setupMaterial()), this;
668
621
  }
669
622
  updateBefore({ renderer: e }) {
670
623
  if (e == null)
@@ -677,8 +630,8 @@ class vo extends Re {
677
630
  y(i != null), this.inputTexelSize.value.set(1 / o, 1 / n);
678
631
  const a = o / n;
679
632
  a > 1 ? this.geometryRatio.value.set(1 / a, 1) : this.geometryRatio.value.set(1, a);
680
- const { width: h, height: l } = c;
681
- this.outputTexelSize.value.set(1 / h, 1 / l), r.array[1] = 0, r.needsUpdate = !0, e.compute(i), this.rendererState = fo(e, this.rendererState), e.setRenderTarget(c), e.render(this.mesh, this.camera), xo(e, this.rendererState);
633
+ const { width: d, height: l } = c;
634
+ this.outputTexelSize.value.set(1 / d, 1 / l), r.array[1] = 0, r.needsUpdate = !0, e.compute(i), this.rendererState = po(e, this.rendererState), e.setRenderTarget(c), e.render(this.mesh, this.camera), mo(e, this.rendererState);
682
635
  }
683
636
  setupCompute(e, t) {
684
637
  const {
@@ -689,27 +642,27 @@ class vo extends Re {
689
642
  outputTexelSize: c
690
643
  } = this;
691
644
  y(n != null);
692
- const a = ss(
645
+ const a = Kt(
693
646
  i,
694
647
  "uint",
695
648
  i.count
696
649
  ).toAtomic();
697
650
  this.computeNode = U(() => {
698
- const h = re(e, t);
699
- ae(Ae.xy.greaterThanEqual(h).any(), () => {
700
- os();
651
+ const d = re(e, t);
652
+ ae(Ae.xy.greaterThanEqual(d).any(), () => {
653
+ Qt();
701
654
  });
702
655
  const l = f(Ae.xy).mul(c).mul(2), u = n.sample(l), p = u.a;
703
656
  ae(p.greaterThan(0.1), () => {
704
- const d = ns(
657
+ const h = Jt(
705
658
  a.element(1),
706
659
  o
707
660
  );
708
661
  for (let m = 0; m < o; ++m) {
709
- const x = r.element(d.add(m));
662
+ const x = r.element(h.add(m));
710
663
  x.get("color").assign(u.rgb), x.get("luminance").assign(p), x.get("position").assign(Ae.xy), x.get("scale").assign(m % 2 === 0 ? 1 : 0.5);
711
- const w = Math.PI * (3 - Math.sqrt(5)), T = Math.PI / o * m + w;
712
- x.get("sin").assign(Math.sin(T)), x.get("cos").assign(Math.cos(T));
664
+ const w = Math.PI * (3 - Math.sqrt(5)), N = Math.PI / o * m + w;
665
+ x.get("sin").assign(Math.sin(N)), x.get("cos").assign(Math.cos(N));
713
666
  }
714
667
  });
715
668
  })().compute(
@@ -730,21 +683,21 @@ class vo extends Re {
730
683
  geometryRatio: a
731
684
  } = this;
732
685
  y(e != null), y(t != null);
733
- const h = o.element(is);
734
- this.material.colorNode = this.wireframe ? z(1) : t.mul(h.get("color").mul(i)), this.material.vertexNode = U(() => {
735
- const l = h.get("sin"), u = h.get("cos"), p = mt(u, l, 0, l.negate(), u, 0, 0, 0, 1), m = h.get("position").mul(c).mul(2), x = m.flipY().mul(2).sub(1), T = h.get("luminance").div(n).saturate(), C = f(T, 1).mul(
736
- h.get("scale"),
686
+ const d = o.element(es);
687
+ this.material.colorNode = this.wireframe ? z(1) : t.mul(d.get("color").mul(i)), this.material.vertexNode = U(() => {
688
+ const l = d.get("sin"), u = d.get("cos"), p = dt(u, l, 0, l.negate(), u, 0, 0, 0, 1), m = d.get("position").mul(c).mul(2), x = m.flipY().mul(2).sub(1), N = d.get("luminance").div(n).saturate(), C = f(N, 1).mul(
689
+ d.get("scale"),
737
690
  r,
738
691
  // Make the spike to shrink at screen borders:
739
692
  m.sub(0.5).length().mul(2).oneMinus().mul(0.5).add(0.5)
740
- ), j = p.mul(ht.mul(z(C, 1, 1))).mul(a).add(M(x, 0));
693
+ ), j = p.mul(ct.mul(z(C, 1, 1))).mul(a).add(M(x, 0));
741
694
  return z(j, 1);
742
695
  })(), this.material.wireframe = this.wireframe, this.material.needsUpdate = !0;
743
696
  }
744
697
  setup(e) {
745
698
  if (this.spikeNode == null) {
746
- const t = go();
747
- t.colorSpace = ks, this.spikeNode = oe(t);
699
+ const t = fo();
700
+ t.colorSpace = Rs, this.spikeNode = oe(t);
748
701
  }
749
702
  return this.setupMaterial(), super.setup(e);
750
703
  }
@@ -752,10 +705,10 @@ class vo extends Re {
752
705
  this.renderTarget.dispose(), this.material.dispose(), this.mesh.geometry.dispose(), super.dispose();
753
706
  }
754
707
  }
755
- const yo = /* @__PURE__ */ new ve();
756
- class wo extends Q {
708
+ const vo = /* @__PURE__ */ new ve();
709
+ class go extends Q {
757
710
  constructor(e) {
758
- super("vec3"), this.intensity = g(1e-5), this.chromaticAberration = g(5e-3), this.aspectRatio = g(0), this.updateBeforeType = H.FRAME, this.inputNode = e;
711
+ super("vec3"), this.intensity = v(1e-5), this.chromaticAberration = v(5e-3), this.aspectRatio = v(0), this.updateBeforeType = H.FRAME, this.inputNode = e;
759
712
  }
760
713
  static get type() {
761
714
  return "LensHaloNode";
@@ -763,7 +716,7 @@ class wo extends Q {
763
716
  updateBefore({ renderer: e }) {
764
717
  if (e == null)
765
718
  return;
766
- const { width: t, height: o } = e.getDrawingBufferSize(yo);
719
+ const { width: t, height: o } = e.getDrawingBufferSize(vo);
767
720
  this.aspectRatio.value = t / o;
768
721
  }
769
722
  setup(e) {
@@ -778,8 +731,8 @@ class wo extends Q {
778
731
  { name: "thickness", type: "float" }
779
732
  ]
780
733
  })(([l, u, p]) => {
781
- const d = ft(_(l.sub(u)).div(p), 1);
782
- return rs(d, d, ie(3, d.mul(2))).oneMinus();
734
+ const h = ht(_(l.sub(u)).div(p), 1);
735
+ return ts(h, h, ie(3, h.mul(2))).oneMinus();
783
736
  }), c = V({
784
737
  name: "sampleHalo",
785
738
  type: "vec3",
@@ -788,20 +741,20 @@ class wo extends Q {
788
741
  { name: "radius", type: "float" }
789
742
  ]
790
743
  })(([l, u]) => {
791
- const p = f(i, 1), d = l.sub(0.5).mul(p).normalize().div(p), m = M(n).mul(M(-1, 0, 1)), x = as(d.mul(u).add(l.oneMinus())), w = M(
792
- t.sample(d.mul(m.r).add(x)).r,
793
- t.sample(d.mul(m.g).add(x)).g,
794
- t.sample(d.mul(m.b).add(x)).b
795
- ), T = l.sub(f(0.5, 0)).mul(p).add(f(0.5, 0)), C = cs(T, f(0.5)).saturate();
744
+ const p = f(i, 1), h = l.sub(0.5).mul(p).normalize().div(p), m = M(n).mul(M(-1, 0, 1)), x = ss(h.mul(u).add(l.oneMinus())), w = M(
745
+ t.sample(h.mul(m.r).add(x)).r,
746
+ t.sample(h.mul(m.g).add(x)).g,
747
+ t.sample(h.mul(m.b).add(x)).b
748
+ ), N = l.sub(f(0.5, 0)).mul(p).add(f(0.5, 0)), C = os(N, f(0.5)).saturate();
796
749
  return w.mulAssign(r(C, 0.45, 0.25)), w;
797
750
  }), a = I();
798
751
  return c(a, 0.3).mul(o);
799
752
  }
800
753
  }
801
754
  const E = (s) => s.greaterThanEqual(0).all().and(s.lessThanEqual(1).all()).toFloat();
802
- class Vt extends qe {
755
+ class At extends qe {
803
756
  constructor(e, t = 4) {
804
- super(e, t), this.blendAmount = g(0.85), this.resolutionScale = 0.5;
757
+ super(e, t), this.blendAmount = v(0.85), this.resolutionScale = 0.5;
805
758
  }
806
759
  static get type() {
807
760
  return "MipmapSurfaceBlurNode";
@@ -809,69 +762,69 @@ class Vt extends qe {
809
762
  setupDownsampleNode(e) {
810
763
  const { inputNode: t, inputTexelSize: o } = this;
811
764
  return y(t != null), U(() => {
812
- const n = I(), i = z(1, 1, -1, -1).mul(o.xyxy).add(n.xyxy).toVertexStage(), r = z(2, 2, -2, -2).mul(o.xyxy).add(n.xyxy).toVertexStage(), c = i.zy, a = i.xy, h = i.zw, l = i.xw, u = r.zy, p = r.xy, d = r.zw, m = r.xw, x = f(n.x, r.y), w = f(r.z, n.y), T = f(r.x, n.y), C = f(n.x, r.w), j = 1 / 4 / 2, R = 1 / 9 / 2, F = t.sample(n).mul(R);
813
- let b;
814
- return b = z(
765
+ const n = I(), i = z(1, 1, -1, -1).mul(o.xyxy).add(n.xyxy).toVertexStage(), r = z(2, 2, -2, -2).mul(o.xyxy).add(n.xyxy).toVertexStage(), c = i.zy, a = i.xy, d = i.zw, l = i.xw, u = r.zy, p = r.xy, h = r.zw, m = r.xw, x = f(n.x, r.y), w = f(r.z, n.y), N = f(r.x, n.y), C = f(n.x, r.w), j = 1 / 4 / 2, R = 1 / 9 / 2, F = t.sample(n).mul(R);
766
+ let S;
767
+ return S = z(
815
768
  E(c),
816
769
  E(a),
817
- E(h),
770
+ E(d),
818
771
  E(l)
819
772
  ).mul(j), F.addAssign(
820
- t.sample(c).mul(b.x),
821
- t.sample(a).mul(b.y),
822
- t.sample(h).mul(b.z),
823
- t.sample(l).mul(b.w)
824
- ), b = z(
773
+ t.sample(c).mul(S.x),
774
+ t.sample(a).mul(S.y),
775
+ t.sample(d).mul(S.z),
776
+ t.sample(l).mul(S.w)
777
+ ), S = z(
825
778
  E(u),
826
779
  E(p),
827
- E(d),
780
+ E(h),
828
781
  E(m)
829
782
  ).mul(R), F.addAssign(
830
- t.sample(u).mul(b.x),
831
- t.sample(p).mul(b.y),
832
- t.sample(d).mul(b.z),
833
- t.sample(m).mul(b.w)
834
- ), b = z(
783
+ t.sample(u).mul(S.x),
784
+ t.sample(p).mul(S.y),
785
+ t.sample(h).mul(S.z),
786
+ t.sample(m).mul(S.w)
787
+ ), S = z(
835
788
  E(x),
836
789
  E(w),
837
- E(T),
790
+ E(N),
838
791
  E(C)
839
792
  ).mul(R), F.addAssign(
840
- t.sample(x).mul(b.x),
841
- t.sample(w).mul(b.y),
842
- t.sample(T).mul(b.z),
843
- t.sample(C).mul(b.w)
793
+ t.sample(x).mul(S.x),
794
+ t.sample(w).mul(S.y),
795
+ t.sample(N).mul(S.z),
796
+ t.sample(C).mul(S.w)
844
797
  ), F;
845
798
  })();
846
799
  }
847
800
  setupUpsampleNode(e) {
848
801
  const { inputNode: t, inputTexelSize: o, downsampleNode: n } = this;
849
802
  y(t != null);
850
- const i = I(), r = z(1, 1, -1, -1).mul(o.xyxy).add(i.xyxy).toVertexStage(), c = f(i.x, r.y), a = f(r.z, i.y), h = f(r.x, i.y), l = f(i.x, r.w), u = r.zy, p = r.xy, d = r.zw, m = r.xw, x = B(
803
+ const i = I(), r = z(1, 1, -1, -1).mul(o.xyxy).add(i.xyxy).toVertexStage(), c = f(i.x, r.y), a = f(r.z, i.y), d = f(r.x, i.y), l = f(i.x, r.w), u = r.zy, p = r.xy, h = r.zw, m = r.xw, x = B(
851
804
  t.sample(i).mul(1 / 4),
852
805
  B(
853
806
  t.sample(c),
854
807
  t.sample(a),
855
- t.sample(h),
808
+ t.sample(d),
856
809
  t.sample(l)
857
810
  ).mul(1 / 8),
858
811
  B(
859
812
  t.sample(u),
860
813
  t.sample(p),
861
- t.sample(d),
814
+ t.sample(h),
862
815
  t.sample(m)
863
816
  ).mul(1 / 16)
864
817
  );
865
818
  return ne(n.sample(i), x, this.blendAmount);
866
819
  }
867
820
  }
868
- const Pn = (...s) => new Vt(...s);
869
- function Pt(s) {
870
- return (s instanceof Cs ? s.renderer.backend : "backend" in s ? s.backend : s).isWebGPUBackend === !0;
821
+ const Dn = (...s) => new At(...s);
822
+ function Vt(s) {
823
+ return (s instanceof Es ? s.renderer.backend : "backend" in s ? s.backend : s).isWebGPUBackend === !0;
871
824
  }
872
- class To extends Q {
825
+ class yo extends Q {
873
826
  constructor(e) {
874
- super("vec4"), this.bloomIntensity = g(0.05), this.inputNode = e, this.thresholdNode = new Bt(), this.blurNode = new At(), this.ghostNode = new mo(), this.haloNode = new wo(), this.bloomNode = new Vt(null, 8), this.glareNode = new vo(), this.featuresNode = us(B(this.ghostNode, this.haloNode)), this.featuresNode.value.name = "LensFlare_features", this.featuresNode.pixelRatio = 0.5, this.blurNode.resolutionScale = 1, this.bloomNode.resolutionScale = 1, this.glareNode.resolutionScale = 1;
827
+ super("vec4"), this.bloomIntensity = v(0.05), this.inputNode = e, this.thresholdNode = new Dt(), this.blurNode = new Bt(), this.ghostNode = new ho(), this.haloNode = new go(), this.bloomNode = new At(null, 8), this.glareNode = new xo(), this.featuresNode = ns(B(this.ghostNode, this.haloNode)), this.featuresNode.value.name = "LensFlare_features", this.featuresNode.pixelRatio = 0.5, this.blurNode.resolutionScale = 1, this.bloomNode.resolutionScale = 1, this.glareNode.resolutionScale = 1;
875
828
  }
876
829
  static get type() {
877
830
  return "LensFlareNode";
@@ -885,133 +838,133 @@ class To extends Q {
885
838
  haloNode: r,
886
839
  bloomNode: c,
887
840
  featuresNode: a,
888
- glareNode: h
841
+ glareNode: d
889
842
  } = this;
890
843
  y(t != null);
891
844
  const l = o.getTextureNode(), u = n.getTextureNode();
892
- o.inputNode = t, n.inputNode = l, i.inputNode = u, r.inputNode = u, c.inputNode = l, h.inputNode = l;
893
- const p = c.getTextureNode().mul(this.bloomIntensity), d = h.getTextureNode();
845
+ o.inputNode = t, n.inputNode = l, i.inputNode = u, r.inputNode = u, c.inputNode = l, d.inputNode = l;
846
+ const p = c.getTextureNode().mul(this.bloomIntensity), h = d.getTextureNode();
894
847
  return U(() => {
895
848
  const m = t;
896
- return m.addAssign(p), Pt(e) && m.addAssign(d), m.add(a);
849
+ return m.addAssign(p), Vt(e) && m.addAssign(h), m.add(a);
897
850
  })();
898
851
  }
899
852
  dispose() {
900
853
  this.thresholdNode.dispose(), this.blurNode.dispose(), this.ghostNode.dispose(), this.haloNode.dispose(), this.bloomNode.dispose(), this.glareNode.dispose(), this.featuresNode.dispose(), super.dispose();
901
854
  }
902
855
  }
903
- const Fn = (s) => new To(s != null ? Oe(s) : null), No = /* @__PURE__ */ V({
856
+ const Bn = (s) => new yo(s != null ? Oe(s) : null), wo = /* @__PURE__ */ V({
904
857
  name: "bvec2Not",
905
858
  type: "bvec2",
906
859
  inputs: [{ name: "x", type: "bvec2" }]
907
- })(([s]) => s.notEqual(Me(!0))), So = /* @__PURE__ */ V({
860
+ })(([s]) => s.notEqual(Me(!0))), No = /* @__PURE__ */ V({
908
861
  name: "bvec3Not",
909
862
  type: "bvec3",
910
863
  inputs: [{ name: "x", type: "bvec3" }]
911
- })(([s]) => s.notEqual(Me(!0))), bo = /* @__PURE__ */ V({
864
+ })(([s]) => s.notEqual(Me(!0))), To = /* @__PURE__ */ V({
912
865
  name: "bvec4Not",
913
866
  type: "bvec4",
914
867
  inputs: [{ name: "x", type: "bvec4" }]
915
- })(([s]) => s.notEqual(Me(!0))), On = /* @__PURE__ */ Le([
868
+ })(([s]) => s.notEqual(Me(!0))), An = /* @__PURE__ */ Le([
869
+ wo,
916
870
  No,
917
- So,
918
- bo
919
- ]), Mo = /* @__PURE__ */ V({
871
+ To
872
+ ]), bo = /* @__PURE__ */ V({
920
873
  name: "bvec2And",
921
874
  type: "bvec2",
922
875
  inputs: [
923
876
  { name: "x", type: "bvec2" },
924
877
  { name: "y", type: "bvec2" }
925
878
  ]
926
- })(([s, e]) => xt(re(s).mul(re(e)))), zo = /* @__PURE__ */ V({
879
+ })(([s, e]) => pt(re(s).mul(re(e)))), So = /* @__PURE__ */ V({
927
880
  name: "bvec3And",
928
881
  type: "bvec3",
929
882
  inputs: [
930
883
  { name: "x", type: "bvec3" },
931
884
  { name: "y", type: "bvec3" }
932
885
  ]
933
- })(([s, e]) => gt(pe(s).mul(pe(e)))), Co = /* @__PURE__ */ V({
886
+ })(([s, e]) => mt(pe(s).mul(pe(e)))), Mo = /* @__PURE__ */ V({
934
887
  name: "bvec4And",
935
888
  type: "bvec4",
936
889
  inputs: [
937
890
  { name: "x", type: "bvec4" },
938
891
  { name: "y", type: "bvec4" }
939
892
  ]
940
- })(([s, e]) => vt(me(s).mul(me(e)))), Un = /* @__PURE__ */ Le([
941
- Mo,
942
- zo,
943
- Co
944
- ]), Ro = /* @__PURE__ */ V({
893
+ })(([s, e]) => ft(me(s).mul(me(e)))), Vn = /* @__PURE__ */ Le([
894
+ bo,
895
+ So,
896
+ Mo
897
+ ]), zo = /* @__PURE__ */ V({
945
898
  name: "bvec2Or",
946
899
  type: "bvec2",
947
900
  inputs: [
948
901
  { name: "x", type: "bvec2" },
949
902
  { name: "y", type: "bvec2" }
950
903
  ]
951
- })(([s, e]) => re(s).add(re(e)).notEqual(0)), Do = /* @__PURE__ */ V({
904
+ })(([s, e]) => re(s).add(re(e)).notEqual(0)), Co = /* @__PURE__ */ V({
952
905
  name: "bvec3Or",
953
906
  type: "bvec3",
954
907
  inputs: [
955
908
  { name: "x", type: "bvec3" },
956
909
  { name: "y", type: "bvec3" }
957
910
  ]
958
- })(([s, e]) => pe(s).add(pe(e)).notEqual(0)), Bo = /* @__PURE__ */ V({
911
+ })(([s, e]) => pe(s).add(pe(e)).notEqual(0)), Ro = /* @__PURE__ */ V({
959
912
  name: "bvec4Or",
960
913
  type: "bvec4",
961
914
  inputs: [
962
915
  { name: "x", type: "bvec4" },
963
916
  { name: "y", type: "bvec4" }
964
917
  ]
965
- })(([s, e]) => me(s).add(me(e)).notEqual(0)), jn = /* @__PURE__ */ Le([Ro, Do, Bo]), En = /* @__PURE__ */ L(
918
+ })(([s, e]) => me(s).add(me(e)).notEqual(0)), Pn = /* @__PURE__ */ Le([zo, Co, Ro]), Fn = /* @__PURE__ */ L(
966
919
  (s, e, t, o) => {
967
- const n = s.sub(t), i = Ne(e, n), r = Ne(n, n).sub(o.pow2()), c = i.pow2().sub(r).toConst(), a = f(-1);
920
+ const n = s.sub(t), i = Te(e, n), r = Te(n, n).sub(o.pow2()), c = i.pow2().sub(r).toConst(), a = f(-1);
968
921
  return ae(c.greaterThanEqual(0), () => {
969
- const h = be(c);
970
- a.assign(f(i.negate().sub(h), i.negate().add(h)));
922
+ const d = Se(c);
923
+ a.assign(f(i.negate().sub(d), i.negate().add(d)));
971
924
  }), a;
972
925
  }
973
- ), Ao = /* @__PURE__ */ Ie({
926
+ ), Do = /* @__PURE__ */ Ie({
974
927
  near: "vec4",
975
928
  far: "vec4"
976
- }), kn = /* @__PURE__ */ L(
929
+ }), On = /* @__PURE__ */ L(
977
930
  (s, e, t, o) => {
978
- const n = s.sub(t), i = Ne(e, n), r = Ne(n, n).sub(o.pow2()), c = i.pow2().sub(r).toConst(), a = f(c.greaterThanEqual(0)).toConst(), h = a.oneMinus().toConst(), l = be(c.max(0)).toConst(), u = a.mul(i.negate().sub(l)).sub(h), p = a.mul(i.negate().add(l)).sub(h);
979
- return Ao(u, p);
931
+ const n = s.sub(t), i = Te(e, n), r = Te(n, n).sub(o.pow2()), c = i.pow2().sub(r).toConst(), a = f(c.greaterThanEqual(0)).toConst(), d = a.oneMinus().toConst(), l = Se(c.max(0)).toConst(), u = a.mul(i.negate().sub(l)).sub(d), p = a.mul(i.negate().add(l)).sub(d);
932
+ return Do(u, p);
980
933
  }
981
- ), In = /* @__PURE__ */ L(
934
+ ), Un = /* @__PURE__ */ L(
982
935
  (s, e, t) => {
983
- const o = s.div(t), n = e.div(t), i = n.dot(n), r = o.dot(n), c = o.dot(o), a = r.pow2().sub(i.mul(c.sub(1))).toConst(), h = f(-1);
936
+ const o = s.div(t), n = e.div(t), i = n.dot(n), r = o.dot(n), c = o.dot(o), a = r.pow2().sub(i.mul(c.sub(1))).toConst(), d = f(-1);
984
937
  return ae(a.greaterThanEqual(0), () => {
985
- const l = be(a);
986
- h.assign(f(r.negate().sub(l), r.negate().add(l)).div(i));
987
- }), h;
938
+ const l = Se(a);
939
+ d.assign(f(r.negate().sub(l), r.negate().add(l)).div(i));
940
+ }), d;
988
941
  }
989
- ), Vo = {
942
+ ), Bo = {
990
943
  float: G,
991
944
  int: K,
992
- uint: ms,
945
+ uint: us,
993
946
  bool: Me,
994
947
  vec2: f,
995
948
  ivec2: O,
996
949
  uvec2: re,
997
- bvec2: xt,
950
+ bvec2: pt,
998
951
  vec3: M,
999
- ivec3: ps,
952
+ ivec3: cs,
1000
953
  uvec3: pe,
1001
- bvec3: gt,
954
+ bvec3: mt,
1002
955
  vec4: z,
1003
- ivec4: yt,
956
+ ivec4: xt,
1004
957
  uvec4: me,
1005
- bvec4: vt,
1006
- mat2: ds,
1007
- mat3: mt,
1008
- mat4: hs,
1009
- color: ls
1010
- }, Ln = Rs;
1011
- function Wn(s) {
1012
- return Vo[s];
958
+ bvec4: ft,
959
+ mat2: as,
960
+ mat3: dt,
961
+ mat4: rs,
962
+ color: is
963
+ }, jn = ks;
964
+ function En(s) {
965
+ return Bo[s];
1013
966
  }
1014
- class Po extends Nt {
967
+ class Ao extends Ct {
1015
968
  static get type() {
1016
969
  return "OutputTexture3DNode";
1017
970
  }
@@ -1022,10 +975,11 @@ class Po extends Nt {
1022
975
  return this.owner.build(e), super.setup(e);
1023
976
  }
1024
977
  clone() {
1025
- return new this.constructor(this.owner, this.value);
978
+ const e = new this.constructor(this.owner, this.value);
979
+ return e.uvNode = this.uvNode, e.levelNode = this.levelNode, e.biasNode = this.biasNode, e.sampler = this.sampler, e.depthNode = this.depthNode, e.compareNode = this.compareNode, e.gradNode = this.gradNode, e.offsetNode = this.offsetNode, e;
1026
980
  }
1027
981
  }
1028
- const $n = (...s) => new Po(...s), Fo = ["x", "y", "z", "w"], qn = /* @__PURE__ */ L(
982
+ const kn = (...s) => new Ao(...s), Vo = ["x", "y", "z", "w"], In = /* @__PURE__ */ L(
1029
983
  (s, e, t = 0) => {
1030
984
  let o;
1031
985
  if (typeof t == "number")
@@ -1034,7 +988,7 @@ const $n = (...s) => new Po(...s), Fo = ["x", "y", "z", "w"], qn = /* @__PURE__
1034
988
  o = t.value;
1035
989
  else
1036
990
  throw new Error("Component must be a constant.");
1037
- const n = s.size(), i = O(e.mul(n).sub(0.5).floor()).toConst(), r = yt(i, i.add(1)).toConst(), c = Fo[o];
991
+ const n = s.size(), i = O(e.mul(n).sub(0.5).floor()).toConst(), r = xt(i, i.add(1)).toConst(), c = Vo[o];
1038
992
  return z(
1039
993
  s.load(r.xw)[c],
1040
994
  // min, max
@@ -1046,23 +1000,69 @@ const $n = (...s) => new Po(...s), Fo = ["x", "y", "z", "w"], qn = /* @__PURE__
1046
1000
  // min, min
1047
1001
  );
1048
1002
  }
1049
- ), Gn = /* @__PURE__ */ L(
1003
+ ), Ln = /* @__PURE__ */ L(
1050
1004
  (s, e = I()) => {
1051
- const t = f(s.size()), o = t.reciprocal(), n = e.mul(t), i = n.sub(0.5).floor().add(0.5), r = n.sub(i), c = r.mul(r.mul(r.mul(0.5).oneMinus()).sub(0.5)), a = r.mul(r).mul(r.mul(1.5).sub(2.5)).add(1), h = r.mul(r.mul(ie(2, r.mul(1.5))).add(0.5)), l = r.mul(r).mul(r.mul(0.5).sub(0.5)), u = a.add(h), p = h.div(a.add(h)), d = i.sub(1).mul(o), m = i.add(2).mul(o), x = i.add(p).mul(o);
1005
+ const t = f(s.size()), o = t.reciprocal(), n = e.mul(t), i = n.sub(0.5).floor().add(0.5), r = n.sub(i), c = r.mul(r.mul(r.mul(0.5).oneMinus()).sub(0.5)), a = r.mul(r).mul(r.mul(1.5).sub(2.5)).add(1), d = r.mul(r.mul(ie(2, r.mul(1.5))).add(0.5)), l = r.mul(r).mul(r.mul(0.5).sub(0.5)), u = a.add(d), p = d.div(a.add(d)), h = i.sub(1).mul(o), m = i.add(2).mul(o), x = i.add(p).mul(o);
1052
1006
  return B(
1053
- s.sample(f(d.x, d.y)).mul(c.x).mul(c.y),
1054
- s.sample(f(x.x, d.y)).mul(u.x).mul(c.y),
1055
- s.sample(f(m.x, d.y)).mul(l.x).mul(c.y),
1056
- s.sample(f(d.x, x.y)).mul(c.x).mul(u.y),
1007
+ s.sample(f(h.x, h.y)).mul(c.x).mul(c.y),
1008
+ s.sample(f(x.x, h.y)).mul(u.x).mul(c.y),
1009
+ s.sample(f(m.x, h.y)).mul(l.x).mul(c.y),
1010
+ s.sample(f(h.x, x.y)).mul(c.x).mul(u.y),
1057
1011
  s.sample(f(x.x, x.y)).mul(u.x).mul(u.y),
1058
1012
  s.sample(f(m.x, x.y)).mul(l.x).mul(u.y),
1059
- s.sample(f(d.x, m.y)).mul(c.x).mul(l.y),
1013
+ s.sample(f(h.x, m.y)).mul(c.x).mul(l.y),
1060
1014
  s.sample(f(x.x, m.y)).mul(u.x).mul(l.y),
1061
1015
  s.sample(f(m.x, m.y)).mul(l.x).mul(l.y)
1062
1016
  );
1063
1017
  }
1064
- ), D = 64;
1065
- function Te(s) {
1018
+ ), Po = /* @__PURE__ */ L(
1019
+ (s, e, t, o) => (n) => {
1020
+ t ??= fe(e), o ??= xe(e);
1021
+ const i = e?.isPerspectiveCamera === !0;
1022
+ return n.renderer.logarithmicDepthBuffer ? gt(s, t, o) : i ? yt(s, t, o) : ls(s, t, o);
1023
+ }
1024
+ ), Ue = (s, e, t) => {
1025
+ e ??= Ee, t ??= je;
1026
+ const o = gt(s, e, t);
1027
+ return ps(o, e, t);
1028
+ }, Wn = (s, e, t) => {
1029
+ e ??= Ee, t ??= je;
1030
+ const o = yt(s, e, t);
1031
+ return vt(o, e, t);
1032
+ }, $n = (s, e, t, o, n) => {
1033
+ const i = o.element(K(2)).element(K(3)), r = o.element(K(3)).element(K(3)), a = z(M(s.flipY(), e).mul(2).sub(1), 1).mul(t.mul(i).add(r));
1034
+ return n.mul(a).xyz;
1035
+ }, Fe = [
1036
+ [58.1375, 2.7747, 26.8183],
1037
+ [-150.5666, 4.2109, -88.5066],
1038
+ [130.5887, -14.0195, 109.0745],
1039
+ [-42.3277, 4.8052, -60.1097],
1040
+ [4.5974, 2.1856, 12.5925],
1041
+ [0.1357, 0.0914, 0.1067]
1042
+ ], Fo = /* @__PURE__ */ V({
1043
+ name: "turbo",
1044
+ type: "vec3",
1045
+ inputs: [{ name: "x", type: "float" }]
1046
+ })(([s]) => {
1047
+ const e = M(...Fe[0]).toVar();
1048
+ for (let t = 1; t < Fe.length; ++t)
1049
+ e.assign(M(...Fe[t]).add(s.mul(e)));
1050
+ return e;
1051
+ }), qn = L(
1052
+ (s, e, t, o) => {
1053
+ t ??= fe(e), o ??= xe(e);
1054
+ const n = Po(s, e, t, o);
1055
+ return Fo(vt(n, t, o));
1056
+ }
1057
+ ), Gn = /* @__PURE__ */ V({
1058
+ name: "equirectToDirectionWorld",
1059
+ type: "vec3",
1060
+ inputs: [{ name: "uv", type: "vec2" }]
1061
+ })(([s]) => {
1062
+ const e = ie(0.5, s.x).mul(ds), t = ie(s.y, 0.5).mul(hs), o = Ze(t);
1063
+ return M(o.mul(Ze(e)), _e(t), o.mul(_e(e)));
1064
+ }), D = 64;
1065
+ function Ne(s) {
1066
1066
  return Math.floor(Math.max(0, s) / D);
1067
1067
  }
1068
1068
  class Oo {
@@ -1073,16 +1073,16 @@ class Oo {
1073
1073
  return [this.size[0], this.size[1], this.size[2]] = e.size, this.offset.x = e.offset.x, this.offset.y = e.offset.y, this;
1074
1074
  }
1075
1075
  }
1076
- const Uo = /* @__PURE__ */ new St(), jo = /* @__PURE__ */ new Ws(), Eo = /* @__PURE__ */ new ve(), ko = /* @__PURE__ */ new Se();
1076
+ const Uo = /* @__PURE__ */ new Tt(), jo = /* @__PURE__ */ new As(), Eo = /* @__PURE__ */ new ve(), ko = /* @__PURE__ */ new be();
1077
1077
  class Io extends Q {
1078
1078
  constructor(e, t, o) {
1079
- super("float"), this.sampleCount = 60, this.hardShadowSamples = 4, this.fadeOutSamples = 8, this.thickness = g(5e-3), this.shadowContrast = g(4), this.shadowIntensity = g(1), this.bilinearThreshold = g(0.02), this.lightCoordinate = g("vec4"), this.dispatchOffset = g("ivec2"), this.dispatchIndex = g(0), this.dispatches = Array.from(
1079
+ super("float"), this.sampleCount = 60, this.hardShadowSamples = 4, this.fadeOutSamples = 8, this.thickness = v(5e-3), this.shadowContrast = v(4), this.shadowIntensity = v(1), this.bilinearThreshold = v(0.02), this.lightCoordinate = v("vec4"), this.dispatchOffset = v("ivec2"), this.dispatchIndex = v(0), this.dispatches = Array.from(
1080
1080
  // Populate the max number of dispatches
1081
1081
  { length: 8 },
1082
1082
  () => new Oo()
1083
1083
  ), this.dispatchCount = 0, this.updateBeforeType = H.FRAME, this.depthNode = e, this.camera = t, this.mainLight = o;
1084
- const n = new Ds(1, 1);
1085
- n.colorSpace = Ls, n.minFilter = ue, n.magFilter = ue, n.generateMipmaps = !1, n.name = "ScreenSpaceShadow", this.outputTexture = n, this.textureNode = $e(this, n), this.computeNode = this.createComputeNode();
1084
+ const n = new Is(1, 1);
1085
+ n.colorSpace = Bs, n.minFilter = ce, n.magFilter = ce, n.generateMipmaps = !1, n.name = "ScreenSpaceShadow", this.outputTexture = n, this.textureNode = $e(this, n), this.computeNode = this.createComputeNode();
1086
1086
  }
1087
1087
  get type() {
1088
1088
  return "ScreenSpaceShadowNode";
@@ -1114,9 +1114,9 @@ class Io extends Q {
1114
1114
  n.matrixWorldInverse
1115
1115
  ), c = Uo.copy(i.position).sub(i.target.position).normalize(), a = jo.set(c.x, c.y, c.z, 0).applyMatrix4(r);
1116
1116
  this.updateDispatchList(a, o);
1117
- for (let h = 0; h < this.dispatchCount; ++h) {
1118
- const l = this.dispatches[h];
1119
- this.dispatchOffset.value.set(l.offset.x, l.offset.y), this.dispatchIndex.value = h, t.compute(this.computeNode, l.size);
1117
+ for (let d = 0; d < this.dispatchCount; ++d) {
1118
+ const l = this.dispatches[d];
1119
+ this.dispatchOffset.value.set(l.offset.x, l.offset.y), this.dispatchIndex.value = d, t.compute(this.computeNode, l.size);
1120
1120
  }
1121
1121
  }
1122
1122
  // See bend_sss_cpu.h
@@ -1129,22 +1129,22 @@ class Io extends Q {
1129
1129
  e.w === 0 ? 0 : e.z / e.w,
1130
1130
  e.w > 0 ? 1 : -1
1131
1131
  );
1132
- const r = Math.round(this.lightCoordinate.value.x), c = Math.round(this.lightCoordinate.value.y), a = -r, h = -(o - c), l = t - r, u = c;
1132
+ const r = Math.round(this.lightCoordinate.value.x), c = Math.round(this.lightCoordinate.value.y), a = -r, d = -(o - c), l = t - r, u = c;
1133
1133
  let p = 0;
1134
- for (let d = 0; d < 4; ++d) {
1135
- const m = d === 0 || d === 3, x = (d & 1) > 0, w = (d & 2) > 0, T = Te(x ? a : -l), C = Te(w ? h : -u), j = D * (m ? 1 : 2) - 1, R = D * (m ? 2 : 1) - 1, F = Te((x ? l : -a) + j), b = Te((w ? u : -h) + R);
1136
- if (F - T > 0 && b - C > 0) {
1137
- const k = d === 2 || d === 3 ? 1 : 0, W = d === 1 || d === 3 ? 1 : 0, v = this.dispatches[p++];
1138
- v.size[0] = D, v.size[1] = F - T, v.size[2] = b - C, v.offset.x = (x ? T : -F) + k, v.offset.y = (w ? -b : C) + W;
1134
+ for (let h = 0; h < 4; ++h) {
1135
+ const m = h === 0 || h === 3, x = (h & 1) > 0, w = (h & 2) > 0, N = Ne(x ? a : -l), C = Ne(w ? d : -u), j = D * (m ? 1 : 2) - 1, R = D * (m ? 2 : 1) - 1, F = Ne((x ? l : -a) + j), S = Ne((w ? u : -d) + R);
1136
+ if (F - N > 0 && S - C > 0) {
1137
+ const k = h === 2 || h === 3 ? 1 : 0, W = h === 1 || h === 3 ? 1 : 0, g = this.dispatches[p++];
1138
+ g.size[0] = D, g.size[1] = F - N, g.size[2] = S - C, g.offset.x = (x ? N : -F) + k, g.offset.y = (w ? -S : C) + W;
1139
1139
  let A;
1140
- if (d === 0 ? A = a - h : d === 1 ? A = l + h : d === 2 ? A = -a - u : A = -l + u, A = (A + D - 1) / D | 0, A > 0) {
1141
- const N = this.dispatches[p++].copy(v);
1142
- d === 0 ? (N.size[2] = Math.min(v.size[2], A), v.size[2] -= N.size[2], N.offset.y = v.offset.y + v.size[2], N.offset.x -= 1, N.size[1] += 1) : d === 1 ? (N.size[1] = Math.min(v.size[1], A), v.size[1] -= N.size[1], N.offset.x = v.offset.x + v.size[1], N.size[2] += 1) : d === 2 ? (N.size[1] = Math.min(v.size[1], A), v.size[1] -= N.size[1], v.offset.x += N.size[1], N.size[2] += 1, N.offset.y -= 1) : d === 3 && (N.size[2] = Math.min(v.size[2], A), v.size[2] -= N.size[2], v.offset.y += N.size[2], ++N.size[1]), (N.size[1] <= 0 || N.size[2] <= 0) && N.copy(this.dispatches[--p]), (v.size[1] <= 0 || v.size[2] <= 0) && v.copy(this.dispatches[--p]);
1140
+ if (h === 0 ? A = a - d : h === 1 ? A = l + d : h === 2 ? A = -a - u : A = -l + u, A = (A + D - 1) / D | 0, A > 0) {
1141
+ const T = this.dispatches[p++].copy(g);
1142
+ h === 0 ? (T.size[2] = Math.min(g.size[2], A), g.size[2] -= T.size[2], T.offset.y = g.offset.y + g.size[2], T.offset.x -= 1, T.size[1] += 1) : h === 1 ? (T.size[1] = Math.min(g.size[1], A), g.size[1] -= T.size[1], T.offset.x = g.offset.x + g.size[1], T.size[2] += 1) : h === 2 ? (T.size[1] = Math.min(g.size[1], A), g.size[1] -= T.size[1], g.offset.x += T.size[1], T.size[2] += 1, T.offset.y -= 1) : h === 3 && (T.size[2] = Math.min(g.size[2], A), g.size[2] -= T.size[2], g.offset.y += T.size[2], ++T.size[1]), (T.size[1] <= 0 || T.size[2] <= 0) && T.copy(this.dispatches[--p]), (g.size[1] <= 0 || g.size[2] <= 0) && g.copy(this.dispatches[--p]);
1143
1143
  }
1144
1144
  }
1145
1145
  }
1146
- for (let d = 0; d < p; ++d) {
1147
- const m = this.dispatches[d];
1146
+ for (let h = 0; h < p; ++h) {
1147
+ const m = this.dispatches[h];
1148
1148
  m.offset.x *= D, m.offset.y *= D;
1149
1149
  }
1150
1150
  this.dispatchCount = p;
@@ -1160,22 +1160,22 @@ class Io extends Q {
1160
1160
  outputTexture: r,
1161
1161
  thickness: c,
1162
1162
  shadowContrast: a,
1163
- shadowIntensity: h,
1163
+ shadowIntensity: d,
1164
1164
  bilinearThreshold: l,
1165
1165
  lightCoordinate: u,
1166
1166
  dispatchOffset: p
1167
- } = this, d = Math.floor(o / D) + 2, m = fs("float", d * D), x = () => {
1168
- const w = O(Ke.yz).mul(D).add(p).toConst(), T = u.xy.floor().add(0.5).toConst(), C = u.xy.sub(T).toConst(), j = u.w.greaterThan(0), R = O(w.sign()).toConst(), F = _(w.x.add(R.y)).lessThan(_(w.y.sub(R.x))).toConst(), b = O(
1167
+ } = this, h = Math.floor(o / D) + 2, m = ms("float", h * D), x = () => {
1168
+ const w = O(Ke.yz).mul(D).add(p).toConst(), N = u.xy.floor().add(0.5).toConst(), C = u.xy.sub(N).toConst(), j = u.w.greaterThan(0), R = O(w.sign()).toConst(), F = _(w.x.add(R.y)).lessThan(_(w.y.sub(R.x))).toConst(), S = O(
1169
1169
  F.select(R.y, 0),
1170
1170
  F.select(0, R.x.negate())
1171
- ), k = f(b.mul(Ke.x).add(w)).toConst(), W = _(k.x).greaterThan(_(k.y)).toConst(), v = W.select(k.x, k.y).toConst(), A = v.abs().toConst(), N = A.sub(D), $ = W.select(C.x, C.y).toVar();
1171
+ ), k = f(S.mul(Ke.x).add(w)).toConst(), W = _(k.x).greaterThan(_(k.y)).toConst(), g = W.select(k.x, k.y).toConst(), A = g.abs().toConst(), T = A.sub(D), $ = W.select(C.x, C.y).toVar();
1172
1172
  $.assign(
1173
- v.greaterThan(0).select($.negate(), $)
1173
+ g.greaterThan(0).select($.negate(), $)
1174
1174
  );
1175
- const Y = k.add(T).toConst(), X = ne(
1175
+ const Y = k.add(N).toConst(), X = ne(
1176
1176
  u.xy,
1177
1177
  Y,
1178
- N.add($).div(A.add($))
1178
+ T.add($).div(A.add($))
1179
1179
  ).toConst(), ee = Y.sub(X).toConst(), te = G(
1180
1180
  j.select(
1181
1181
  we,
@@ -1185,47 +1185,47 @@ class Io extends Q {
1185
1185
  return { pixelXY: Z, pixelDistance: q, xyDelta: ee, xAxisMajor: W };
1186
1186
  };
1187
1187
  return U((w) => {
1188
- const [T, C] = w.renderer.reversedDepthBuffer ? [G(1), G(0)] : [G(0), G(1)], j = (S) => {
1189
- let P = e.load(S);
1188
+ const [N, C] = w.renderer.reversedDepthBuffer ? [G(1), G(0)] : [G(0), G(1)], j = (b) => {
1189
+ let P = e.load(b);
1190
1190
  return w.renderer.logarithmicDepthBuffer && (P = Ue(
1191
1191
  P,
1192
1192
  fe(t),
1193
1193
  xe(t)
1194
1194
  )), P = P.toConst(), wt(
1195
- S.greaterThanEqual(0).all(),
1196
- S.lessThan(e.size()).all()
1195
+ b.greaterThanEqual(0).all(),
1196
+ b.lessThan(e.size()).all()
1197
1197
  ).select(P, C);
1198
- }, { pixelXY: R, xyDelta: F, pixelDistance: b, xAxisMajor: k } = x(), W = u.w.negate(), v = T.greaterThan(C).select(-1, 1).toConst(), A = O(R.floor()).toConst();
1199
- let N, $, Y;
1200
- for (let S = 0; S < d; ++S) {
1201
- const P = O(R.floor()).toConst(), de = k.select(R.y, R.x).fract().sub(0.5).greaterThan(0).select(1, -1).toConst(), Ft = O(
1202
- k.select(0, de),
1203
- k.select(de, 0)
1204
- ), se = j(P).toConst(), He = j(P.add(Ft)).toConst(), Ye = C.sub(se).abs().toConst(), Ot = xs(
1198
+ }, { pixelXY: R, xyDelta: F, pixelDistance: S, xAxisMajor: k } = x(), W = u.w.negate(), g = N.greaterThan(C).select(-1, 1).toConst(), A = O(R.floor()).toConst();
1199
+ let T, $, Y;
1200
+ for (let b = 0; b < h; ++b) {
1201
+ const P = O(R.floor()).toConst(), he = k.select(R.y, R.x).fract().sub(0.5).greaterThan(0).select(1, -1).toConst(), Pt = O(
1202
+ k.select(0, he),
1203
+ k.select(he, 0)
1204
+ ), se = j(P).toConst(), He = j(P.add(Pt)).toConst(), Ye = C.sub(se).abs().toConst(), Ft = fs(
1205
1205
  se.sub(He).abs(),
1206
1206
  Ye.mul(l)
1207
- ), Ut = se.add(
1208
- _(se.sub(He)).mul(v)
1209
- ), jt = Ot.select(se, Ut), De = S === 0 ? b : W.mul(D * S).add(b).toConst();
1210
- let Be = jt.sub(u.z).div(De).toConst();
1211
- S > 0 && (Be = De.greaterThan(0).select(Be, 1e10).toConst()), m.element(we.add(D * S)).assign(Be), S === 0 && (N = se, $ = Ye, Y = De), R.addAssign(F.mul(W));
1207
+ ), Ot = se.add(
1208
+ _(se.sub(He)).mul(g)
1209
+ ), Ut = Ft.select(se, Ot), De = b === 0 ? S : W.mul(D * b).add(S).toConst();
1210
+ let Be = Ut.sub(u.z).div(De).toConst();
1211
+ b > 0 && (Be = De.greaterThan(0).select(Be, 1e10).toConst()), m.element(we.add(D * b)).assign(Be), b === 0 && (T = se, $ = Ye, Y = De), R.addAssign(F.mul(W));
1212
1212
  }
1213
- gs();
1214
- const X = N.sub(u.z).div(Y).toVar(), ee = Y.add(W).min(c.reciprocal()).mul(Y).div($).toConst();
1215
- X.assign(X.mul(ee).sub(v));
1213
+ xs();
1214
+ const X = T.sub(u.z).div(Y).toVar(), ee = Y.add(W).min(c.reciprocal()).mul(Y).div($).toConst();
1215
+ X.assign(X.mul(ee).sub(g));
1216
1216
  const te = we.add(1).toConst(), Z = G(1).toVar();
1217
- for (let S = 0; S < n; ++S) {
1218
- const P = X.sub(m.element(te.add(S)).mul(ee)).abs();
1217
+ for (let b = 0; b < n; ++b) {
1218
+ const P = X.sub(m.element(te.add(b)).mul(ee)).abs();
1219
1219
  Z.assign(Z.min(P));
1220
1220
  }
1221
1221
  const q = z(1).toVar();
1222
- for (let S = n; S < o - i; ++S) {
1223
- const P = X.sub(m.element(te.add(S)).mul(ee)).abs(), he = K(S & 3).toConst();
1224
- q.element(he).assign(q.element(he).min(P));
1222
+ for (let b = n; b < o - i; ++b) {
1223
+ const P = X.sub(m.element(te.add(b)).mul(ee)).abs(), de = K(b & 3).toConst();
1224
+ q.element(de).assign(q.element(de).min(P));
1225
1225
  }
1226
- for (let S = o - i; S < o; ++S) {
1227
- const P = X.sub(m.element(te.add(S)).mul(ee)).abs(), he = (S + 1 - (o - i)) / (i + 1) * 0.75, de = K(S & 3).toConst();
1228
- q.element(de).assign(q.element(de).min(P.add(he)));
1226
+ for (let b = o - i; b < o; ++b) {
1227
+ const P = X.sub(m.element(te.add(b)).mul(ee)).abs(), de = (b + 1 - (o - i)) / (i + 1) * 0.75, he = K(b & 3).toConst();
1228
+ q.element(he).assign(q.element(he).min(P.add(de)));
1229
1229
  }
1230
1230
  const Ge = a.oneMinus().toConst();
1231
1231
  Z.assign(
@@ -1234,7 +1234,7 @@ class Io extends Q {
1234
1234
  q.mul(a).add(Ge).saturate()
1235
1235
  );
1236
1236
  const ye = G(0).toVar();
1237
- ye.assign(q.dot(z(0.25))), ye.assign(ft(Z, ye)), vs(r, A, ne(1, ye, h));
1237
+ ye.assign(q.dot(z(0.25))), ye.assign(ht(Z, ye)), vs(r, A, ne(1, ye, d));
1238
1238
  })().computeKernel([D, 1, 1]);
1239
1239
  }
1240
1240
  setup(e) {
@@ -1245,26 +1245,30 @@ class Io extends Q {
1245
1245
  }
1246
1246
  }
1247
1247
  const Hn = (...s) => new Io(...s), Lo = /* @__PURE__ */ (() => {
1248
- const s = new Bs(new Uint8Array(1));
1249
- return s.format = As, s.minFilter = Qe, s.magFilter = Qe, s.wrapS = Ve, s.wrapT = Ve, s.wrapR = Ve, s.needsUpdate = !0, s;
1248
+ const s = new Ls(new Uint8Array(1));
1249
+ return s.format = Ws, s.minFilter = Qe, s.magFilter = Qe, s.wrapS = Ve, s.wrapT = Ve, s.wrapR = Ve, s.needsUpdate = !0, s;
1250
1250
  })();
1251
- class Wo extends Nt {
1251
+ class Wo extends Ct {
1252
1252
  constructor() {
1253
- super(Lo), this.url = Hs;
1253
+ super(Lo), this.url = Gs;
1254
1254
  }
1255
1255
  customCacheKey() {
1256
- return Xs(this.url);
1256
+ return Ys(this.url);
1257
1257
  }
1258
1258
  setup(e) {
1259
- return new Ys().loadAsync(this.url).then((t) => {
1259
+ return new Hs().loadAsync(this.url).then((t) => {
1260
1260
  this.value = t;
1261
1261
  }).catch((t) => {
1262
1262
  console.error(t);
1263
1263
  }), super.setup(e);
1264
1264
  }
1265
+ clone() {
1266
+ const e = new this.constructor();
1267
+ return e.uvNode = this.uvNode, e.levelNode = this.levelNode, e.biasNode = this.biasNode, e.sampler = this.sampler, e.depthNode = this.depthNode, e.compareNode = this.compareNode, e.gradNode = this.gradNode, e.offsetNode = this.offsetNode, e;
1268
+ }
1265
1269
  }
1266
- const $o = /* @__PURE__ */ pt(Wo), Yn = /* @__PURE__ */ U(() => $o.sample(M(ke.xy, ys.mod(64)).div(M(128, 128, 64))).r.toConst("stbn")).once()();
1267
- class qo extends Vs {
1270
+ const $o = /* @__PURE__ */ lt(Wo), Yn = /* @__PURE__ */ U(() => $o.sample(M(ke.xy, gs.mod(64)).div(M(128, 128, 64))).r.toConst("stbn")).once()();
1271
+ class qo extends $s {
1268
1272
  static get type() {
1269
1273
  return "StorageTexture3DNode";
1270
1274
  }
@@ -1304,8 +1308,8 @@ const Xo = /* @__PURE__ */ V({
1304
1308
  { name: "maxColor", type: "vec4" }
1305
1309
  ]
1306
1310
  })(([s, e, t, o]) => {
1307
- const n = o.rgb.add(t.rgb).mul(0.5).toConst(), i = o.rgb.sub(t.rgb).mul(0.5).add(1e-7), r = e.sub(z(n, s.a)).toConst(), a = r.xyz.div(i).abs().toConst(), h = Tt(a.x, a.y, a.z).toConst();
1308
- return h.greaterThan(1).select(z(n, s.a).add(r.div(h)), e);
1311
+ const n = o.rgb.add(t.rgb).mul(0.5).toConst(), i = o.rgb.sub(t.rgb).mul(0.5).add(1e-7), r = e.sub(z(n, s.a)).toConst(), a = r.xyz.div(i).abs().toConst(), d = Nt(a.x, a.y, a.z).toConst();
1312
+ return d.greaterThan(1).select(z(n, s.a).add(r.div(d)), e);
1309
1313
  }), it = [
1310
1314
  [-1, -1],
1311
1315
  [-1, 1],
@@ -1318,11 +1322,11 @@ const Xo = /* @__PURE__ */ V({
1318
1322
  ], Zo = /* @__PURE__ */ L(
1319
1323
  (s, e, t, o, n) => {
1320
1324
  const i = t.toVar(), r = t.pow2().toVar();
1321
- for (const [p, d] of it) {
1322
- const m = s.load(e.add(O(p, d))).toConst();
1325
+ for (const [p, h] of it) {
1326
+ const m = s.load(e.add(O(p, h))).toConst();
1323
1327
  i.addAssign(m), r.addAssign(m.pow2());
1324
1328
  }
1325
- const c = it.length + 1, a = i.div(c).toConst(), h = be(r.div(c).sub(a.pow2()).max(0)).mul(n).toConst(), l = a.sub(h).toConst(), u = a.add(h).toConst();
1329
+ const c = it.length + 1, a = i.div(c).toConst(), d = Se(r.div(c).sub(a.pow2()).max(0)).mul(n).toConst(), l = a.sub(d).toConst(), u = a.add(d).toConst();
1326
1330
  return Xo(a.clamp(l, u), o, l, u);
1327
1331
  }
1328
1332
  ), _o = [
@@ -1352,13 +1356,13 @@ const Xo = /* @__PURE__ */ V({
1352
1356
  }
1353
1357
  ), Jo = /* @__PURE__ */ L(
1354
1358
  (s, e) => {
1355
- const o = s.mul(e).fract().abs(), n = Tt(o, o.oneMinus());
1359
+ const o = s.mul(e).fract().abs(), n = Nt(o, o.oneMinus());
1356
1360
  return n.x.mul(n.y).oneMinus().div(0.75);
1357
1361
  }
1358
- ), rt = /* @__PURE__ */ new ve(), en = /* @__PURE__ */ new $s(1, 1);
1362
+ ), rt = /* @__PURE__ */ new ve(), en = /* @__PURE__ */ new Vs(1, 1);
1359
1363
  class at extends Q {
1360
1364
  constructor(e, t, o, n) {
1361
- if (super("vec4"), this.temporalAlpha = g(0.05), this.varianceGamma = g(1), this.velocityThreshold = g(0.1), this.depthError = g(1e-3), this.debugShowRejection = !1, this.resolveRT = this.createRenderTarget("resolve"), this.historyRT = this.createRenderTarget("history"), this.resolveMaterial = new ce(), this.mesh = new ze(), this.needsSyncRenderPipeline = !1, this.needsClearHistory = !1, this.resolveNode = oe(this.resolveRT.texture), this.historyNode = oe(this.historyRT.texture), this.previousDepthNode = oe(en), this.originalProjectionMatrix = new Se(), this.jitterIndex = 0, this.updateBeforeType = H.FRAME, this.resolveMaterial.name = "TemporalAntialias_resolve", this.mesh.name = "TemporalAntialias", this.inputNode = e, this.depthNode = t, this.velocityNode = o, !Yo(n))
1365
+ 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 ue(), this.mesh = new ze(), this.needsSyncRenderPipeline = !1, this.needsClearHistory = !1, this.resolveNode = oe(this.resolveRT.texture), this.historyNode = oe(this.historyRT.texture), this.previousDepthNode = oe(en), this.originalProjectionMatrix = new be(), this.jitterIndex = 0, this.updateBeforeType = H.FRAME, this.resolveMaterial.name = "TemporalAntialias_resolve", this.mesh.name = "TemporalAntialias", this.inputNode = e, this.depthNode = t, this.velocityNode = o, !Yo(n))
1362
1366
  throw new Error("The provided camera is not supported.");
1363
1367
  this.camera = n, this.textureNode = $e(this, this.resolveRT.texture);
1364
1368
  }
@@ -1369,12 +1373,12 @@ class at extends Q {
1369
1373
  return We(this.camera.id, +this.debugShowRejection);
1370
1374
  }
1371
1375
  createRenderTarget(e) {
1372
- const t = new Mt(1, 1, {
1376
+ const t = new St(1, 1, {
1373
1377
  depthBuffer: !1,
1374
- type: Ct,
1375
- format: zt
1378
+ type: zt,
1379
+ format: Mt
1376
1380
  }), o = t.texture;
1377
- o.minFilter = ue, o.magFilter = ue, o.generateMipmaps = !1;
1381
+ o.minFilter = ce, o.magFilter = ce, o.generateMipmaps = !1;
1378
1382
  const n = this.constructor.type;
1379
1383
  return o.name = e != null ? `${n}_${e}` : n, t;
1380
1384
  }
@@ -1409,7 +1413,7 @@ class at extends Q {
1409
1413
  if (e == null)
1410
1414
  return;
1411
1415
  const t = e.getDrawingBufferSize(rt);
1412
- this.setSize(t.x, t.y), this.rendererState = Go(e, this.rendererState), this.needsClearHistory && this.clearHistory(e), e.setRenderTarget(this.resolveRT), this.mesh.material = this.resolveMaterial, this.mesh.render(e), Ho(e, this.rendererState), Pt(e) && this.copyDepthTexture(e), this.swapBuffers(), this.needsSyncRenderPipeline && this.clearViewOffset();
1416
+ this.setSize(t.x, t.y), this.rendererState = Go(e, this.rendererState), this.needsClearHistory && this.clearHistory(e), e.setRenderTarget(this.resolveRT), this.mesh.material = this.resolveMaterial, this.mesh.render(e), Ho(e, this.rendererState), Vt(e) && this.copyDepthTexture(e), this.swapBuffers(), this.needsSyncRenderPipeline && this.clearViewOffset();
1413
1417
  }
1414
1418
  setupResolveNode({ renderer: e }) {
1415
1419
  const t = (o) => {
@@ -1421,22 +1425,22 @@ class at extends Q {
1421
1425
  ) : e.reversedDepthBuffer ? i.oneMinus() : i;
1422
1426
  };
1423
1427
  return U(() => {
1424
- const o = O(ke), n = ws, i = Qo(this.depthNode, o).toConst(), r = i.get("closestCoord"), c = i.get("closestDepth"), a = this.velocityNode.load(r).xyz.mul(M(0.5, -0.5, 0.5)).toConst(), h = a.xy.length().div(this.velocityThreshold).oneMinus().saturate(), l = n.sub(a.xy).toConst(), u = t(l), p = e.logarithmicDepthBuffer ? Ue(
1428
+ const o = O(ke), n = ys, i = Qo(this.depthNode, o).toConst(), r = i.get("closestCoord"), c = i.get("closestDepth"), a = this.velocityNode.load(r).xyz.mul(M(0.5, -0.5, 0.5)).toConst(), d = a.xy.length().div(this.velocityThreshold).oneMinus().saturate(), l = n.sub(a.xy).toConst(), u = t(l), p = e.logarithmicDepthBuffer ? Ue(
1425
1429
  c,
1426
1430
  fe(this.camera),
1427
1431
  xe(this.camera)
1428
- ) : c, d = Ts(
1432
+ ) : c, h = ws(
1429
1433
  p.add(a.z),
1430
1434
  u.add(this.depthError)
1431
- ), m = h.mul(d), x = wt(
1435
+ ), m = d.mul(h), x = wt(
1432
1436
  l.greaterThanEqual(0).all(),
1433
1437
  l.lessThanEqual(1).all()
1434
- ).toFloat(), w = c.notEqual(1).toFloat(), T = this.inputNode.load(o).toVar();
1438
+ ).toFloat(), w = c.notEqual(1).toFloat(), N = this.inputNode.load(o).toVar();
1435
1439
  return ae(x.mul(w).mul(m).greaterThan(0), () => {
1436
1440
  const C = oe(this.historyNode, l), j = Zo(
1437
1441
  this.inputNode,
1438
1442
  o,
1439
- T,
1443
+ N,
1440
1444
  C,
1441
1445
  this.varianceGamma
1442
1446
  ), R = ne(
@@ -1444,10 +1448,10 @@ class at extends Q {
1444
1448
  0.4,
1445
1449
  Jo(a.xy, Ns(this.inputNode))
1446
1450
  ).saturate();
1447
- T.assign(ne(j, T, R));
1451
+ N.assign(ne(j, N, R));
1448
1452
  }).Else(() => {
1449
- this.debugShowRejection && T.assign(M(1, 0, 0));
1450
- }), T;
1453
+ this.debugShowRejection && N.assign(M(1, 0, 0));
1454
+ }), N;
1451
1455
  })();
1452
1456
  }
1453
1457
  setup(e) {
@@ -1487,74 +1491,74 @@ function Zn(...s) {
1487
1491
  );
1488
1492
  }
1489
1493
  export {
1490
- yn as CascadedShadowMapsNode,
1491
- Bt as DownsampleThresholdNode,
1494
+ fn as CascadedShadowMapsNode,
1495
+ Dt as DownsampleThresholdNode,
1492
1496
  V as FnLayout,
1493
1497
  L as FnVar,
1494
- At as GaussianBlurNode,
1495
- ho as HighpVelocityNode,
1496
- po as KawaseBlurNode,
1497
- To as LensFlareNode,
1498
- so as MipmapBlurNode,
1499
- Vt as MipmapSurfaceBlurNode,
1500
- Ln as Node,
1501
- Rn as OnBeforeFrameUpdate,
1502
- Cn as OnFrameUpdate,
1503
- Po as OutputTexture3DNode,
1504
- Qs as OutputTextureNode,
1498
+ Bt as GaussianBlurNode,
1499
+ uo as HighpVelocityNode,
1500
+ lo as KawaseBlurNode,
1501
+ yo as LensFlareNode,
1502
+ eo as MipmapBlurNode,
1503
+ At as MipmapSurfaceBlurNode,
1504
+ jn as Node,
1505
+ Sn as OnBeforeFrameUpdate,
1506
+ bn as OnFrameUpdate,
1507
+ Ao as OutputTexture3DNode,
1508
+ _s as OutputTextureNode,
1505
1509
  Wo as STBNTextureNode,
1506
1510
  Io as ScreenSpaceShadowNode,
1507
1511
  qo as StorageTexture3DNode,
1508
1512
  at as TemporalAntialiasNode,
1509
- Un as bvecAnd,
1510
- On as bvecNot,
1511
- jn as bvecOr,
1513
+ Vn as bvecAnd,
1514
+ An as bvecNot,
1515
+ Pn as bvecOr,
1512
1516
  xe as cameraFar,
1513
1517
  fe as cameraNear,
1514
- gn as cameraPositionWorld,
1515
- Nn as debugFragmentNode,
1516
- wn as debugMaterial,
1517
- Sn as debugNode,
1518
- Tn as debugVertexNode,
1519
- hn as depthToColor,
1520
- Rt as depthToViewZ,
1521
- Bn as dithering,
1522
- zn as downsampleThreshold,
1523
- An as equirectGrid,
1524
- dn as equirectToDirectionWorld,
1525
- Dn as gaussianBlur,
1518
+ pn as cameraPositionWorld,
1519
+ gn as debugFragmentNode,
1520
+ xn as debugMaterial,
1521
+ yn as debugNode,
1522
+ vn as debugVertexNode,
1523
+ qn as depthToColor,
1524
+ Po as depthToViewZ,
1525
+ zn as dithering,
1526
+ Tn as downsampleThreshold,
1527
+ Cn as equirectGrid,
1528
+ Gn as equirectToDirectionWorld,
1529
+ Mn as gaussianBlur,
1526
1530
  tt as highpVelocity,
1527
- bn as hookFunction,
1528
- lo as interleavedGradientNoise,
1529
- fn as inverseProjectionMatrix,
1530
- xn as inverseViewMatrix,
1531
- Pt as isWebGPU,
1532
- Vn as kawaseBlur,
1533
- Fn as lensFlare,
1531
+ wn as hookFunction,
1532
+ co as interleavedGradientNoise,
1533
+ dn as inverseProjectionMatrix,
1534
+ hn as inverseViewMatrix,
1535
+ Vt as isWebGPU,
1536
+ Rn as kawaseBlur,
1537
+ Bn as lensFlare,
1534
1538
  Ue as logarithmicToPerspectiveDepth,
1535
- Mn as mipmapBlur,
1536
- Dt as mipmapBlurDownsample,
1537
- to as mipmapBlurUpsample,
1538
- Pn as mipmapSurfaceBlur,
1539
- Wn as node,
1539
+ Nn as mipmapBlur,
1540
+ Rt as mipmapBlurDownsample,
1541
+ Js as mipmapBlurUpsample,
1542
+ Dn as mipmapSurfaceBlur,
1543
+ En as node,
1540
1544
  $e as outputTexture,
1541
- $n as outputTexture3D,
1542
- un as perspectiveToLogarithmicDepth,
1543
- pn as projectionMatrix,
1544
- In as rayEllipsoidIntersection,
1545
- En as raySphereIntersection,
1546
- kn as raySpheresIntersections,
1547
- Ao as raySpheresIntersectionsStruct,
1545
+ kn as outputTexture3D,
1546
+ Wn as perspectiveToLogarithmicDepth,
1547
+ un as projectionMatrix,
1548
+ Un as rayEllipsoidIntersection,
1549
+ Fn as raySphereIntersection,
1550
+ On as raySpheresIntersections,
1551
+ Do as raySpheresIntersectionsStruct,
1548
1552
  Hn as screenSpaceShadow,
1549
- ln as screenToPositionView,
1553
+ $n as screenToPositionView,
1550
1554
  Yn as stbn,
1551
1555
  $o as stbnTexture,
1552
1556
  Xn as storageTexture3D,
1553
1557
  Zn as temporalAntialias,
1554
- Gn as textureCatmullRom,
1555
- qn as textureGather,
1556
- Zs as turbo,
1557
- mn as viewMatrix,
1558
- vn as viewZ
1558
+ Ln as textureCatmullRom,
1559
+ In as textureGather,
1560
+ Fo as turbo,
1561
+ ln as viewMatrix,
1562
+ mn as viewZ
1559
1563
  };
1560
1564
  //# sourceMappingURL=webgpu.js.map