softbox 4.6.0 → 4.8.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.
@@ -1,7 +1,8 @@
1
- import * as B from "three";
2
- import { UnsignedIntType as re, DataTexture as M, NearestFilter as T, IntType as we, FloatType as R, UnsignedByteType as Me, UnsignedShortType as Ct, ByteType as Be, ShortType as Ft, RGBAFormat as I, RGBAIntegerFormat as Ae, RGIntegerFormat as ft, RedIntegerFormat as Dt, RGFormat as dt, RedFormat as me, BufferAttribute as P, BufferGeometry as $, Matrix4 as O, Matrix3 as Pt, Vector3 as F, Vector4 as Z, MeshBasicMaterial as Et, Mesh as mt, OrthographicCamera as kt, Float32BufferAttribute as We, ShaderMaterial as ge, NoBlending as ie, WebGLRenderTarget as ae, Vector2 as j, PerspectiveCamera as pt, DataUtils as k, HalfFloatType as D, LinearFilter as C, RepeatWrapping as z, ClampToEdgeWrapping as N, Source as Ot, Quaternion as zt, DataArrayTexture as Nt, DoubleSide as Ht, BackSide as Bt, FrontSide as Wt, WebGLArrayRenderTarget as Lt, Color as se, NoToneMapping as Ut, NormalBlending as gt, EquirectangularReflectionMapping as vt, Spherical as Vt, LinearMipMapLinearFilter as Gt, Clock as qt, Scene as $t, AdditiveBlending as jt } from "three";
3
- import { g as Yt, a as Xt, B as Le, I as Qt, C as Kt, O as Zt, S as Jt, b as er, L as tr, c as rr, M as ar, T as ir, D as sr, d as or, R as S, e as W, E as L } from "./index-DoB8YjQ9.js";
4
- function nr(s) {
1
+ import * as J from "three";
2
+ import { UnsignedIntType as re, DataTexture as M, NearestFilter as T, IntType as we, FloatType as R, UnsignedByteType as Me, UnsignedShortType as Mt, ByteType as Be, ShortType as At, RGBAFormat as I, RGBAIntegerFormat as Ae, RGIntegerFormat as ft, RedIntegerFormat as Ct, RGFormat as ht, RedFormat as me, BufferAttribute as P, BufferGeometry as Q, Matrix4 as O, Matrix3 as Ft, Vector3 as F, Vector4 as K, MeshBasicMaterial as Dt, Mesh as Pt, ShaderMaterial as ge, NoBlending as ie, WebGLRenderTarget as ae, Vector2 as q, PerspectiveCamera as dt, DataUtils as k, HalfFloatType as D, LinearFilter as C, RepeatWrapping as z, ClampToEdgeWrapping as N, Source as Et, Quaternion as kt, DataArrayTexture as Ot, DoubleSide as zt, BackSide as Nt, FrontSide as Ht, WebGLArrayRenderTarget as Bt, Color as se, NoToneMapping as Wt, NormalBlending as mt, EquirectangularReflectionMapping as pt, Spherical as Lt, LinearMipMapLinearFilter as Ut, Clock as Vt, Scene as Gt, AdditiveBlending as qt } from "three";
3
+ import { g as $t, a as jt, B as We, I as Yt, C as Xt, O as Qt, S as Kt, b as Zt, L as Jt, c as er, M as tr, T as rr, D as ar, d as ir, R as S, e as B, E as W } from "./index-C4Vga5nj.js";
4
+ import { F as Z } from "./Pass-DOcH4lwV.js";
5
+ function sr(s) {
5
6
  switch (s) {
6
7
  case 1:
7
8
  return "R";
@@ -14,22 +15,22 @@ function nr(s) {
14
15
  }
15
16
  throw new Error();
16
17
  }
17
- function lr(s) {
18
+ function or(s) {
18
19
  switch (s) {
19
20
  case 1:
20
21
  return me;
21
22
  case 2:
22
- return dt;
23
+ return ht;
23
24
  case 3:
24
25
  return I;
25
26
  case 4:
26
27
  return I;
27
28
  }
28
29
  }
29
- function Ue(s) {
30
+ function Le(s) {
30
31
  switch (s) {
31
32
  case 1:
32
- return Dt;
33
+ return Ct;
33
34
  case 2:
34
35
  return ft;
35
36
  case 3:
@@ -38,7 +39,7 @@ function Ue(s) {
38
39
  return Ae;
39
40
  }
40
41
  }
41
- class xt extends M {
42
+ class gt extends M {
42
43
  constructor() {
43
44
  super(), this.minFilter = T, this.magFilter = T, this.generateMipmaps = !1, this.overrideItemSize = null, this._forcedType = null;
44
45
  }
@@ -59,34 +60,34 @@ class xt extends M {
59
60
  throw new Error("VertexAttributeTexture: overrideItemSize must divide evenly into buffer length.");
60
61
  e.itemSize = t, e.count = i * r / t;
61
62
  }
62
- const o = e.itemSize, a = e.count, l = e.normalized, h = e.array.constructor, d = h.BYTES_PER_ELEMENT;
63
- let f = this._forcedType, u = o;
64
- if (f === null)
65
- switch (h) {
63
+ const o = e.itemSize, a = e.count, l = e.normalized, f = e.array.constructor, d = f.BYTES_PER_ELEMENT;
64
+ let h = this._forcedType, u = o;
65
+ if (h === null)
66
+ switch (f) {
66
67
  case Float32Array:
67
- f = R;
68
+ h = R;
68
69
  break;
69
70
  case Uint8Array:
70
71
  case Uint16Array:
71
72
  case Uint32Array:
72
- f = re;
73
+ h = re;
73
74
  break;
74
75
  case Int8Array:
75
76
  case Int16Array:
76
77
  case Int32Array:
77
- f = we;
78
+ h = we;
78
79
  break;
79
80
  }
80
- let n, x, m, g, c = nr(o);
81
- switch (f) {
81
+ let n, x, m, g, c = sr(o);
82
+ switch (h) {
82
83
  case R:
83
- m = 1, x = lr(o), l && d === 1 ? (g = h, c += "8", h === Uint8Array ? n = Me : (n = Be, c += "_SNORM")) : (g = Float32Array, c += "32F", n = R);
84
+ m = 1, x = or(o), l && d === 1 ? (g = f, c += "8", f === Uint8Array ? n = Me : (n = Be, c += "_SNORM")) : (g = Float32Array, c += "32F", n = R);
84
85
  break;
85
86
  case we:
86
- c += d * 8 + "I", m = l ? Math.pow(2, h.BYTES_PER_ELEMENT * 8 - 1) : 1, x = Ue(o), d === 1 ? (g = Int8Array, n = Be) : d === 2 ? (g = Int16Array, n = Ft) : (g = Int32Array, n = we);
87
+ c += d * 8 + "I", m = l ? Math.pow(2, f.BYTES_PER_ELEMENT * 8 - 1) : 1, x = Le(o), d === 1 ? (g = Int8Array, n = Be) : d === 2 ? (g = Int16Array, n = At) : (g = Int32Array, n = we);
87
88
  break;
88
89
  case re:
89
- c += d * 8 + "UI", m = l ? Math.pow(2, h.BYTES_PER_ELEMENT * 8 - 1) : 1, x = Ue(o), d === 1 ? (g = Uint8Array, n = Me) : d === 2 ? (g = Uint16Array, n = Ct) : (g = Uint32Array, n = re);
90
+ c += d * 8 + "UI", m = l ? Math.pow(2, f.BYTES_PER_ELEMENT * 8 - 1) : 1, x = Le(o), d === 1 ? (g = Uint8Array, n = Me) : d === 2 ? (g = Uint16Array, n = Mt) : (g = Uint32Array, n = re);
90
91
  break;
91
92
  }
92
93
  u === 3 && (x === I || x === Ae) && (u = 4);
@@ -99,19 +100,19 @@ class xt extends M {
99
100
  e.normalized = y, this.internalFormat = c, this.format = x, this.type = n, this.image.width = p, this.image.height = p, this.image.data = b, this.needsUpdate = !0, this.dispose(), e.itemSize = r, e.count = i;
100
101
  }
101
102
  }
102
- class bt extends xt {
103
+ class vt extends gt {
103
104
  constructor() {
104
105
  super(), this._forcedType = re;
105
106
  }
106
107
  }
107
- class yt extends xt {
108
+ class xt extends gt {
108
109
  constructor() {
109
110
  super(), this._forcedType = R;
110
111
  }
111
112
  }
112
- class cr {
113
+ class nr {
113
114
  constructor() {
114
- this.index = new bt(), this.position = new yt(), this.bvhBounds = new M(), this.bvhContents = new M(), this._cachedIndexAttr = null, this.index.overrideItemSize = 3;
115
+ this.index = new vt(), this.position = new xt(), this.bvhBounds = new M(), this.bvhContents = new M(), this._cachedIndexAttr = null, this.index.overrideItemSize = 3;
115
116
  }
116
117
  /**
117
118
  * Updates the object and associated textures with data from the provided BVH.
@@ -121,16 +122,16 @@ class cr {
121
122
  */
122
123
  updateFrom(e) {
123
124
  const { geometry: t } = e;
124
- if (hr(e, this.bvhBounds, this.bvhContents), this.position.updateFrom(t.attributes.position), e.indirect) {
125
+ if (cr(e, this.bvhBounds, this.bvhContents), this.position.updateFrom(t.attributes.position), e.indirect) {
125
126
  const r = e._indirectBuffer;
126
127
  if (this._cachedIndexAttr === null || this._cachedIndexAttr.count !== r.length)
127
128
  if (t.index)
128
129
  this._cachedIndexAttr = t.index.clone();
129
130
  else {
130
- const i = Yt(Xt(t));
131
+ const i = $t(jt(t));
131
132
  this._cachedIndexAttr = new P(i, 1, !1);
132
133
  }
133
- ur(t, r, this._cachedIndexAttr), this.index.updateFrom(this._cachedIndexAttr);
134
+ lr(t, r, this._cachedIndexAttr), this.index.updateFrom(this._cachedIndexAttr);
134
135
  } else
135
136
  this.index.updateFrom(t.index);
136
137
  }
@@ -144,34 +145,34 @@ class cr {
144
145
  e && e.dispose(), t && t.dispose(), r && r.dispose(), i && i.dispose();
145
146
  }
146
147
  }
147
- function ur(s, e, t) {
148
+ function lr(s, e, t) {
148
149
  const r = t.array, i = s.index ? s.index.array : null;
149
150
  for (let o = 0, a = e.length; o < a; o++) {
150
- const l = 3 * o, h = 3 * e[o];
151
+ const l = 3 * o, f = 3 * e[o];
151
152
  for (let d = 0; d < 3; d++)
152
- r[l + d] = i ? i[h + d] : h + d;
153
+ r[l + d] = i ? i[f + d] : f + d;
153
154
  }
154
155
  }
155
- function hr(s, e, t) {
156
+ function cr(s, e, t) {
156
157
  const r = s._roots;
157
158
  if (r.length !== 1)
158
159
  throw new Error("MeshBVHUniformStruct: Multi-root BVHs not supported.");
159
- const i = r[0], o = new Uint16Array(i), a = new Uint32Array(i), l = new Float32Array(i), h = i.byteLength / Le, d = 2 * Math.ceil(Math.sqrt(h / 2)), f = new Float32Array(4 * d * d), u = Math.ceil(Math.sqrt(h)), n = new Uint32Array(2 * u * u);
160
- for (let x = 0; x < h; x++) {
161
- const m = x * Le / 4, g = m * 2, c = er(m);
160
+ const i = r[0], o = new Uint16Array(i), a = new Uint32Array(i), l = new Float32Array(i), f = i.byteLength / We, d = 2 * Math.ceil(Math.sqrt(f / 2)), h = new Float32Array(4 * d * d), u = Math.ceil(Math.sqrt(f)), n = new Uint32Array(2 * u * u);
161
+ for (let x = 0; x < f; x++) {
162
+ const m = x * We / 4, g = m * 2, c = Zt(m);
162
163
  for (let p = 0; p < 3; p++)
163
- f[8 * x + 0 + p] = l[c + 0 + p], f[8 * x + 4 + p] = l[c + 3 + p];
164
- if (Qt(g, o)) {
165
- const p = Kt(g, o), v = Zt(m, a), b = tr | p;
164
+ h[8 * x + 0 + p] = l[c + 0 + p], h[8 * x + 4 + p] = l[c + 3 + p];
165
+ if (Yt(g, o)) {
166
+ const p = Xt(g, o), v = Qt(m, a), b = Jt | p;
166
167
  n[x * 2 + 0] = b, n[x * 2 + 1] = v;
167
168
  } else {
168
- const p = a[m + 6], v = Jt(m, a);
169
+ const p = a[m + 6], v = Kt(m, a);
169
170
  n[x * 2 + 0] = v, n[x * 2 + 1] = p;
170
171
  }
171
172
  }
172
- e.image.data = f, e.image.width = d, e.image.height = d, e.format = I, e.type = R, e.internalFormat = "RGBA32F", e.minFilter = T, e.magFilter = T, e.generateMipmaps = !1, e.needsUpdate = !0, e.dispose(), t.image.data = n, t.image.width = u, t.image.height = u, t.format = ft, t.type = re, t.internalFormat = "RG32UI", t.minFilter = T, t.magFilter = T, t.generateMipmaps = !1, t.needsUpdate = !0, t.dispose();
173
+ e.image.data = h, e.image.width = d, e.image.height = d, e.format = I, e.type = R, e.internalFormat = "RGBA32F", e.minFilter = T, e.magFilter = T, e.generateMipmaps = !1, e.needsUpdate = !0, e.dispose(), t.image.data = n, t.image.width = u, t.image.height = u, t.format = ft, t.type = re, t.internalFormat = "RG32UI", t.minFilter = T, t.magFilter = T, t.generateMipmaps = !1, t.needsUpdate = !0, t.dispose();
173
174
  }
174
- const fr = (
175
+ const ur = (
175
176
  /* glsl */
176
177
  `
177
178
 
@@ -256,7 +257,7 @@ void ndcToCameraRay(
256
257
 
257
258
  }
258
259
  `
259
- ), dr = (
260
+ ), fr = (
260
261
  /* glsl */
261
262
  `
262
263
 
@@ -463,7 +464,7 @@ bool _bvhIntersectFirstHit(
463
464
 
464
465
  }
465
466
  `
466
- ), mr = (
467
+ ), hr = (
467
468
  /* glsl */
468
469
  `
469
470
  struct BVH {
@@ -477,7 +478,7 @@ struct BVH {
477
478
  };
478
479
  `
479
480
  );
480
- function Tt(s, e, t = 0) {
481
+ function bt(s, e, t = 0) {
481
482
  if (s.isInterleavedBufferAttribute) {
482
483
  const r = s.itemSize;
483
484
  for (let i = 0, o = s.count; i < o; i++) {
@@ -493,7 +494,7 @@ function te(s, e = null) {
493
494
  const t = s.array.constructor, r = s.normalized, i = s.itemSize, o = e === null ? s.count : e;
494
495
  return new P(new t(i * o), i, r);
495
496
  }
496
- function K(s, e) {
497
+ function X(s, e) {
497
498
  if (!s && !e)
498
499
  return !0;
499
500
  if (!!s != !!e)
@@ -501,7 +502,7 @@ function K(s, e) {
501
502
  const t = s.count === e.count, r = s.normalized === e.normalized, i = s.array.constructor === e.array.constructor, o = s.itemSize === e.itemSize;
502
503
  return !(!t || !r || !i || !o);
503
504
  }
504
- function pr(s) {
505
+ function dr(s) {
505
506
  const e = s[0].index !== null, t = new Set(Object.keys(s[0].attributes));
506
507
  if (!s[0].getAttribute("position"))
507
508
  throw new Error("StaticGeometryGenerator: position attribute is required.");
@@ -519,34 +520,34 @@ function pr(s) {
519
520
  throw new Error("StaticGeometryGenerator: All geometries must have the same number of attributes.");
520
521
  }
521
522
  }
522
- function gr(s) {
523
+ function mr(s) {
523
524
  let e = 0;
524
525
  for (let t = 0, r = s.length; t < r; t++)
525
526
  e += s[t].getIndex().count;
526
527
  return e;
527
528
  }
528
- function vr(s) {
529
+ function pr(s) {
529
530
  let e = 0;
530
531
  for (let t = 0, r = s.length; t < r; t++)
531
532
  e += s[t].getAttribute("position").count;
532
533
  return e;
533
534
  }
534
- function xr(s, e, t) {
535
+ function gr(s, e, t) {
535
536
  s.index && s.index.count !== e && s.setIndex(null);
536
537
  const r = s.attributes;
537
538
  for (const i in r)
538
539
  r[i].count !== t && s.deleteAttribute(i);
539
540
  }
540
- function br(s, e = {}, t = new $()) {
541
+ function vr(s, e = {}, t = new Q()) {
541
542
  const {
542
543
  useGroups: r = !1,
543
544
  forceUpdate: i = !1,
544
545
  skipAssigningAttributes: o = [],
545
546
  overwriteIndex: a = !0
546
547
  } = e;
547
- pr(s);
548
- const l = s[0].index !== null, h = l ? gr(s) : -1, d = vr(s);
549
- if (xr(t, h, d), r) {
548
+ dr(s);
549
+ const l = s[0].index !== null, f = l ? mr(s) : -1, d = pr(s);
550
+ if (gr(t, f, d), r) {
550
551
  let u = 0;
551
552
  for (let n = 0, x = s.length; n < x; n++) {
552
553
  const m = s[n];
@@ -556,7 +557,7 @@ function br(s, e = {}, t = new $()) {
556
557
  }
557
558
  if (l) {
558
559
  let u = !1;
559
- if (t.index || (t.setIndex(new P(new Uint32Array(h), 1, !1)), u = !0), u || a) {
560
+ if (t.index || (t.setIndex(new P(new Uint32Array(f), 1, !1)), u = !0), u || a) {
560
561
  let n = 0, x = 0;
561
562
  const m = t.getIndex();
562
563
  for (let g = 0, c = s.length; g < c; g++) {
@@ -568,10 +569,10 @@ function br(s, e = {}, t = new $()) {
568
569
  }
569
570
  }
570
571
  }
571
- const f = Object.keys(s[0].attributes);
572
- for (let u = 0, n = f.length; u < n; u++) {
572
+ const h = Object.keys(s[0].attributes);
573
+ for (let u = 0, n = h.length; u < n; u++) {
573
574
  let x = !1;
574
- const m = f[u];
575
+ const m = h[u];
575
576
  if (!t.getAttribute(m)) {
576
577
  const p = s[0].getAttribute(m);
577
578
  t.setAttribute(m, te(p, d)), x = !0;
@@ -580,29 +581,29 @@ function br(s, e = {}, t = new $()) {
580
581
  const c = t.getAttribute(m);
581
582
  for (let p = 0, v = s.length; p < v; p++) {
582
583
  const b = s[p], y = !i && !x && o[p], w = b.getAttribute(m);
583
- y || Tt(w, c, g), g += w.count;
584
+ y || bt(w, c, g), g += w.count;
584
585
  }
585
586
  }
586
587
  }
587
- function yr(s, e, t) {
588
+ function xr(s, e, t) {
588
589
  const r = s.index, o = s.attributes.position.count, a = r ? r.count : o;
589
590
  let l = s.groups;
590
591
  l.length === 0 && (l = [{ count: a, start: 0, materialIndex: 0 }]);
591
- let h = s.getAttribute("materialIndex");
592
- if (!h || h.count !== o) {
593
- let f;
594
- t.length <= 255 ? f = new Uint8Array(o) : f = new Uint16Array(o), h = new P(f, 1, !1), s.deleteAttribute("materialIndex"), s.setAttribute("materialIndex", h);
595
- }
596
- const d = h.array;
597
- for (let f = 0; f < l.length; f++) {
598
- const u = l[f], n = u.start, x = u.count, m = Math.min(x, a - n), g = Array.isArray(e) ? e[u.materialIndex] : e, c = t.indexOf(g);
592
+ let f = s.getAttribute("materialIndex");
593
+ if (!f || f.count !== o) {
594
+ let h;
595
+ t.length <= 255 ? h = new Uint8Array(o) : h = new Uint16Array(o), f = new P(h, 1, !1), s.deleteAttribute("materialIndex"), s.setAttribute("materialIndex", f);
596
+ }
597
+ const d = f.array;
598
+ for (let h = 0; h < l.length; h++) {
599
+ const u = l[h], n = u.start, x = u.count, m = Math.min(x, a - n), g = Array.isArray(e) ? e[u.materialIndex] : e, c = t.indexOf(g);
599
600
  for (let p = 0; p < m; p++) {
600
601
  let v = n + p;
601
602
  r && (v = r.getX(v)), d[v] = c;
602
603
  }
603
604
  }
604
605
  }
605
- function Tr(s, e) {
606
+ function br(s, e) {
606
607
  if (!s.index) {
607
608
  const t = s.attributes.position.count, r = new Array(t);
608
609
  for (let i = 0; i < t; i++)
@@ -640,7 +641,7 @@ function De(s) {
640
641
  }
641
642
  return e;
642
643
  }
643
- function Ve(s) {
644
+ function Ue(s) {
644
645
  let e = s.uuid;
645
646
  const t = Object.values(s.attributes);
646
647
  s.index && (t.push(s.index), e += `index|${s.index.version}`);
@@ -651,32 +652,32 @@ function Ve(s) {
651
652
  }
652
653
  return e;
653
654
  }
654
- function Ge(s) {
655
+ function Ve(s) {
655
656
  const e = s.skeleton;
656
657
  return e ? (e.boneTexture || e.computeBoneTexture(), `${De(e.boneTexture.image.data.buffer)}_${e.boneTexture.uuid}`) : null;
657
658
  }
658
- class wr {
659
+ class yr {
659
660
  constructor(e = null) {
660
661
  this.matrixWorld = new O(), this.geometryHash = null, this.skeletonHash = null, this.primitiveCount = -1, e !== null && this.updateFrom(e);
661
662
  }
662
663
  updateFrom(e) {
663
664
  const t = e.geometry, r = (t.index ? t.index.count : t.attributes.position.count) / 3;
664
- this.matrixWorld.copy(e.matrixWorld), this.geometryHash = Ve(t), this.primitiveCount = r, this.skeletonHash = Ge(e);
665
+ this.matrixWorld.copy(e.matrixWorld), this.geometryHash = Ue(t), this.primitiveCount = r, this.skeletonHash = Ve(e);
665
666
  }
666
667
  didChange(e) {
667
668
  const t = e.geometry, r = (t.index ? t.index.count : t.attributes.position.count) / 3;
668
- return !(this.matrixWorld.equals(e.matrixWorld) && this.geometryHash === Ve(t) && this.skeletonHash === Ge(e) && this.primitiveCount === r);
669
+ return !(this.matrixWorld.equals(e.matrixWorld) && this.geometryHash === Ue(t) && this.skeletonHash === Ve(e) && this.primitiveCount === r);
669
670
  }
670
671
  }
671
- const U = /* @__PURE__ */ new F(), V = /* @__PURE__ */ new F(), G = /* @__PURE__ */ new F(), qe = /* @__PURE__ */ new Z(), le = /* @__PURE__ */ new F(), Ie = /* @__PURE__ */ new F(), $e = /* @__PURE__ */ new Z(), je = /* @__PURE__ */ new Z(), ce = /* @__PURE__ */ new O(), Ye = /* @__PURE__ */ new O();
672
- function Xe(s, e, t) {
672
+ const L = /* @__PURE__ */ new F(), U = /* @__PURE__ */ new F(), V = /* @__PURE__ */ new F(), Ge = /* @__PURE__ */ new K(), le = /* @__PURE__ */ new F(), Ie = /* @__PURE__ */ new F(), qe = /* @__PURE__ */ new K(), $e = /* @__PURE__ */ new K(), ce = /* @__PURE__ */ new O(), je = /* @__PURE__ */ new O();
673
+ function Ye(s, e, t) {
673
674
  const r = s.skeleton, i = s.geometry, o = r.bones, a = r.boneInverses;
674
- $e.fromBufferAttribute(i.attributes.skinIndex, e), je.fromBufferAttribute(i.attributes.skinWeight, e), ce.elements.fill(0);
675
+ qe.fromBufferAttribute(i.attributes.skinIndex, e), $e.fromBufferAttribute(i.attributes.skinWeight, e), ce.elements.fill(0);
675
676
  for (let l = 0; l < 4; l++) {
676
- const h = je.getComponent(l);
677
- if (h !== 0) {
678
- const d = $e.getComponent(l);
679
- Ye.multiplyMatrices(o[d].matrixWorld, a[d]), Ir(ce, Ye, h);
677
+ const f = $e.getComponent(l);
678
+ if (f !== 0) {
679
+ const d = qe.getComponent(l);
680
+ je.multiplyMatrices(o[d].matrixWorld, a[d]), Tr(ce, je, f);
680
681
  }
681
682
  }
682
683
  return ce.multiply(s.bindMatrix).premultiply(s.bindMatrixInverse), t.transformDirection(ce), t;
@@ -684,17 +685,17 @@ function Xe(s, e, t) {
684
685
  function Re(s, e, t, r, i) {
685
686
  le.set(0, 0, 0);
686
687
  for (let o = 0, a = s.length; o < a; o++) {
687
- const l = e[o], h = s[o];
688
- l !== 0 && (Ie.fromBufferAttribute(h, r), t ? le.addScaledVector(Ie, l) : le.addScaledVector(Ie.sub(i), l));
688
+ const l = e[o], f = s[o];
689
+ l !== 0 && (Ie.fromBufferAttribute(f, r), t ? le.addScaledVector(Ie, l) : le.addScaledVector(Ie.sub(i), l));
689
690
  }
690
691
  i.add(le);
691
692
  }
692
- function Ir(s, e, t) {
693
+ function Tr(s, e, t) {
693
694
  const r = s.elements, i = e.elements;
694
695
  for (let o = 0, a = i.length; o < a; o++)
695
696
  r[o] += i[o] * t;
696
697
  }
697
- function Rr(s) {
698
+ function wr(s) {
698
699
  const { index: e, attributes: t } = s;
699
700
  if (e)
700
701
  for (let r = 0, i = e.count; r < i; r += 3) {
@@ -705,36 +706,36 @@ function Rr(s) {
705
706
  for (const r in t) {
706
707
  const i = t[r], o = i.itemSize;
707
708
  for (let a = 0, l = i.count; a < l; a += 3)
708
- for (let h = 0; h < o; h++) {
709
- const d = i.getComponent(a, h), f = i.getComponent(a + 2, h);
710
- i.setComponent(a, h, f), i.setComponent(a + 2, h, d);
709
+ for (let f = 0; f < o; f++) {
710
+ const d = i.getComponent(a, f), h = i.getComponent(a + 2, f);
711
+ i.setComponent(a, f, h), i.setComponent(a + 2, f, d);
711
712
  }
712
713
  }
713
714
  return s;
714
715
  }
715
- function Sr(s, e = {}, t = new $()) {
716
+ function Ir(s, e = {}, t = new Q()) {
716
717
  e = {
717
718
  applyWorldTransforms: !0,
718
719
  attributes: [],
719
720
  ...e
720
721
  };
721
- const r = s.geometry, i = e.applyWorldTransforms, o = e.attributes.includes("normal"), a = e.attributes.includes("tangent"), l = r.attributes, h = t.attributes;
722
+ const r = s.geometry, i = e.applyWorldTransforms, o = e.attributes.includes("normal"), a = e.attributes.includes("tangent"), l = r.attributes, f = t.attributes;
722
723
  for (const v in t.attributes)
723
724
  (!e.attributes.includes(v) || !(v in r.attributes)) && t.deleteAttribute(v);
724
- !t.index && r.index && (t.index = r.index.clone()), h.position || t.setAttribute("position", te(l.position)), o && !h.normal && l.normal && t.setAttribute("normal", te(l.normal)), a && !h.tangent && l.tangent && t.setAttribute("tangent", te(l.tangent)), K(r.index, t.index), K(l.position, h.position), o && K(l.normal, h.normal), a && K(l.tangent, h.tangent);
725
- const d = l.position, f = o ? l.normal : null, u = a ? l.tangent : null, n = r.morphAttributes.position, x = r.morphAttributes.normal, m = r.morphAttributes.tangent, g = r.morphTargetsRelative, c = s.morphTargetInfluences, p = new Pt();
725
+ !t.index && r.index && (t.index = r.index.clone()), f.position || t.setAttribute("position", te(l.position)), o && !f.normal && l.normal && t.setAttribute("normal", te(l.normal)), a && !f.tangent && l.tangent && t.setAttribute("tangent", te(l.tangent)), X(r.index, t.index), X(l.position, f.position), o && X(l.normal, f.normal), a && X(l.tangent, f.tangent);
726
+ const d = l.position, h = o ? l.normal : null, u = a ? l.tangent : null, n = r.morphAttributes.position, x = r.morphAttributes.normal, m = r.morphAttributes.tangent, g = r.morphTargetsRelative, c = s.morphTargetInfluences, p = new Ft();
726
727
  p.getNormalMatrix(s.matrixWorld), r.index && t.index.array.set(r.index.array);
727
728
  for (let v = 0, b = l.position.count; v < b; v++)
728
- U.fromBufferAttribute(d, v), f && V.fromBufferAttribute(f, v), u && (qe.fromBufferAttribute(u, v), G.fromBufferAttribute(u, v)), c && (n && Re(n, c, g, v, U), x && Re(x, c, g, v, V), m && Re(m, c, g, v, G)), s.isSkinnedMesh && (s.applyBoneTransform(v, U), f && Xe(s, v, V), u && Xe(s, v, G)), i && U.applyMatrix4(s.matrixWorld), h.position.setXYZ(v, U.x, U.y, U.z), f && (i && V.applyNormalMatrix(p), h.normal.setXYZ(v, V.x, V.y, V.z)), u && (i && G.transformDirection(s.matrixWorld), h.tangent.setXYZW(v, G.x, G.y, G.z, qe.w));
729
+ L.fromBufferAttribute(d, v), h && U.fromBufferAttribute(h, v), u && (Ge.fromBufferAttribute(u, v), V.fromBufferAttribute(u, v)), c && (n && Re(n, c, g, v, L), x && Re(x, c, g, v, U), m && Re(m, c, g, v, V)), s.isSkinnedMesh && (s.applyBoneTransform(v, L), h && Ye(s, v, U), u && Ye(s, v, V)), i && L.applyMatrix4(s.matrixWorld), f.position.setXYZ(v, L.x, L.y, L.z), h && (i && U.applyNormalMatrix(p), f.normal.setXYZ(v, U.x, U.y, U.z)), u && (i && V.transformDirection(s.matrixWorld), f.tangent.setXYZW(v, V.x, V.y, V.z, Ge.w));
729
730
  for (const v in e.attributes) {
730
731
  const b = e.attributes[v];
731
- b === "position" || b === "tangent" || b === "normal" || !(b in l) || (h[b] || t.setAttribute(b, te(l[b])), K(l[b], h[b]), Tt(l[b], h[b]));
732
+ b === "position" || b === "tangent" || b === "normal" || !(b in l) || (f[b] || t.setAttribute(b, te(l[b])), X(l[b], f[b]), bt(l[b], f[b]));
732
733
  }
733
- return s.matrixWorld.determinant() < 0 && Rr(t), t;
734
+ return s.matrixWorld.determinant() < 0 && wr(t), t;
734
735
  }
735
- class _r extends $ {
736
+ class Rr extends Q {
736
737
  constructor() {
737
- super(), this.version = 0, this.hash = null, this._diff = new wr();
738
+ super(), this.version = 0, this.hash = null, this._diff = new yr();
738
739
  }
739
740
  // returns whether the passed mesh is compatible with this baked geometry
740
741
  // such that it can be updated without resizing attributes
@@ -742,24 +743,24 @@ class _r extends $ {
742
743
  const r = e.geometry;
743
744
  for (let i = 0; i < t.length; i++) {
744
745
  const o = t[i], a = r.attributes[o], l = this.attributes[o];
745
- if (a && !K(a, l))
746
+ if (a && !X(a, l))
746
747
  return !1;
747
748
  }
748
749
  return !0;
749
750
  }
750
751
  updateFrom(e, t) {
751
752
  const r = this._diff;
752
- return r.didChange(e) ? (Sr(e, t, this), r.updateFrom(e), this.version++, this.hash = `${this.uuid}_${this.version}`, !0) : !1;
753
+ return r.didChange(e) ? (Ir(e, t, this), r.updateFrom(e), this.version++, this.hash = `${this.uuid}_${this.version}`, !0) : !1;
753
754
  }
754
755
  }
755
- const Ce = 0, wt = 1, It = 2;
756
- function Mr(s, e) {
756
+ const Ce = 0, yt = 1, Tt = 2;
757
+ function Sr(s, e) {
757
758
  for (let t = 0, r = s.length; t < r; t++)
758
759
  s[t].traverseVisible((o) => {
759
760
  o.isMesh && e(o);
760
761
  });
761
762
  }
762
- function Ar(s) {
763
+ function _r(s) {
763
764
  const e = [];
764
765
  for (let t = 0, r = s.length; t < r; t++) {
765
766
  const i = s[t];
@@ -767,7 +768,7 @@ function Ar(s) {
767
768
  }
768
769
  return e;
769
770
  }
770
- function Cr(s, e, t) {
771
+ function Mr(s, e, t) {
771
772
  if (s.length === 0) {
772
773
  e.setIndex(null);
773
774
  const r = e.attributes;
@@ -776,24 +777,24 @@ function Cr(s, e, t) {
776
777
  for (const i in t.attributes)
777
778
  e.setAttribute(t.attributes[i], new P(new Float32Array(0), 4, !1));
778
779
  } else
779
- br(s, t, e);
780
+ vr(s, t, e);
780
781
  for (const r in e.attributes)
781
782
  e.attributes[r].needsUpdate = !0;
782
783
  }
783
- class Fr {
784
+ class Ar {
784
785
  constructor(e) {
785
786
  this.objects = null, this.useGroups = !0, this.applyWorldTransforms = !0, this.generateMissingAttributes = !0, this.overwriteIndex = !0, this.attributes = ["position", "normal", "color", "tangent", "uv", "uv2"], this._intermediateGeometry = /* @__PURE__ */ new Map(), this._geometryMergeSets = /* @__PURE__ */ new WeakMap(), this._mergeOrder = [], this._dummyMesh = null, this.setObjects(e || []);
786
787
  }
787
788
  _getDummyMesh() {
788
789
  if (!this._dummyMesh) {
789
- const e = new Et(), t = new $();
790
- t.setAttribute("position", new P(new Float32Array(9), 3)), this._dummyMesh = new mt(t, e);
790
+ const e = new Dt(), t = new Q();
791
+ t.setAttribute("position", new P(new Float32Array(9), 3)), this._dummyMesh = new Pt(t, e);
791
792
  }
792
793
  return this._dummyMesh;
793
794
  }
794
795
  _getMeshes() {
795
796
  const e = [];
796
- return Mr(this.objects, (t) => {
797
+ return Sr(this.objects, (t) => {
797
798
  e.push(t);
798
799
  }), e.sort((t, r) => t.uuid > r.uuid ? 1 : t.uuid < r.uuid ? -1 : 0), e.length === 0 && e.push(this._getDummyMesh()), e;
799
800
  }
@@ -803,10 +804,10 @@ class Fr {
803
804
  applyWorldTransforms: this.applyWorldTransforms
804
805
  };
805
806
  for (let o = 0, a = t.length; o < a; o++) {
806
- const l = t[o], h = l.uuid;
807
- r.delete(h);
808
- let d = e.get(h);
809
- (!d || !d.isCompatible(l, this.attributes)) && (d && d.dispose(), d = new _r(), e.set(h, d)), d.updateFrom(l, i) && this.generateMissingAttributes && Tr(d, this.attributes);
807
+ const l = t[o], f = l.uuid;
808
+ r.delete(f);
809
+ let d = e.get(f);
810
+ (!d || !d.isCompatible(l, this.attributes)) && (d && d.dispose(), d = new Rr(), e.set(f, d)), d.updateFrom(l, i) && this.generateMissingAttributes && br(d, this.attributes);
810
811
  }
811
812
  r.forEach((o) => {
812
813
  e.delete(o);
@@ -815,30 +816,30 @@ class Fr {
815
816
  setObjects(e) {
816
817
  Array.isArray(e) ? this.objects = [...e] : this.objects = [e];
817
818
  }
818
- generate(e = new $()) {
819
- const { useGroups: t, overwriteIndex: r, _intermediateGeometry: i, _geometryMergeSets: o } = this, a = this._getMeshes(), l = [], h = [], d = o.get(e) || [];
819
+ generate(e = new Q()) {
820
+ const { useGroups: t, overwriteIndex: r, _intermediateGeometry: i, _geometryMergeSets: o } = this, a = this._getMeshes(), l = [], f = [], d = o.get(e) || [];
820
821
  this._updateIntermediateGeometries();
821
- let f = !1;
822
- a.length !== d.length && (f = !0);
822
+ let h = !1;
823
+ a.length !== d.length && (h = !0);
823
824
  for (let n = 0, x = a.length; n < x; n++) {
824
825
  const m = a[n], g = i.get(m.uuid);
825
- h.push(g);
826
+ f.push(g);
826
827
  const c = d[n];
827
- !c || c.uuid !== g.uuid ? (l.push(!1), f = !0) : c.version !== g.version ? l.push(!1) : l.push(!0);
828
+ !c || c.uuid !== g.uuid ? (l.push(!1), h = !0) : c.version !== g.version ? l.push(!1) : l.push(!0);
828
829
  }
829
- Cr(h, e, { useGroups: t, forceUpdate: f, skipAssigningAttributes: l, overwriteIndex: r }), f && e.dispose(), o.set(e, h.map((n) => ({
830
+ Mr(f, e, { useGroups: t, forceUpdate: h, skipAssigningAttributes: l, overwriteIndex: r }), h && e.dispose(), o.set(e, f.map((n) => ({
830
831
  version: n.version,
831
832
  uuid: n.uuid
832
833
  })));
833
834
  let u = Ce;
834
- return f ? u = It : l.includes(!1) && (u = wt), {
835
+ return h ? u = Tt : l.includes(!1) && (u = yt), {
835
836
  changeType: u,
836
- materials: Ar(a),
837
+ materials: _r(a),
837
838
  geometry: e
838
839
  };
839
840
  }
840
841
  }
841
- function Dr(s) {
842
+ function Cr(s) {
842
843
  const e = /* @__PURE__ */ new Set();
843
844
  for (let t = 0, r = s.length; t < r; t++) {
844
845
  const i = s[t];
@@ -849,7 +850,7 @@ function Dr(s) {
849
850
  }
850
851
  return Array.from(e);
851
852
  }
852
- function Pr(s) {
853
+ function Fr(s) {
853
854
  const e = [], t = /* @__PURE__ */ new Set();
854
855
  for (let i = 0, o = s.length; i < o; i++)
855
856
  s[i].traverse((a) => {
@@ -858,12 +859,12 @@ function Pr(s) {
858
859
  const r = Array.from(t).sort((i, o) => i.uuid < o.uuid ? 1 : i.uuid > o.uuid ? -1 : 0);
859
860
  return { lights: e, iesTextures: r };
860
861
  }
861
- class Er {
862
+ class Dr {
862
863
  get initialized() {
863
864
  return !!this.bvh;
864
865
  }
865
866
  constructor(e) {
866
- this.bvhOptions = {}, this.attributes = ["position", "normal", "tangent", "color", "uv", "uv2"], this.generateBVH = !0, this.bvh = null, this.geometry = new $(), this.staticGeometryGenerator = new Fr(e), this._bvhWorker = null, this._pendingGenerate = null, this._buildAsync = !1;
867
+ this.bvhOptions = {}, this.attributes = ["position", "normal", "tangent", "color", "uv", "uv2"], this.generateBVH = !0, this.bvh = null, this.geometry = new Q(), this.staticGeometryGenerator = new Ar(e), this._bvhWorker = null, this._pendingGenerate = null, this._buildAsync = !1;
867
868
  }
868
869
  setObjects(e) {
869
870
  this.staticGeometryGenerator.setObjects(e);
@@ -889,76 +890,33 @@ class Er {
889
890
  n.isSkinnedMesh && n.skeleton && n.skeleton.update();
890
891
  });
891
892
  });
892
- const a = t.generate(r), l = a.materials, h = Dr(l), { lights: d, iesTextures: f } = Pr(o);
893
- if (a.changeType !== Ce && yr(r, l, l), this.generateBVH) {
893
+ const a = t.generate(r), l = a.materials, f = Cr(l), { lights: d, iesTextures: h } = Fr(o);
894
+ if (a.changeType !== Ce && xr(r, l, l), this.generateBVH) {
894
895
  if (this.bvh instanceof Promise)
895
896
  throw new Error("PathTracingSceneGenerator: BVH is already building asynchronously.");
896
- if (a.changeType === It) {
897
+ if (a.changeType === Tt) {
897
898
  const u = {
898
- strategy: rr,
899
+ strategy: er,
899
900
  maxLeafTris: 1,
900
901
  indirect: !0,
901
902
  onProgress: e,
902
903
  ...this.bvhOptions
903
904
  };
904
- this._buildAsync ? this.bvh = this._bvhWorker.generate(r, u) : this.bvh = new ar(r, u);
905
- } else a.changeType === wt && this.bvh.refit();
905
+ this._buildAsync ? this.bvh = this._bvhWorker.generate(r, u) : this.bvh = new tr(r, u);
906
+ } else a.changeType === yt && this.bvh.refit();
906
907
  }
907
908
  return {
908
909
  bvhChanged: a.changeType !== Ce,
909
910
  bvh: this.bvh,
910
911
  lights: d,
911
- iesTextures: f,
912
+ iesTextures: h,
912
913
  geometry: r,
913
914
  materials: l,
914
- textures: h,
915
+ textures: f,
915
916
  objects: o
916
917
  };
917
918
  }
918
919
  }
919
- const kr = new kt(-1, 1, 1, -1, 0, 1);
920
- class Or extends $ {
921
- constructor() {
922
- super(), this.setAttribute("position", new We([-1, 3, 0, -1, -1, 0, 3, -1, 0], 3)), this.setAttribute("uv", new We([0, 2, 0, 0, 2, 0], 2));
923
- }
924
- }
925
- const zr = new Or();
926
- class J {
927
- /**
928
- * Constructs a new full screen quad.
929
- *
930
- * @param {?Material} material - The material to render te full screen quad with.
931
- */
932
- constructor(e) {
933
- this._mesh = new mt(zr, e);
934
- }
935
- /**
936
- * Frees the GPU-related resources allocated by this instance. Call this
937
- * method whenever the instance is no longer used in your app.
938
- */
939
- dispose() {
940
- this._mesh.geometry.dispose();
941
- }
942
- /**
943
- * Renders the full screen quad.
944
- *
945
- * @param {WebGLRenderer} renderer - The renderer.
946
- */
947
- render(e) {
948
- e.render(this._mesh, kr);
949
- }
950
- /**
951
- * The quad's material.
952
- *
953
- * @type {?Material}
954
- */
955
- get material() {
956
- return this._mesh.material;
957
- }
958
- set material(e) {
959
- this._mesh.material = e;
960
- }
961
- }
962
920
  class Pe extends ge {
963
921
  set needsUpdate(e) {
964
922
  super.needsUpdate = !0, this.dispatchEvent({
@@ -987,7 +945,7 @@ class Pe extends ge {
987
945
  return !1;
988
946
  }
989
947
  }
990
- class Nr extends Pe {
948
+ class Pr extends Pe {
991
949
  constructor(e) {
992
950
  super({
993
951
  blending: ie,
@@ -1084,7 +1042,7 @@ function ue(s = 1) {
1084
1042
  }
1085
1043
  `;
1086
1044
  }
1087
- function he(s = 1) {
1045
+ function fe(s = 1) {
1088
1046
  let e = "uint", t = "float", r = "", i = ".r", o = "1u";
1089
1047
  return s > 1 && (e = "uvec" + s, t = "vec" + s, r = s + "", s === 2 ? (i = ".rg", o = "uvec2( 1u, 2u )") : s === 3 ? (i = ".rgb", o = "uvec3( 1u, 2u, 3u )") : (i = "", o = "uvec4( 1u, 2u, 3u, 4u )")), /* glsl */
1090
1048
  `
@@ -1107,7 +1065,7 @@ function he(s = 1) {
1107
1065
  }
1108
1066
  `;
1109
1067
  }
1110
- const Rt = (
1068
+ const wt = (
1111
1069
  /* glsl */
1112
1070
  `
1113
1071
 
@@ -1133,7 +1091,7 @@ const Rt = (
1133
1091
  }
1134
1092
 
1135
1093
  `
1136
- ), Hr = (
1094
+ ), Er = (
1137
1095
  /* glsl */
1138
1096
  `
1139
1097
 
@@ -1214,7 +1172,7 @@ const Rt = (
1214
1172
  }
1215
1173
 
1216
1174
  `
1217
- ), Br = (
1175
+ ), kr = (
1218
1176
  /* glsl */
1219
1177
  `
1220
1178
 
@@ -1254,19 +1212,19 @@ const Rt = (
1254
1212
 
1255
1213
  }
1256
1214
 
1257
- ${he(1)}
1258
- ${he(2)}
1259
- ${he(3)}
1260
- ${he(4)}
1215
+ ${fe(1)}
1216
+ ${fe(2)}
1217
+ ${fe(3)}
1218
+ ${fe(4)}
1261
1219
 
1262
1220
  `
1263
1221
  );
1264
- class Wr extends Pe {
1222
+ class Or extends Pe {
1265
1223
  constructor() {
1266
1224
  super({
1267
1225
  blending: ie,
1268
1226
  uniforms: {
1269
- resolution: { value: new j() }
1227
+ resolution: { value: new q() }
1270
1228
  },
1271
1229
  vertexShader: (
1272
1230
  /* glsl */
@@ -1285,8 +1243,8 @@ class Wr extends Pe {
1285
1243
  /* glsl */
1286
1244
  `
1287
1245
 
1288
- ${Rt}
1289
- ${Hr}
1246
+ ${wt}
1247
+ ${Er}
1290
1248
 
1291
1249
  varying vec2 vUv;
1292
1250
  uniform vec2 resolution;
@@ -1301,7 +1259,7 @@ class Wr extends Pe {
1301
1259
  });
1302
1260
  }
1303
1261
  }
1304
- class Lr {
1262
+ class zr {
1305
1263
  generate(e, t = 256) {
1306
1264
  const r = new ae(t, t, {
1307
1265
  type: R,
@@ -1311,11 +1269,11 @@ class Lr {
1311
1269
  generateMipmaps: !1
1312
1270
  }), i = e.getRenderTarget();
1313
1271
  e.setRenderTarget(r);
1314
- const o = new J(new Wr());
1272
+ const o = new Z(new Or());
1315
1273
  return o.material.resolution.set(t, t), o.render(e), e.setRenderTarget(i), o.dispose(), r;
1316
1274
  }
1317
1275
  }
1318
- class Ur extends pt {
1276
+ class Nr extends dt {
1319
1277
  set bokehSize(e) {
1320
1278
  this.fStop = this.getFocalLength() / e;
1321
1279
  }
@@ -1329,12 +1287,12 @@ class Ur extends pt {
1329
1287
  return super.copy(e, t), this.fStop = e.fStop, this.apertureBlades = e.apertureBlades, this.apertureRotation = e.apertureRotation, this.focusDistance = e.focusDistance, this.anamorphicRatio = e.anamorphicRatio, this;
1330
1288
  }
1331
1289
  }
1332
- class Vr {
1290
+ class Hr {
1333
1291
  constructor() {
1334
1292
  this.bokehSize = 0, this.apertureBlades = 0, this.apertureRotation = 0, this.focusDistance = 10, this.anamorphicRatio = 1;
1335
1293
  }
1336
1294
  updateFrom(e) {
1337
- e instanceof Ur ? (this.bokehSize = e.bokehSize, this.apertureBlades = e.apertureBlades, this.apertureRotation = e.apertureRotation, this.focusDistance = e.focusDistance, this.anamorphicRatio = e.anamorphicRatio) : (this.bokehSize = 0, this.apertureRotation = 0, this.apertureBlades = 0, this.focusDistance = 10, this.anamorphicRatio = 1);
1295
+ e instanceof Nr ? (this.bokehSize = e.bokehSize, this.apertureBlades = e.apertureBlades, this.apertureRotation = e.apertureRotation, this.focusDistance = e.focusDistance, this.anamorphicRatio = e.anamorphicRatio) : (this.bokehSize = 0, this.apertureRotation = 0, this.apertureBlades = 0, this.focusDistance = 10, this.anamorphicRatio = 1);
1338
1296
  }
1339
1297
  }
1340
1298
  function Se(s) {
@@ -1343,7 +1301,7 @@ function Se(s) {
1343
1301
  e[t] = k.toHalfFloat(s[t]);
1344
1302
  return e;
1345
1303
  }
1346
- function Qe(s, e, t = 0, r = s.length) {
1304
+ function Xe(s, e, t = 0, r = s.length) {
1347
1305
  let i = t, o = t + r - 1;
1348
1306
  for (; i < o; ) {
1349
1307
  const a = i + o >> 1;
@@ -1351,37 +1309,37 @@ function Qe(s, e, t = 0, r = s.length) {
1351
1309
  }
1352
1310
  return i - t;
1353
1311
  }
1354
- function Gr(s, e, t) {
1312
+ function Br(s, e, t) {
1355
1313
  return 0.2126 * s + 0.7152 * e + 0.0722 * t;
1356
1314
  }
1357
- function qr(s, e = D) {
1315
+ function Wr(s, e = D) {
1358
1316
  const t = s.clone();
1359
- t.source = new Ot({ ...t.image });
1317
+ t.source = new Et({ ...t.image });
1360
1318
  const { width: r, height: i, data: o } = t.image;
1361
1319
  let a = o;
1362
1320
  if (t.type !== e) {
1363
1321
  e === D ? a = new Uint16Array(o.length) : a = new Float32Array(o.length);
1364
1322
  let l;
1365
1323
  o instanceof Int8Array || o instanceof Int16Array || o instanceof Int32Array ? l = 2 ** (8 * o.BYTES_PER_ELEMENT - 1) - 1 : l = 2 ** (8 * o.BYTES_PER_ELEMENT) - 1;
1366
- for (let h = 0, d = o.length; h < d; h++) {
1367
- let f = o[h];
1368
- t.type === D && (f = k.fromHalfFloat(o[h])), t.type !== R && t.type !== D && (f /= l), e === D && (a[h] = k.toHalfFloat(f));
1324
+ for (let f = 0, d = o.length; f < d; f++) {
1325
+ let h = o[f];
1326
+ t.type === D && (h = k.fromHalfFloat(o[f])), t.type !== R && t.type !== D && (h /= l), e === D && (a[f] = k.toHalfFloat(h));
1369
1327
  }
1370
1328
  t.image.data = a, t.type = e;
1371
1329
  }
1372
1330
  if (t.flipY) {
1373
1331
  const l = a;
1374
1332
  a = a.slice();
1375
- for (let h = 0; h < i; h++)
1333
+ for (let f = 0; f < i; f++)
1376
1334
  for (let d = 0; d < r; d++) {
1377
- const f = i - h - 1, u = 4 * (h * r + d), n = 4 * (f * r + d);
1335
+ const h = i - f - 1, u = 4 * (f * r + d), n = 4 * (h * r + d);
1378
1336
  a[n + 0] = l[u + 0], a[n + 1] = l[u + 1], a[n + 2] = l[u + 2], a[n + 3] = l[u + 3];
1379
1337
  }
1380
1338
  t.flipY = !1, t.image.data = a;
1381
1339
  }
1382
1340
  return t;
1383
1341
  }
1384
- class $r {
1342
+ class Lr {
1385
1343
  constructor() {
1386
1344
  const e = new M(Se(new Float32Array([0, 0, 0, 0])), 1, 1);
1387
1345
  e.type = D, e.format = I, e.minFilter = C, e.magFilter = C, e.wrapS = z, e.wrapT = z, e.generateMipmaps = !1, e.needsUpdate = !0;
@@ -1394,41 +1352,41 @@ class $r {
1394
1352
  this.marginalWeights.dispose(), this.conditionalWeights.dispose(), this.map.dispose();
1395
1353
  }
1396
1354
  updateFrom(e) {
1397
- const t = qr(e);
1355
+ const t = Wr(e);
1398
1356
  t.wrapS = z, t.wrapT = N;
1399
- const { width: r, height: i, data: o } = t.image, a = new Float32Array(r * i), l = new Float32Array(r * i), h = new Float32Array(i), d = new Float32Array(i);
1400
- let f = 0, u = 0;
1357
+ const { width: r, height: i, data: o } = t.image, a = new Float32Array(r * i), l = new Float32Array(r * i), f = new Float32Array(i), d = new Float32Array(i);
1358
+ let h = 0, u = 0;
1401
1359
  for (let c = 0; c < i; c++) {
1402
1360
  let p = 0;
1403
1361
  for (let v = 0; v < r; v++) {
1404
- const b = c * r + v, y = k.fromHalfFloat(o[4 * b + 0]), w = k.fromHalfFloat(o[4 * b + 1]), E = k.fromHalfFloat(o[4 * b + 2]), H = Gr(y, w, E);
1405
- p += H, f += H, a[b] = H, l[b] = p;
1362
+ const b = c * r + v, y = k.fromHalfFloat(o[4 * b + 0]), w = k.fromHalfFloat(o[4 * b + 1]), E = k.fromHalfFloat(o[4 * b + 2]), H = Br(y, w, E);
1363
+ p += H, h += H, a[b] = H, l[b] = p;
1406
1364
  }
1407
1365
  if (p !== 0)
1408
1366
  for (let v = c * r, b = c * r + r; v < b; v++)
1409
1367
  a[v] /= p, l[v] /= p;
1410
- u += p, h[c] = p, d[c] = u;
1368
+ u += p, f[c] = p, d[c] = u;
1411
1369
  }
1412
1370
  if (u !== 0)
1413
- for (let c = 0, p = h.length; c < p; c++)
1414
- h[c] /= u, d[c] /= u;
1371
+ for (let c = 0, p = f.length; c < p; c++)
1372
+ f[c] /= u, d[c] /= u;
1415
1373
  const n = new Uint16Array(i), x = new Uint16Array(r * i);
1416
1374
  for (let c = 0; c < i; c++) {
1417
- const p = (c + 1) / i, v = Qe(d, p);
1375
+ const p = (c + 1) / i, v = Xe(d, p);
1418
1376
  n[c] = k.toHalfFloat((v + 0.5) / i);
1419
1377
  }
1420
1378
  for (let c = 0; c < i; c++)
1421
1379
  for (let p = 0; p < r; p++) {
1422
- const v = c * r + p, b = (p + 1) / r, y = Qe(l, b, c * r, r);
1380
+ const v = c * r + p, b = (p + 1) / r, y = Xe(l, b, c * r, r);
1423
1381
  x[v] = k.toHalfFloat((y + 0.5) / r);
1424
1382
  }
1425
1383
  this.dispose();
1426
1384
  const { marginalWeights: m, conditionalWeights: g } = this;
1427
- m.image = { width: i, height: 1, data: n }, m.needsUpdate = !0, g.image = { width: r, height: i, data: x }, g.needsUpdate = !0, this.totalSum = f, this.map = t;
1385
+ m.image = { width: i, height: 1, data: n }, m.needsUpdate = !0, g.image = { width: r, height: i, data: x }, g.needsUpdate = !0, this.totalSum = h, this.map = t;
1428
1386
  }
1429
1387
  }
1430
- const _e = 6, jr = 0, Yr = 1, Xr = 2, Qr = 3, Kr = 4, A = new F(), _ = new F(), Ke = new O(), Y = new zt(), Ze = new F(), X = new F(), Zr = new F(0, 1, 0);
1431
- class Jr {
1388
+ const _e = 6, Ur = 0, Vr = 1, Gr = 2, qr = 3, $r = 4, A = new F(), _ = new F(), Qe = new O(), $ = new kt(), Ke = new F(), j = new F(), jr = new F(0, 1, 0);
1389
+ class Yr {
1432
1390
  constructor() {
1433
1391
  const e = new M(new Float32Array(4), 1, 1);
1434
1392
  e.format = I, e.type = R, e.wrapS = N, e.wrapT = N, e.generateMipmaps = !1, e.minFilter = T, e.magFilter = T, this.tex = e, this.count = 0;
@@ -1437,24 +1395,24 @@ class Jr {
1437
1395
  const r = this.tex, i = Math.max(e.length * _e, 1), o = Math.ceil(Math.sqrt(i));
1438
1396
  r.image.width !== o && (r.dispose(), r.image.data = new Float32Array(o * o * 4), r.image.width = o, r.image.height = o);
1439
1397
  const a = r.image.data;
1440
- for (let h = 0, d = e.length; h < d; h++) {
1441
- const f = e[h], u = h * _e * 4;
1398
+ for (let f = 0, d = e.length; f < d; f++) {
1399
+ const h = e[f], u = f * _e * 4;
1442
1400
  let n = 0;
1443
1401
  for (let m = 0; m < _e * 4; m++)
1444
1402
  a[u + m] = 0;
1445
- f.getWorldPosition(_), a[u + n++] = _.x, a[u + n++] = _.y, a[u + n++] = _.z;
1446
- let x = jr;
1447
- if (f.isRectAreaLight && f.isCircular ? x = Yr : f.isSpotLight ? x = Xr : f.isDirectionalLight ? x = Qr : f.isPointLight && (x = Kr), a[u + n++] = x, a[u + n++] = f.color.r, a[u + n++] = f.color.g, a[u + n++] = f.color.b, a[u + n++] = f.intensity, f.getWorldQuaternion(Y), f.isRectAreaLight)
1448
- A.set(f.width, 0, 0).applyQuaternion(Y), a[u + n++] = A.x, a[u + n++] = A.y, a[u + n++] = A.z, n++, _.set(0, f.height, 0).applyQuaternion(Y), a[u + n++] = _.x, a[u + n++] = _.y, a[u + n++] = _.z, a[u + n++] = A.cross(_).length() * (f.isCircular ? Math.PI / 4 : 1);
1449
- else if (f.isSpotLight) {
1450
- const m = f.radius || 0;
1451
- Ze.setFromMatrixPosition(f.matrixWorld), X.setFromMatrixPosition(f.target.matrixWorld), Ke.lookAt(Ze, X, Zr), Y.setFromRotationMatrix(Ke), A.set(1, 0, 0).applyQuaternion(Y), a[u + n++] = A.x, a[u + n++] = A.y, a[u + n++] = A.z, n++, _.set(0, 1, 0).applyQuaternion(Y), a[u + n++] = _.x, a[u + n++] = _.y, a[u + n++] = _.z, a[u + n++] = Math.PI * m * m, a[u + n++] = m, a[u + n++] = f.decay, a[u + n++] = f.distance, a[u + n++] = Math.cos(f.angle), a[u + n++] = Math.cos(f.angle * (1 - f.penumbra)), a[u + n++] = f.iesMap ? t.indexOf(f.iesMap) : -1;
1452
- } else if (f.isPointLight) {
1453
- const m = A.setFromMatrixPosition(f.matrixWorld);
1454
- a[u + n++] = m.x, a[u + n++] = m.y, a[u + n++] = m.z, n++, n += 4, n += 1, a[u + n++] = f.decay, a[u + n++] = f.distance;
1455
- } else if (f.isDirectionalLight) {
1456
- const m = A.setFromMatrixPosition(f.matrixWorld), g = _.setFromMatrixPosition(f.target.matrixWorld);
1457
- X.subVectors(m, g).normalize(), a[u + n++] = X.x, a[u + n++] = X.y, a[u + n++] = X.z;
1403
+ h.getWorldPosition(_), a[u + n++] = _.x, a[u + n++] = _.y, a[u + n++] = _.z;
1404
+ let x = Ur;
1405
+ if (h.isRectAreaLight && h.isCircular ? x = Vr : h.isSpotLight ? x = Gr : h.isDirectionalLight ? x = qr : h.isPointLight && (x = $r), a[u + n++] = x, a[u + n++] = h.color.r, a[u + n++] = h.color.g, a[u + n++] = h.color.b, a[u + n++] = h.intensity, h.getWorldQuaternion($), h.isRectAreaLight)
1406
+ A.set(h.width, 0, 0).applyQuaternion($), a[u + n++] = A.x, a[u + n++] = A.y, a[u + n++] = A.z, n++, _.set(0, h.height, 0).applyQuaternion($), a[u + n++] = _.x, a[u + n++] = _.y, a[u + n++] = _.z, a[u + n++] = A.cross(_).length() * (h.isCircular ? Math.PI / 4 : 1);
1407
+ else if (h.isSpotLight) {
1408
+ const m = h.radius || 0;
1409
+ Ke.setFromMatrixPosition(h.matrixWorld), j.setFromMatrixPosition(h.target.matrixWorld), Qe.lookAt(Ke, j, jr), $.setFromRotationMatrix(Qe), A.set(1, 0, 0).applyQuaternion($), a[u + n++] = A.x, a[u + n++] = A.y, a[u + n++] = A.z, n++, _.set(0, 1, 0).applyQuaternion($), a[u + n++] = _.x, a[u + n++] = _.y, a[u + n++] = _.z, a[u + n++] = Math.PI * m * m, a[u + n++] = m, a[u + n++] = h.decay, a[u + n++] = h.distance, a[u + n++] = Math.cos(h.angle), a[u + n++] = Math.cos(h.angle * (1 - h.penumbra)), a[u + n++] = h.iesMap ? t.indexOf(h.iesMap) : -1;
1410
+ } else if (h.isPointLight) {
1411
+ const m = A.setFromMatrixPosition(h.matrixWorld);
1412
+ a[u + n++] = m.x, a[u + n++] = m.y, a[u + n++] = m.z, n++, n += 4, n += 1, a[u + n++] = h.decay, a[u + n++] = h.distance;
1413
+ } else if (h.isDirectionalLight) {
1414
+ const m = A.setFromMatrixPosition(h.matrixWorld), g = _.setFromMatrixPosition(h.target.matrixWorld);
1415
+ j.subVectors(m, g).normalize(), a[u + n++] = j.x, a[u + n++] = j.y, a[u + n++] = j.z;
1458
1416
  }
1459
1417
  }
1460
1418
  this.count = e.length;
@@ -1462,7 +1420,7 @@ class Jr {
1462
1420
  return this.hash !== l ? (this.hash = l, r.needsUpdate = !0, !0) : !1;
1463
1421
  }
1464
1422
  }
1465
- function Je(s, e, t, r, i) {
1423
+ function Ze(s, e, t, r, i) {
1466
1424
  if (e > r)
1467
1425
  throw new Error();
1468
1426
  const o = s.length / e, a = s.constructor.BYTES_PER_ELEMENT * 8;
@@ -1479,13 +1437,13 @@ function Je(s, e, t, r, i) {
1479
1437
  l = 2 ** (a - 1) - 1;
1480
1438
  break;
1481
1439
  }
1482
- for (let h = 0; h < o; h++) {
1483
- const d = 4 * h, f = e * h;
1440
+ for (let f = 0; f < o; f++) {
1441
+ const d = 4 * f, h = e * f;
1484
1442
  for (let u = 0; u < r; u++)
1485
- t[i + d + u] = e >= u + 1 ? s[f + u] / l : 0;
1443
+ t[i + d + u] = e >= u + 1 ? s[h + u] / l : 0;
1486
1444
  }
1487
1445
  }
1488
- class ea extends Nt {
1446
+ class Xr extends Ot {
1489
1447
  constructor() {
1490
1448
  super(), this._textures = [], this.type = R, this.format = I, this.internalFormat = "RGBA32F";
1491
1449
  }
@@ -1495,9 +1453,9 @@ class ea extends Nt {
1495
1453
  const i = r.image, o = this.image;
1496
1454
  if (i.width !== o.width || i.height !== o.height)
1497
1455
  throw new Error("FloatAttributeTextureArray: Attribute must be the same dimensions when updating single layer.");
1498
- const { width: a, height: l, data: h } = o, f = a * l * 4 * e;
1456
+ const { width: a, height: l, data: f } = o, h = a * l * 4 * e;
1499
1457
  let u = t.itemSize;
1500
- u === 3 && (u = 4), Je(r.image.data, u, h, 4, f), this.dispose(), this.needsUpdate = !0;
1458
+ u === 3 && (u = 4), Ze(r.image.data, u, f, 4, h), this.dispose(), this.needsUpdate = !0;
1501
1459
  }
1502
1460
  setAttributes(e) {
1503
1461
  const t = e[0].count, r = e.length;
@@ -1506,7 +1464,7 @@ class ea extends Nt {
1506
1464
  throw new Error("FloatAttributeTextureArray: All attributes must have the same item count.");
1507
1465
  const i = this._textures;
1508
1466
  for (; i.length < r; ) {
1509
- const u = new yt();
1467
+ const u = new xt();
1510
1468
  i.push(u);
1511
1469
  }
1512
1470
  for (; i.length > r; )
@@ -1515,16 +1473,16 @@ class ea extends Nt {
1515
1473
  i[u].updateFrom(e[u]);
1516
1474
  const a = i[0].image, l = this.image;
1517
1475
  (a.width !== l.width || a.height !== l.height || a.depth !== r) && (l.width = a.width, l.height = a.height, l.depth = r, l.data = new Float32Array(l.width * l.height * l.depth * 4));
1518
- const { data: h, width: d, height: f } = l;
1476
+ const { data: f, width: d, height: h } = l;
1519
1477
  for (let u = 0, n = r; u < n; u++) {
1520
- const x = i[u], g = d * f * 4 * u;
1478
+ const x = i[u], g = d * h * 4 * u;
1521
1479
  let c = e[u].itemSize;
1522
- c === 3 && (c = 4), Je(x.image.data, c, h, 4, g);
1480
+ c === 3 && (c = 4), Ze(x.image.data, c, f, 4, g);
1523
1481
  }
1524
1482
  this.dispose(), this.needsUpdate = !0;
1525
1483
  }
1526
1484
  }
1527
- class ta extends ea {
1485
+ class Qr extends Xr {
1528
1486
  updateNormalAttribute(e) {
1529
1487
  this.updateAttribute(0, e);
1530
1488
  }
@@ -1547,7 +1505,7 @@ function Ee(s, e) {
1547
1505
  function Fe(s) {
1548
1506
  return `${s.source.uuid}:${s.colorSpace}`;
1549
1507
  }
1550
- function ra(s) {
1508
+ function Kr(s) {
1551
1509
  const e = /* @__PURE__ */ new Set(), t = [];
1552
1510
  for (let r = 0, i = s.length; r < i; r++) {
1553
1511
  const o = s[r], a = Fe(o);
@@ -1555,11 +1513,11 @@ function ra(s) {
1555
1513
  }
1556
1514
  return t;
1557
1515
  }
1558
- function aa(s) {
1516
+ function Zr(s) {
1559
1517
  const e = s.map((r) => r.iesMap || null).filter((r) => r), t = new Set(e);
1560
1518
  return Array.from(t).sort(Ee);
1561
1519
  }
1562
- function ia(s) {
1520
+ function Jr(s) {
1563
1521
  const e = /* @__PURE__ */ new Set();
1564
1522
  for (let r = 0, i = s.length; r < i; r++) {
1565
1523
  const o = s[r];
@@ -1569,16 +1527,16 @@ function ia(s) {
1569
1527
  }
1570
1528
  }
1571
1529
  const t = Array.from(e);
1572
- return ra(t).sort(Ee);
1530
+ return Kr(t).sort(Ee);
1573
1531
  }
1574
- function sa(s) {
1532
+ function ea(s) {
1575
1533
  const e = [];
1576
1534
  return s.traverse((t) => {
1577
1535
  t.visible && (t.isRectAreaLight || t.isSpotLight || t.isPointLight || t.isDirectionalLight) && e.push(t);
1578
1536
  }), e.sort(Ee);
1579
1537
  }
1580
- const St = 45, et = St * 4;
1581
- class oa {
1538
+ const It = 45, Je = It * 4;
1539
+ class ta {
1582
1540
  constructor() {
1583
1541
  this._features = {};
1584
1542
  }
@@ -1592,9 +1550,9 @@ class oa {
1592
1550
  this._features = {};
1593
1551
  }
1594
1552
  }
1595
- class na extends M {
1553
+ class ra extends M {
1596
1554
  constructor() {
1597
- super(new Float32Array(4), 1, 1), this.format = I, this.type = R, this.wrapS = N, this.wrapT = N, this.minFilter = T, this.magFilter = T, this.generateMipmaps = !1, this.features = new oa();
1555
+ super(new Float32Array(4), 1, 1), this.format = I, this.type = R, this.wrapS = N, this.wrapT = N, this.minFilter = T, this.magFilter = T, this.generateMipmaps = !1, this.features = new ta();
1598
1556
  }
1599
1557
  updateFrom(e, t) {
1600
1558
  function r(m, g, c = -1) {
@@ -1618,19 +1576,19 @@ class na extends M {
1618
1576
  return 8;
1619
1577
  }
1620
1578
  let a = 0;
1621
- const l = e.length * St, h = Math.ceil(Math.sqrt(l)) || 1, { image: d, features: f } = this, u = {};
1579
+ const l = e.length * It, f = Math.ceil(Math.sqrt(l)) || 1, { image: d, features: h } = this, u = {};
1622
1580
  for (let m = 0, g = t.length; m < g; m++)
1623
1581
  u[Fe(t[m])] = m;
1624
- d.width !== h && (this.dispose(), d.data = new Float32Array(h * h * 4), d.width = h, d.height = h);
1582
+ d.width !== f && (this.dispose(), d.data = new Float32Array(f * f * 4), d.width = f, d.height = f);
1625
1583
  const n = d.data;
1626
- f.reset();
1584
+ h.reset();
1627
1585
  for (let m = 0, g = e.length; m < g; m++) {
1628
1586
  const c = e[m];
1629
1587
  if (c.isFogVolumeMaterial) {
1630
- f.setUsed("FOG");
1631
- for (let b = 0; b < et; b++)
1588
+ h.setUsed("FOG");
1589
+ for (let b = 0; b < Je; b++)
1632
1590
  n[a + b] = 0;
1633
- n[a + 0 + 0] = c.color.r, n[a + 0 + 1] = c.color.g, n[a + 0 + 2] = c.color.b, n[a + 8 + 3] = i(c, "emissiveIntensity", 0), n[a + 12 + 0] = c.emissive.r, n[a + 12 + 1] = c.emissive.g, n[a + 12 + 2] = c.emissive.b, n[a + 52 + 1] = c.density, n[a + 52 + 3] = 0, n[a + 56 + 2] = 4, a += et;
1591
+ n[a + 0 + 0] = c.color.r, n[a + 0 + 1] = c.color.g, n[a + 0 + 2] = c.color.b, n[a + 8 + 3] = i(c, "emissiveIntensity", 0), n[a + 12 + 0] = c.emissive.r, n[a + 12 + 1] = c.emissive.g, n[a + 12 + 2] = c.emissive.b, n[a + 52 + 1] = c.density, n[a + 52 + 3] = 0, n[a + 56 + 2] = 4, a += Je;
1634
1592
  continue;
1635
1593
  }
1636
1594
  n[a++] = c.color.r, n[a++] = c.color.g, n[a++] = c.color.b, n[a++] = r(c, "map"), n[a++] = i(c, "metalness", 0), n[a++] = r(c, "metalnessMap"), n[a++] = i(c, "roughness", 0), n[a++] = r(c, "roughnessMap"), n[a++] = i(c, "ior", 1.5), n[a++] = i(c, "transmission", 0), n[a++] = r(c, "transmissionMap"), n[a++] = i(c, "emissiveIntensity", 0), "emissive" in c ? (n[a++] = c.emissive.r, n[a++] = c.emissive.g, n[a++] = c.emissive.b) : (n[a++] = 0, n[a++] = 0, n[a++] = 0), n[a++] = r(c, "emissiveMap"), n[a++] = r(c, "normalMap"), "normalScale" in c ? (n[a++] = c.normalScale.x, n[a++] = c.normalScale.y) : (n[a++] = 1, n[a++] = 1), n[a++] = i(c, "clearcoat", 0), n[a++] = r(c, "clearcoatMap"), n[a++] = i(c, "clearcoatRoughness", 0), n[a++] = r(c, "clearcoatRoughnessMap"), n[a++] = r(c, "clearcoatNormalMap"), "clearcoatNormalScale" in c ? (n[a++] = c.clearcoatNormalScale.x, n[a++] = c.clearcoatNormalScale.y) : (n[a++] = 1, n[a++] = 1), a++, n[a++] = i(c, "sheen", 0), "sheenColor" in c ? (n[a++] = c.sheenColor.r, n[a++] = c.sheenColor.g, n[a++] = c.sheenColor.b) : (n[a++] = 0, n[a++] = 0, n[a++] = 0), n[a++] = r(c, "sheenColorMap"), n[a++] = i(c, "sheenRoughness", 0), n[a++] = r(c, "sheenRoughnessMap"), n[a++] = r(c, "iridescenceMap"), n[a++] = r(c, "iridescenceThicknessMap"), n[a++] = i(c, "iridescence", 0), n[a++] = i(c, "iridescenceIOR", 1.3);
@@ -1641,13 +1599,13 @@ class na extends M {
1641
1599
  n[a++] = 0;
1642
1600
  else
1643
1601
  switch (c.side) {
1644
- case Wt:
1602
+ case Ht:
1645
1603
  n[a++] = 1;
1646
1604
  break;
1647
- case Bt:
1605
+ case Nt:
1648
1606
  n[a++] = -1;
1649
1607
  break;
1650
- case Ht:
1608
+ case zt:
1651
1609
  n[a++] = 0;
1652
1610
  break;
1653
1611
  }
@@ -1657,15 +1615,15 @@ class na extends M {
1657
1615
  return this.hash !== x ? (this.hash = x, this.needsUpdate = !0, !0) : !1;
1658
1616
  }
1659
1617
  }
1660
- const tt = new se();
1661
- function la(s) {
1618
+ const et = new se();
1619
+ function aa(s) {
1662
1620
  return s ? `${s.uuid}:${s.version}` : null;
1663
1621
  }
1664
- function ca(s, e) {
1622
+ function ia(s, e) {
1665
1623
  for (const t in e)
1666
1624
  t in s && (s[t] = e[t]);
1667
1625
  }
1668
- class rt extends Lt {
1626
+ class tt extends Bt {
1669
1627
  constructor(e, t, r) {
1670
1628
  const i = {
1671
1629
  format: I,
@@ -1677,30 +1635,30 @@ class rt extends Lt {
1677
1635
  generateMipmaps: !1,
1678
1636
  ...r
1679
1637
  };
1680
- super(e, t, 1, i), ca(this.texture, i), this.texture.setTextures = (...a) => {
1638
+ super(e, t, 1, i), ia(this.texture, i), this.texture.setTextures = (...a) => {
1681
1639
  this.setTextures(...a);
1682
1640
  }, this.hashes = [null];
1683
- const o = new J(new ua());
1641
+ const o = new Z(new sa());
1684
1642
  this.fsQuad = o;
1685
1643
  }
1686
1644
  setTextures(e, t, r = this.width, i = this.height) {
1687
1645
  const o = e.getRenderTarget(), a = e.toneMapping, l = e.getClearAlpha();
1688
- e.getClearColor(tt);
1689
- const h = t.length || 1;
1690
- (r !== this.width || i !== this.height || this.depth !== h) && (this.setSize(r, i, h), this.hashes = new Array(h).fill(null)), e.setClearColor(0, 0), e.toneMapping = Ut;
1691
- const d = this.fsQuad, f = this.hashes;
1646
+ e.getClearColor(et);
1647
+ const f = t.length || 1;
1648
+ (r !== this.width || i !== this.height || this.depth !== f) && (this.setSize(r, i, f), this.hashes = new Array(f).fill(null)), e.setClearColor(0, 0), e.toneMapping = Wt;
1649
+ const d = this.fsQuad, h = this.hashes;
1692
1650
  let u = !1;
1693
- for (let n = 0, x = h; n < x; n++) {
1694
- const m = t[n], g = la(m);
1695
- m && (f[n] !== g || m.isWebGLRenderTarget) && (m.matrixAutoUpdate = !1, m.matrix.identity(), d.material.map = m, e.setRenderTarget(this, n), d.render(e), m.updateMatrix(), m.matrixAutoUpdate = !0, f[n] = g, u = !0);
1651
+ for (let n = 0, x = f; n < x; n++) {
1652
+ const m = t[n], g = aa(m);
1653
+ m && (h[n] !== g || m.isWebGLRenderTarget) && (m.matrixAutoUpdate = !1, m.matrix.identity(), d.material.map = m, e.setRenderTarget(this, n), d.render(e), m.updateMatrix(), m.matrixAutoUpdate = !0, h[n] = g, u = !0);
1696
1654
  }
1697
- return d.material.map = null, e.setClearColor(tt, l), e.setRenderTarget(o), e.toneMapping = a, u;
1655
+ return d.material.map = null, e.setClearColor(et, l), e.setRenderTarget(o), e.toneMapping = a, u;
1698
1656
  }
1699
1657
  dispose() {
1700
1658
  super.dispose(), this.fsQuad.dispose();
1701
1659
  }
1702
1660
  }
1703
- class ua extends ge {
1661
+ class sa extends ge {
1704
1662
  get map() {
1705
1663
  return this.uniforms.map.value;
1706
1664
  }
@@ -1739,14 +1697,14 @@ class ua extends ge {
1739
1697
  });
1740
1698
  }
1741
1699
  }
1742
- function ha(s, e = Math.random()) {
1700
+ function oa(s, e = Math.random()) {
1743
1701
  for (let t = s.length - 1; t > 0; t--) {
1744
1702
  const r = Math.floor(e() * (t + 1)), i = s[t];
1745
1703
  s[t] = s[r], s[r] = i;
1746
1704
  }
1747
1705
  return s;
1748
1706
  }
1749
- class fa {
1707
+ class na {
1750
1708
  constructor(e, t, r = Math.random) {
1751
1709
  const i = e ** t, o = new Uint16Array(i);
1752
1710
  let a = i;
@@ -1760,39 +1718,39 @@ class fa {
1760
1718
  a = 0;
1761
1719
  }, this.next = function() {
1762
1720
  const { samples: l } = this;
1763
- a >= o.length && (ha(o, r), this.reshuffle());
1764
- let h = o[a++];
1721
+ a >= o.length && (oa(o, r), this.reshuffle());
1722
+ let f = o[a++];
1765
1723
  for (let d = 0; d < t; d++)
1766
- l[d] = (h % e + r()) / e, h = Math.floor(h / e);
1724
+ l[d] = (f % e + r()) / e, f = Math.floor(f / e);
1767
1725
  return l;
1768
1726
  };
1769
1727
  }
1770
1728
  }
1771
- class da {
1729
+ class la {
1772
1730
  constructor(e, t, r = Math.random) {
1773
1731
  let i = 0;
1774
- for (const h of t)
1775
- i += h;
1732
+ for (const f of t)
1733
+ i += f;
1776
1734
  const o = new Float32Array(i), a = [];
1777
1735
  let l = 0;
1778
- for (const h of t) {
1779
- const d = new fa(e, h, r);
1736
+ for (const f of t) {
1737
+ const d = new na(e, f, r);
1780
1738
  d.samples = new Float32Array(o.buffer, l, d.samples.length), l += d.samples.length * 4, a.push(d);
1781
1739
  }
1782
1740
  this.samples = o, this.strataCount = e, this.next = function() {
1783
- for (const h of a)
1784
- h.next();
1741
+ for (const f of a)
1742
+ f.next();
1785
1743
  return o;
1786
1744
  }, this.reshuffle = function() {
1787
- for (const h of a)
1788
- h.reshuffle();
1745
+ for (const f of a)
1746
+ f.reshuffle();
1789
1747
  }, this.reset = function() {
1790
- for (const h of a)
1791
- h.reset();
1748
+ for (const f of a)
1749
+ f.reset();
1792
1750
  };
1793
1751
  }
1794
1752
  }
1795
- class ma {
1753
+ class ca {
1796
1754
  constructor(e = 0) {
1797
1755
  this.m = 2147483648, this.a = 1103515245, this.c = 12345, this.seed = e;
1798
1756
  }
@@ -1803,15 +1761,15 @@ class ma {
1803
1761
  return this.nextInt() / (this.m - 1);
1804
1762
  }
1805
1763
  }
1806
- class pa extends M {
1764
+ class ua extends M {
1807
1765
  constructor(e = 1, t = 1, r = 8) {
1808
- super(new Float32Array(1), 1, 1, I, R), this.minFilter = T, this.magFilter = T, this.strata = r, this.sampler = null, this.generator = new ma(), this.stableNoise = !1, this.random = () => this.stableNoise ? this.generator.nextFloat() : Math.random(), this.init(e, t, r);
1766
+ super(new Float32Array(1), 1, 1, I, R), this.minFilter = T, this.magFilter = T, this.strata = r, this.sampler = null, this.generator = new ca(), this.stableNoise = !1, this.random = () => this.stableNoise ? this.generator.nextFloat() : Math.random(), this.init(e, t, r);
1809
1767
  }
1810
1768
  init(e = this.image.height, t = this.image.width, r = this.strata) {
1811
1769
  const { image: i } = this;
1812
1770
  if (i.width === t && i.height === e && this.sampler !== null)
1813
1771
  return;
1814
- const o = new Array(e * t).fill(4), a = new da(r, o, this.random);
1772
+ const o = new Array(e * t).fill(4), a = new la(r, o, this.random);
1815
1773
  i.width = t, i.height = e, i.data = a.samples, this.sampler = a, this.dispose(), this.next();
1816
1774
  }
1817
1775
  next() {
@@ -1821,18 +1779,18 @@ class pa extends M {
1821
1779
  this.sampler.reset(), this.generator.seed = 0;
1822
1780
  }
1823
1781
  }
1824
- function ga(s, e = Math.random) {
1782
+ function fa(s, e = Math.random) {
1825
1783
  for (let t = s.length - 1; t > 0; t--) {
1826
1784
  const r = ~~((e() - 1e-6) * t), i = s[t];
1827
1785
  s[t] = s[r], s[r] = i;
1828
1786
  }
1829
1787
  }
1830
- function va(s, e) {
1788
+ function ha(s, e) {
1831
1789
  s.fill(0);
1832
1790
  for (let t = 0; t < e; t++)
1833
1791
  s[t] = 1;
1834
1792
  }
1835
- class at {
1793
+ class rt {
1836
1794
  constructor(e) {
1837
1795
  this.count = 0, this.size = -1, this.sigma = -1, this.radius = -1, this.lookupTable = null, this.score = null, this.binaryPattern = null, this.resize(e), this.setSigma(1.5);
1838
1796
  }
@@ -1864,8 +1822,8 @@ class at {
1864
1822
  const t = ~~(Math.sqrt(20 * e ** 2) + 1), r = 2 * t + 1, i = new Float32Array(r * r), o = e * e;
1865
1823
  for (let a = -t; a <= t; a++)
1866
1824
  for (let l = -t; l <= t; l++) {
1867
- const h = (t + l) * r + a + t, d = a * a + l * l;
1868
- i[h] = Math.E ** (-d / (2 * o));
1825
+ const f = (t + l) * r + a + t, d = a * a + l * l;
1826
+ i[f] = Math.E ** (-d / (2 * o));
1869
1827
  }
1870
1828
  this.lookupTable = i, this.sigma = e, this.radius = t;
1871
1829
  }
@@ -1883,13 +1841,13 @@ class at {
1883
1841
  e[i] = 0;
1884
1842
  }
1885
1843
  updateScore(e, t, r) {
1886
- const { size: i, score: o, lookupTable: a } = this, l = this.radius, h = 2 * l + 1;
1844
+ const { size: i, score: o, lookupTable: a } = this, l = this.radius, f = 2 * l + 1;
1887
1845
  for (let d = -l; d <= l; d++)
1888
- for (let f = -l; f <= l; f++) {
1889
- const u = (l + f) * h + d + l, n = a[u];
1846
+ for (let h = -l; h <= l; h++) {
1847
+ const u = (l + h) * f + d + l, n = a[u];
1890
1848
  let x = e + d;
1891
1849
  x = x < 0 ? i + x : x % i;
1892
- let m = t + f;
1850
+ let m = t + h;
1893
1851
  m = m < 0 ? i + m : m % i;
1894
1852
  const g = m * i + x;
1895
1853
  o[g] += r * n;
@@ -1909,9 +1867,9 @@ class at {
1909
1867
  this.resize(e.size), this.score.set(e.score), this.binaryPattern.set(e.binaryPattern), this.setSigma(e.sigma), this.count = e.count;
1910
1868
  }
1911
1869
  }
1912
- class xa {
1870
+ class da {
1913
1871
  constructor() {
1914
- this.random = Math.random, this.sigma = 1.5, this.size = 64, this.majorityPointsRatio = 0.1, this.samples = new at(1), this.savedSamples = new at(1);
1872
+ this.random = Math.random, this.sigma = 1.5, this.size = 64, this.majorityPointsRatio = 0.1, this.samples = new rt(1), this.savedSamples = new rt(1);
1915
1873
  }
1916
1874
  generate() {
1917
1875
  const {
@@ -1923,7 +1881,7 @@ class xa {
1923
1881
  } = this;
1924
1882
  e.resize(o), e.setSigma(r);
1925
1883
  const a = Math.floor(o * o * i), l = e.binaryPattern;
1926
- va(l, a), ga(l, this.random);
1884
+ ha(l, a), fa(l, this.random);
1927
1885
  for (let u = 0, n = l.length; u < n; u++)
1928
1886
  l[u] === 1 && e.addPointIndex(u);
1929
1887
  for (; ; ) {
@@ -1936,59 +1894,59 @@ class xa {
1936
1894
  }
1937
1895
  e.addPointIndex(n);
1938
1896
  }
1939
- const h = new Uint32Array(o * o);
1897
+ const f = new Uint32Array(o * o);
1940
1898
  t.copy(e);
1941
1899
  let d;
1942
1900
  for (d = e.count - 1; d >= 0; ) {
1943
1901
  const u = e.findCluster();
1944
- e.removePointIndex(u), h[u] = d, d--;
1902
+ e.removePointIndex(u), f[u] = d, d--;
1945
1903
  }
1946
- const f = o * o;
1947
- for (d = t.count; d < f / 2; ) {
1904
+ const h = o * o;
1905
+ for (d = t.count; d < h / 2; ) {
1948
1906
  const u = t.findVoid();
1949
- t.addPointIndex(u), h[u] = d, d++;
1907
+ t.addPointIndex(u), f[u] = d, d++;
1950
1908
  }
1951
- for (t.invert(); d < f; ) {
1909
+ for (t.invert(); d < h; ) {
1952
1910
  const u = t.findCluster();
1953
- t.removePointIndex(u), h[u] = d, d++;
1911
+ t.removePointIndex(u), f[u] = d, d++;
1954
1912
  }
1955
- return { data: h, maxValue: f };
1913
+ return { data: f, maxValue: h };
1956
1914
  }
1957
1915
  }
1958
- function ba(s) {
1916
+ function ma(s) {
1959
1917
  return s >= 3 ? 4 : s;
1960
1918
  }
1961
- function ya(s) {
1919
+ function pa(s) {
1962
1920
  switch (s) {
1963
1921
  case 1:
1964
1922
  return me;
1965
1923
  case 2:
1966
- return dt;
1924
+ return ht;
1967
1925
  default:
1968
1926
  return I;
1969
1927
  }
1970
1928
  }
1971
- class Ta extends M {
1929
+ class ga extends M {
1972
1930
  constructor(e = 64, t = 1) {
1973
1931
  super(new Float32Array(4), 1, 1, I, R), this.minFilter = T, this.magFilter = T, this.size = e, this.channels = t, this.update();
1974
1932
  }
1975
1933
  update() {
1976
- const e = this.channels, t = this.size, r = new xa();
1934
+ const e = this.channels, t = this.size, r = new da();
1977
1935
  r.channels = e, r.size = t;
1978
- const i = ba(e), o = ya(i);
1936
+ const i = ma(e), o = pa(i);
1979
1937
  (this.image.width !== t || o !== this.format) && (this.image.width = t, this.image.height = t, this.image.data = new Float32Array(t ** 2 * i), this.format = o, this.dispose());
1980
1938
  const a = this.image.data;
1981
- for (let l = 0, h = e; l < h; l++) {
1982
- const d = r.generate(), f = d.data, u = d.maxValue;
1983
- for (let n = 0, x = f.length; n < x; n++) {
1984
- const m = f[n] / u;
1939
+ for (let l = 0, f = e; l < f; l++) {
1940
+ const d = r.generate(), h = d.data, u = d.maxValue;
1941
+ for (let n = 0, x = h.length; n < x; n++) {
1942
+ const m = h[n] / u;
1985
1943
  a[n * i + l] = m;
1986
1944
  }
1987
1945
  }
1988
1946
  this.needsUpdate = !0;
1989
1947
  }
1990
1948
  }
1991
- const wa = (
1949
+ const va = (
1992
1950
  /* glsl */
1993
1951
  `
1994
1952
 
@@ -2003,7 +1961,7 @@ const wa = (
2003
1961
  };
2004
1962
 
2005
1963
  `
2006
- ), Ia = (
1964
+ ), xa = (
2007
1965
  /* glsl */
2008
1966
  `
2009
1967
 
@@ -2018,7 +1976,7 @@ const wa = (
2018
1976
  };
2019
1977
 
2020
1978
  `
2021
- ), Ra = (
1979
+ ), ba = (
2022
1980
  /* glsl */
2023
1981
  `
2024
1982
 
@@ -2107,7 +2065,7 @@ const wa = (
2107
2065
  }
2108
2066
 
2109
2067
  `
2110
- ), Sa = (
2068
+ ), ya = (
2111
2069
  /* glsl */
2112
2070
  `
2113
2071
 
@@ -2317,7 +2275,7 @@ const wa = (
2317
2275
  }
2318
2276
 
2319
2277
  `
2320
- ), _a = (
2278
+ ), Ta = (
2321
2279
  /* glsl */
2322
2280
  `
2323
2281
 
@@ -2382,7 +2340,7 @@ const wa = (
2382
2340
  };
2383
2341
 
2384
2342
  `
2385
- ), Ma = (
2343
+ ), wa = (
2386
2344
  /* glsl */
2387
2345
  `
2388
2346
 
@@ -2452,7 +2410,7 @@ const wa = (
2452
2410
 
2453
2411
  }
2454
2412
  `
2455
- ), Aa = (
2413
+ ), Ia = (
2456
2414
  /* glsl */
2457
2415
  `
2458
2416
 
@@ -2670,7 +2628,7 @@ const wa = (
2670
2628
  }
2671
2629
 
2672
2630
  `
2673
- ), Ca = (
2631
+ ), Ra = (
2674
2632
  /* glsl */
2675
2633
  `
2676
2634
 
@@ -2758,7 +2716,7 @@ const wa = (
2758
2716
 
2759
2717
 
2760
2718
  `
2761
- ), Fa = (
2719
+ ), Sa = (
2762
2720
  /* glsl */
2763
2721
  `
2764
2722
 
@@ -2864,7 +2822,7 @@ const wa = (
2864
2822
  }
2865
2823
 
2866
2824
  `
2867
- ), Da = (
2825
+ ), _a = (
2868
2826
  /* glsl */
2869
2827
  `
2870
2828
 
@@ -2947,7 +2905,7 @@ const wa = (
2947
2905
  }
2948
2906
 
2949
2907
  `
2950
- ), Pa = (
2908
+ ), Ma = (
2951
2909
  /* glsl */
2952
2910
  `
2953
2911
 
@@ -3011,7 +2969,7 @@ const wa = (
3011
2969
  }
3012
2970
 
3013
2971
  `
3014
- ), Ea = (
2972
+ ), Aa = (
3015
2973
  /*glsl */
3016
2974
  `
3017
2975
 
@@ -3037,7 +2995,7 @@ const wa = (
3037
2995
  }
3038
2996
 
3039
2997
  `
3040
- ), _t = (
2998
+ ), Rt = (
3041
2999
  /* glsl */
3042
3000
  `
3043
3001
 
@@ -3155,7 +3113,7 @@ const wa = (
3155
3113
 
3156
3114
  }
3157
3115
  `
3158
- ), it = (
3116
+ ), at = (
3159
3117
  /* glsl */
3160
3118
  `
3161
3119
 
@@ -3214,7 +3172,7 @@ const wa = (
3214
3172
 
3215
3173
  }
3216
3174
  `
3217
- ), ka = (
3175
+ ), Ca = (
3218
3176
  /* glsl */
3219
3177
  `
3220
3178
 
@@ -3266,7 +3224,7 @@ const wa = (
3266
3224
  }
3267
3225
 
3268
3226
  `
3269
- ), Oa = (
3227
+ ), Fa = (
3270
3228
  /* glsl */
3271
3229
  `
3272
3230
 
@@ -3707,7 +3665,7 @@ const wa = (
3707
3665
  }
3708
3666
 
3709
3667
  `
3710
- ), za = (
3668
+ ), Da = (
3711
3669
  /* glsl */
3712
3670
  `
3713
3671
 
@@ -3731,7 +3689,7 @@ const wa = (
3731
3689
  }
3732
3690
 
3733
3691
  `
3734
- ), Na = (
3692
+ ), Pa = (
3735
3693
  /* glsl */
3736
3694
  `
3737
3695
 
@@ -3835,7 +3793,7 @@ const wa = (
3835
3793
  }
3836
3794
 
3837
3795
  `
3838
- ), Ha = (
3796
+ ), Ea = (
3839
3797
  /* glsl */
3840
3798
  `
3841
3799
 
@@ -3972,7 +3930,7 @@ const wa = (
3972
3930
  }
3973
3931
 
3974
3932
  `
3975
- ), Ba = (
3933
+ ), ka = (
3976
3934
  /* glsl */
3977
3935
  `
3978
3936
 
@@ -4072,7 +4030,7 @@ const wa = (
4072
4030
  }
4073
4031
 
4074
4032
  `
4075
- ), Wa = (
4033
+ ), Oa = (
4076
4034
  /* glsl */
4077
4035
  `
4078
4036
 
@@ -4136,7 +4094,7 @@ bool bvhIntersectFogVolumeHit(
4136
4094
  }
4137
4095
 
4138
4096
  `
4139
- ), La = (
4097
+ ), za = (
4140
4098
  /* glsl */
4141
4099
  `
4142
4100
 
@@ -4316,7 +4274,7 @@ bool bvhIntersectFogVolumeHit(
4316
4274
  }
4317
4275
 
4318
4276
  `
4319
- ), Ua = (
4277
+ ), Na = (
4320
4278
  /* glsl */
4321
4279
  `
4322
4280
 
@@ -4402,7 +4360,7 @@ bool bvhIntersectFogVolumeHit(
4402
4360
  }
4403
4361
 
4404
4362
  `
4405
- ), Va = (
4363
+ ), Ha = (
4406
4364
  /*glsl*/
4407
4365
  `
4408
4366
 
@@ -4501,7 +4459,7 @@ bool bvhIntersectFogVolumeHit(
4501
4459
  }
4502
4460
 
4503
4461
  `
4504
- ), Ga = (
4462
+ ), Ba = (
4505
4463
  /* glsl */
4506
4464
  `
4507
4465
 
@@ -4826,7 +4784,7 @@ bool bvhIntersectFogVolumeHit(
4826
4784
 
4827
4785
  }
4828
4786
  `
4829
- ), qa = (
4787
+ ), Wa = (
4830
4788
  /* glsl */
4831
4789
  `
4832
4790
 
@@ -4878,7 +4836,7 @@ bool bvhIntersectFogVolumeHit(
4878
4836
  }
4879
4837
 
4880
4838
  `
4881
- ), $a = (
4839
+ ), La = (
4882
4840
  /* glsl */
4883
4841
  `
4884
4842
 
@@ -4929,7 +4887,7 @@ bool bvhIntersectFogVolumeHit(
4929
4887
 
4930
4888
  `
4931
4889
  );
4932
- class ja extends Pe {
4890
+ class Ua extends Pe {
4933
4891
  onBeforeRender() {
4934
4892
  this.setDefine("FEATURE_DOF", this.physicalCamera.bokehSize === 0 ? 0 : 1), this.setDefine("FEATURE_BACKGROUND_MAP", this.backgroundMap ? 1 : 0), this.setDefine("FEATURE_FOG", this.materials.features.isUsed("FOG") ? 1 : 0);
4935
4893
  }
@@ -4959,31 +4917,31 @@ class ja extends Pe {
4959
4917
  },
4960
4918
  uniforms: {
4961
4919
  // path trace uniforms
4962
- resolution: { value: new j() },
4920
+ resolution: { value: new q() },
4963
4921
  opacity: { value: 1 },
4964
4922
  bounces: { value: 10 },
4965
4923
  transmissiveBounces: { value: 10 },
4966
4924
  filterGlossyFactor: { value: 0 },
4967
4925
  // camera uniforms
4968
- physicalCamera: { value: new Vr() },
4926
+ physicalCamera: { value: new Hr() },
4969
4927
  cameraWorldMatrix: { value: new O() },
4970
4928
  invProjectionMatrix: { value: new O() },
4971
4929
  // scene uniforms
4972
- bvh: { value: new cr() },
4973
- attributesArray: { value: new ta() },
4974
- materialIndexAttribute: { value: new bt() },
4975
- materials: { value: new na() },
4976
- textures: { value: new rt().texture },
4930
+ bvh: { value: new nr() },
4931
+ attributesArray: { value: new Qr() },
4932
+ materialIndexAttribute: { value: new vt() },
4933
+ materials: { value: new ra() },
4934
+ textures: { value: new tt().texture },
4977
4935
  // light uniforms
4978
- lights: { value: new Jr() },
4979
- iesProfiles: { value: new rt(360, 180, {
4936
+ lights: { value: new Yr() },
4937
+ iesProfiles: { value: new tt(360, 180, {
4980
4938
  type: D,
4981
4939
  wrapS: N,
4982
4940
  wrapT: N
4983
4941
  }).texture },
4984
4942
  environmentIntensity: { value: 1 },
4985
4943
  environmentRotation: { value: new O() },
4986
- envMapInfo: { value: new $r() },
4944
+ envMapInfo: { value: new Lr() },
4987
4945
  // background uniforms
4988
4946
  backgroundBlur: { value: 0 },
4989
4947
  backgroundMap: { value: null },
@@ -4993,8 +4951,8 @@ class ja extends Pe {
4993
4951
  // randomness uniforms
4994
4952
  seed: { value: 0 },
4995
4953
  sobolTexture: { value: null },
4996
- stratifiedTexture: { value: new pa() },
4997
- stratifiedOffsetTexture: { value: new Ta(64, 1) }
4954
+ stratifiedTexture: { value: new ua() },
4955
+ stratifiedOffsetTexture: { value: new ga(64, 1) }
4998
4956
  },
4999
4957
  vertexShader: (
5000
4958
  /* glsl */
@@ -5026,27 +4984,27 @@ class ja extends Pe {
5026
4984
  #include <common>
5027
4985
 
5028
4986
  // bvh intersection
4987
+ ${ur}
4988
+ ${hr}
5029
4989
  ${fr}
5030
- ${mr}
5031
- ${dr}
5032
4990
 
5033
4991
  // uniform structs
5034
- ${wa}
5035
- ${Ra}
5036
- ${Ia}
5037
- ${Sa}
5038
- ${_a}
4992
+ ${va}
4993
+ ${ba}
4994
+ ${xa}
4995
+ ${ya}
4996
+ ${Ta}
5039
4997
 
5040
4998
  // random
5041
4999
  #if RANDOM_TYPE == 2 // Stratified List
5042
5000
 
5043
- ${ka}
5001
+ ${Ca}
5044
5002
 
5045
5003
  #elif RANDOM_TYPE == 1 // Sobol
5046
5004
 
5047
- ${it}
5048
- ${Rt}
5049
- ${Br}
5005
+ ${at}
5006
+ ${wt}
5007
+ ${kr}
5050
5008
 
5051
5009
  #define rand(v) sobol(v)
5052
5010
  #define rand2(v) sobol2(v)
@@ -5055,7 +5013,7 @@ class ja extends Pe {
5055
5013
 
5056
5014
  #else // PCG
5057
5015
 
5058
- ${it}
5016
+ ${at}
5059
5017
 
5060
5018
  // Using the sobol functions seems to break the the compiler on MacOS
5061
5019
  // - specifically the "sobolReverseBits" function.
@@ -5071,11 +5029,11 @@ class ja extends Pe {
5071
5029
  #endif
5072
5030
 
5073
5031
  // common
5074
- ${Ea}
5075
- ${Fa}
5076
- ${_t}
5077
- ${Da}
5078
- ${Pa}
5032
+ ${Aa}
5033
+ ${Sa}
5034
+ ${Rt}
5035
+ ${_a}
5036
+ ${Ma}
5079
5037
 
5080
5038
  // environment
5081
5039
  uniform EquirectHdrInfo envMapInfo;
@@ -5131,16 +5089,16 @@ class ja extends Pe {
5131
5089
  float lightsDenom;
5132
5090
 
5133
5091
  // sampling
5134
- ${Ca}
5135
- ${Ma}
5136
- ${Aa}
5092
+ ${Ra}
5093
+ ${wa}
5094
+ ${Ia}
5137
5095
 
5138
- ${Wa}
5139
- ${Na}
5140
- ${Ba}
5141
- ${Ha}
5142
- ${za}
5143
5096
  ${Oa}
5097
+ ${Pa}
5098
+ ${ka}
5099
+ ${Ea}
5100
+ ${Da}
5101
+ ${Fa}
5144
5102
 
5145
5103
  float applyFilteredGlossy( float roughness, float accumulatedRoughness ) {
5146
5104
 
@@ -5172,12 +5130,12 @@ class ja extends Pe {
5172
5130
 
5173
5131
  }
5174
5132
 
5175
- ${qa}
5176
- ${Ua}
5177
- ${$a}
5133
+ ${Wa}
5134
+ ${Na}
5178
5135
  ${La}
5179
- ${Va}
5180
- ${Ga}
5136
+ ${za}
5137
+ ${Ha}
5138
+ ${Ba}
5181
5139
 
5182
5140
  void main() {
5183
5141
 
@@ -5474,7 +5432,7 @@ class ja extends Pe {
5474
5432
  }), this.setValues(e);
5475
5433
  }
5476
5434
  }
5477
- function* Ya() {
5435
+ function* Va() {
5478
5436
  const {
5479
5437
  _renderer: s,
5480
5438
  _fsQuad: e,
@@ -5484,18 +5442,18 @@ function* Ya() {
5484
5442
  _sobolTarget: o,
5485
5443
  _subframe: a,
5486
5444
  alpha: l,
5487
- material: h
5488
- } = this, d = new Z(), f = new Z(), u = t.material;
5445
+ material: f
5446
+ } = this, d = new K(), h = new K(), u = t.material;
5489
5447
  let [n, x] = i;
5490
5448
  for (; ; ) {
5491
- l ? (u.opacity = this._opacityFactor / (this.samples + 1), h.blending = ie, h.opacity = 1) : (h.opacity = this._opacityFactor / (this.samples + 1), h.blending = gt);
5449
+ l ? (u.opacity = this._opacityFactor / (this.samples + 1), f.blending = ie, f.opacity = 1) : (f.opacity = this._opacityFactor / (this.samples + 1), f.blending = mt);
5492
5450
  const [m, g, c, p] = a, v = r.width, b = r.height;
5493
- h.resolution.set(v * c, b * p), h.sobolTexture = o.texture, h.stratifiedTexture.init(20, h.bounces + h.transmissiveBounces + 5), h.stratifiedTexture.next(), h.seed++;
5451
+ f.resolution.set(v * c, b * p), f.sobolTexture = o.texture, f.stratifiedTexture.init(20, f.bounces + f.transmissiveBounces + 5), f.stratifiedTexture.next(), f.seed++;
5494
5452
  const y = this.tiles.x || 1, w = this.tiles.y || 1, E = y * w, H = Math.ceil(v * c), ve = Math.ceil(b * p), ke = Math.floor(m * v), Oe = Math.floor(g * b), xe = Math.ceil(H / y), be = Math.ceil(ve / w);
5495
5453
  for (let oe = 0; oe < w; oe++)
5496
5454
  for (let ne = 0; ne < y; ne++) {
5497
- const ze = s.getRenderTarget(), Mt = s.autoClear, At = s.getScissorTest();
5498
- s.getScissor(d), s.getViewport(f);
5455
+ const ze = s.getRenderTarget(), St = s.autoClear, _t = s.getScissorTest();
5456
+ s.getScissor(d), s.getViewport(h);
5499
5457
  let ye = ne, Ne = oe;
5500
5458
  if (!this.stableTiles) {
5501
5459
  const Te = this._currentTile % (y * w);
@@ -5512,13 +5470,13 @@ function* Ya() {
5512
5470
  Oe,
5513
5471
  H,
5514
5472
  ve
5515
- ), s.setRenderTarget(r), s.setScissorTest(!0), s.autoClear = !1, e.render(s), s.setViewport(f), s.setScissor(d), s.setScissorTest(At), s.setRenderTarget(ze), s.autoClear = Mt, l && (u.target1 = n.texture, u.target2 = r.texture, s.setRenderTarget(x), t.render(s), s.setRenderTarget(ze)), this.samples += 1 / E, ne === y - 1 && oe === w - 1 && (this.samples = Math.round(this.samples)), yield;
5473
+ ), s.setRenderTarget(r), s.setScissorTest(!0), s.autoClear = !1, e.render(s), s.setViewport(h), s.setScissor(d), s.setScissorTest(_t), s.setRenderTarget(ze), s.autoClear = St, l && (u.target1 = n.texture, u.target2 = r.texture, s.setRenderTarget(x), t.render(s), s.setRenderTarget(ze)), this.samples += 1 / E, ne === y - 1 && oe === w - 1 && (this.samples = Math.round(this.samples)), yield;
5516
5474
  }
5517
5475
  [n, x] = [x, n];
5518
5476
  }
5519
5477
  }
5520
- const st = new se();
5521
- class ot {
5478
+ const it = new se();
5479
+ class st {
5522
5480
  get material() {
5523
5481
  return this._fsQuad.material;
5524
5482
  }
@@ -5538,7 +5496,7 @@ class ot {
5538
5496
  return !!this._compilePromise;
5539
5497
  }
5540
5498
  constructor(e) {
5541
- this.camera = null, this.tiles = new j(3, 3), this.stableNoise = !1, this.stableTiles = !0, this.samples = 0, this._subframe = new Z(0, 0, 1, 1), this._opacityFactor = 1, this._renderer = e, this._alpha = !1, this._fsQuad = new J(new ja()), this._blendQuad = new J(new Nr()), this._task = null, this._currentTile = 0, this._compilePromise = null, this._sobolTarget = new Lr().generate(e), this._primaryTarget = new ae(1, 1, {
5499
+ this.camera = null, this.tiles = new q(3, 3), this.stableNoise = !1, this.stableTiles = !0, this.samples = 0, this._subframe = new K(0, 0, 1, 1), this._opacityFactor = 1, this._renderer = e, this._alpha = !1, this._fsQuad = new Z(new Ua()), this._blendQuad = new Z(new Pr()), this._task = null, this._currentTile = 0, this._compilePromise = null, this._sobolTarget = new zr().generate(e), this._primaryTarget = new ae(1, 1, {
5542
5500
  format: I,
5543
5501
  type: R,
5544
5502
  magFilter: T,
@@ -5583,14 +5541,14 @@ class ot {
5583
5541
  }
5584
5542
  reset() {
5585
5543
  const { _renderer: e, _primaryTarget: t, _blendTargets: r } = this, i = e.getRenderTarget(), o = e.getClearAlpha();
5586
- e.getClearColor(st), e.setRenderTarget(t), e.setClearColor(0, 0), e.clearColor(), e.setRenderTarget(r[0]), e.setClearColor(0, 0), e.clearColor(), e.setRenderTarget(r[1]), e.setClearColor(0, 0), e.clearColor(), e.setClearColor(st, o), e.setRenderTarget(i), this.samples = 0, this._task = null, this.material.stratifiedTexture.stableNoise = this.stableNoise, this.stableNoise && (this.material.seed = 0, this.material.stratifiedTexture.reset());
5544
+ e.getClearColor(it), e.setRenderTarget(t), e.setClearColor(0, 0), e.clearColor(), e.setRenderTarget(r[0]), e.setClearColor(0, 0), e.clearColor(), e.setRenderTarget(r[1]), e.setClearColor(0, 0), e.clearColor(), e.setClearColor(it, o), e.setRenderTarget(i), this.samples = 0, this._task = null, this.material.stratifiedTexture.stableNoise = this.stableNoise, this.stableNoise && (this.material.seed = 0, this.material.stratifiedTexture.reset());
5587
5545
  }
5588
5546
  update() {
5589
- this.material.onBeforeRender(), !this.isCompiling && (this._task || (this._task = Ya.call(this)), this._task.next());
5547
+ this.material.onBeforeRender(), !this.isCompiling && (this._task || (this._task = Va.call(this)), this._task.next());
5590
5548
  }
5591
5549
  }
5592
- const q = new j(), nt = new j(), fe = new Vt(), de = new se();
5593
- class Xa extends M {
5550
+ const G = new q(), ot = new q(), he = new Lt(), de = new se();
5551
+ class Ga extends M {
5594
5552
  constructor(e = 512, t = 512) {
5595
5553
  super(
5596
5554
  new Float32Array(e * t * 4),
@@ -5598,7 +5556,7 @@ class Xa extends M {
5598
5556
  t,
5599
5557
  I,
5600
5558
  R,
5601
- vt,
5559
+ pt,
5602
5560
  z,
5603
5561
  N,
5604
5562
  C,
@@ -5610,7 +5568,7 @@ class Xa extends M {
5610
5568
  const { data: e, width: t, height: r } = this.image;
5611
5569
  for (let i = 0; i < t; i++)
5612
5570
  for (let o = 0; o < r; o++) {
5613
- nt.set(t, r), q.set(i / t, o / r), q.x -= 0.5, q.y = 1 - q.y, fe.theta = q.x * 2 * Math.PI, fe.phi = q.y * Math.PI, fe.radius = 1, this.generationCallback(fe, q, nt, de);
5571
+ ot.set(t, r), G.set(i / t, o / r), G.x -= 0.5, G.y = 1 - G.y, he.theta = G.x * 2 * Math.PI, he.phi = G.y * Math.PI, he.radius = 1, this.generationCallback(he, G, ot, de);
5614
5572
  const l = 4 * (o * t + i);
5615
5573
  e[l + 0] = de.r, e[l + 1] = de.g, e[l + 2] = de.b, e[l + 3] = 1;
5616
5574
  }
@@ -5619,12 +5577,12 @@ class Xa extends M {
5619
5577
  return super.copy(e), this.generationCallback = e.generationCallback, this;
5620
5578
  }
5621
5579
  }
5622
- const lt = new F();
5623
- class Qa extends Xa {
5580
+ const nt = new F();
5581
+ class qa extends Ga {
5624
5582
  constructor(e = 512) {
5625
5583
  super(e, e), this.topColor = new se().set(16777215), this.bottomColor = new se().set(0), this.exponent = 2, this.generationCallback = (t, r, i, o) => {
5626
- lt.setFromSpherical(t);
5627
- const a = lt.y * 0.5 + 0.5;
5584
+ nt.setFromSpherical(t);
5585
+ const a = nt.y * 0.5 + 0.5;
5628
5586
  o.lerpColors(this.bottomColor, this.topColor, a ** this.exponent);
5629
5587
  };
5630
5588
  }
@@ -5632,7 +5590,7 @@ class Qa extends Xa {
5632
5590
  return super.copy(e), this.topColor.copy(e.topColor), this.bottomColor.copy(e.bottomColor), this;
5633
5591
  }
5634
5592
  }
5635
- class Ka extends ge {
5593
+ class $a extends ge {
5636
5594
  get map() {
5637
5595
  return this.uniforms.map.value;
5638
5596
  }
@@ -5719,7 +5677,7 @@ class Ka extends ge {
5719
5677
  }), this.setValues(e);
5720
5678
  }
5721
5679
  }
5722
- class Za extends ge {
5680
+ class ja extends ge {
5723
5681
  constructor() {
5724
5682
  super({
5725
5683
  uniforms: {
@@ -5749,7 +5707,7 @@ class Za extends ge {
5749
5707
  #include <common>
5750
5708
  #include <cube_uv_reflection_fragment>
5751
5709
 
5752
- ${_t}
5710
+ ${Rt}
5753
5711
 
5754
5712
  void main() {
5755
5713
 
@@ -5762,9 +5720,9 @@ class Za extends ge {
5762
5720
  }), this.depthWrite = !1, this.depthTest = !1;
5763
5721
  }
5764
5722
  }
5765
- class ct {
5723
+ class lt {
5766
5724
  constructor(e) {
5767
- this._renderer = e, this._quad = new J(new Za());
5725
+ this._renderer = e, this._quad = new Z(new ja());
5768
5726
  }
5769
5727
  generate(e, t = null, r = null) {
5770
5728
  if (!e.isCubeTexture)
@@ -5774,8 +5732,8 @@ class ct {
5774
5732
  const l = new ae(t, r, {
5775
5733
  type: R,
5776
5734
  colorSpace: i.colorSpace
5777
- }), h = i.height, d = Math.log2(h) - 2, f = 1 / h, u = 1 / (3 * Math.max(Math.pow(2, d), 112));
5778
- a.material.defines.CUBEUV_MAX_MIP = `${d}.0`, a.material.defines.CUBEUV_TEXEL_WIDTH = u, a.material.defines.CUBEUV_TEXEL_HEIGHT = f, a.material.uniforms.envMap.value = e, a.material.uniforms.flipEnvMap.value = e.isRenderTargetTexture ? 1 : -1, a.material.needsUpdate = !0;
5735
+ }), f = i.height, d = Math.log2(f) - 2, h = 1 / f, u = 1 / (3 * Math.max(Math.pow(2, d), 112));
5736
+ a.material.defines.CUBEUV_MAX_MIP = `${d}.0`, a.material.defines.CUBEUV_TEXEL_WIDTH = u, a.material.defines.CUBEUV_TEXEL_HEIGHT = h, a.material.uniforms.envMap.value = e, a.material.uniforms.flipEnvMap.value = e.isRenderTargetTexture ? 1 : -1, a.material.needsUpdate = !0;
5779
5737
  const n = o.getRenderTarget(), x = o.autoClear;
5780
5738
  o.autoClear = !0, o.setRenderTarget(l), a.render(o), o.setRenderTarget(n), o.autoClear = x;
5781
5739
  const m = new Uint16Array(t * r * 4), g = new Float32Array(t * r * 4);
@@ -5783,17 +5741,17 @@ class ct {
5783
5741
  for (let p = 0, v = g.length; p < v; p++)
5784
5742
  m[p] = k.toHalfFloat(g[p]);
5785
5743
  const c = new M(m, t, r, I, D);
5786
- return c.minFilter = Gt, c.magFilter = C, c.wrapS = z, c.wrapT = z, c.mapping = vt, c.needsUpdate = !0, c;
5744
+ return c.minFilter = Ut, c.magFilter = C, c.wrapS = z, c.wrapT = z, c.mapping = pt, c.needsUpdate = !0, c;
5787
5745
  }
5788
5746
  dispose() {
5789
5747
  this._quad.dispose();
5790
5748
  }
5791
5749
  }
5792
- function Ja(s) {
5750
+ function Ya(s) {
5793
5751
  return s.extensions.get("EXT_float_blend");
5794
5752
  }
5795
- const Q = new j();
5796
- class ei {
5753
+ const Y = new q();
5754
+ class Xa {
5797
5755
  get multipleImportanceSampling() {
5798
5756
  return !!this._pathTracer.material.defines.FEATURE_MIS;
5799
5757
  }
@@ -5837,17 +5795,17 @@ class ei {
5837
5795
  return !!this._pathTracer.isCompiling;
5838
5796
  }
5839
5797
  constructor(e) {
5840
- this._renderer = e, this._generator = new Er(), this._pathTracer = new ot(e), this._queueReset = !1, this._clock = new qt(), this._compilePromise = null, this._lowResPathTracer = new ot(e), this._lowResPathTracer.tiles.set(1, 1), this._quad = new J(new Ka({
5798
+ this._renderer = e, this._generator = new Dr(), this._pathTracer = new st(e), this._queueReset = !1, this._clock = new Vt(), this._compilePromise = null, this._lowResPathTracer = new st(e), this._lowResPathTracer.tiles.set(1, 1), this._quad = new Z(new $a({
5841
5799
  map: null,
5842
5800
  transparent: !0,
5843
5801
  blending: ie,
5844
5802
  premultipliedAlpha: e.getContextAttributes().premultipliedAlpha
5845
- })), this._materials = null, this._previousEnvironment = null, this._previousBackground = null, this._internalBackground = null, this.renderDelay = 100, this.minSamples = 5, this.fadeDuration = 500, this.enablePathTracing = !0, this.pausePathTracing = !1, this.dynamicLowRes = !1, this.lowResScale = 0.25, this.renderScale = 1, this.synchronizeRenderSize = !0, this.rasterizeScene = !0, this.renderToCanvas = !0, this.textureSize = new j(1024, 1024), this.rasterizeSceneCallback = (t, r) => {
5803
+ })), this._materials = null, this._previousEnvironment = null, this._previousBackground = null, this._internalBackground = null, this.renderDelay = 100, this.minSamples = 5, this.fadeDuration = 500, this.enablePathTracing = !0, this.pausePathTracing = !1, this.dynamicLowRes = !1, this.lowResScale = 0.25, this.renderScale = 1, this.synchronizeRenderSize = !0, this.rasterizeScene = !0, this.renderToCanvas = !0, this.textureSize = new q(1024, 1024), this.rasterizeSceneCallback = (t, r) => {
5846
5804
  this._renderer.render(t, r);
5847
5805
  }, this.renderToCanvasCallback = (t, r, i) => {
5848
5806
  const o = r.autoClear;
5849
5807
  r.autoClear = !1, i.render(r), r.autoClear = o;
5850
- }, this.setScene(new $t(), new pt());
5808
+ }, this.setScene(new Gt(), new dt());
5851
5809
  }
5852
5810
  setBVHWorker(e) {
5853
5811
  this._generator.setBVHWorker(e);
@@ -5875,11 +5833,11 @@ class ei {
5875
5833
  e.updateMatrixWorld(), this._pathTracer.setCamera(e), this._lowResPathTracer.setCamera(e), this.reset();
5876
5834
  }
5877
5835
  updateMaterials() {
5878
- const e = this._pathTracer.material, t = this._renderer, r = this._materials, i = this.textureSize, o = ia(r);
5836
+ const e = this._pathTracer.material, t = this._renderer, r = this._materials, i = this.textureSize, o = Jr(r);
5879
5837
  e.textures.setTextures(t, o, i.x, i.y), e.materials.updateFrom(r, o), this.reset();
5880
5838
  }
5881
5839
  updateLights() {
5882
- const e = this.scene, t = this._renderer, r = this._pathTracer.material, i = sa(e), o = aa(i);
5840
+ const e = this.scene, t = this._renderer, r = this._pathTracer.material, i = ea(e), o = Zr(i);
5883
5841
  r.lights.updateFrom(i, o), r.iesProfiles.setTextures(t, o), this.reset();
5884
5842
  }
5885
5843
  updateEnvironment() {
@@ -5887,12 +5845,12 @@ class ei {
5887
5845
  if (this._internalBackground && (this._internalBackground.dispose(), this._internalBackground = null), t.backgroundBlur = e.backgroundBlurriness, t.backgroundIntensity = e.backgroundIntensity ?? 1, t.backgroundRotation.makeRotationFromEuler(e.backgroundRotation).invert(), e.background === null)
5888
5846
  t.backgroundMap = null, t.backgroundAlpha = 0;
5889
5847
  else if (e.background.isColor) {
5890
- this._colorBackground = this._colorBackground || new Qa(16);
5848
+ this._colorBackground = this._colorBackground || new qa(16);
5891
5849
  const r = this._colorBackground;
5892
5850
  r.topColor.equals(e.background) || (r.topColor.set(e.background), r.bottomColor.set(e.background), r.update()), t.backgroundMap = r, t.backgroundAlpha = 1;
5893
5851
  } else if (e.background.isCubeTexture) {
5894
5852
  if (e.background !== this._previousBackground) {
5895
- const r = new ct(this._renderer).generate(e.background);
5853
+ const r = new lt(this._renderer).generate(e.background);
5896
5854
  this._internalBackground = r, t.backgroundMap = r, t.backgroundAlpha = 1;
5897
5855
  }
5898
5856
  } else
@@ -5900,7 +5858,7 @@ class ei {
5900
5858
  if (t.environmentIntensity = e.environmentIntensity ?? 1, t.environmentRotation.makeRotationFromEuler(e.environmentRotation).invert(), this._previousEnvironment !== e.environment)
5901
5859
  if (e.environment !== null)
5902
5860
  if (e.environment.isCubeTexture) {
5903
- const r = new ct(this._renderer).generate(e.environment);
5861
+ const r = new lt(this._renderer).generate(e.environment);
5904
5862
  t.envMapInfo.updateFrom(r);
5905
5863
  } else
5906
5864
  t.envMapInfo.updateFrom(e.environment);
@@ -5928,17 +5886,17 @@ class ei {
5928
5886
  const e = this._lowResPathTracer, t = this._pathTracer, r = this._renderer, i = this._clock, o = this._quad;
5929
5887
  this._updateScale(), this._queueReset && (t.reset(), e.reset(), this._queueReset = !1, o.material.opacity = 0, i.start());
5930
5888
  const a = i.getDelta() * 1e3, l = i.getElapsedTime() * 1e3;
5931
- if (!this.pausePathTracing && this.enablePathTracing && this.renderDelay <= l && !this.isCompiling && t.update(), t.alpha = t.material.backgroundAlpha !== 1 || !Ja(r), e.alpha = t.alpha, this.renderToCanvas) {
5932
- const h = this._renderer, d = this.minSamples;
5889
+ if (!this.pausePathTracing && this.enablePathTracing && this.renderDelay <= l && !this.isCompiling && t.update(), t.alpha = t.material.backgroundAlpha !== 1 || !Ya(r), e.alpha = t.alpha, this.renderToCanvas) {
5890
+ const f = this._renderer, d = this.minSamples;
5933
5891
  if (l >= this.renderDelay && this.samples >= this.minSamples && (this.fadeDuration !== 0 ? o.material.opacity = Math.min(o.material.opacity + a / this.fadeDuration, 1) : o.material.opacity = 1), !this.enablePathTracing || this.samples < d || o.material.opacity < 1) {
5934
5892
  if (this.dynamicLowRes && !this.isCompiling) {
5935
5893
  e.samples < 1 && (e.material = t.material, e.update());
5936
- const f = o.material.opacity;
5937
- o.material.opacity = 1 - o.material.opacity, o.material.map = e.target.texture, o.render(h), o.material.opacity = f;
5894
+ const h = o.material.opacity;
5895
+ o.material.opacity = 1 - o.material.opacity, o.material.map = e.target.texture, o.render(f), o.material.opacity = h;
5938
5896
  }
5939
5897
  (!this.dynamicLowRes && this.rasterizeScene || this.dynamicLowRes && this.isCompiling) && this.rasterizeSceneCallback(this.scene, this.camera);
5940
5898
  }
5941
- this.enablePathTracing && o.material.opacity > 0 && (o.material.opacity < 1 && (o.material.blending = this.dynamicLowRes ? jt : gt), o.material.map = t.target.texture, this.renderToCanvasCallback(t.target, h, o), o.material.blending = ie);
5899
+ this.enablePathTracing && o.material.opacity > 0 && (o.material.opacity < 1 && (o.material.blending = this.dynamicLowRes ? qt : mt), o.material.map = t.target.texture, this.renderToCanvasCallback(t.target, f, o), o.material.blending = ie);
5942
5900
  }
5943
5901
  }
5944
5902
  reset() {
@@ -5949,16 +5907,16 @@ class ei {
5949
5907
  }
5950
5908
  _updateScale() {
5951
5909
  if (this.synchronizeRenderSize) {
5952
- this._renderer.getDrawingBufferSize(Q);
5953
- const e = Math.floor(this.renderScale * Q.x), t = Math.floor(this.renderScale * Q.y);
5954
- if (this._pathTracer.getSize(Q), Q.x !== e || Q.y !== t) {
5910
+ this._renderer.getDrawingBufferSize(Y);
5911
+ const e = Math.floor(this.renderScale * Y.x), t = Math.floor(this.renderScale * Y.y);
5912
+ if (this._pathTracer.getSize(Y), Y.x !== e || Y.y !== t) {
5955
5913
  const r = this.lowResScale;
5956
5914
  this._pathTracer.setSize(e, t), this._lowResPathTracer.setSize(Math.floor(e * r), Math.floor(t * r));
5957
5915
  }
5958
5916
  }
5959
5917
  }
5960
5918
  }
5961
- function ut(s) {
5919
+ function ct(s) {
5962
5920
  return typeof s == "object" && s !== null && "getInternalRenderer" in s && typeof s.getInternalRenderer == "function";
5963
5921
  }
5964
5922
  function ee(s) {
@@ -5966,8 +5924,8 @@ function ee(s) {
5966
5924
  }
5967
5925
  const pe = class pe {
5968
5926
  constructor() {
5969
- this.pathTracer = null, this.enabled = !1, this.renderer = null, this.sampleCount = 0, this.createAttempts = 0, this.maxCreateAttempts = 10, this.sceneInitialized = !1, this.environmentWaitFrames = 0, this.maxEnvironmentWaitFrames = 300, this.disposed = !1, this.convertedEnvTexture = null, this.resumable = !1, this.lastCameraMoveTime = -1 / 0, this.cameraDirty = !1, this.events = new ir(), this.settings = {
5970
- samples: sr,
5927
+ this.pathTracer = null, this.enabled = !1, this.renderer = null, this.sampleCount = 0, this.createAttempts = 0, this.maxCreateAttempts = 10, this.sceneInitialized = !1, this.environmentWaitFrames = 0, this.maxEnvironmentWaitFrames = 300, this.disposed = !1, this.convertedEnvTexture = null, this.resumable = !1, this.lastCameraMoveTime = -1 / 0, this.cameraDirty = !1, this.events = new rr(), this.settings = {
5928
+ samples: ar,
5971
5929
  bounces: 4,
5972
5930
  // Reduce bounces for better performance
5973
5931
  transmissiveBounces: 2,
@@ -5992,7 +5950,7 @@ const pe = class pe {
5992
5950
  const r = [];
5993
5951
  e.traverse((o) => {
5994
5952
  var a;
5995
- (a = o.userData) != null && a[or] && o.visible && r.push(o);
5953
+ (a = o.userData) != null && a[ir] && o.visible && r.push(o);
5996
5954
  }), r.forEach((o) => o.visible = !1);
5997
5955
  try {
5998
5956
  (i = this.pathTracer) == null || i.setScene(e, t);
@@ -6013,31 +5971,31 @@ const pe = class pe {
6013
5971
  return null;
6014
5972
  i.drawImage(t, 0, 0);
6015
5973
  const o = i.getImageData(0, 0, r.width, r.height), a = new Float32Array(o.data.length);
6016
- for (let h = 0; h < o.data.length; h++)
6017
- a[h] = o.data[h] / 255;
6018
- const l = new B.DataTexture(
5974
+ for (let f = 0; f < o.data.length; f++)
5975
+ a[f] = o.data[f] / 255;
5976
+ const l = new J.DataTexture(
6019
5977
  a,
6020
5978
  r.width,
6021
5979
  r.height,
6022
- B.RGBAFormat,
6023
- B.FloatType
5980
+ J.RGBAFormat,
5981
+ J.FloatType
6024
5982
  );
6025
5983
  return l.mapping = e.mapping, l.wrapS = e.wrapS, l.wrapT = e.wrapT, l.magFilter = e.magFilter, l.minFilter = e.minFilter, l.anisotropy = e.anisotropy, l.needsUpdate = !0, l;
6026
5984
  }
6027
5985
  async initialize(e) {
6028
5986
  try {
6029
5987
  return this.renderer = e.renderer, this.enabled = e.enabled, this.isSupported() ? S.ok(void 0) : S.err(
6030
- new W(
5988
+ new B(
6031
5989
  "Path tracing is not supported in this environment",
6032
- L.PATH_TRACING_INIT_FAILED,
5990
+ W.PATH_TRACING_INIT_FAILED,
6033
5991
  { reason: "WebGL2 or required extensions not available" }
6034
5992
  )
6035
5993
  );
6036
5994
  } catch (t) {
6037
5995
  return S.err(
6038
- new W(
5996
+ new B(
6039
5997
  "Failed to initialize path tracing",
6040
- L.PATH_TRACING_INIT_FAILED,
5998
+ W.PATH_TRACING_INIT_FAILED,
6041
5999
  { originalError: t }
6042
6000
  )
6043
6001
  );
@@ -6046,24 +6004,24 @@ const pe = class pe {
6046
6004
  createPathTracer() {
6047
6005
  if (this.disposed)
6048
6006
  return S.err(
6049
- new W(
6007
+ new B(
6050
6008
  "Instance is disposed",
6051
- L.INVALID_STATE
6009
+ W.INVALID_STATE
6052
6010
  )
6053
6011
  );
6054
6012
  try {
6055
6013
  const e = ee(this.renderer) ? this.renderer.getInternalRenderer() : null;
6056
- return e ? (this.pathTracer = new ei(e), this.pathTracer.tiles && "set" in this.pathTracer.tiles && this.pathTracer.tiles.set(1, 1), this.pathTracer.bounces = this.settings.bounces, this.settings.transmissiveBounces !== void 0 && (this.pathTracer.transmissiveBounces = this.settings.transmissiveBounces), this.pathTracer.renderScale = this.settings.renderScale, this.pathTracer.dynamicLowRes = this.settings.dynamicLowRes, this.pathTracer.lowResScale = this.settings.lowResScale, this.pathTracer.environmentIntensity !== void 0 && (this.pathTracer.environmentIntensity = 2), e.toneMapping !== B.ACESFilmicToneMapping && (e.toneMapping = B.ACESFilmicToneMapping, e.toneMappingExposure = 1.5), e.setRenderTarget(null), S.ok(void 0)) : S.err(
6057
- new W(
6014
+ return e ? (this.pathTracer = new Xa(e), this.pathTracer.tiles && "set" in this.pathTracer.tiles && this.pathTracer.tiles.set(1, 1), this.pathTracer.bounces = this.settings.bounces, this.settings.transmissiveBounces !== void 0 && (this.pathTracer.transmissiveBounces = this.settings.transmissiveBounces), this.pathTracer.renderScale = this.settings.renderScale, this.pathTracer.dynamicLowRes = this.settings.dynamicLowRes, this.pathTracer.lowResScale = this.settings.lowResScale, e.setRenderTarget(null), S.ok(void 0)) : S.err(
6015
+ new B(
6058
6016
  "Renderer not ready, will retry",
6059
- L.RENDERER_NOT_INITIALIZED
6017
+ W.RENDERER_NOT_INITIALIZED
6060
6018
  )
6061
6019
  );
6062
6020
  } catch (e) {
6063
6021
  return S.err(
6064
- new W(
6022
+ new B(
6065
6023
  "Failed to create path tracer",
6066
- L.PATH_TRACING_INIT_FAILED,
6024
+ W.PATH_TRACING_INIT_FAILED,
6067
6025
  { originalError: e }
6068
6026
  )
6069
6027
  );
@@ -6108,9 +6066,9 @@ const pe = class pe {
6108
6066
  const i = this.extractThreeObjects(e, t);
6109
6067
  if (!i)
6110
6068
  return S.err(
6111
- new W(
6069
+ new B(
6112
6070
  "Could not extract Three.js scene or camera",
6113
- L.INVALID_PARAMETER
6071
+ W.INVALID_PARAMETER
6114
6072
  )
6115
6073
  );
6116
6074
  const { threeScene: o, threeCamera: a } = i;
@@ -6128,9 +6086,9 @@ const pe = class pe {
6128
6086
  return this.sceneInitialized ? this.accumulateSample(r, e, t) : r.render(e, t);
6129
6087
  } catch (i) {
6130
6088
  return S.err(
6131
- new W(
6089
+ new B(
6132
6090
  "Failed to render with path tracing",
6133
- L.RENDER_FAILED,
6091
+ W.RENDER_FAILED,
6134
6092
  { originalError: i }
6135
6093
  )
6136
6094
  );
@@ -6152,7 +6110,7 @@ const pe = class pe {
6152
6110
  /** Unwraps the Three.js scene/camera from their adapters, or null if either fails. */
6153
6111
  extractThreeObjects(e, t) {
6154
6112
  let r = null, i = null;
6155
- return ut(e) && (r = e.getInternalRenderer()), ut(t) && (i = t.getInternalRenderer()), !r || !i ? null : { threeScene: r, threeCamera: i };
6113
+ return ct(e) && (r = e.getInternalRenderer()), ct(t) && (i = t.getInternalRenderer()), !r || !i ? null : { threeScene: r, threeCamera: i };
6156
6114
  }
6157
6115
  /**
6158
6116
  * First-frame setup: waits for an environment texture, converts an
@@ -6169,39 +6127,39 @@ const pe = class pe {
6169
6127
  if (!i.environment && !l)
6170
6128
  return this.environmentWaitFrames++, this.environmentWaitFrames >= this.maxEnvironmentWaitFrames && (this.disableAfterSelfPause("gave-up"), this.environmentWaitFrames = 0), e.render(t, r);
6171
6129
  if (this.environmentWaitFrames = 0, l && l.isCubeTexture) {
6172
- const h = i.environment;
6130
+ const f = i.environment;
6173
6131
  i.environment = l;
6174
6132
  try {
6175
6133
  this.ingestSceneWithoutShadowHelpers(i, o), this.sceneInitialized = !0;
6176
6134
  } finally {
6177
- i.environment = h;
6135
+ i.environment = f;
6178
6136
  }
6179
- } else if (l && l.mapping === B.EquirectangularReflectionMapping) {
6180
- let h = l;
6137
+ } else if (l && l.mapping === J.EquirectangularReflectionMapping) {
6138
+ let f = l;
6181
6139
  if (l.image instanceof HTMLImageElement)
6182
6140
  if (this.convertedEnvTexture)
6183
- h = this.convertedEnvTexture;
6141
+ f = this.convertedEnvTexture;
6184
6142
  else {
6185
- const f = this.convertToDataTexture(l);
6186
- if (!f)
6143
+ const h = this.convertToDataTexture(l);
6144
+ if (!h)
6187
6145
  throw new Error("Failed to convert environment texture to DataTexture");
6188
- this.convertedEnvTexture = f, h = f;
6146
+ this.convertedEnvTexture = h, f = h;
6189
6147
  }
6190
6148
  const d = i.environment;
6191
- i.environment = h;
6149
+ i.environment = f;
6192
6150
  try {
6193
- const f = l.image;
6194
- f && !("data" in f && f.data) && f instanceof HTMLImageElement && !f.complete && await new Promise((u) => {
6195
- f.onload = () => {
6151
+ const h = l.image;
6152
+ h && !("data" in h && h.data) && h instanceof HTMLImageElement && !h.complete && await new Promise((u) => {
6153
+ h.onload = () => {
6196
6154
  l.needsUpdate = !0, u();
6197
- }, f.onerror = () => {
6155
+ }, h.onerror = () => {
6198
6156
  u();
6199
- }, f.complete && u();
6157
+ }, h.complete && u();
6200
6158
  }), this.ingestSceneWithoutShadowHelpers(i, o), this.sceneInitialized = !0, i.environment = d;
6201
- } catch (f) {
6202
- throw i.environment = d, f;
6159
+ } catch (h) {
6160
+ throw i.environment = d, h;
6203
6161
  }
6204
- } else if (((a = i.environment) == null ? void 0 : a.mapping) === B.EquirectangularReflectionMapping)
6162
+ } else if (((a = i.environment) == null ? void 0 : a.mapping) === J.EquirectangularReflectionMapping)
6205
6163
  this.ingestSceneWithoutShadowHelpers(i, o), this.sceneInitialized = !0;
6206
6164
  else
6207
6165
  return this.disableAfterSelfPause("gave-up"), e.render(t, r);
@@ -6304,7 +6262,7 @@ const pe = class pe {
6304
6262
  }
6305
6263
  };
6306
6264
  pe.CAMERA_SETTLE_MS = 200;
6307
- let ht = pe;
6265
+ let ut = pe;
6308
6266
  export {
6309
- ht as ThreePathTracingService
6267
+ ut as ThreePathTracingService
6310
6268
  };