softbox 4.2.0 → 4.2.2

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,7 @@
1
- import * as H from "three";
2
- import { UnsignedIntType as re, DataTexture as M, NearestFilter as T, IntType as Te, FloatType as R, UnsignedByteType as _e, UnsignedShortType as Mt, ByteType as Be, ShortType as At, RGBAFormat as I, RGBAIntegerFormat as Me, RGIntegerFormat as ut, RedIntegerFormat as Ft, RGFormat as ht, RedFormat as me, BufferAttribute as P, BufferGeometry as $, Matrix4 as O, Matrix3 as Ct, Vector3 as C, Vector4 as J, MeshBasicMaterial as Dt, Mesh as ft, OrthographicCamera as Pt, Float32BufferAttribute as He, ShaderMaterial as pe, NoBlending as ie, WebGLRenderTarget as ae, Vector2 as j, PerspectiveCamera as dt, DataUtils as k, HalfFloatType as D, LinearFilter as F, RepeatWrapping as z, ClampToEdgeWrapping as N, Source as Et, Quaternion as kt, DataArrayTexture as Ot, DoubleSide as zt, BackSide as Nt, FrontSide as Bt, WebGLArrayRenderTarget as Ht, 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, R as S, d as W, E as L, h as Le } from "./index-B0k0_Cfm.js";
4
- function ir(s) {
1
+ import * as B from "three";
2
+ import { UnsignedIntType as re, DataTexture as M, NearestFilter as T, IntType as Te, FloatType as R, UnsignedByteType as _e, UnsignedShortType as Mt, ByteType as He, ShortType as At, RGBAFormat as I, RGBAIntegerFormat as Me, RGIntegerFormat as ut, RedIntegerFormat as Ft, RGFormat as ht, RedFormat as me, BufferAttribute as P, BufferGeometry as $, Matrix4 as O, Matrix3 as Ct, Vector3 as C, Vector4 as J, MeshBasicMaterial as Dt, Mesh as ft, OrthographicCamera as Pt, Float32BufferAttribute as Be, ShaderMaterial as pe, NoBlending as ie, WebGLRenderTarget as ae, Vector2 as j, PerspectiveCamera as dt, DataUtils as k, HalfFloatType as D, LinearFilter as F, 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 W, E as L, h as Le } from "./index-D9zA-xWX.js";
4
+ function sr(s) {
5
5
  switch (s) {
6
6
  case 1:
7
7
  return "R";
@@ -14,7 +14,7 @@ function ir(s) {
14
14
  }
15
15
  throw new Error();
16
16
  }
17
- function sr(s) {
17
+ function or(s) {
18
18
  switch (s) {
19
19
  case 1:
20
20
  return me;
@@ -59,44 +59,44 @@ class gt extends M {
59
59
  throw new Error("VertexAttributeTexture: overrideItemSize must divide evenly into buffer length.");
60
60
  e.itemSize = t, e.count = i * r / t;
61
61
  }
62
- const o = e.itemSize, a = e.count, l = e.normalized, h = e.array.constructor, f = h.BYTES_PER_ELEMENT;
63
- let d = this._forcedType, u = o;
64
- if (d === null)
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
65
  switch (h) {
66
66
  case Float32Array:
67
- d = R;
67
+ f = R;
68
68
  break;
69
69
  case Uint8Array:
70
70
  case Uint16Array:
71
71
  case Uint32Array:
72
- d = re;
72
+ f = re;
73
73
  break;
74
74
  case Int8Array:
75
75
  case Int16Array:
76
76
  case Int32Array:
77
- d = Te;
77
+ f = Te;
78
78
  break;
79
79
  }
80
- let n, v, m, g, c = ir(o);
81
- switch (d) {
80
+ let n, x, m, g, c = sr(o);
81
+ switch (f) {
82
82
  case R:
83
- m = 1, v = sr(o), l && f === 1 ? (g = h, c += "8", h === Uint8Array ? n = _e : (n = Be, c += "_SNORM")) : (g = Float32Array, c += "32F", n = R);
83
+ m = 1, x = or(o), l && d === 1 ? (g = h, c += "8", h === Uint8Array ? n = _e : (n = He, c += "_SNORM")) : (g = Float32Array, c += "32F", n = R);
84
84
  break;
85
85
  case Te:
86
- c += f * 8 + "I", m = l ? Math.pow(2, h.BYTES_PER_ELEMENT * 8 - 1) : 1, v = Ue(o), f === 1 ? (g = Int8Array, n = Be) : f === 2 ? (g = Int16Array, n = At) : (g = Int32Array, n = Te);
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 = He) : d === 2 ? (g = Int16Array, n = At) : (g = Int32Array, n = Te);
87
87
  break;
88
88
  case re:
89
- c += f * 8 + "UI", m = l ? Math.pow(2, h.BYTES_PER_ELEMENT * 8 - 1) : 1, v = Ue(o), f === 1 ? (g = Uint8Array, n = _e) : f === 2 ? (g = Uint16Array, n = Mt) : (g = Uint32Array, n = 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 = _e) : d === 2 ? (g = Uint16Array, n = Mt) : (g = Uint32Array, n = re);
90
90
  break;
91
91
  }
92
- u === 3 && (v === I || v === Me) && (u = 4);
93
- const p = Math.ceil(Math.sqrt(a)) || 1, x = u * p * p, b = new g(x), y = e.normalized;
92
+ u === 3 && (x === I || x === Me) && (u = 4);
93
+ const p = Math.ceil(Math.sqrt(a)) || 1, v = u * p * p, b = new g(v), y = e.normalized;
94
94
  e.normalized = !1;
95
95
  for (let w = 0; w < a; w++) {
96
96
  const E = u * w;
97
97
  b[E] = e.getX(w) / m, o >= 2 && (b[E + 1] = e.getY(w) / m), o >= 3 && (b[E + 2] = e.getZ(w) / m, u === 4 && (b[E + 3] = 1)), o >= 4 && (b[E + 3] = e.getW(w) / m);
98
98
  }
99
- e.normalized = y, this.internalFormat = c, this.format = v, 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;
99
+ 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
100
  }
101
101
  }
102
102
  class vt extends gt {
@@ -109,7 +109,7 @@ class xt extends gt {
109
109
  super(), this._forcedType = R;
110
110
  }
111
111
  }
112
- class or {
112
+ class nr {
113
113
  constructor() {
114
114
  this.index = new vt(), this.position = new xt(), this.bvhBounds = new M(), this.bvhContents = new M(), this._cachedIndexAttr = null, this.index.overrideItemSize = 3;
115
115
  }
@@ -121,7 +121,7 @@ class or {
121
121
  */
122
122
  updateFrom(e) {
123
123
  const { geometry: t } = e;
124
- if (lr(e, this.bvhBounds, this.bvhContents), this.position.updateFrom(t.attributes.position), e.indirect) {
124
+ if (cr(e, this.bvhBounds, this.bvhContents), this.position.updateFrom(t.attributes.position), e.indirect) {
125
125
  const r = e._indirectBuffer;
126
126
  if (this._cachedIndexAttr === null || this._cachedIndexAttr.count !== r.length)
127
127
  if (t.index)
@@ -130,7 +130,7 @@ class or {
130
130
  const i = $t(jt(t));
131
131
  this._cachedIndexAttr = new P(i, 1, !1);
132
132
  }
133
- nr(t, r, this._cachedIndexAttr), this.index.updateFrom(this._cachedIndexAttr);
133
+ lr(t, r, this._cachedIndexAttr), this.index.updateFrom(this._cachedIndexAttr);
134
134
  } else
135
135
  this.index.updateFrom(t.index);
136
136
  }
@@ -144,34 +144,34 @@ class or {
144
144
  e && e.dispose(), t && t.dispose(), r && r.dispose(), i && i.dispose();
145
145
  }
146
146
  }
147
- function nr(s, e, t) {
147
+ function lr(s, e, t) {
148
148
  const r = t.array, i = s.index ? s.index.array : null;
149
149
  for (let o = 0, a = e.length; o < a; o++) {
150
150
  const l = 3 * o, h = 3 * e[o];
151
- for (let f = 0; f < 3; f++)
152
- r[l + f] = i ? i[h + f] : h + f;
151
+ for (let d = 0; d < 3; d++)
152
+ r[l + d] = i ? i[h + d] : h + d;
153
153
  }
154
154
  }
155
- function lr(s, e, t) {
155
+ function cr(s, e, t) {
156
156
  const r = s._roots;
157
157
  if (r.length !== 1)
158
158
  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 / We, f = 2 * Math.ceil(Math.sqrt(h / 2)), d = new Float32Array(4 * f * f), u = Math.ceil(Math.sqrt(h)), n = new Uint32Array(2 * u * u);
160
- for (let v = 0; v < h; v++) {
161
- const m = v * We / 4, g = m * 2, c = Zt(m);
159
+ const i = r[0], o = new Uint16Array(i), a = new Uint32Array(i), l = new Float32Array(i), h = i.byteLength / We, 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 * We / 4, g = m * 2, c = Zt(m);
162
162
  for (let p = 0; p < 3; p++)
163
- d[8 * v + 0 + p] = l[c + 0 + p], d[8 * v + 4 + p] = l[c + 3 + p];
163
+ f[8 * x + 0 + p] = l[c + 0 + p], f[8 * x + 4 + p] = l[c + 3 + p];
164
164
  if (Yt(g, o)) {
165
- const p = Xt(g, o), x = Qt(m, a), b = Jt | p;
166
- n[v * 2 + 0] = b, n[v * 2 + 1] = x;
165
+ const p = Xt(g, o), v = Qt(m, a), b = Jt | p;
166
+ n[x * 2 + 0] = b, n[x * 2 + 1] = v;
167
167
  } else {
168
- const p = a[m + 6], x = Kt(m, a);
169
- n[v * 2 + 0] = x, n[v * 2 + 1] = p;
168
+ const p = a[m + 6], v = Kt(m, a);
169
+ n[x * 2 + 0] = v, n[x * 2 + 1] = p;
170
170
  }
171
171
  }
172
- e.image.data = d, e.image.width = f, e.image.height = f, 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 = ut, t.type = re, t.internalFormat = "RG32UI", t.minFilter = T, t.magFilter = T, t.generateMipmaps = !1, t.needsUpdate = !0, t.dispose();
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 = ut, t.type = re, t.internalFormat = "RG32UI", t.minFilter = T, t.magFilter = T, t.generateMipmaps = !1, t.needsUpdate = !0, t.dispose();
173
173
  }
174
- const cr = (
174
+ const ur = (
175
175
  /* glsl */
176
176
  `
177
177
 
@@ -256,7 +256,7 @@ void ndcToCameraRay(
256
256
 
257
257
  }
258
258
  `
259
- ), ur = (
259
+ ), hr = (
260
260
  /* glsl */
261
261
  `
262
262
 
@@ -463,7 +463,7 @@ bool _bvhIntersectFirstHit(
463
463
 
464
464
  }
465
465
  `
466
- ), hr = (
466
+ ), fr = (
467
467
  /* glsl */
468
468
  `
469
469
  struct BVH {
@@ -501,7 +501,7 @@ function Z(s, e) {
501
501
  const t = s.count === e.count, r = s.normalized === e.normalized, i = s.array.constructor === e.array.constructor, o = s.itemSize === e.itemSize;
502
502
  return !(!t || !r || !i || !o);
503
503
  }
504
- function fr(s) {
504
+ function dr(s) {
505
505
  const e = s[0].index !== null, t = new Set(Object.keys(s[0].attributes));
506
506
  if (!s[0].getAttribute("position"))
507
507
  throw new Error("StaticGeometryGenerator: position attribute is required.");
@@ -519,36 +519,36 @@ function fr(s) {
519
519
  throw new Error("StaticGeometryGenerator: All geometries must have the same number of attributes.");
520
520
  }
521
521
  }
522
- function dr(s) {
522
+ function mr(s) {
523
523
  let e = 0;
524
524
  for (let t = 0, r = s.length; t < r; t++)
525
525
  e += s[t].getIndex().count;
526
526
  return e;
527
527
  }
528
- function mr(s) {
528
+ function pr(s) {
529
529
  let e = 0;
530
530
  for (let t = 0, r = s.length; t < r; t++)
531
531
  e += s[t].getAttribute("position").count;
532
532
  return e;
533
533
  }
534
- function pr(s, e, t) {
534
+ function gr(s, e, t) {
535
535
  s.index && s.index.count !== e && s.setIndex(null);
536
536
  const r = s.attributes;
537
537
  for (const i in r)
538
538
  r[i].count !== t && s.deleteAttribute(i);
539
539
  }
540
- function gr(s, e = {}, t = new $()) {
540
+ function vr(s, e = {}, t = new $()) {
541
541
  const {
542
542
  useGroups: r = !1,
543
543
  forceUpdate: i = !1,
544
544
  skipAssigningAttributes: o = [],
545
545
  overwriteIndex: a = !0
546
546
  } = e;
547
- fr(s);
548
- const l = s[0].index !== null, h = l ? dr(s) : -1, f = mr(s);
549
- if (pr(t, h, f), r) {
547
+ dr(s);
548
+ const l = s[0].index !== null, h = l ? mr(s) : -1, d = pr(s);
549
+ if (gr(t, h, d), r) {
550
550
  let u = 0;
551
- for (let n = 0, v = s.length; n < v; n++) {
551
+ for (let n = 0, x = s.length; n < x; n++) {
552
552
  const m = s[n];
553
553
  let g;
554
554
  l ? g = m.getIndex().count : g = m.getAttribute("position").count, t.addGroup(u, g, n), u += g;
@@ -557,52 +557,52 @@ function gr(s, e = {}, t = new $()) {
557
557
  if (l) {
558
558
  let u = !1;
559
559
  if (t.index || (t.setIndex(new P(new Uint32Array(h), 1, !1)), u = !0), u || a) {
560
- let n = 0, v = 0;
560
+ let n = 0, x = 0;
561
561
  const m = t.getIndex();
562
562
  for (let g = 0, c = s.length; g < c; g++) {
563
- const p = s[g], x = p.getIndex();
563
+ const p = s[g], v = p.getIndex();
564
564
  if (!(!i && !u && o[g]))
565
- for (let y = 0; y < x.count; ++y)
566
- m.setX(n + y, x.getX(y) + v);
567
- n += x.count, v += p.getAttribute("position").count;
565
+ for (let y = 0; y < v.count; ++y)
566
+ m.setX(n + y, v.getX(y) + x);
567
+ n += v.count, x += p.getAttribute("position").count;
568
568
  }
569
569
  }
570
570
  }
571
- const d = Object.keys(s[0].attributes);
572
- for (let u = 0, n = d.length; u < n; u++) {
573
- let v = !1;
574
- const m = d[u];
571
+ const f = Object.keys(s[0].attributes);
572
+ for (let u = 0, n = f.length; u < n; u++) {
573
+ let x = !1;
574
+ const m = f[u];
575
575
  if (!t.getAttribute(m)) {
576
576
  const p = s[0].getAttribute(m);
577
- t.setAttribute(m, te(p, f)), v = !0;
577
+ t.setAttribute(m, te(p, d)), x = !0;
578
578
  }
579
579
  let g = 0;
580
580
  const c = t.getAttribute(m);
581
- for (let p = 0, x = s.length; p < x; p++) {
582
- const b = s[p], y = !i && !v && o[p], w = b.getAttribute(m);
581
+ for (let p = 0, v = s.length; p < v; p++) {
582
+ const b = s[p], y = !i && !x && o[p], w = b.getAttribute(m);
583
583
  y || bt(w, c, g), g += w.count;
584
584
  }
585
585
  }
586
586
  }
587
- function vr(s, e, t) {
587
+ function xr(s, e, t) {
588
588
  const r = s.index, o = s.attributes.position.count, a = r ? r.count : o;
589
589
  let l = s.groups;
590
590
  l.length === 0 && (l = [{ count: a, start: 0, materialIndex: 0 }]);
591
591
  let h = s.getAttribute("materialIndex");
592
592
  if (!h || h.count !== o) {
593
- let d;
594
- t.length <= 255 ? d = new Uint8Array(o) : d = new Uint16Array(o), h = new P(d, 1, !1), s.deleteAttribute("materialIndex"), s.setAttribute("materialIndex", h);
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
595
  }
596
- const f = h.array;
597
- for (let d = 0; d < l.length; d++) {
598
- const u = l[d], n = u.start, v = u.count, m = Math.min(v, a - n), g = Array.isArray(e) ? e[u.materialIndex] : e, c = t.indexOf(g);
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);
599
599
  for (let p = 0; p < m; p++) {
600
- let x = n + p;
601
- r && (x = r.getX(x)), f[x] = c;
600
+ let v = n + p;
601
+ r && (v = r.getX(v)), d[v] = c;
602
602
  }
603
603
  }
604
604
  }
605
- function xr(s, e) {
605
+ function br(s, e) {
606
606
  if (!s.index) {
607
607
  const t = s.attributes.position.count, r = new Array(t);
608
608
  for (let i = 0; i < t; i++)
@@ -655,7 +655,7 @@ function Ge(s) {
655
655
  const e = s.skeleton;
656
656
  return e ? (e.boneTexture || e.computeBoneTexture(), `${Ce(e.boneTexture.image.data.buffer)}_${e.boneTexture.uuid}`) : null;
657
657
  }
658
- class br {
658
+ class yr {
659
659
  constructor(e = null) {
660
660
  this.matrixWorld = new O(), this.geometryHash = null, this.skeletonHash = null, this.primitiveCount = -1, e !== null && this.updateFrom(e);
661
661
  }
@@ -675,8 +675,8 @@ function Xe(s, e, t) {
675
675
  for (let l = 0; l < 4; l++) {
676
676
  const h = je.getComponent(l);
677
677
  if (h !== 0) {
678
- const f = $e.getComponent(l);
679
- Ye.multiplyMatrices(o[f].matrixWorld, a[f]), yr(ce, Ye, h);
678
+ const d = $e.getComponent(l);
679
+ Ye.multiplyMatrices(o[d].matrixWorld, a[d]), Tr(ce, Ye, h);
680
680
  }
681
681
  }
682
682
  return ce.multiply(s.bindMatrix).premultiply(s.bindMatrixInverse), t.transformDirection(ce), t;
@@ -689,12 +689,12 @@ function Ie(s, e, t, r, i) {
689
689
  }
690
690
  i.add(le);
691
691
  }
692
- function yr(s, e, t) {
692
+ function Tr(s, e, t) {
693
693
  const r = s.elements, i = e.elements;
694
694
  for (let o = 0, a = i.length; o < a; o++)
695
695
  r[o] += i[o] * t;
696
696
  }
697
- function Tr(s) {
697
+ function wr(s) {
698
698
  const { index: e, attributes: t } = s;
699
699
  if (e)
700
700
  for (let r = 0, i = e.count; r < i; r += 3) {
@@ -706,35 +706,35 @@ function Tr(s) {
706
706
  const i = t[r], o = i.itemSize;
707
707
  for (let a = 0, l = i.count; a < l; a += 3)
708
708
  for (let h = 0; h < o; h++) {
709
- const f = i.getComponent(a, h), d = i.getComponent(a + 2, h);
710
- i.setComponent(a, h, d), i.setComponent(a + 2, h, f);
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);
711
711
  }
712
712
  }
713
713
  return s;
714
714
  }
715
- function wr(s, e = {}, t = new $()) {
715
+ function Ir(s, e = {}, t = new $()) {
716
716
  e = {
717
717
  applyWorldTransforms: !0,
718
718
  attributes: [],
719
719
  ...e
720
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
- for (const x in t.attributes)
723
- (!e.attributes.includes(x) || !(x in r.attributes)) && t.deleteAttribute(x);
722
+ for (const v in t.attributes)
723
+ (!e.attributes.includes(v) || !(v in r.attributes)) && t.deleteAttribute(v);
724
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)), Z(r.index, t.index), Z(l.position, h.position), o && Z(l.normal, h.normal), a && Z(l.tangent, h.tangent);
725
- const f = l.position, d = o ? l.normal : null, u = a ? l.tangent : null, n = r.morphAttributes.position, v = r.morphAttributes.normal, m = r.morphAttributes.tangent, g = r.morphTargetsRelative, c = s.morphTargetInfluences, p = new Ct();
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 Ct();
726
726
  p.getNormalMatrix(s.matrixWorld), r.index && t.index.array.set(r.index.array);
727
- for (let x = 0, b = l.position.count; x < b; x++)
728
- U.fromBufferAttribute(f, x), d && V.fromBufferAttribute(d, x), u && (qe.fromBufferAttribute(u, x), G.fromBufferAttribute(u, x)), c && (n && Ie(n, c, g, x, U), v && Ie(v, c, g, x, V), m && Ie(m, c, g, x, G)), s.isSkinnedMesh && (s.applyBoneTransform(x, U), d && Xe(s, x, V), u && Xe(s, x, G)), i && U.applyMatrix4(s.matrixWorld), h.position.setXYZ(x, U.x, U.y, U.z), d && (i && V.applyNormalMatrix(p), h.normal.setXYZ(x, V.x, V.y, V.z)), u && (i && G.transformDirection(s.matrixWorld), h.tangent.setXYZW(x, G.x, G.y, G.z, qe.w));
729
- for (const x in e.attributes) {
730
- const b = e.attributes[x];
727
+ 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 && Ie(n, c, g, v, U), x && Ie(x, c, g, v, V), m && Ie(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
+ for (const v in e.attributes) {
730
+ const b = e.attributes[v];
731
731
  b === "position" || b === "tangent" || b === "normal" || !(b in l) || (h[b] || t.setAttribute(b, te(l[b])), Z(l[b], h[b]), bt(l[b], h[b]));
732
732
  }
733
- return s.matrixWorld.determinant() < 0 && Tr(t), t;
733
+ return s.matrixWorld.determinant() < 0 && wr(t), t;
734
734
  }
735
- class Ir extends $ {
735
+ class Rr extends $ {
736
736
  constructor() {
737
- super(), this.version = 0, this.hash = null, this._diff = new br();
737
+ super(), this.version = 0, this.hash = null, this._diff = new yr();
738
738
  }
739
739
  // returns whether the passed mesh is compatible with this baked geometry
740
740
  // such that it can be updated without resizing attributes
@@ -749,17 +749,17 @@ class Ir extends $ {
749
749
  }
750
750
  updateFrom(e, t) {
751
751
  const r = this._diff;
752
- return r.didChange(e) ? (wr(e, t, this), r.updateFrom(e), this.version++, this.hash = `${this.uuid}_${this.version}`, !0) : !1;
752
+ return r.didChange(e) ? (Ir(e, t, this), r.updateFrom(e), this.version++, this.hash = `${this.uuid}_${this.version}`, !0) : !1;
753
753
  }
754
754
  }
755
755
  const Ae = 0, yt = 1, Tt = 2;
756
- function Rr(s, e) {
756
+ function Sr(s, e) {
757
757
  for (let t = 0, r = s.length; t < r; t++)
758
758
  s[t].traverseVisible((o) => {
759
759
  o.isMesh && e(o);
760
760
  });
761
761
  }
762
- function Sr(s) {
762
+ function _r(s) {
763
763
  const e = [];
764
764
  for (let t = 0, r = s.length; t < r; t++) {
765
765
  const i = s[t];
@@ -767,7 +767,7 @@ function Sr(s) {
767
767
  }
768
768
  return e;
769
769
  }
770
- function _r(s, e, t) {
770
+ function Mr(s, e, t) {
771
771
  if (s.length === 0) {
772
772
  e.setIndex(null);
773
773
  const r = e.attributes;
@@ -776,11 +776,11 @@ function _r(s, e, t) {
776
776
  for (const i in t.attributes)
777
777
  e.setAttribute(t.attributes[i], new P(new Float32Array(0), 4, !1));
778
778
  } else
779
- gr(s, t, e);
779
+ vr(s, t, e);
780
780
  for (const r in e.attributes)
781
781
  e.attributes[r].needsUpdate = !0;
782
782
  }
783
- class Mr {
783
+ class Ar {
784
784
  constructor(e) {
785
785
  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
786
  }
@@ -793,7 +793,7 @@ class Mr {
793
793
  }
794
794
  _getMeshes() {
795
795
  const e = [];
796
- return Rr(this.objects, (t) => {
796
+ return Sr(this.objects, (t) => {
797
797
  e.push(t);
798
798
  }), e.sort((t, r) => t.uuid > r.uuid ? 1 : t.uuid < r.uuid ? -1 : 0), e.length === 0 && e.push(this._getDummyMesh()), e;
799
799
  }
@@ -805,8 +805,8 @@ class Mr {
805
805
  for (let o = 0, a = t.length; o < a; o++) {
806
806
  const l = t[o], h = l.uuid;
807
807
  r.delete(h);
808
- let f = e.get(h);
809
- (!f || !f.isCompatible(l, this.attributes)) && (f && f.dispose(), f = new Ir(), e.set(h, f)), f.updateFrom(l, i) && this.generateMissingAttributes && xr(f, this.attributes);
808
+ let d = e.get(h);
809
+ (!d || !d.isCompatible(l, this.attributes)) && (d && d.dispose(), d = new Rr(), e.set(h, d)), d.updateFrom(l, i) && this.generateMissingAttributes && br(d, this.attributes);
810
810
  }
811
811
  r.forEach((o) => {
812
812
  e.delete(o);
@@ -816,29 +816,29 @@ class Mr {
816
816
  Array.isArray(e) ? this.objects = [...e] : this.objects = [e];
817
817
  }
818
818
  generate(e = new $()) {
819
- const { useGroups: t, overwriteIndex: r, _intermediateGeometry: i, _geometryMergeSets: o } = this, a = this._getMeshes(), l = [], h = [], f = o.get(e) || [];
819
+ const { useGroups: t, overwriteIndex: r, _intermediateGeometry: i, _geometryMergeSets: o } = this, a = this._getMeshes(), l = [], h = [], d = o.get(e) || [];
820
820
  this._updateIntermediateGeometries();
821
- let d = !1;
822
- a.length !== f.length && (d = !0);
823
- for (let n = 0, v = a.length; n < v; n++) {
821
+ let f = !1;
822
+ a.length !== d.length && (f = !0);
823
+ for (let n = 0, x = a.length; n < x; n++) {
824
824
  const m = a[n], g = i.get(m.uuid);
825
825
  h.push(g);
826
- const c = f[n];
827
- !c || c.uuid !== g.uuid ? (l.push(!1), d = !0) : c.version !== g.version ? l.push(!1) : l.push(!0);
826
+ 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
828
  }
829
- _r(h, e, { useGroups: t, forceUpdate: d, skipAssigningAttributes: l, overwriteIndex: r }), d && e.dispose(), o.set(e, h.map((n) => ({
829
+ Mr(h, e, { useGroups: t, forceUpdate: f, skipAssigningAttributes: l, overwriteIndex: r }), f && e.dispose(), o.set(e, h.map((n) => ({
830
830
  version: n.version,
831
831
  uuid: n.uuid
832
832
  })));
833
833
  let u = Ae;
834
- return d ? u = Tt : l.includes(!1) && (u = yt), {
834
+ return f ? u = Tt : l.includes(!1) && (u = yt), {
835
835
  changeType: u,
836
- materials: Sr(a),
836
+ materials: _r(a),
837
837
  geometry: e
838
838
  };
839
839
  }
840
840
  }
841
- function Ar(s) {
841
+ function Fr(s) {
842
842
  const e = /* @__PURE__ */ new Set();
843
843
  for (let t = 0, r = s.length; t < r; t++) {
844
844
  const i = s[t];
@@ -849,7 +849,7 @@ function Ar(s) {
849
849
  }
850
850
  return Array.from(e);
851
851
  }
852
- function Fr(s) {
852
+ function Cr(s) {
853
853
  const e = [], t = /* @__PURE__ */ new Set();
854
854
  for (let i = 0, o = s.length; i < o; i++)
855
855
  s[i].traverse((a) => {
@@ -858,12 +858,12 @@ function Fr(s) {
858
858
  const r = Array.from(t).sort((i, o) => i.uuid < o.uuid ? 1 : i.uuid > o.uuid ? -1 : 0);
859
859
  return { lights: e, iesTextures: r };
860
860
  }
861
- class Cr {
861
+ class Dr {
862
862
  get initialized() {
863
863
  return !!this.bvh;
864
864
  }
865
865
  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 Mr(e), this._bvhWorker = null, this._pendingGenerate = null, this._buildAsync = !1;
866
+ this.bvhOptions = {}, this.attributes = ["position", "normal", "tangent", "color", "uv", "uv2"], this.generateBVH = !0, this.bvh = null, this.geometry = new $(), this.staticGeometryGenerator = new Ar(e), this._bvhWorker = null, this._pendingGenerate = null, this._buildAsync = !1;
867
867
  }
868
868
  setObjects(e) {
869
869
  this.staticGeometryGenerator.setObjects(e);
@@ -889,8 +889,8 @@ class Cr {
889
889
  n.isSkinnedMesh && n.skeleton && n.skeleton.update();
890
890
  });
891
891
  });
892
- const a = t.generate(r), l = a.materials, h = Ar(l), { lights: f, iesTextures: d } = Fr(o);
893
- if (a.changeType !== Ae && vr(r, l, l), this.generateBVH) {
892
+ const a = t.generate(r), l = a.materials, h = Fr(l), { lights: d, iesTextures: f } = Cr(o);
893
+ if (a.changeType !== Ae && xr(r, l, l), this.generateBVH) {
894
894
  if (this.bvh instanceof Promise)
895
895
  throw new Error("PathTracingSceneGenerator: BVH is already building asynchronously.");
896
896
  if (a.changeType === Tt) {
@@ -907,8 +907,8 @@ class Cr {
907
907
  return {
908
908
  bvhChanged: a.changeType !== Ae,
909
909
  bvh: this.bvh,
910
- lights: f,
911
- iesTextures: d,
910
+ lights: d,
911
+ iesTextures: f,
912
912
  geometry: r,
913
913
  materials: l,
914
914
  textures: h,
@@ -916,13 +916,13 @@ class Cr {
916
916
  };
917
917
  }
918
918
  }
919
- const Dr = new Pt(-1, 1, 1, -1, 0, 1);
920
- class Pr extends $ {
919
+ const Pr = new Pt(-1, 1, 1, -1, 0, 1);
920
+ class Er extends $ {
921
921
  constructor() {
922
- super(), this.setAttribute("position", new He([-1, 3, 0, -1, -1, 0, 3, -1, 0], 3)), this.setAttribute("uv", new He([0, 2, 0, 0, 2, 0], 2));
922
+ super(), this.setAttribute("position", new Be([-1, 3, 0, -1, -1, 0, 3, -1, 0], 3)), this.setAttribute("uv", new Be([0, 2, 0, 0, 2, 0], 2));
923
923
  }
924
924
  }
925
- const Er = new Pr();
925
+ const kr = new Er();
926
926
  class ee {
927
927
  /**
928
928
  * Constructs a new full screen quad.
@@ -930,7 +930,7 @@ class ee {
930
930
  * @param {?Material} material - The material to render te full screen quad with.
931
931
  */
932
932
  constructor(e) {
933
- this._mesh = new ft(Er, e);
933
+ this._mesh = new ft(kr, e);
934
934
  }
935
935
  /**
936
936
  * Frees the GPU-related resources allocated by this instance. Call this
@@ -945,7 +945,7 @@ class ee {
945
945
  * @param {WebGLRenderer} renderer - The renderer.
946
946
  */
947
947
  render(e) {
948
- e.render(this._mesh, Dr);
948
+ e.render(this._mesh, Pr);
949
949
  }
950
950
  /**
951
951
  * The quad's material.
@@ -987,7 +987,7 @@ class De extends pe {
987
987
  return !1;
988
988
  }
989
989
  }
990
- class kr extends De {
990
+ class Or extends De {
991
991
  constructor(e) {
992
992
  super({
993
993
  blending: ie,
@@ -1133,7 +1133,7 @@ const wt = (
1133
1133
  }
1134
1134
 
1135
1135
  `
1136
- ), Or = (
1136
+ ), zr = (
1137
1137
  /* glsl */
1138
1138
  `
1139
1139
 
@@ -1214,7 +1214,7 @@ const wt = (
1214
1214
  }
1215
1215
 
1216
1216
  `
1217
- ), zr = (
1217
+ ), Nr = (
1218
1218
  /* glsl */
1219
1219
  `
1220
1220
 
@@ -1261,7 +1261,7 @@ const wt = (
1261
1261
 
1262
1262
  `
1263
1263
  );
1264
- class Nr extends De {
1264
+ class Hr extends De {
1265
1265
  constructor() {
1266
1266
  super({
1267
1267
  blending: ie,
@@ -1286,7 +1286,7 @@ class Nr extends De {
1286
1286
  `
1287
1287
 
1288
1288
  ${wt}
1289
- ${Or}
1289
+ ${zr}
1290
1290
 
1291
1291
  varying vec2 vUv;
1292
1292
  uniform vec2 resolution;
@@ -1311,11 +1311,11 @@ class Br {
1311
1311
  generateMipmaps: !1
1312
1312
  }), i = e.getRenderTarget();
1313
1313
  e.setRenderTarget(r);
1314
- const o = new ee(new Nr());
1314
+ const o = new ee(new Hr());
1315
1315
  return o.material.resolution.set(t, t), o.render(e), e.setRenderTarget(i), o.dispose(), r;
1316
1316
  }
1317
1317
  }
1318
- class Hr extends dt {
1318
+ class Wr extends dt {
1319
1319
  set bokehSize(e) {
1320
1320
  this.fStop = this.getFocalLength() / e;
1321
1321
  }
@@ -1329,12 +1329,12 @@ class Hr extends dt {
1329
1329
  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
1330
  }
1331
1331
  }
1332
- class Wr {
1332
+ class Lr {
1333
1333
  constructor() {
1334
1334
  this.bokehSize = 0, this.apertureBlades = 0, this.apertureRotation = 0, this.focusDistance = 10, this.anamorphicRatio = 1;
1335
1335
  }
1336
1336
  updateFrom(e) {
1337
- e instanceof Hr ? (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);
1337
+ e instanceof Wr ? (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
1338
  }
1339
1339
  }
1340
1340
  function Re(s) {
@@ -1351,10 +1351,10 @@ function Qe(s, e, t = 0, r = s.length) {
1351
1351
  }
1352
1352
  return i - t;
1353
1353
  }
1354
- function Lr(s, e, t) {
1354
+ function Ur(s, e, t) {
1355
1355
  return 0.2126 * s + 0.7152 * e + 0.0722 * t;
1356
1356
  }
1357
- function Ur(s, e = D) {
1357
+ function Vr(s, e = D) {
1358
1358
  const t = s.clone();
1359
1359
  t.source = new Et({ ...t.image });
1360
1360
  const { width: r, height: i, data: o } = t.image;
@@ -1363,9 +1363,9 @@ function Ur(s, e = D) {
1363
1363
  e === D ? a = new Uint16Array(o.length) : a = new Float32Array(o.length);
1364
1364
  let l;
1365
1365
  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, f = o.length; h < f; h++) {
1367
- let d = o[h];
1368
- t.type === D && (d = k.fromHalfFloat(o[h])), t.type !== R && t.type !== D && (d /= l), e === D && (a[h] = k.toHalfFloat(d));
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));
1369
1369
  }
1370
1370
  t.image.data = a, t.type = e;
1371
1371
  }
@@ -1373,15 +1373,15 @@ function Ur(s, e = D) {
1373
1373
  const l = a;
1374
1374
  a = a.slice();
1375
1375
  for (let h = 0; h < i; h++)
1376
- for (let f = 0; f < r; f++) {
1377
- const d = i - h - 1, u = 4 * (h * r + f), n = 4 * (d * r + f);
1376
+ for (let d = 0; d < r; d++) {
1377
+ const f = i - h - 1, u = 4 * (h * r + d), n = 4 * (f * r + d);
1378
1378
  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
1379
  }
1380
1380
  t.flipY = !1, t.image.data = a;
1381
1381
  }
1382
1382
  return t;
1383
1383
  }
1384
- class Vr {
1384
+ class Gr {
1385
1385
  constructor() {
1386
1386
  const e = new M(Re(new Float32Array([0, 0, 0, 0])), 1, 1);
1387
1387
  e.type = D, e.format = I, e.minFilter = F, e.magFilter = F, e.wrapS = z, e.wrapT = z, e.generateMipmaps = !1, e.needsUpdate = !0;
@@ -1394,41 +1394,41 @@ class Vr {
1394
1394
  this.marginalWeights.dispose(), this.conditionalWeights.dispose(), this.map.dispose();
1395
1395
  }
1396
1396
  updateFrom(e) {
1397
- const t = Ur(e);
1397
+ const t = Vr(e);
1398
1398
  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), f = new Float32Array(i);
1400
- let d = 0, u = 0;
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;
1401
1401
  for (let c = 0; c < i; c++) {
1402
1402
  let p = 0;
1403
- for (let x = 0; x < r; x++) {
1404
- const b = c * r + x, y = k.fromHalfFloat(o[4 * b + 0]), w = k.fromHalfFloat(o[4 * b + 1]), E = k.fromHalfFloat(o[4 * b + 2]), B = Lr(y, w, E);
1405
- p += B, d += B, a[b] = B, l[b] = p;
1403
+ 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 = Ur(y, w, E);
1405
+ p += H, f += H, a[b] = H, l[b] = p;
1406
1406
  }
1407
1407
  if (p !== 0)
1408
- for (let x = c * r, b = c * r + r; x < b; x++)
1409
- a[x] /= p, l[x] /= p;
1410
- u += p, h[c] = p, f[c] = u;
1408
+ for (let v = c * r, b = c * r + r; v < b; v++)
1409
+ a[v] /= p, l[v] /= p;
1410
+ u += p, h[c] = p, d[c] = u;
1411
1411
  }
1412
1412
  if (u !== 0)
1413
1413
  for (let c = 0, p = h.length; c < p; c++)
1414
- h[c] /= u, f[c] /= u;
1415
- const n = new Uint16Array(i), v = new Uint16Array(r * i);
1414
+ h[c] /= u, d[c] /= u;
1415
+ const n = new Uint16Array(i), x = new Uint16Array(r * i);
1416
1416
  for (let c = 0; c < i; c++) {
1417
- const p = (c + 1) / i, x = Qe(f, p);
1418
- n[c] = k.toHalfFloat((x + 0.5) / i);
1417
+ const p = (c + 1) / i, v = Qe(d, p);
1418
+ n[c] = k.toHalfFloat((v + 0.5) / i);
1419
1419
  }
1420
1420
  for (let c = 0; c < i; c++)
1421
1421
  for (let p = 0; p < r; p++) {
1422
- const x = c * r + p, b = (p + 1) / r, y = Qe(l, b, c * r, r);
1423
- v[x] = k.toHalfFloat((y + 0.5) / r);
1422
+ const v = c * r + p, b = (p + 1) / r, y = Qe(l, b, c * r, r);
1423
+ x[v] = k.toHalfFloat((y + 0.5) / r);
1424
1424
  }
1425
1425
  this.dispose();
1426
1426
  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: v }, g.needsUpdate = !0, this.totalSum = d, this.map = t;
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;
1428
1428
  }
1429
1429
  }
1430
- const Se = 6, Gr = 0, qr = 1, $r = 2, jr = 3, Yr = 4, A = new C(), _ = new C(), Ke = new O(), Y = new kt(), Ze = new C(), X = new C(), Xr = new C(0, 1, 0);
1431
- class Qr {
1430
+ const Se = 6, qr = 0, $r = 1, jr = 2, Yr = 3, Xr = 4, A = new C(), _ = new C(), Ke = new O(), Y = new kt(), Ze = new C(), X = new C(), Qr = new C(0, 1, 0);
1431
+ class Kr {
1432
1432
  constructor() {
1433
1433
  const e = new M(new Float32Array(4), 1, 1);
1434
1434
  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,23 +1437,23 @@ class Qr {
1437
1437
  const r = this.tex, i = Math.max(e.length * Se, 1), o = Math.ceil(Math.sqrt(i));
1438
1438
  r.image.width !== o && (r.dispose(), r.image.data = new Float32Array(o * o * 4), r.image.width = o, r.image.height = o);
1439
1439
  const a = r.image.data;
1440
- for (let h = 0, f = e.length; h < f; h++) {
1441
- const d = e[h], u = h * Se * 4;
1440
+ for (let h = 0, d = e.length; h < d; h++) {
1441
+ const f = e[h], u = h * Se * 4;
1442
1442
  let n = 0;
1443
1443
  for (let m = 0; m < Se * 4; m++)
1444
1444
  a[u + m] = 0;
1445
- d.getWorldPosition(_), a[u + n++] = _.x, a[u + n++] = _.y, a[u + n++] = _.z;
1446
- let v = Gr;
1447
- if (d.isRectAreaLight && d.isCircular ? v = qr : d.isSpotLight ? v = $r : d.isDirectionalLight ? v = jr : d.isPointLight && (v = Yr), a[u + n++] = v, a[u + n++] = d.color.r, a[u + n++] = d.color.g, a[u + n++] = d.color.b, a[u + n++] = d.intensity, d.getWorldQuaternion(Y), d.isRectAreaLight)
1448
- A.set(d.width, 0, 0).applyQuaternion(Y), a[u + n++] = A.x, a[u + n++] = A.y, a[u + n++] = A.z, n++, _.set(0, d.height, 0).applyQuaternion(Y), a[u + n++] = _.x, a[u + n++] = _.y, a[u + n++] = _.z, a[u + n++] = A.cross(_).length() * (d.isCircular ? Math.PI / 4 : 1);
1449
- else if (d.isSpotLight) {
1450
- const m = d.radius || 0;
1451
- Ze.setFromMatrixPosition(d.matrixWorld), X.setFromMatrixPosition(d.target.matrixWorld), Ke.lookAt(Ze, X, Xr), 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++] = d.decay, a[u + n++] = d.distance, a[u + n++] = Math.cos(d.angle), a[u + n++] = Math.cos(d.angle * (1 - d.penumbra)), a[u + n++] = d.iesMap ? t.indexOf(d.iesMap) : -1;
1452
- } else if (d.isPointLight) {
1453
- const m = A.setFromMatrixPosition(d.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++] = d.decay, a[u + n++] = d.distance;
1455
- } else if (d.isDirectionalLight) {
1456
- const m = A.setFromMatrixPosition(d.matrixWorld), g = _.setFromMatrixPosition(d.target.matrixWorld);
1445
+ f.getWorldPosition(_), a[u + n++] = _.x, a[u + n++] = _.y, a[u + n++] = _.z;
1446
+ let x = qr;
1447
+ if (f.isRectAreaLight && f.isCircular ? x = $r : f.isSpotLight ? x = jr : f.isDirectionalLight ? x = Yr : f.isPointLight && (x = Xr), 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, Qr), 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
1457
  X.subVectors(m, g).normalize(), a[u + n++] = X.x, a[u + n++] = X.y, a[u + n++] = X.z;
1458
1458
  }
1459
1459
  }
@@ -1480,12 +1480,12 @@ function Je(s, e, t, r, i) {
1480
1480
  break;
1481
1481
  }
1482
1482
  for (let h = 0; h < o; h++) {
1483
- const f = 4 * h, d = e * h;
1483
+ const d = 4 * h, f = e * h;
1484
1484
  for (let u = 0; u < r; u++)
1485
- t[i + f + u] = e >= u + 1 ? s[d + u] / l : 0;
1485
+ t[i + d + u] = e >= u + 1 ? s[f + u] / l : 0;
1486
1486
  }
1487
1487
  }
1488
- class Kr extends Ot {
1488
+ class Zr extends Ot {
1489
1489
  constructor() {
1490
1490
  super(), this._textures = [], this.type = R, this.format = I, this.internalFormat = "RGBA32F";
1491
1491
  }
@@ -1495,9 +1495,9 @@ class Kr extends Ot {
1495
1495
  const i = r.image, o = this.image;
1496
1496
  if (i.width !== o.width || i.height !== o.height)
1497
1497
  throw new Error("FloatAttributeTextureArray: Attribute must be the same dimensions when updating single layer.");
1498
- const { width: a, height: l, data: h } = o, d = a * l * 4 * e;
1498
+ const { width: a, height: l, data: h } = o, f = a * l * 4 * e;
1499
1499
  let u = t.itemSize;
1500
- u === 3 && (u = 4), Je(r.image.data, u, h, 4, d), this.dispose(), this.needsUpdate = !0;
1500
+ u === 3 && (u = 4), Je(r.image.data, u, h, 4, f), this.dispose(), this.needsUpdate = !0;
1501
1501
  }
1502
1502
  setAttributes(e) {
1503
1503
  const t = e[0].count, r = e.length;
@@ -1515,16 +1515,16 @@ class Kr extends Ot {
1515
1515
  i[u].updateFrom(e[u]);
1516
1516
  const a = i[0].image, l = this.image;
1517
1517
  (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: f, height: d } = l;
1518
+ const { data: h, width: d, height: f } = l;
1519
1519
  for (let u = 0, n = r; u < n; u++) {
1520
- const v = i[u], g = f * d * 4 * u;
1520
+ const x = i[u], g = d * f * 4 * u;
1521
1521
  let c = e[u].itemSize;
1522
- c === 3 && (c = 4), Je(v.image.data, c, h, 4, g);
1522
+ c === 3 && (c = 4), Je(x.image.data, c, h, 4, g);
1523
1523
  }
1524
1524
  this.dispose(), this.needsUpdate = !0;
1525
1525
  }
1526
1526
  }
1527
- class Zr extends Kr {
1527
+ class Jr extends Zr {
1528
1528
  updateNormalAttribute(e) {
1529
1529
  this.updateAttribute(0, e);
1530
1530
  }
@@ -1547,7 +1547,7 @@ function Pe(s, e) {
1547
1547
  function Fe(s) {
1548
1548
  return `${s.source.uuid}:${s.colorSpace}`;
1549
1549
  }
1550
- function Jr(s) {
1550
+ function ea(s) {
1551
1551
  const e = /* @__PURE__ */ new Set(), t = [];
1552
1552
  for (let r = 0, i = s.length; r < i; r++) {
1553
1553
  const o = s[r], a = Fe(o);
@@ -1555,11 +1555,11 @@ function Jr(s) {
1555
1555
  }
1556
1556
  return t;
1557
1557
  }
1558
- function ea(s) {
1558
+ function ta(s) {
1559
1559
  const e = s.map((r) => r.iesMap || null).filter((r) => r), t = new Set(e);
1560
1560
  return Array.from(t).sort(Pe);
1561
1561
  }
1562
- function ta(s) {
1562
+ function ra(s) {
1563
1563
  const e = /* @__PURE__ */ new Set();
1564
1564
  for (let r = 0, i = s.length; r < i; r++) {
1565
1565
  const o = s[r];
@@ -1569,16 +1569,16 @@ function ta(s) {
1569
1569
  }
1570
1570
  }
1571
1571
  const t = Array.from(e);
1572
- return Jr(t).sort(Pe);
1572
+ return ea(t).sort(Pe);
1573
1573
  }
1574
- function ra(s) {
1574
+ function aa(s) {
1575
1575
  const e = [];
1576
1576
  return s.traverse((t) => {
1577
1577
  t.visible && (t.isRectAreaLight || t.isSpotLight || t.isPointLight || t.isDirectionalLight) && e.push(t);
1578
1578
  }), e.sort(Pe);
1579
1579
  }
1580
1580
  const It = 45, et = It * 4;
1581
- class aa {
1581
+ class ia {
1582
1582
  constructor() {
1583
1583
  this._features = {};
1584
1584
  }
@@ -1592,9 +1592,9 @@ class aa {
1592
1592
  this._features = {};
1593
1593
  }
1594
1594
  }
1595
- class ia extends M {
1595
+ class sa extends M {
1596
1596
  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 aa();
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 ia();
1598
1598
  }
1599
1599
  updateFrom(e, t) {
1600
1600
  function r(m, g, c = -1) {
@@ -1608,26 +1608,26 @@ class ia extends M {
1608
1608
  return g in m ? m[g] : c;
1609
1609
  }
1610
1610
  function o(m, g, c, p) {
1611
- const x = m[g] && m[g].isTexture ? m[g] : null;
1612
- if (x) {
1613
- x.matrixAutoUpdate && x.updateMatrix();
1614
- const b = x.matrix.elements;
1611
+ const v = m[g] && m[g].isTexture ? m[g] : null;
1612
+ if (v) {
1613
+ v.matrixAutoUpdate && v.updateMatrix();
1614
+ const b = v.matrix.elements;
1615
1615
  let y = 0;
1616
1616
  c[p + y++] = b[0], c[p + y++] = b[3], c[p + y++] = b[6], y++, c[p + y++] = b[1], c[p + y++] = b[4], c[p + y++] = b[7], y++;
1617
1617
  }
1618
1618
  return 8;
1619
1619
  }
1620
1620
  let a = 0;
1621
- const l = e.length * It, h = Math.ceil(Math.sqrt(l)) || 1, { image: f, features: d } = this, u = {};
1621
+ const l = e.length * It, h = Math.ceil(Math.sqrt(l)) || 1, { image: d, features: f } = this, u = {};
1622
1622
  for (let m = 0, g = t.length; m < g; m++)
1623
1623
  u[Fe(t[m])] = m;
1624
- f.width !== h && (this.dispose(), f.data = new Float32Array(h * h * 4), f.width = h, f.height = h);
1625
- const n = f.data;
1626
- d.reset();
1624
+ d.width !== h && (this.dispose(), d.data = new Float32Array(h * h * 4), d.width = h, d.height = h);
1625
+ const n = d.data;
1626
+ f.reset();
1627
1627
  for (let m = 0, g = e.length; m < g; m++) {
1628
1628
  const c = e[m];
1629
1629
  if (c.isFogVolumeMaterial) {
1630
- d.setUsed("FOG");
1630
+ f.setUsed("FOG");
1631
1631
  for (let b = 0; b < et; b++)
1632
1632
  n[a + b] = 0;
1633
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;
@@ -1636,12 +1636,12 @@ class ia extends M {
1636
1636
  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);
1637
1637
  const p = i(c, "iridescenceThicknessRange", [100, 400]);
1638
1638
  n[a++] = p[0], n[a++] = p[1], "specularColor" in c ? (n[a++] = c.specularColor.r, n[a++] = c.specularColor.g, n[a++] = c.specularColor.b) : (n[a++] = 1, n[a++] = 1, n[a++] = 1), n[a++] = r(c, "specularColorMap"), n[a++] = i(c, "specularIntensity", 1), n[a++] = r(c, "specularIntensityMap");
1639
- const x = i(c, "thickness", 0) === 0 && i(c, "attenuationDistance", 1 / 0) === 1 / 0;
1640
- if (n[a++] = Number(x), a++, "attenuationColor" in c ? (n[a++] = c.attenuationColor.r, n[a++] = c.attenuationColor.g, n[a++] = c.attenuationColor.b) : (n[a++] = 1, n[a++] = 1, n[a++] = 1), n[a++] = i(c, "attenuationDistance", 1 / 0), n[a++] = r(c, "alphaMap"), n[a++] = c.opacity, n[a++] = c.alphaTest, !x && c.transmission > 0)
1639
+ const v = i(c, "thickness", 0) === 0 && i(c, "attenuationDistance", 1 / 0) === 1 / 0;
1640
+ if (n[a++] = Number(v), a++, "attenuationColor" in c ? (n[a++] = c.attenuationColor.r, n[a++] = c.attenuationColor.g, n[a++] = c.attenuationColor.b) : (n[a++] = 1, n[a++] = 1, n[a++] = 1), n[a++] = i(c, "attenuationDistance", 1 / 0), n[a++] = r(c, "alphaMap"), n[a++] = c.opacity, n[a++] = c.alphaTest, !v && c.transmission > 0)
1641
1641
  n[a++] = 0;
1642
1642
  else
1643
1643
  switch (c.side) {
1644
- case Bt:
1644
+ case Ht:
1645
1645
  n[a++] = 1;
1646
1646
  break;
1647
1647
  case Nt:
@@ -1653,19 +1653,19 @@ class ia extends M {
1653
1653
  }
1654
1654
  n[a++] = Number(i(c, "matte", !1)), n[a++] = Number(i(c, "castShadow", !0)), n[a++] = Number(c.vertexColors) | Number(c.flatShading) << 1, n[a++] = Number(c.transparent), a += o(c, "map", n, a), a += o(c, "metalnessMap", n, a), a += o(c, "roughnessMap", n, a), a += o(c, "transmissionMap", n, a), a += o(c, "emissiveMap", n, a), a += o(c, "normalMap", n, a), a += o(c, "clearcoatMap", n, a), a += o(c, "clearcoatNormalMap", n, a), a += o(c, "clearcoatRoughnessMap", n, a), a += o(c, "sheenColorMap", n, a), a += o(c, "sheenRoughnessMap", n, a), a += o(c, "iridescenceMap", n, a), a += o(c, "iridescenceThicknessMap", n, a), a += o(c, "specularColorMap", n, a), a += o(c, "specularIntensityMap", n, a);
1655
1655
  }
1656
- const v = Ce(n.buffer);
1657
- return this.hash !== v ? (this.hash = v, this.needsUpdate = !0, !0) : !1;
1656
+ const x = Ce(n.buffer);
1657
+ return this.hash !== x ? (this.hash = x, this.needsUpdate = !0, !0) : !1;
1658
1658
  }
1659
1659
  }
1660
1660
  const tt = new se();
1661
- function sa(s) {
1661
+ function oa(s) {
1662
1662
  return s ? `${s.uuid}:${s.version}` : null;
1663
1663
  }
1664
- function oa(s, e) {
1664
+ function na(s, e) {
1665
1665
  for (const t in e)
1666
1666
  t in s && (s[t] = e[t]);
1667
1667
  }
1668
- class rt extends Ht {
1668
+ class rt extends Bt {
1669
1669
  constructor(e, t, r) {
1670
1670
  const i = {
1671
1671
  format: I,
@@ -1677,10 +1677,10 @@ class rt extends Ht {
1677
1677
  generateMipmaps: !1,
1678
1678
  ...r
1679
1679
  };
1680
- super(e, t, 1, i), oa(this.texture, i), this.texture.setTextures = (...a) => {
1680
+ super(e, t, 1, i), na(this.texture, i), this.texture.setTextures = (...a) => {
1681
1681
  this.setTextures(...a);
1682
1682
  }, this.hashes = [null];
1683
- const o = new ee(new na());
1683
+ const o = new ee(new la());
1684
1684
  this.fsQuad = o;
1685
1685
  }
1686
1686
  setTextures(e, t, r = this.width, i = this.height) {
@@ -1688,19 +1688,19 @@ class rt extends Ht {
1688
1688
  e.getClearColor(tt);
1689
1689
  const h = t.length || 1;
1690
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 = Wt;
1691
- const f = this.fsQuad, d = this.hashes;
1691
+ const d = this.fsQuad, f = this.hashes;
1692
1692
  let u = !1;
1693
- for (let n = 0, v = h; n < v; n++) {
1694
- const m = t[n], g = sa(m);
1695
- m && (d[n] !== g || m.isWebGLRenderTarget) && (m.matrixAutoUpdate = !1, m.matrix.identity(), f.material.map = m, e.setRenderTarget(this, n), f.render(e), m.updateMatrix(), m.matrixAutoUpdate = !0, d[n] = g, u = !0);
1693
+ for (let n = 0, x = h; n < x; n++) {
1694
+ const m = t[n], g = oa(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);
1696
1696
  }
1697
- return f.material.map = null, e.setClearColor(tt, l), e.setRenderTarget(o), e.toneMapping = a, u;
1697
+ return d.material.map = null, e.setClearColor(tt, l), e.setRenderTarget(o), e.toneMapping = a, u;
1698
1698
  }
1699
1699
  dispose() {
1700
1700
  super.dispose(), this.fsQuad.dispose();
1701
1701
  }
1702
1702
  }
1703
- class na extends pe {
1703
+ class la extends pe {
1704
1704
  get map() {
1705
1705
  return this.uniforms.map.value;
1706
1706
  }
@@ -1739,14 +1739,14 @@ class na extends pe {
1739
1739
  });
1740
1740
  }
1741
1741
  }
1742
- function la(s, e = Math.random()) {
1742
+ function ca(s, e = Math.random()) {
1743
1743
  for (let t = s.length - 1; t > 0; t--) {
1744
1744
  const r = Math.floor(e() * (t + 1)), i = s[t];
1745
1745
  s[t] = s[r], s[r] = i;
1746
1746
  }
1747
1747
  return s;
1748
1748
  }
1749
- class ca {
1749
+ class ua {
1750
1750
  constructor(e, t, r = Math.random) {
1751
1751
  const i = e ** t, o = new Uint16Array(i);
1752
1752
  let a = i;
@@ -1760,15 +1760,15 @@ class ca {
1760
1760
  a = 0;
1761
1761
  }, this.next = function() {
1762
1762
  const { samples: l } = this;
1763
- a >= o.length && (la(o, r), this.reshuffle());
1763
+ a >= o.length && (ca(o, r), this.reshuffle());
1764
1764
  let h = o[a++];
1765
- for (let f = 0; f < t; f++)
1766
- l[f] = (h % e + r()) / e, h = Math.floor(h / e);
1765
+ for (let d = 0; d < t; d++)
1766
+ l[d] = (h % e + r()) / e, h = Math.floor(h / e);
1767
1767
  return l;
1768
1768
  };
1769
1769
  }
1770
1770
  }
1771
- class ua {
1771
+ class ha {
1772
1772
  constructor(e, t, r = Math.random) {
1773
1773
  let i = 0;
1774
1774
  for (const h of t)
@@ -1776,8 +1776,8 @@ class ua {
1776
1776
  const o = new Float32Array(i), a = [];
1777
1777
  let l = 0;
1778
1778
  for (const h of t) {
1779
- const f = new ca(e, h, r);
1780
- f.samples = new Float32Array(o.buffer, l, f.samples.length), l += f.samples.length * 4, a.push(f);
1779
+ const d = new ua(e, h, r);
1780
+ d.samples = new Float32Array(o.buffer, l, d.samples.length), l += d.samples.length * 4, a.push(d);
1781
1781
  }
1782
1782
  this.samples = o, this.strataCount = e, this.next = function() {
1783
1783
  for (const h of a)
@@ -1792,7 +1792,7 @@ class ua {
1792
1792
  };
1793
1793
  }
1794
1794
  }
1795
- class ha {
1795
+ class fa {
1796
1796
  constructor(e = 0) {
1797
1797
  this.m = 2147483648, this.a = 1103515245, this.c = 12345, this.seed = e;
1798
1798
  }
@@ -1803,15 +1803,15 @@ class ha {
1803
1803
  return this.nextInt() / (this.m - 1);
1804
1804
  }
1805
1805
  }
1806
- class fa extends M {
1806
+ class da extends M {
1807
1807
  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 ha(), this.stableNoise = !1, this.random = () => this.stableNoise ? this.generator.nextFloat() : Math.random(), this.init(e, t, r);
1808
+ super(new Float32Array(1), 1, 1, I, R), this.minFilter = T, this.magFilter = T, this.strata = r, this.sampler = null, this.generator = new fa(), this.stableNoise = !1, this.random = () => this.stableNoise ? this.generator.nextFloat() : Math.random(), this.init(e, t, r);
1809
1809
  }
1810
1810
  init(e = this.image.height, t = this.image.width, r = this.strata) {
1811
1811
  const { image: i } = this;
1812
1812
  if (i.width === t && i.height === e && this.sampler !== null)
1813
1813
  return;
1814
- const o = new Array(e * t).fill(4), a = new ua(r, o, this.random);
1814
+ const o = new Array(e * t).fill(4), a = new ha(r, o, this.random);
1815
1815
  i.width = t, i.height = e, i.data = a.samples, this.sampler = a, this.dispose(), this.next();
1816
1816
  }
1817
1817
  next() {
@@ -1821,13 +1821,13 @@ class fa extends M {
1821
1821
  this.sampler.reset(), this.generator.seed = 0;
1822
1822
  }
1823
1823
  }
1824
- function da(s, e = Math.random) {
1824
+ function ma(s, e = Math.random) {
1825
1825
  for (let t = s.length - 1; t > 0; t--) {
1826
1826
  const r = ~~((e() - 1e-6) * t), i = s[t];
1827
1827
  s[t] = s[r], s[r] = i;
1828
1828
  }
1829
1829
  }
1830
- function ma(s, e) {
1830
+ function pa(s, e) {
1831
1831
  s.fill(0);
1832
1832
  for (let t = 0; t < e; t++)
1833
1833
  s[t] = 1;
@@ -1864,8 +1864,8 @@ class at {
1864
1864
  const t = ~~(Math.sqrt(20 * e ** 2) + 1), r = 2 * t + 1, i = new Float32Array(r * r), o = e * e;
1865
1865
  for (let a = -t; a <= t; a++)
1866
1866
  for (let l = -t; l <= t; l++) {
1867
- const h = (t + l) * r + a + t, f = a * a + l * l;
1868
- i[h] = Math.E ** (-f / (2 * o));
1867
+ const h = (t + l) * r + a + t, d = a * a + l * l;
1868
+ i[h] = Math.E ** (-d / (2 * o));
1869
1869
  }
1870
1870
  this.lookupTable = i, this.sigma = e, this.radius = t;
1871
1871
  }
@@ -1884,14 +1884,14 @@ class at {
1884
1884
  }
1885
1885
  updateScore(e, t, r) {
1886
1886
  const { size: i, score: o, lookupTable: a } = this, l = this.radius, h = 2 * l + 1;
1887
- for (let f = -l; f <= l; f++)
1888
- for (let d = -l; d <= l; d++) {
1889
- const u = (l + d) * h + f + l, n = a[u];
1890
- let v = e + f;
1891
- v = v < 0 ? i + v : v % i;
1892
- let m = t + d;
1887
+ 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];
1890
+ let x = e + d;
1891
+ x = x < 0 ? i + x : x % i;
1892
+ let m = t + f;
1893
1893
  m = m < 0 ? i + m : m % i;
1894
- const g = m * i + v;
1894
+ const g = m * i + x;
1895
1895
  o[g] += r * n;
1896
1896
  }
1897
1897
  }
@@ -1909,7 +1909,7 @@ class at {
1909
1909
  this.resize(e.size), this.score.set(e.score), this.binaryPattern.set(e.binaryPattern), this.setSigma(e.sigma), this.count = e.count;
1910
1910
  }
1911
1911
  }
1912
- class pa {
1912
+ class ga {
1913
1913
  constructor() {
1914
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);
1915
1915
  }
@@ -1923,7 +1923,7 @@ class pa {
1923
1923
  } = this;
1924
1924
  e.resize(o), e.setSigma(r);
1925
1925
  const a = Math.floor(o * o * i), l = e.binaryPattern;
1926
- ma(l, a), da(l, this.random);
1926
+ pa(l, a), ma(l, this.random);
1927
1927
  for (let u = 0, n = l.length; u < n; u++)
1928
1928
  l[u] === 1 && e.addPointIndex(u);
1929
1929
  for (; ; ) {
@@ -1938,27 +1938,27 @@ class pa {
1938
1938
  }
1939
1939
  const h = new Uint32Array(o * o);
1940
1940
  t.copy(e);
1941
- let f;
1942
- for (f = e.count - 1; f >= 0; ) {
1941
+ let d;
1942
+ for (d = e.count - 1; d >= 0; ) {
1943
1943
  const u = e.findCluster();
1944
- e.removePointIndex(u), h[u] = f, f--;
1944
+ e.removePointIndex(u), h[u] = d, d--;
1945
1945
  }
1946
- const d = o * o;
1947
- for (f = t.count; f < d / 2; ) {
1946
+ const f = o * o;
1947
+ for (d = t.count; d < f / 2; ) {
1948
1948
  const u = t.findVoid();
1949
- t.addPointIndex(u), h[u] = f, f++;
1949
+ t.addPointIndex(u), h[u] = d, d++;
1950
1950
  }
1951
- for (t.invert(); f < d; ) {
1951
+ for (t.invert(); d < f; ) {
1952
1952
  const u = t.findCluster();
1953
- t.removePointIndex(u), h[u] = f, f++;
1953
+ t.removePointIndex(u), h[u] = d, d++;
1954
1954
  }
1955
- return { data: h, maxValue: d };
1955
+ return { data: h, maxValue: f };
1956
1956
  }
1957
1957
  }
1958
- function ga(s) {
1958
+ function va(s) {
1959
1959
  return s >= 3 ? 4 : s;
1960
1960
  }
1961
- function va(s) {
1961
+ function xa(s) {
1962
1962
  switch (s) {
1963
1963
  case 1:
1964
1964
  return me;
@@ -1968,27 +1968,27 @@ function va(s) {
1968
1968
  return I;
1969
1969
  }
1970
1970
  }
1971
- class xa extends M {
1971
+ class ba extends M {
1972
1972
  constructor(e = 64, t = 1) {
1973
1973
  super(new Float32Array(4), 1, 1, I, R), this.minFilter = T, this.magFilter = T, this.size = e, this.channels = t, this.update();
1974
1974
  }
1975
1975
  update() {
1976
- const e = this.channels, t = this.size, r = new pa();
1976
+ const e = this.channels, t = this.size, r = new ga();
1977
1977
  r.channels = e, r.size = t;
1978
- const i = ga(e), o = va(i);
1978
+ const i = va(e), o = xa(i);
1979
1979
  (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
1980
  const a = this.image.data;
1981
1981
  for (let l = 0, h = e; l < h; l++) {
1982
- const f = r.generate(), d = f.data, u = f.maxValue;
1983
- for (let n = 0, v = d.length; n < v; n++) {
1984
- const m = d[n] / u;
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;
1985
1985
  a[n * i + l] = m;
1986
1986
  }
1987
1987
  }
1988
1988
  this.needsUpdate = !0;
1989
1989
  }
1990
1990
  }
1991
- const ba = (
1991
+ const ya = (
1992
1992
  /* glsl */
1993
1993
  `
1994
1994
 
@@ -2003,7 +2003,7 @@ const ba = (
2003
2003
  };
2004
2004
 
2005
2005
  `
2006
- ), ya = (
2006
+ ), Ta = (
2007
2007
  /* glsl */
2008
2008
  `
2009
2009
 
@@ -2018,7 +2018,7 @@ const ba = (
2018
2018
  };
2019
2019
 
2020
2020
  `
2021
- ), Ta = (
2021
+ ), wa = (
2022
2022
  /* glsl */
2023
2023
  `
2024
2024
 
@@ -2107,7 +2107,7 @@ const ba = (
2107
2107
  }
2108
2108
 
2109
2109
  `
2110
- ), wa = (
2110
+ ), Ia = (
2111
2111
  /* glsl */
2112
2112
  `
2113
2113
 
@@ -2317,7 +2317,7 @@ const ba = (
2317
2317
  }
2318
2318
 
2319
2319
  `
2320
- ), Ia = (
2320
+ ), Ra = (
2321
2321
  /* glsl */
2322
2322
  `
2323
2323
 
@@ -2382,7 +2382,7 @@ const ba = (
2382
2382
  };
2383
2383
 
2384
2384
  `
2385
- ), Ra = (
2385
+ ), Sa = (
2386
2386
  /* glsl */
2387
2387
  `
2388
2388
 
@@ -2452,7 +2452,7 @@ const ba = (
2452
2452
 
2453
2453
  }
2454
2454
  `
2455
- ), Sa = (
2455
+ ), _a = (
2456
2456
  /* glsl */
2457
2457
  `
2458
2458
 
@@ -2670,7 +2670,7 @@ const ba = (
2670
2670
  }
2671
2671
 
2672
2672
  `
2673
- ), _a = (
2673
+ ), Ma = (
2674
2674
  /* glsl */
2675
2675
  `
2676
2676
 
@@ -2758,7 +2758,7 @@ const ba = (
2758
2758
 
2759
2759
 
2760
2760
  `
2761
- ), Ma = (
2761
+ ), Aa = (
2762
2762
  /* glsl */
2763
2763
  `
2764
2764
 
@@ -2864,7 +2864,7 @@ const ba = (
2864
2864
  }
2865
2865
 
2866
2866
  `
2867
- ), Aa = (
2867
+ ), Fa = (
2868
2868
  /* glsl */
2869
2869
  `
2870
2870
 
@@ -2947,7 +2947,7 @@ const ba = (
2947
2947
  }
2948
2948
 
2949
2949
  `
2950
- ), Fa = (
2950
+ ), Ca = (
2951
2951
  /* glsl */
2952
2952
  `
2953
2953
 
@@ -3011,7 +3011,7 @@ const ba = (
3011
3011
  }
3012
3012
 
3013
3013
  `
3014
- ), Ca = (
3014
+ ), Da = (
3015
3015
  /*glsl */
3016
3016
  `
3017
3017
 
@@ -3214,7 +3214,7 @@ const ba = (
3214
3214
 
3215
3215
  }
3216
3216
  `
3217
- ), Da = (
3217
+ ), Pa = (
3218
3218
  /* glsl */
3219
3219
  `
3220
3220
 
@@ -3266,7 +3266,7 @@ const ba = (
3266
3266
  }
3267
3267
 
3268
3268
  `
3269
- ), Pa = (
3269
+ ), Ea = (
3270
3270
  /* glsl */
3271
3271
  `
3272
3272
 
@@ -3707,7 +3707,7 @@ const ba = (
3707
3707
  }
3708
3708
 
3709
3709
  `
3710
- ), Ea = (
3710
+ ), ka = (
3711
3711
  /* glsl */
3712
3712
  `
3713
3713
 
@@ -3731,7 +3731,7 @@ const ba = (
3731
3731
  }
3732
3732
 
3733
3733
  `
3734
- ), ka = (
3734
+ ), Oa = (
3735
3735
  /* glsl */
3736
3736
  `
3737
3737
 
@@ -3835,7 +3835,7 @@ const ba = (
3835
3835
  }
3836
3836
 
3837
3837
  `
3838
- ), Oa = (
3838
+ ), za = (
3839
3839
  /* glsl */
3840
3840
  `
3841
3841
 
@@ -3972,7 +3972,7 @@ const ba = (
3972
3972
  }
3973
3973
 
3974
3974
  `
3975
- ), za = (
3975
+ ), Na = (
3976
3976
  /* glsl */
3977
3977
  `
3978
3978
 
@@ -4072,7 +4072,7 @@ const ba = (
4072
4072
  }
4073
4073
 
4074
4074
  `
4075
- ), Na = (
4075
+ ), Ha = (
4076
4076
  /* glsl */
4077
4077
  `
4078
4078
 
@@ -4316,7 +4316,7 @@ bool bvhIntersectFogVolumeHit(
4316
4316
  }
4317
4317
 
4318
4318
  `
4319
- ), Ha = (
4319
+ ), Wa = (
4320
4320
  /* glsl */
4321
4321
  `
4322
4322
 
@@ -4402,7 +4402,7 @@ bool bvhIntersectFogVolumeHit(
4402
4402
  }
4403
4403
 
4404
4404
  `
4405
- ), Wa = (
4405
+ ), La = (
4406
4406
  /*glsl*/
4407
4407
  `
4408
4408
 
@@ -4501,7 +4501,7 @@ bool bvhIntersectFogVolumeHit(
4501
4501
  }
4502
4502
 
4503
4503
  `
4504
- ), La = (
4504
+ ), Ua = (
4505
4505
  /* glsl */
4506
4506
  `
4507
4507
 
@@ -4826,7 +4826,7 @@ bool bvhIntersectFogVolumeHit(
4826
4826
 
4827
4827
  }
4828
4828
  `
4829
- ), Ua = (
4829
+ ), Va = (
4830
4830
  /* glsl */
4831
4831
  `
4832
4832
 
@@ -4878,7 +4878,7 @@ bool bvhIntersectFogVolumeHit(
4878
4878
  }
4879
4879
 
4880
4880
  `
4881
- ), Va = (
4881
+ ), Ga = (
4882
4882
  /* glsl */
4883
4883
  `
4884
4884
 
@@ -4929,7 +4929,7 @@ bool bvhIntersectFogVolumeHit(
4929
4929
 
4930
4930
  `
4931
4931
  );
4932
- class Ga extends De {
4932
+ class qa extends De {
4933
4933
  onBeforeRender() {
4934
4934
  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
4935
  }
@@ -4965,17 +4965,17 @@ class Ga extends De {
4965
4965
  transmissiveBounces: { value: 10 },
4966
4966
  filterGlossyFactor: { value: 0 },
4967
4967
  // camera uniforms
4968
- physicalCamera: { value: new Wr() },
4968
+ physicalCamera: { value: new Lr() },
4969
4969
  cameraWorldMatrix: { value: new O() },
4970
4970
  invProjectionMatrix: { value: new O() },
4971
4971
  // scene uniforms
4972
- bvh: { value: new or() },
4973
- attributesArray: { value: new Zr() },
4972
+ bvh: { value: new nr() },
4973
+ attributesArray: { value: new Jr() },
4974
4974
  materialIndexAttribute: { value: new vt() },
4975
- materials: { value: new ia() },
4975
+ materials: { value: new sa() },
4976
4976
  textures: { value: new rt().texture },
4977
4977
  // light uniforms
4978
- lights: { value: new Qr() },
4978
+ lights: { value: new Kr() },
4979
4979
  iesProfiles: { value: new rt(360, 180, {
4980
4980
  type: D,
4981
4981
  wrapS: N,
@@ -4983,7 +4983,7 @@ class Ga extends De {
4983
4983
  }).texture },
4984
4984
  environmentIntensity: { value: 1 },
4985
4985
  environmentRotation: { value: new O() },
4986
- envMapInfo: { value: new Vr() },
4986
+ envMapInfo: { value: new Gr() },
4987
4987
  // background uniforms
4988
4988
  backgroundBlur: { value: 0 },
4989
4989
  backgroundMap: { value: null },
@@ -4993,8 +4993,8 @@ class Ga extends De {
4993
4993
  // randomness uniforms
4994
4994
  seed: { value: 0 },
4995
4995
  sobolTexture: { value: null },
4996
- stratifiedTexture: { value: new fa() },
4997
- stratifiedOffsetTexture: { value: new xa(64, 1) }
4996
+ stratifiedTexture: { value: new da() },
4997
+ stratifiedOffsetTexture: { value: new ba(64, 1) }
4998
4998
  },
4999
4999
  vertexShader: (
5000
5000
  /* glsl */
@@ -5026,27 +5026,27 @@ class Ga extends De {
5026
5026
  #include <common>
5027
5027
 
5028
5028
  // bvh intersection
5029
- ${cr}
5030
- ${hr}
5031
5029
  ${ur}
5030
+ ${fr}
5031
+ ${hr}
5032
5032
 
5033
5033
  // uniform structs
5034
- ${ba}
5035
- ${Ta}
5036
5034
  ${ya}
5037
5035
  ${wa}
5036
+ ${Ta}
5038
5037
  ${Ia}
5038
+ ${Ra}
5039
5039
 
5040
5040
  // random
5041
5041
  #if RANDOM_TYPE == 2 // Stratified List
5042
5042
 
5043
- ${Da}
5043
+ ${Pa}
5044
5044
 
5045
5045
  #elif RANDOM_TYPE == 1 // Sobol
5046
5046
 
5047
5047
  ${it}
5048
5048
  ${wt}
5049
- ${zr}
5049
+ ${Nr}
5050
5050
 
5051
5051
  #define rand(v) sobol(v)
5052
5052
  #define rand2(v) sobol2(v)
@@ -5071,11 +5071,11 @@ class Ga extends De {
5071
5071
  #endif
5072
5072
 
5073
5073
  // common
5074
- ${Ca}
5075
- ${Ma}
5076
- ${Rt}
5074
+ ${Da}
5077
5075
  ${Aa}
5076
+ ${Rt}
5078
5077
  ${Fa}
5078
+ ${Ca}
5079
5079
 
5080
5080
  // environment
5081
5081
  uniform EquirectHdrInfo envMapInfo;
@@ -5131,16 +5131,16 @@ class Ga extends De {
5131
5131
  float lightsDenom;
5132
5132
 
5133
5133
  // sampling
5134
- ${_a}
5135
- ${Ra}
5134
+ ${Ma}
5136
5135
  ${Sa}
5136
+ ${_a}
5137
5137
 
5138
+ ${Ha}
5139
+ ${Oa}
5138
5140
  ${Na}
5139
- ${ka}
5140
5141
  ${za}
5141
- ${Oa}
5142
+ ${ka}
5142
5143
  ${Ea}
5143
- ${Pa}
5144
5144
 
5145
5145
  float applyFilteredGlossy( float roughness, float accumulatedRoughness ) {
5146
5146
 
@@ -5172,12 +5172,12 @@ class Ga extends De {
5172
5172
 
5173
5173
  }
5174
5174
 
5175
- ${Ua}
5176
- ${Ha}
5177
5175
  ${Va}
5178
- ${Ba}
5179
5176
  ${Wa}
5177
+ ${Ga}
5178
+ ${Ba}
5180
5179
  ${La}
5180
+ ${Ua}
5181
5181
 
5182
5182
  void main() {
5183
5183
 
@@ -5474,7 +5474,7 @@ class Ga extends De {
5474
5474
  }), this.setValues(e);
5475
5475
  }
5476
5476
  }
5477
- function* qa() {
5477
+ function* $a() {
5478
5478
  const {
5479
5479
  _renderer: s,
5480
5480
  _fsQuad: e,
@@ -5485,17 +5485,17 @@ function* qa() {
5485
5485
  _subframe: a,
5486
5486
  alpha: l,
5487
5487
  material: h
5488
- } = this, f = new J(), d = new J(), u = t.material;
5489
- let [n, v] = i;
5488
+ } = this, d = new J(), f = new J(), u = t.material;
5489
+ let [n, x] = i;
5490
5490
  for (; ; ) {
5491
5491
  l ? (u.opacity = this._opacityFactor / (this.samples + 1), h.blending = ie, h.opacity = 1) : (h.opacity = this._opacityFactor / (this.samples + 1), h.blending = mt);
5492
- const [m, g, c, p] = a, x = r.width, b = r.height;
5493
- h.resolution.set(x * c, b * p), h.sobolTexture = o.texture, h.stratifiedTexture.init(20, h.bounces + h.transmissiveBounces + 5), h.stratifiedTexture.next(), h.seed++;
5494
- const y = this.tiles.x || 1, w = this.tiles.y || 1, E = y * w, B = Math.ceil(x * c), ge = Math.ceil(b * p), Ee = Math.floor(m * x), ke = Math.floor(g * b), ve = Math.ceil(B / y), xe = Math.ceil(ge / w);
5492
+ 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++;
5494
+ const y = this.tiles.x || 1, w = this.tiles.y || 1, E = y * w, H = Math.ceil(v * c), ge = Math.ceil(b * p), Ee = Math.floor(m * v), ke = Math.floor(g * b), ve = Math.ceil(H / y), xe = Math.ceil(ge / w);
5495
5495
  for (let oe = 0; oe < w; oe++)
5496
5496
  for (let ne = 0; ne < y; ne++) {
5497
5497
  const Oe = s.getRenderTarget(), St = s.autoClear, _t = s.getScissorTest();
5498
- s.getScissor(f), s.getViewport(d);
5498
+ s.getScissor(d), s.getViewport(f);
5499
5499
  let be = ne, ze = oe;
5500
5500
  if (!this.stableTiles) {
5501
5501
  const ye = this._currentTile % (y * w);
@@ -5505,16 +5505,16 @@ function* qa() {
5505
5505
  r.scissor.set(
5506
5506
  Ee + be * ve,
5507
5507
  ke + Ne * xe,
5508
- Math.min(ve, B - be * ve),
5508
+ Math.min(ve, H - be * ve),
5509
5509
  Math.min(xe, ge - Ne * xe)
5510
5510
  ), r.viewport.set(
5511
5511
  Ee,
5512
5512
  ke,
5513
- B,
5513
+ H,
5514
5514
  ge
5515
- ), s.setRenderTarget(r), s.setScissorTest(!0), s.autoClear = !1, e.render(s), s.setViewport(d), s.setScissor(f), s.setScissorTest(_t), s.setRenderTarget(Oe), s.autoClear = St, l && (u.target1 = n.texture, u.target2 = r.texture, s.setRenderTarget(v), t.render(s), s.setRenderTarget(Oe)), this.samples += 1 / E, ne === y - 1 && oe === w - 1 && (this.samples = Math.round(this.samples)), yield;
5515
+ ), s.setRenderTarget(r), s.setScissorTest(!0), s.autoClear = !1, e.render(s), s.setViewport(f), s.setScissor(d), s.setScissorTest(_t), s.setRenderTarget(Oe), s.autoClear = St, l && (u.target1 = n.texture, u.target2 = r.texture, s.setRenderTarget(x), t.render(s), s.setRenderTarget(Oe)), this.samples += 1 / E, ne === y - 1 && oe === w - 1 && (this.samples = Math.round(this.samples)), yield;
5516
5516
  }
5517
- [n, v] = [v, n];
5517
+ [n, x] = [x, n];
5518
5518
  }
5519
5519
  }
5520
5520
  const st = new se();
@@ -5538,7 +5538,7 @@ class ot {
5538
5538
  return !!this._compilePromise;
5539
5539
  }
5540
5540
  constructor(e) {
5541
- this.camera = null, this.tiles = new j(3, 3), this.stableNoise = !1, this.stableTiles = !0, this.samples = 0, this._subframe = new J(0, 0, 1, 1), this._opacityFactor = 1, this._renderer = e, this._alpha = !1, this._fsQuad = new ee(new Ga()), this._blendQuad = new ee(new kr()), this._task = null, this._currentTile = 0, this._compilePromise = null, this._sobolTarget = new Br().generate(e), this._primaryTarget = new ae(1, 1, {
5541
+ this.camera = null, this.tiles = new j(3, 3), this.stableNoise = !1, this.stableTiles = !0, this.samples = 0, this._subframe = new J(0, 0, 1, 1), this._opacityFactor = 1, this._renderer = e, this._alpha = !1, this._fsQuad = new ee(new qa()), this._blendQuad = new ee(new Or()), this._task = null, this._currentTile = 0, this._compilePromise = null, this._sobolTarget = new Br().generate(e), this._primaryTarget = new ae(1, 1, {
5542
5542
  format: I,
5543
5543
  type: R,
5544
5544
  magFilter: T,
@@ -5586,11 +5586,11 @@ class ot {
5586
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());
5587
5587
  }
5588
5588
  update() {
5589
- this.material.onBeforeRender(), !this.isCompiling && (this._task || (this._task = qa.call(this)), this._task.next());
5589
+ this.material.onBeforeRender(), !this.isCompiling && (this._task || (this._task = $a.call(this)), this._task.next());
5590
5590
  }
5591
5591
  }
5592
5592
  const q = new j(), nt = new j(), fe = new Lt(), de = new se();
5593
- class $a extends M {
5593
+ class ja extends M {
5594
5594
  constructor(e = 512, t = 512) {
5595
5595
  super(
5596
5596
  new Float32Array(e * t * 4),
@@ -5620,7 +5620,7 @@ class $a extends M {
5620
5620
  }
5621
5621
  }
5622
5622
  const lt = new C();
5623
- class ja extends $a {
5623
+ class Ya extends ja {
5624
5624
  constructor(e = 512) {
5625
5625
  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
5626
  lt.setFromSpherical(t);
@@ -5632,7 +5632,7 @@ class ja extends $a {
5632
5632
  return super.copy(e), this.topColor.copy(e.topColor), this.bottomColor.copy(e.bottomColor), this;
5633
5633
  }
5634
5634
  }
5635
- class Ya extends pe {
5635
+ class Xa extends pe {
5636
5636
  get map() {
5637
5637
  return this.uniforms.map.value;
5638
5638
  }
@@ -5719,7 +5719,7 @@ class Ya extends pe {
5719
5719
  }), this.setValues(e);
5720
5720
  }
5721
5721
  }
5722
- class Xa extends pe {
5722
+ class Qa extends pe {
5723
5723
  constructor() {
5724
5724
  super({
5725
5725
  uniforms: {
@@ -5764,7 +5764,7 @@ class Xa extends pe {
5764
5764
  }
5765
5765
  class ct {
5766
5766
  constructor(e) {
5767
- this._renderer = e, this._quad = new ee(new Xa());
5767
+ this._renderer = e, this._quad = new ee(new Qa());
5768
5768
  }
5769
5769
  generate(e, t = null, r = null) {
5770
5770
  if (!e.isCubeTexture)
@@ -5774,13 +5774,13 @@ class ct {
5774
5774
  const l = new ae(t, r, {
5775
5775
  type: R,
5776
5776
  colorSpace: i.colorSpace
5777
- }), h = i.height, f = Math.log2(h) - 2, d = 1 / h, u = 1 / (3 * Math.max(Math.pow(2, f), 112));
5778
- a.material.defines.CUBEUV_MAX_MIP = `${f}.0`, a.material.defines.CUBEUV_TEXEL_WIDTH = u, a.material.defines.CUBEUV_TEXEL_HEIGHT = d, a.material.uniforms.envMap.value = e, a.material.uniforms.flipEnvMap.value = e.isRenderTargetTexture ? 1 : -1, a.material.needsUpdate = !0;
5779
- const n = o.getRenderTarget(), v = o.autoClear;
5780
- o.autoClear = !0, o.setRenderTarget(l), a.render(o), o.setRenderTarget(n), o.autoClear = v;
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;
5779
+ const n = o.getRenderTarget(), x = o.autoClear;
5780
+ o.autoClear = !0, o.setRenderTarget(l), a.render(o), o.setRenderTarget(n), o.autoClear = x;
5781
5781
  const m = new Uint16Array(t * r * 4), g = new Float32Array(t * r * 4);
5782
5782
  o.readRenderTargetPixels(l, 0, 0, t, r, g), l.dispose();
5783
- for (let p = 0, x = g.length; p < x; p++)
5783
+ for (let p = 0, v = g.length; p < v; p++)
5784
5784
  m[p] = k.toHalfFloat(g[p]);
5785
5785
  const c = new M(m, t, r, I, D);
5786
5786
  return c.minFilter = Ut, c.magFilter = F, c.wrapS = z, c.wrapT = z, c.mapping = pt, c.needsUpdate = !0, c;
@@ -5789,11 +5789,11 @@ class ct {
5789
5789
  this._quad.dispose();
5790
5790
  }
5791
5791
  }
5792
- function Qa(s) {
5792
+ function Ka(s) {
5793
5793
  return s.extensions.get("EXT_float_blend");
5794
5794
  }
5795
5795
  const Q = new j();
5796
- class Ka {
5796
+ class Za {
5797
5797
  get multipleImportanceSampling() {
5798
5798
  return !!this._pathTracer.material.defines.FEATURE_MIS;
5799
5799
  }
@@ -5837,7 +5837,7 @@ class Ka {
5837
5837
  return !!this._pathTracer.isCompiling;
5838
5838
  }
5839
5839
  constructor(e) {
5840
- this._renderer = e, this._generator = new Cr(), this._pathTracer = new ot(e), this._queueReset = !1, this._clock = new Vt(), this._compilePromise = null, this._lowResPathTracer = new ot(e), this._lowResPathTracer.tiles.set(1, 1), this._quad = new ee(new Ya({
5840
+ this._renderer = e, this._generator = new Dr(), this._pathTracer = new ot(e), this._queueReset = !1, this._clock = new Vt(), this._compilePromise = null, this._lowResPathTracer = new ot(e), this._lowResPathTracer.tiles.set(1, 1), this._quad = new ee(new Xa({
5841
5841
  map: null,
5842
5842
  transparent: !0,
5843
5843
  blending: ie,
@@ -5875,11 +5875,11 @@ class Ka {
5875
5875
  e.updateMatrixWorld(), this._pathTracer.setCamera(e), this._lowResPathTracer.setCamera(e), this.reset();
5876
5876
  }
5877
5877
  updateMaterials() {
5878
- const e = this._pathTracer.material, t = this._renderer, r = this._materials, i = this.textureSize, o = ta(r);
5878
+ const e = this._pathTracer.material, t = this._renderer, r = this._materials, i = this.textureSize, o = ra(r);
5879
5879
  e.textures.setTextures(t, o, i.x, i.y), e.materials.updateFrom(r, o), this.reset();
5880
5880
  }
5881
5881
  updateLights() {
5882
- const e = this.scene, t = this._renderer, r = this._pathTracer.material, i = ra(e), o = ea(i);
5882
+ const e = this.scene, t = this._renderer, r = this._pathTracer.material, i = aa(e), o = ta(i);
5883
5883
  r.lights.updateFrom(i, o), r.iesProfiles.setTextures(t, o), this.reset();
5884
5884
  }
5885
5885
  updateEnvironment() {
@@ -5887,7 +5887,7 @@ class Ka {
5887
5887
  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
5888
  t.backgroundMap = null, t.backgroundAlpha = 0;
5889
5889
  else if (e.background.isColor) {
5890
- this._colorBackground = this._colorBackground || new ja(16);
5890
+ this._colorBackground = this._colorBackground || new Ya(16);
5891
5891
  const r = this._colorBackground;
5892
5892
  r.topColor.equals(e.background) || (r.topColor.set(e.background), r.bottomColor.set(e.background), r.update()), t.backgroundMap = r, t.backgroundAlpha = 1;
5893
5893
  } else if (e.background.isCubeTexture) {
@@ -5916,25 +5916,25 @@ class Ka {
5916
5916
  bvhChanged: l
5917
5917
  } = r;
5918
5918
  this._materials = i;
5919
- const f = this._pathTracer.material;
5920
- return l && (f.bvh.updateFrom(a), f.attributesArray.updateFrom(
5919
+ const d = this._pathTracer.material;
5920
+ return l && (d.bvh.updateFrom(a), d.attributesArray.updateFrom(
5921
5921
  o.attributes.normal,
5922
5922
  o.attributes.tangent,
5923
5923
  o.attributes.uv,
5924
5924
  o.attributes.color
5925
- ), f.materialIndexAttribute.updateFrom(o.attributes.materialIndex)), this._previousScene = e, this.scene = e, this.camera = t, this.updateCamera(), this.updateMaterials(), this.updateEnvironment(), this.updateLights(), r;
5925
+ ), d.materialIndexAttribute.updateFrom(o.attributes.materialIndex)), this._previousScene = e, this.scene = e, this.camera = t, this.updateCamera(), this.updateMaterials(), this.updateEnvironment(), this.updateLights(), r;
5926
5926
  }
5927
5927
  renderSample() {
5928
5928
  const e = this._lowResPathTracer, t = this._pathTracer, r = this._renderer, i = this._clock, o = this._quad;
5929
5929
  this._updateScale(), this._queueReset && (t.reset(), e.reset(), this._queueReset = !1, o.material.opacity = 0, i.start());
5930
5930
  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 || !Qa(r), e.alpha = t.alpha, this.renderToCanvas) {
5932
- const h = this._renderer, f = this.minSamples;
5933
- 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 < f || o.material.opacity < 1) {
5931
+ if (!this.pausePathTracing && this.enablePathTracing && this.renderDelay <= l && !this.isCompiling && t.update(), t.alpha = t.material.backgroundAlpha !== 1 || !Ka(r), e.alpha = t.alpha, this.renderToCanvas) {
5932
+ const h = this._renderer, d = this.minSamples;
5933
+ 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
5934
  if (this.dynamicLowRes && !this.isCompiling) {
5935
5935
  e.samples < 1 && (e.material = t.material, e.update());
5936
- const d = o.material.opacity;
5937
- o.material.opacity = 1 - o.material.opacity, o.material.map = e.target.texture, o.render(h), o.material.opacity = d;
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;
5938
5938
  }
5939
5939
  (!this.dynamicLowRes && this.rasterizeScene || this.dynamicLowRes && this.isCompiling) && this.rasterizeSceneCallback(this.scene, this.camera);
5940
5940
  }
@@ -5961,7 +5961,7 @@ class Ka {
5961
5961
  function K(s) {
5962
5962
  return s !== null && typeof s == "object" && "getInternalRenderer" in s && typeof s.getInternalRenderer == "function";
5963
5963
  }
5964
- class ei {
5964
+ class ti {
5965
5965
  constructor() {
5966
5966
  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.disposeTimer = null, this.convertedEnvTexture = null, this.lastResetTime = 0, this.events = new rr(), this.settings = {
5967
5967
  samples: ar,
@@ -5976,6 +5976,27 @@ class ei {
5976
5976
  enablePathTracing: !0
5977
5977
  };
5978
5978
  }
5979
+ /**
5980
+ * Hand the scene to the path tracer with the viewer's own contact-shadow
5981
+ * helpers hidden: the tracer computes physically-correct contact shadows
5982
+ * itself, so ingesting the baked disc double-darkens the contact area (and
5983
+ * the live ShadowMaterial catcher is equally meaningless to it). The
5984
+ * generator skips invisible nodes; visibility is restored right after the
5985
+ * ingest so the raster fallback path keeps its baked shadow.
5986
+ */
5987
+ ingestSceneWithoutShadowHelpers(e, t) {
5988
+ var i;
5989
+ const r = [];
5990
+ e.traverse((o) => {
5991
+ var a;
5992
+ (a = o.userData) != null && a[ir] && o.visible && r.push(o);
5993
+ }), r.forEach((o) => o.visible = !1);
5994
+ try {
5995
+ (i = this.pathTracer) == null || i.setScene(e, t);
5996
+ } finally {
5997
+ r.forEach((o) => o.visible = !0);
5998
+ }
5999
+ }
5979
6000
  /**
5980
6001
  * Convert an HTMLImageElement-based texture to a DataTexture for path tracing
5981
6002
  */
@@ -5991,12 +6012,12 @@ class ei {
5991
6012
  const o = i.getImageData(0, 0, r.width, r.height), a = new Float32Array(o.data.length);
5992
6013
  for (let h = 0; h < o.data.length; h++)
5993
6014
  a[h] = o.data[h] / 255;
5994
- const l = new H.DataTexture(
6015
+ const l = new B.DataTexture(
5995
6016
  a,
5996
6017
  r.width,
5997
6018
  r.height,
5998
- H.RGBAFormat,
5999
- H.FloatType
6019
+ B.RGBAFormat,
6020
+ B.FloatType
6000
6021
  );
6001
6022
  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;
6002
6023
  }
@@ -6029,7 +6050,7 @@ class ei {
6029
6050
  );
6030
6051
  try {
6031
6052
  const e = K(this.renderer) ? this.renderer.getInternalRenderer() : null;
6032
- return e ? (this.pathTracer = new Ka(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 !== H.ACESFilmicToneMapping && (e.toneMapping = H.ACESFilmicToneMapping, e.toneMappingExposure = 1.5), e.autoClear = !1, e.setRenderTarget(null), S.ok(void 0)) : S.err(
6053
+ return e ? (this.pathTracer = new Za(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.autoClear = !1, e.setRenderTarget(null), S.ok(void 0)) : S.err(
6033
6054
  new W(
6034
6055
  "Renderer not ready, will retry",
6035
6056
  L.RENDERER_NOT_INITIALIZED
@@ -6139,42 +6160,42 @@ class ei {
6139
6160
  * waiting, or the environment shape isn't one the tracer can use.
6140
6161
  */
6141
6162
  async initializeSceneForPathTracing(e, t, r, i, o) {
6142
- var a, l, h;
6163
+ var a;
6143
6164
  try {
6144
- const f = i.__originalEnvironmentTexture;
6145
- if (!i.environment && !f)
6165
+ const l = i.__originalEnvironmentTexture;
6166
+ if (!i.environment && !l)
6146
6167
  return this.environmentWaitFrames++, this.environmentWaitFrames >= this.maxEnvironmentWaitFrames && (this.disableAfterSelfPause("gave-up"), this.environmentWaitFrames = 0), e.render(t, r);
6147
- if (this.environmentWaitFrames = 0, f && f.mapping === H.EquirectangularReflectionMapping) {
6148
- let d = f;
6149
- if (f.image instanceof HTMLImageElement)
6168
+ if (this.environmentWaitFrames = 0, l && l.mapping === B.EquirectangularReflectionMapping) {
6169
+ let h = l;
6170
+ if (l.image instanceof HTMLImageElement)
6150
6171
  if (this.convertedEnvTexture)
6151
- d = this.convertedEnvTexture;
6172
+ h = this.convertedEnvTexture;
6152
6173
  else {
6153
- const n = this.convertToDataTexture(f);
6154
- if (!n)
6174
+ const f = this.convertToDataTexture(l);
6175
+ if (!f)
6155
6176
  throw new Error("Failed to convert environment texture to DataTexture");
6156
- this.convertedEnvTexture = n, d = n;
6177
+ this.convertedEnvTexture = f, h = f;
6157
6178
  }
6158
- const u = i.environment;
6159
- i.environment = d;
6179
+ const d = i.environment;
6180
+ i.environment = h;
6160
6181
  try {
6161
- const n = f.image;
6162
- n && !("data" in n && n.data) && n instanceof HTMLImageElement && !n.complete && await new Promise((v) => {
6163
- n.onload = () => {
6164
- f.needsUpdate = !0, v();
6165
- }, n.onerror = () => {
6166
- v();
6167
- }, n.complete && v();
6168
- }), (a = this.pathTracer) == null || a.setScene(i, o), this.sceneInitialized = !0, i.environment = u;
6169
- } catch (n) {
6170
- throw i.environment = u, n;
6182
+ const f = l.image;
6183
+ f && !("data" in f && f.data) && f instanceof HTMLImageElement && !f.complete && await new Promise((u) => {
6184
+ f.onload = () => {
6185
+ l.needsUpdate = !0, u();
6186
+ }, f.onerror = () => {
6187
+ u();
6188
+ }, f.complete && u();
6189
+ }), this.ingestSceneWithoutShadowHelpers(i, o), this.sceneInitialized = !0, i.environment = d;
6190
+ } catch (f) {
6191
+ throw i.environment = d, f;
6171
6192
  }
6172
- } else if (((l = i.environment) == null ? void 0 : l.mapping) === H.EquirectangularReflectionMapping)
6173
- (h = this.pathTracer) == null || h.setScene(i, o), this.sceneInitialized = !0;
6193
+ } else if (((a = i.environment) == null ? void 0 : a.mapping) === B.EquirectangularReflectionMapping)
6194
+ this.ingestSceneWithoutShadowHelpers(i, o), this.sceneInitialized = !0;
6174
6195
  else
6175
6196
  return this.disableAfterSelfPause("gave-up"), e.render(t, r);
6176
- } catch (f) {
6177
- return console.warn("Scene initialization error:", f), e.render(t, r);
6197
+ } catch (l) {
6198
+ return console.warn("Scene initialization error:", l), e.render(t, r);
6178
6199
  }
6179
6200
  return null;
6180
6201
  }
@@ -6245,9 +6266,9 @@ class ei {
6245
6266
  isPathTracerDisposed() {
6246
6267
  return this.disposed;
6247
6268
  }
6248
- reset() {
6249
- const e = performance.now();
6250
- e - this.lastResetTime < 50 || (this.lastResetTime = e, this.sampleCount = 0, this.pathTracer && (this.pathTracer.reset(), this.sceneInitialized = !1));
6269
+ reset(e = !1) {
6270
+ const t = performance.now();
6271
+ !e && t - this.lastResetTime < 50 || (this.lastResetTime = t, this.sampleCount = 0, this.pathTracer && (this.pathTracer.reset(), this.sceneInitialized = !1));
6251
6272
  }
6252
6273
  /**
6253
6274
  * Dispose of path tracing resources after the final frame is on screen
@@ -6283,5 +6304,5 @@ class ei {
6283
6304
  }
6284
6305
  }
6285
6306
  export {
6286
- ei as ThreePathTracingService
6307
+ ti as ThreePathTracingService
6287
6308
  };