softbox 4.4.1 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
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-uh2exMyt.js";
4
- function sr(s) {
2
+ import { UnsignedIntType as re, DataTexture as M, NearestFilter as T, IntType as we, FloatType as R, UnsignedByteType as Me, UnsignedShortType as Ct, ByteType as Be, ShortType as Ft, RGBAFormat as I, RGBAIntegerFormat as Ae, RGIntegerFormat as ft, RedIntegerFormat as Dt, RGFormat as dt, RedFormat as me, BufferAttribute as P, BufferGeometry as $, Matrix4 as O, Matrix3 as Pt, Vector3 as F, Vector4 as Z, MeshBasicMaterial as Et, Mesh as mt, OrthographicCamera as kt, Float32BufferAttribute as We, ShaderMaterial as ge, NoBlending as ie, WebGLRenderTarget as ae, Vector2 as j, PerspectiveCamera as pt, DataUtils as k, HalfFloatType as D, LinearFilter as C, RepeatWrapping as z, ClampToEdgeWrapping as N, Source as Ot, Quaternion as zt, DataArrayTexture as Nt, DoubleSide as Ht, BackSide as Bt, FrontSide as Wt, WebGLArrayRenderTarget as Lt, Color as se, NoToneMapping as Ut, NormalBlending as gt, EquirectangularReflectionMapping as vt, Spherical as Vt, LinearMipMapLinearFilter as Gt, Clock as qt, Scene as $t, AdditiveBlending as jt } from "three";
3
+ import { g as Yt, a as Xt, B as Le, I as Qt, C as Kt, O as Zt, S as Jt, b as er, L as tr, c as rr, M as ar, T as ir, D as sr, d as or, R as S, e as W, E as L } from "./index-CC3LzFRV.js";
4
+ function nr(s) {
5
5
  switch (s) {
6
6
  case 1:
7
7
  return "R";
@@ -14,12 +14,12 @@ function sr(s) {
14
14
  }
15
15
  throw new Error();
16
16
  }
17
- function or(s) {
17
+ function lr(s) {
18
18
  switch (s) {
19
19
  case 1:
20
20
  return me;
21
21
  case 2:
22
- return ht;
22
+ return dt;
23
23
  case 3:
24
24
  return I;
25
25
  case 4:
@@ -29,16 +29,16 @@ function or(s) {
29
29
  function Ue(s) {
30
30
  switch (s) {
31
31
  case 1:
32
- return Ft;
32
+ return Dt;
33
33
  case 2:
34
- return ut;
34
+ return ft;
35
35
  case 3:
36
- return Me;
36
+ return Ae;
37
37
  case 4:
38
- return Me;
38
+ return Ae;
39
39
  }
40
40
  }
41
- class gt extends M {
41
+ class xt extends M {
42
42
  constructor() {
43
43
  super(), this.minFilter = T, this.magFilter = T, this.generateMipmaps = !1, this.overrideItemSize = null, this._forcedType = null;
44
44
  }
@@ -74,22 +74,22 @@ class gt extends M {
74
74
  case Int8Array:
75
75
  case Int16Array:
76
76
  case Int32Array:
77
- f = Te;
77
+ f = we;
78
78
  break;
79
79
  }
80
- let n, x, m, g, c = sr(o);
80
+ let n, x, m, g, c = nr(o);
81
81
  switch (f) {
82
82
  case 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);
83
+ m = 1, x = lr(o), l && d === 1 ? (g = h, c += "8", h === Uint8Array ? n = Me : (n = Be, c += "_SNORM")) : (g = Float32Array, c += "32F", n = R);
84
84
  break;
85
- case 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);
85
+ case we:
86
+ c += d * 8 + "I", m = l ? Math.pow(2, h.BYTES_PER_ELEMENT * 8 - 1) : 1, x = Ue(o), d === 1 ? (g = Int8Array, n = Be) : d === 2 ? (g = Int16Array, n = Ft) : (g = Int32Array, n = we);
87
87
  break;
88
88
  case re:
89
- c += d * 8 + "UI", m = l ? Math.pow(2, h.BYTES_PER_ELEMENT * 8 - 1) : 1, x = Ue(o), d === 1 ? (g = Uint8Array, n = _e) : d === 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 = Me) : d === 2 ? (g = Uint16Array, n = Ct) : (g = Uint32Array, n = re);
90
90
  break;
91
91
  }
92
- u === 3 && (x === I || x === Me) && (u = 4);
92
+ u === 3 && (x === I || x === Ae) && (u = 4);
93
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++) {
@@ -99,19 +99,19 @@ class gt extends M {
99
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
- class vt extends gt {
102
+ class bt extends xt {
103
103
  constructor() {
104
104
  super(), this._forcedType = re;
105
105
  }
106
106
  }
107
- class xt extends gt {
107
+ class yt extends xt {
108
108
  constructor() {
109
109
  super(), this._forcedType = R;
110
110
  }
111
111
  }
112
- class nr {
112
+ class cr {
113
113
  constructor() {
114
- this.index = new vt(), this.position = new xt(), this.bvhBounds = new M(), this.bvhContents = new M(), this._cachedIndexAttr = null, this.index.overrideItemSize = 3;
114
+ this.index = new bt(), this.position = new yt(), this.bvhBounds = new M(), this.bvhContents = new M(), this._cachedIndexAttr = null, this.index.overrideItemSize = 3;
115
115
  }
116
116
  /**
117
117
  * Updates the object and associated textures with data from the provided BVH.
@@ -121,16 +121,16 @@ class nr {
121
121
  */
122
122
  updateFrom(e) {
123
123
  const { geometry: t } = e;
124
- if (cr(e, this.bvhBounds, this.bvhContents), this.position.updateFrom(t.attributes.position), e.indirect) {
124
+ if (hr(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)
128
128
  this._cachedIndexAttr = t.index.clone();
129
129
  else {
130
- const i = $t(jt(t));
130
+ const i = Yt(Xt(t));
131
131
  this._cachedIndexAttr = new P(i, 1, !1);
132
132
  }
133
- lr(t, r, this._cachedIndexAttr), this.index.updateFrom(this._cachedIndexAttr);
133
+ ur(t, r, this._cachedIndexAttr), this.index.updateFrom(this._cachedIndexAttr);
134
134
  } else
135
135
  this.index.updateFrom(t.index);
136
136
  }
@@ -144,7 +144,7 @@ class nr {
144
144
  e && e.dispose(), t && t.dispose(), r && r.dispose(), i && i.dispose();
145
145
  }
146
146
  }
147
- function lr(s, e, t) {
147
+ function ur(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];
@@ -152,26 +152,26 @@ function lr(s, e, t) {
152
152
  r[l + d] = i ? i[h + d] : h + d;
153
153
  }
154
154
  }
155
- function cr(s, e, t) {
155
+ function hr(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, 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);
159
+ const i = r[0], o = new Uint16Array(i), a = new Uint32Array(i), l = new Float32Array(i), h = i.byteLength / Le, d = 2 * Math.ceil(Math.sqrt(h / 2)), f = new Float32Array(4 * d * d), u = Math.ceil(Math.sqrt(h)), n = new Uint32Array(2 * u * u);
160
160
  for (let x = 0; x < h; x++) {
161
- const m = x * We / 4, g = m * 2, c = Zt(m);
161
+ const m = x * Le / 4, g = m * 2, c = er(m);
162
162
  for (let p = 0; p < 3; p++)
163
163
  f[8 * x + 0 + p] = l[c + 0 + p], f[8 * x + 4 + p] = l[c + 3 + p];
164
- if (Yt(g, o)) {
165
- const p = Xt(g, o), v = Qt(m, a), b = Jt | p;
164
+ if (Qt(g, o)) {
165
+ const p = Kt(g, o), v = Zt(m, a), b = tr | p;
166
166
  n[x * 2 + 0] = b, n[x * 2 + 1] = v;
167
167
  } else {
168
- const p = a[m + 6], v = Kt(m, a);
168
+ const p = a[m + 6], v = Jt(m, a);
169
169
  n[x * 2 + 0] = v, n[x * 2 + 1] = p;
170
170
  }
171
171
  }
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();
172
+ e.image.data = f, e.image.width = d, e.image.height = d, e.format = I, e.type = R, e.internalFormat = "RGBA32F", e.minFilter = T, e.magFilter = T, e.generateMipmaps = !1, e.needsUpdate = !0, e.dispose(), t.image.data = n, t.image.width = u, t.image.height = u, t.format = ft, t.type = re, t.internalFormat = "RG32UI", t.minFilter = T, t.magFilter = T, t.generateMipmaps = !1, t.needsUpdate = !0, t.dispose();
173
173
  }
174
- const ur = (
174
+ const fr = (
175
175
  /* glsl */
176
176
  `
177
177
 
@@ -256,7 +256,7 @@ void ndcToCameraRay(
256
256
 
257
257
  }
258
258
  `
259
- ), hr = (
259
+ ), dr = (
260
260
  /* glsl */
261
261
  `
262
262
 
@@ -463,7 +463,7 @@ bool _bvhIntersectFirstHit(
463
463
 
464
464
  }
465
465
  `
466
- ), fr = (
466
+ ), mr = (
467
467
  /* glsl */
468
468
  `
469
469
  struct BVH {
@@ -477,7 +477,7 @@ struct BVH {
477
477
  };
478
478
  `
479
479
  );
480
- function bt(s, e, t = 0) {
480
+ function Tt(s, e, t = 0) {
481
481
  if (s.isInterleavedBufferAttribute) {
482
482
  const r = s.itemSize;
483
483
  for (let i = 0, o = s.count; i < o; i++) {
@@ -493,7 +493,7 @@ function te(s, e = null) {
493
493
  const t = s.array.constructor, r = s.normalized, i = s.itemSize, o = e === null ? s.count : e;
494
494
  return new P(new t(i * o), i, r);
495
495
  }
496
- function Z(s, e) {
496
+ function K(s, e) {
497
497
  if (!s && !e)
498
498
  return !0;
499
499
  if (!!s != !!e)
@@ -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 dr(s) {
504
+ function pr(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,34 +519,34 @@ function dr(s) {
519
519
  throw new Error("StaticGeometryGenerator: All geometries must have the same number of attributes.");
520
520
  }
521
521
  }
522
- function mr(s) {
522
+ function gr(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 pr(s) {
528
+ function vr(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 gr(s, e, t) {
534
+ function xr(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 vr(s, e = {}, t = new $()) {
540
+ function br(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
- dr(s);
548
- const l = s[0].index !== null, h = l ? mr(s) : -1, d = pr(s);
549
- if (gr(t, h, d), r) {
547
+ pr(s);
548
+ const l = s[0].index !== null, h = l ? gr(s) : -1, d = vr(s);
549
+ if (xr(t, h, d), r) {
550
550
  let u = 0;
551
551
  for (let n = 0, x = s.length; n < x; n++) {
552
552
  const m = s[n];
@@ -580,11 +580,11 @@ function vr(s, e = {}, t = new $()) {
580
580
  const c = t.getAttribute(m);
581
581
  for (let p = 0, v = s.length; p < v; p++) {
582
582
  const b = s[p], y = !i && !x && o[p], w = b.getAttribute(m);
583
- y || bt(w, c, g), g += w.count;
583
+ y || Tt(w, c, g), g += w.count;
584
584
  }
585
585
  }
586
586
  }
587
- function xr(s, e, t) {
587
+ function yr(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 }]);
@@ -602,7 +602,7 @@ function xr(s, e, t) {
602
602
  }
603
603
  }
604
604
  }
605
- function br(s, e) {
605
+ function Tr(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++)
@@ -629,7 +629,7 @@ function br(s, e) {
629
629
  r.fill(1), s.setAttribute("color", new P(r, 4));
630
630
  }
631
631
  }
632
- function Ce(s) {
632
+ function De(s) {
633
633
  let e = 0;
634
634
  if (s.byteLength !== 0) {
635
635
  const t = new Uint8Array(s);
@@ -653,9 +653,9 @@ function Ve(s) {
653
653
  }
654
654
  function Ge(s) {
655
655
  const e = s.skeleton;
656
- return e ? (e.boneTexture || e.computeBoneTexture(), `${Ce(e.boneTexture.image.data.buffer)}_${e.boneTexture.uuid}`) : null;
656
+ return e ? (e.boneTexture || e.computeBoneTexture(), `${De(e.boneTexture.image.data.buffer)}_${e.boneTexture.uuid}`) : null;
657
657
  }
658
- class yr {
658
+ class wr {
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
  }
@@ -668,7 +668,7 @@ class yr {
668
668
  return !(this.matrixWorld.equals(e.matrixWorld) && this.geometryHash === Ve(t) && this.skeletonHash === Ge(e) && this.primitiveCount === r);
669
669
  }
670
670
  }
671
- const U = /* @__PURE__ */ new C(), V = /* @__PURE__ */ new C(), G = /* @__PURE__ */ new C(), qe = /* @__PURE__ */ new J(), le = /* @__PURE__ */ new C(), we = /* @__PURE__ */ new C(), $e = /* @__PURE__ */ new J(), je = /* @__PURE__ */ new J(), ce = /* @__PURE__ */ new O(), Ye = /* @__PURE__ */ new O();
671
+ const U = /* @__PURE__ */ new F(), V = /* @__PURE__ */ new F(), G = /* @__PURE__ */ new F(), qe = /* @__PURE__ */ new Z(), le = /* @__PURE__ */ new F(), Ie = /* @__PURE__ */ new F(), $e = /* @__PURE__ */ new Z(), je = /* @__PURE__ */ new Z(), ce = /* @__PURE__ */ new O(), Ye = /* @__PURE__ */ new O();
672
672
  function Xe(s, e, t) {
673
673
  const r = s.skeleton, i = s.geometry, o = r.bones, a = r.boneInverses;
674
674
  $e.fromBufferAttribute(i.attributes.skinIndex, e), je.fromBufferAttribute(i.attributes.skinWeight, e), ce.elements.fill(0);
@@ -676,25 +676,25 @@ function Xe(s, e, t) {
676
676
  const h = je.getComponent(l);
677
677
  if (h !== 0) {
678
678
  const d = $e.getComponent(l);
679
- Ye.multiplyMatrices(o[d].matrixWorld, a[d]), Tr(ce, Ye, h);
679
+ Ye.multiplyMatrices(o[d].matrixWorld, a[d]), Ir(ce, Ye, h);
680
680
  }
681
681
  }
682
682
  return ce.multiply(s.bindMatrix).premultiply(s.bindMatrixInverse), t.transformDirection(ce), t;
683
683
  }
684
- function Ie(s, e, t, r, i) {
684
+ function Re(s, e, t, r, i) {
685
685
  le.set(0, 0, 0);
686
686
  for (let o = 0, a = s.length; o < a; o++) {
687
687
  const l = e[o], h = s[o];
688
- l !== 0 && (we.fromBufferAttribute(h, r), t ? le.addScaledVector(we, l) : le.addScaledVector(we.sub(i), l));
688
+ l !== 0 && (Ie.fromBufferAttribute(h, r), t ? le.addScaledVector(Ie, l) : le.addScaledVector(Ie.sub(i), l));
689
689
  }
690
690
  i.add(le);
691
691
  }
692
- function Tr(s, e, t) {
692
+ function Ir(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 wr(s) {
697
+ function Rr(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) {
@@ -712,7 +712,7 @@ function wr(s) {
712
712
  }
713
713
  return s;
714
714
  }
715
- function Ir(s, e = {}, t = new $()) {
715
+ function Sr(s, e = {}, t = new $()) {
716
716
  e = {
717
717
  applyWorldTransforms: !0,
718
718
  attributes: [],
@@ -721,20 +721,20 @@ function Ir(s, e = {}, t = new $()) {
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
722
  for (const v in t.attributes)
723
723
  (!e.attributes.includes(v) || !(v in r.attributes)) && t.deleteAttribute(v);
724
- !t.index && r.index && (t.index = r.index.clone()), h.position || t.setAttribute("position", te(l.position)), o && !h.normal && l.normal && t.setAttribute("normal", te(l.normal)), a && !h.tangent && l.tangent && t.setAttribute("tangent", te(l.tangent)), Z(r.index, t.index), Z(l.position, h.position), o && Z(l.normal, h.normal), a && Z(l.tangent, h.tangent);
725
- const d = l.position, f = o ? l.normal : null, u = a ? l.tangent : null, n = r.morphAttributes.position, x = r.morphAttributes.normal, m = r.morphAttributes.tangent, g = r.morphTargetsRelative, c = s.morphTargetInfluences, p = new Ct();
724
+ !t.index && r.index && (t.index = r.index.clone()), h.position || t.setAttribute("position", te(l.position)), o && !h.normal && l.normal && t.setAttribute("normal", te(l.normal)), a && !h.tangent && l.tangent && t.setAttribute("tangent", te(l.tangent)), K(r.index, t.index), K(l.position, h.position), o && K(l.normal, h.normal), a && K(l.tangent, h.tangent);
725
+ const d = l.position, f = o ? l.normal : null, u = a ? l.tangent : null, n = r.morphAttributes.position, x = r.morphAttributes.normal, m = r.morphAttributes.tangent, g = r.morphTargetsRelative, c = s.morphTargetInfluences, p = new Pt();
726
726
  p.getNormalMatrix(s.matrixWorld), r.index && t.index.array.set(r.index.array);
727
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));
728
+ U.fromBufferAttribute(d, v), f && V.fromBufferAttribute(f, v), u && (qe.fromBufferAttribute(u, v), G.fromBufferAttribute(u, v)), c && (n && Re(n, c, g, v, U), x && Re(x, c, g, v, V), m && Re(m, c, g, v, G)), s.isSkinnedMesh && (s.applyBoneTransform(v, U), f && Xe(s, v, V), u && Xe(s, v, G)), i && U.applyMatrix4(s.matrixWorld), h.position.setXYZ(v, U.x, U.y, U.z), f && (i && V.applyNormalMatrix(p), h.normal.setXYZ(v, V.x, V.y, V.z)), u && (i && G.transformDirection(s.matrixWorld), h.tangent.setXYZW(v, G.x, G.y, G.z, qe.w));
729
729
  for (const v in e.attributes) {
730
730
  const b = e.attributes[v];
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]));
731
+ b === "position" || b === "tangent" || b === "normal" || !(b in l) || (h[b] || t.setAttribute(b, te(l[b])), K(l[b], h[b]), Tt(l[b], h[b]));
732
732
  }
733
- return s.matrixWorld.determinant() < 0 && wr(t), t;
733
+ return s.matrixWorld.determinant() < 0 && Rr(t), t;
734
734
  }
735
- class Rr extends $ {
735
+ class _r extends $ {
736
736
  constructor() {
737
- super(), this.version = 0, this.hash = null, this._diff = new yr();
737
+ super(), this.version = 0, this.hash = null, this._diff = new wr();
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
@@ -742,24 +742,24 @@ class Rr extends $ {
742
742
  const r = e.geometry;
743
743
  for (let i = 0; i < t.length; i++) {
744
744
  const o = t[i], a = r.attributes[o], l = this.attributes[o];
745
- if (a && !Z(a, l))
745
+ if (a && !K(a, l))
746
746
  return !1;
747
747
  }
748
748
  return !0;
749
749
  }
750
750
  updateFrom(e, t) {
751
751
  const r = this._diff;
752
- return r.didChange(e) ? (Ir(e, t, this), r.updateFrom(e), this.version++, this.hash = `${this.uuid}_${this.version}`, !0) : !1;
752
+ return r.didChange(e) ? (Sr(e, t, this), r.updateFrom(e), this.version++, this.hash = `${this.uuid}_${this.version}`, !0) : !1;
753
753
  }
754
754
  }
755
- const Ae = 0, yt = 1, Tt = 2;
756
- function Sr(s, e) {
755
+ const Ce = 0, wt = 1, It = 2;
756
+ function Mr(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 _r(s) {
762
+ function Ar(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 _r(s) {
767
767
  }
768
768
  return e;
769
769
  }
770
- function Mr(s, e, t) {
770
+ function Cr(s, e, t) {
771
771
  if (s.length === 0) {
772
772
  e.setIndex(null);
773
773
  const r = e.attributes;
@@ -776,24 +776,24 @@ function Mr(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
- vr(s, t, e);
779
+ br(s, t, e);
780
780
  for (const r in e.attributes)
781
781
  e.attributes[r].needsUpdate = !0;
782
782
  }
783
- class Ar {
783
+ class Fr {
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
  }
787
787
  _getDummyMesh() {
788
788
  if (!this._dummyMesh) {
789
- const e = new Dt(), t = new $();
790
- t.setAttribute("position", new P(new Float32Array(9), 3)), this._dummyMesh = new ft(t, e);
789
+ const e = new Et(), t = new $();
790
+ t.setAttribute("position", new P(new Float32Array(9), 3)), this._dummyMesh = new mt(t, e);
791
791
  }
792
792
  return this._dummyMesh;
793
793
  }
794
794
  _getMeshes() {
795
795
  const e = [];
796
- return Sr(this.objects, (t) => {
796
+ return Mr(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
  }
@@ -806,7 +806,7 @@ class Ar {
806
806
  const l = t[o], h = l.uuid;
807
807
  r.delete(h);
808
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);
809
+ (!d || !d.isCompatible(l, this.attributes)) && (d && d.dispose(), d = new _r(), e.set(h, d)), d.updateFrom(l, i) && this.generateMissingAttributes && Tr(d, this.attributes);
810
810
  }
811
811
  r.forEach((o) => {
812
812
  e.delete(o);
@@ -826,19 +826,19 @@ class Ar {
826
826
  const c = d[n];
827
827
  !c || c.uuid !== g.uuid ? (l.push(!1), f = !0) : c.version !== g.version ? l.push(!1) : l.push(!0);
828
828
  }
829
- Mr(h, e, { useGroups: t, forceUpdate: f, skipAssigningAttributes: l, overwriteIndex: r }), f && e.dispose(), o.set(e, h.map((n) => ({
829
+ Cr(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
- let u = Ae;
834
- return f ? u = Tt : l.includes(!1) && (u = yt), {
833
+ let u = Ce;
834
+ return f ? u = It : l.includes(!1) && (u = wt), {
835
835
  changeType: u,
836
- materials: _r(a),
836
+ materials: Ar(a),
837
837
  geometry: e
838
838
  };
839
839
  }
840
840
  }
841
- function Fr(s) {
841
+ function Dr(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 Fr(s) {
849
849
  }
850
850
  return Array.from(e);
851
851
  }
852
- function Cr(s) {
852
+ function Pr(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 Cr(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 Dr {
861
+ class Er {
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 Ar(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 Fr(e), this._bvhWorker = null, this._pendingGenerate = null, this._buildAsync = !1;
867
867
  }
868
868
  setObjects(e) {
869
869
  this.staticGeometryGenerator.setObjects(e);
@@ -889,23 +889,23 @@ class Dr {
889
889
  n.isSkinnedMesh && n.skeleton && n.skeleton.update();
890
890
  });
891
891
  });
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) {
892
+ const a = t.generate(r), l = a.materials, h = Dr(l), { lights: d, iesTextures: f } = Pr(o);
893
+ if (a.changeType !== Ce && yr(r, l, l), this.generateBVH) {
894
894
  if (this.bvh instanceof Promise)
895
895
  throw new Error("PathTracingSceneGenerator: BVH is already building asynchronously.");
896
- if (a.changeType === Tt) {
896
+ if (a.changeType === It) {
897
897
  const u = {
898
- strategy: er,
898
+ strategy: rr,
899
899
  maxLeafTris: 1,
900
900
  indirect: !0,
901
901
  onProgress: e,
902
902
  ...this.bvhOptions
903
903
  };
904
- this._buildAsync ? this.bvh = this._bvhWorker.generate(r, u) : this.bvh = new tr(r, u);
905
- } else a.changeType === yt && this.bvh.refit();
904
+ this._buildAsync ? this.bvh = this._bvhWorker.generate(r, u) : this.bvh = new ar(r, u);
905
+ } else a.changeType === wt && this.bvh.refit();
906
906
  }
907
907
  return {
908
- bvhChanged: a.changeType !== Ae,
908
+ bvhChanged: a.changeType !== Ce,
909
909
  bvh: this.bvh,
910
910
  lights: d,
911
911
  iesTextures: f,
@@ -916,21 +916,21 @@ class Dr {
916
916
  };
917
917
  }
918
918
  }
919
- const Pr = new Pt(-1, 1, 1, -1, 0, 1);
920
- class Er extends $ {
919
+ const kr = new kt(-1, 1, 1, -1, 0, 1);
920
+ class Or extends $ {
921
921
  constructor() {
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));
922
+ super(), this.setAttribute("position", new We([-1, 3, 0, -1, -1, 0, 3, -1, 0], 3)), this.setAttribute("uv", new We([0, 2, 0, 0, 2, 0], 2));
923
923
  }
924
924
  }
925
- const kr = new Er();
926
- class ee {
925
+ const zr = new Or();
926
+ class J {
927
927
  /**
928
928
  * Constructs a new full screen quad.
929
929
  *
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(kr, e);
933
+ this._mesh = new mt(zr, 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, Pr);
948
+ e.render(this._mesh, kr);
949
949
  }
950
950
  /**
951
951
  * The quad's material.
@@ -959,7 +959,7 @@ class ee {
959
959
  this._mesh.material = e;
960
960
  }
961
961
  }
962
- class De extends pe {
962
+ class Pe extends ge {
963
963
  set needsUpdate(e) {
964
964
  super.needsUpdate = !0, this.dispatchEvent({
965
965
  type: "recompilation"
@@ -987,7 +987,7 @@ class De extends pe {
987
987
  return !1;
988
988
  }
989
989
  }
990
- class Or extends De {
990
+ class Nr extends Pe {
991
991
  constructor(e) {
992
992
  super({
993
993
  blending: ie,
@@ -1107,7 +1107,7 @@ function he(s = 1) {
1107
1107
  }
1108
1108
  `;
1109
1109
  }
1110
- const wt = (
1110
+ const Rt = (
1111
1111
  /* glsl */
1112
1112
  `
1113
1113
 
@@ -1133,7 +1133,7 @@ const wt = (
1133
1133
  }
1134
1134
 
1135
1135
  `
1136
- ), zr = (
1136
+ ), Hr = (
1137
1137
  /* glsl */
1138
1138
  `
1139
1139
 
@@ -1214,7 +1214,7 @@ const wt = (
1214
1214
  }
1215
1215
 
1216
1216
  `
1217
- ), Nr = (
1217
+ ), Br = (
1218
1218
  /* glsl */
1219
1219
  `
1220
1220
 
@@ -1261,7 +1261,7 @@ const wt = (
1261
1261
 
1262
1262
  `
1263
1263
  );
1264
- class Hr extends De {
1264
+ class Wr extends Pe {
1265
1265
  constructor() {
1266
1266
  super({
1267
1267
  blending: ie,
@@ -1285,8 +1285,8 @@ class Hr extends De {
1285
1285
  /* glsl */
1286
1286
  `
1287
1287
 
1288
- ${wt}
1289
- ${zr}
1288
+ ${Rt}
1289
+ ${Hr}
1290
1290
 
1291
1291
  varying vec2 vUv;
1292
1292
  uniform vec2 resolution;
@@ -1301,7 +1301,7 @@ class Hr extends De {
1301
1301
  });
1302
1302
  }
1303
1303
  }
1304
- class Br {
1304
+ class Lr {
1305
1305
  generate(e, t = 256) {
1306
1306
  const r = new ae(t, t, {
1307
1307
  type: R,
@@ -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 Hr());
1314
+ const o = new J(new Wr());
1315
1315
  return o.material.resolution.set(t, t), o.render(e), e.setRenderTarget(i), o.dispose(), r;
1316
1316
  }
1317
1317
  }
1318
- class Wr extends dt {
1318
+ class Ur extends pt {
1319
1319
  set bokehSize(e) {
1320
1320
  this.fStop = this.getFocalLength() / e;
1321
1321
  }
@@ -1329,15 +1329,15 @@ class Wr 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 Lr {
1332
+ class Vr {
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 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);
1337
+ e instanceof Ur ? (this.bokehSize = e.bokehSize, this.apertureBlades = e.apertureBlades, this.apertureRotation = e.apertureRotation, this.focusDistance = e.focusDistance, this.anamorphicRatio = e.anamorphicRatio) : (this.bokehSize = 0, this.apertureRotation = 0, this.apertureBlades = 0, this.focusDistance = 10, this.anamorphicRatio = 1);
1338
1338
  }
1339
1339
  }
1340
- function Re(s) {
1340
+ function Se(s) {
1341
1341
  const e = new Uint16Array(s.length);
1342
1342
  for (let t = 0, r = s.length; t < r; ++t)
1343
1343
  e[t] = k.toHalfFloat(s[t]);
@@ -1351,12 +1351,12 @@ function Qe(s, e, t = 0, r = s.length) {
1351
1351
  }
1352
1352
  return i - t;
1353
1353
  }
1354
- function Ur(s, e, t) {
1354
+ function Gr(s, e, t) {
1355
1355
  return 0.2126 * s + 0.7152 * e + 0.0722 * t;
1356
1356
  }
1357
- function Vr(s, e = D) {
1357
+ function qr(s, e = D) {
1358
1358
  const t = s.clone();
1359
- t.source = new Et({ ...t.image });
1359
+ t.source = new Ot({ ...t.image });
1360
1360
  const { width: r, height: i, data: o } = t.image;
1361
1361
  let a = o;
1362
1362
  if (t.type !== e) {
@@ -1381,27 +1381,27 @@ function Vr(s, e = D) {
1381
1381
  }
1382
1382
  return t;
1383
1383
  }
1384
- class Gr {
1384
+ class $r {
1385
1385
  constructor() {
1386
- const e = new M(Re(new Float32Array([0, 0, 0, 0])), 1, 1);
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;
1388
- const t = new M(Re(new Float32Array([0, 1])), 1, 2);
1389
- t.type = D, t.format = me, t.minFilter = F, t.magFilter = F, t.generateMipmaps = !1, t.needsUpdate = !0;
1390
- const r = new M(Re(new Float32Array([0, 0, 1, 1])), 2, 2);
1391
- r.type = D, r.format = me, r.minFilter = F, r.magFilter = F, r.generateMipmaps = !1, r.needsUpdate = !0, this.map = e, this.marginalWeights = t, this.conditionalWeights = r, this.totalSum = 0;
1386
+ const e = new M(Se(new Float32Array([0, 0, 0, 0])), 1, 1);
1387
+ e.type = D, e.format = I, e.minFilter = C, e.magFilter = C, e.wrapS = z, e.wrapT = z, e.generateMipmaps = !1, e.needsUpdate = !0;
1388
+ const t = new M(Se(new Float32Array([0, 1])), 1, 2);
1389
+ t.type = D, t.format = me, t.minFilter = C, t.magFilter = C, t.generateMipmaps = !1, t.needsUpdate = !0;
1390
+ const r = new M(Se(new Float32Array([0, 0, 1, 1])), 2, 2);
1391
+ r.type = D, r.format = me, r.minFilter = C, r.magFilter = C, r.generateMipmaps = !1, r.needsUpdate = !0, this.map = e, this.marginalWeights = t, this.conditionalWeights = r, this.totalSum = 0;
1392
1392
  }
1393
1393
  dispose() {
1394
1394
  this.marginalWeights.dispose(), this.conditionalWeights.dispose(), this.map.dispose();
1395
1395
  }
1396
1396
  updateFrom(e) {
1397
- const t = Vr(e);
1397
+ const t = qr(e);
1398
1398
  t.wrapS = z, t.wrapT = N;
1399
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
1400
  let f = 0, u = 0;
1401
1401
  for (let c = 0; c < i; c++) {
1402
1402
  let p = 0;
1403
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);
1404
+ const b = c * r + v, y = k.fromHalfFloat(o[4 * b + 0]), w = k.fromHalfFloat(o[4 * b + 1]), E = k.fromHalfFloat(o[4 * b + 2]), H = Gr(y, w, E);
1405
1405
  p += H, f += H, a[b] = H, l[b] = p;
1406
1406
  }
1407
1407
  if (p !== 0)
@@ -1427,28 +1427,28 @@ class Gr {
1427
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, 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 {
1430
+ const _e = 6, jr = 0, Yr = 1, Xr = 2, Qr = 3, Kr = 4, A = new F(), _ = new F(), Ke = new O(), Y = new zt(), Ze = new F(), X = new F(), Zr = new F(0, 1, 0);
1431
+ class Jr {
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;
1435
1435
  }
1436
1436
  updateFrom(e, t = []) {
1437
- const r = this.tex, i = Math.max(e.length * Se, 1), o = Math.ceil(Math.sqrt(i));
1437
+ const r = this.tex, i = Math.max(e.length * _e, 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
1440
  for (let h = 0, d = e.length; h < d; h++) {
1441
- const f = e[h], u = h * Se * 4;
1441
+ const f = e[h], u = h * _e * 4;
1442
1442
  let n = 0;
1443
- for (let m = 0; m < Se * 4; m++)
1443
+ for (let m = 0; m < _e * 4; m++)
1444
1444
  a[u + m] = 0;
1445
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)
1446
+ let x = jr;
1447
+ if (f.isRectAreaLight && f.isCircular ? x = Yr : f.isSpotLight ? x = Xr : f.isDirectionalLight ? x = Qr : f.isPointLight && (x = Kr), a[u + n++] = x, a[u + n++] = f.color.r, a[u + n++] = f.color.g, a[u + n++] = f.color.b, a[u + n++] = f.intensity, f.getWorldQuaternion(Y), f.isRectAreaLight)
1448
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
1449
  else if (f.isSpotLight) {
1450
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;
1451
+ Ze.setFromMatrixPosition(f.matrixWorld), X.setFromMatrixPosition(f.target.matrixWorld), Ke.lookAt(Ze, X, Zr), Y.setFromRotationMatrix(Ke), A.set(1, 0, 0).applyQuaternion(Y), a[u + n++] = A.x, a[u + n++] = A.y, a[u + n++] = A.z, n++, _.set(0, 1, 0).applyQuaternion(Y), a[u + n++] = _.x, a[u + n++] = _.y, a[u + n++] = _.z, a[u + n++] = Math.PI * m * m, a[u + n++] = m, a[u + n++] = f.decay, a[u + n++] = f.distance, a[u + n++] = Math.cos(f.angle), a[u + n++] = Math.cos(f.angle * (1 - f.penumbra)), a[u + n++] = f.iesMap ? t.indexOf(f.iesMap) : -1;
1452
1452
  } else if (f.isPointLight) {
1453
1453
  const m = A.setFromMatrixPosition(f.matrixWorld);
1454
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;
@@ -1458,7 +1458,7 @@ class Kr {
1458
1458
  }
1459
1459
  }
1460
1460
  this.count = e.length;
1461
- const l = Ce(a.buffer);
1461
+ const l = De(a.buffer);
1462
1462
  return this.hash !== l ? (this.hash = l, r.needsUpdate = !0, !0) : !1;
1463
1463
  }
1464
1464
  }
@@ -1485,7 +1485,7 @@ function Je(s, e, t, r, i) {
1485
1485
  t[i + d + u] = e >= u + 1 ? s[f + u] / l : 0;
1486
1486
  }
1487
1487
  }
1488
- class Zr extends Ot {
1488
+ class ea extends Nt {
1489
1489
  constructor() {
1490
1490
  super(), this._textures = [], this.type = R, this.format = I, this.internalFormat = "RGBA32F";
1491
1491
  }
@@ -1506,7 +1506,7 @@ class Zr extends Ot {
1506
1506
  throw new Error("FloatAttributeTextureArray: All attributes must have the same item count.");
1507
1507
  const i = this._textures;
1508
1508
  for (; i.length < r; ) {
1509
- const u = new xt();
1509
+ const u = new yt();
1510
1510
  i.push(u);
1511
1511
  }
1512
1512
  for (; i.length > r; )
@@ -1524,7 +1524,7 @@ class Zr extends Ot {
1524
1524
  this.dispose(), this.needsUpdate = !0;
1525
1525
  }
1526
1526
  }
1527
- class Jr extends Zr {
1527
+ class ta extends ea {
1528
1528
  updateNormalAttribute(e) {
1529
1529
  this.updateAttribute(0, e);
1530
1530
  }
@@ -1541,13 +1541,13 @@ class Jr extends Zr {
1541
1541
  this.setAttributes([e, t, r, i]);
1542
1542
  }
1543
1543
  }
1544
- function Pe(s, e) {
1544
+ function Ee(s, e) {
1545
1545
  return s.uuid < e.uuid ? 1 : s.uuid > e.uuid ? -1 : 0;
1546
1546
  }
1547
1547
  function Fe(s) {
1548
1548
  return `${s.source.uuid}:${s.colorSpace}`;
1549
1549
  }
1550
- function ea(s) {
1550
+ function ra(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 ea(s) {
1555
1555
  }
1556
1556
  return t;
1557
1557
  }
1558
- function ta(s) {
1558
+ function aa(s) {
1559
1559
  const e = s.map((r) => r.iesMap || null).filter((r) => r), t = new Set(e);
1560
- return Array.from(t).sort(Pe);
1560
+ return Array.from(t).sort(Ee);
1561
1561
  }
1562
- function ra(s) {
1562
+ function ia(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 ra(s) {
1569
1569
  }
1570
1570
  }
1571
1571
  const t = Array.from(e);
1572
- return ea(t).sort(Pe);
1572
+ return ra(t).sort(Ee);
1573
1573
  }
1574
- function aa(s) {
1574
+ function sa(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
- }), e.sort(Pe);
1578
+ }), e.sort(Ee);
1579
1579
  }
1580
- const It = 45, et = It * 4;
1581
- class ia {
1580
+ const St = 45, et = St * 4;
1581
+ class oa {
1582
1582
  constructor() {
1583
1583
  this._features = {};
1584
1584
  }
@@ -1592,9 +1592,9 @@ class ia {
1592
1592
  this._features = {};
1593
1593
  }
1594
1594
  }
1595
- class sa extends M {
1595
+ class na 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 ia();
1597
+ super(new Float32Array(4), 1, 1), this.format = I, this.type = R, this.wrapS = N, this.wrapT = N, this.minFilter = T, this.magFilter = T, this.generateMipmaps = !1, this.features = new oa();
1598
1598
  }
1599
1599
  updateFrom(e, t) {
1600
1600
  function r(m, g, c = -1) {
@@ -1618,7 +1618,7 @@ class sa extends M {
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: d, features: f } = this, u = {};
1621
+ const l = e.length * St, 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
1624
  d.width !== h && (this.dispose(), d.data = new Float32Array(h * h * 4), d.width = h, d.height = h);
@@ -1641,57 +1641,57 @@ class sa extends M {
1641
1641
  n[a++] = 0;
1642
1642
  else
1643
1643
  switch (c.side) {
1644
- case Ht:
1644
+ case Wt:
1645
1645
  n[a++] = 1;
1646
1646
  break;
1647
- case Nt:
1647
+ case Bt:
1648
1648
  n[a++] = -1;
1649
1649
  break;
1650
- case zt:
1650
+ case Ht:
1651
1651
  n[a++] = 0;
1652
1652
  break;
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 x = Ce(n.buffer);
1656
+ const x = De(n.buffer);
1657
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 oa(s) {
1661
+ function la(s) {
1662
1662
  return s ? `${s.uuid}:${s.version}` : null;
1663
1663
  }
1664
- function na(s, e) {
1664
+ function ca(s, e) {
1665
1665
  for (const t in e)
1666
1666
  t in s && (s[t] = e[t]);
1667
1667
  }
1668
- class rt extends Bt {
1668
+ class rt extends Lt {
1669
1669
  constructor(e, t, r) {
1670
1670
  const i = {
1671
1671
  format: I,
1672
- type: _e,
1673
- minFilter: F,
1674
- magFilter: F,
1672
+ type: Me,
1673
+ minFilter: C,
1674
+ magFilter: C,
1675
1675
  wrapS: z,
1676
1676
  wrapT: z,
1677
1677
  generateMipmaps: !1,
1678
1678
  ...r
1679
1679
  };
1680
- super(e, t, 1, i), na(this.texture, i), this.texture.setTextures = (...a) => {
1680
+ super(e, t, 1, i), ca(this.texture, i), this.texture.setTextures = (...a) => {
1681
1681
  this.setTextures(...a);
1682
1682
  }, this.hashes = [null];
1683
- const o = new ee(new la());
1683
+ const o = new J(new ua());
1684
1684
  this.fsQuad = o;
1685
1685
  }
1686
1686
  setTextures(e, t, r = this.width, i = this.height) {
1687
1687
  const o = e.getRenderTarget(), a = e.toneMapping, l = e.getClearAlpha();
1688
1688
  e.getClearColor(tt);
1689
1689
  const h = t.length || 1;
1690
- (r !== this.width || i !== this.height || this.depth !== h) && (this.setSize(r, i, h), this.hashes = new Array(h).fill(null)), e.setClearColor(0, 0), e.toneMapping = Wt;
1690
+ (r !== this.width || i !== this.height || this.depth !== h) && (this.setSize(r, i, h), this.hashes = new Array(h).fill(null)), e.setClearColor(0, 0), e.toneMapping = Ut;
1691
1691
  const d = this.fsQuad, f = this.hashes;
1692
1692
  let u = !1;
1693
1693
  for (let n = 0, x = h; n < x; n++) {
1694
- const m = t[n], g = oa(m);
1694
+ const m = t[n], g = la(m);
1695
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
1697
  return d.material.map = null, e.setClearColor(tt, l), e.setRenderTarget(o), e.toneMapping = a, u;
@@ -1700,7 +1700,7 @@ class rt extends Bt {
1700
1700
  super.dispose(), this.fsQuad.dispose();
1701
1701
  }
1702
1702
  }
1703
- class la extends pe {
1703
+ class ua extends ge {
1704
1704
  get map() {
1705
1705
  return this.uniforms.map.value;
1706
1706
  }
@@ -1739,14 +1739,14 @@ class la extends pe {
1739
1739
  });
1740
1740
  }
1741
1741
  }
1742
- function ca(s, e = Math.random()) {
1742
+ function ha(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 ua {
1749
+ class fa {
1750
1750
  constructor(e, t, r = Math.random) {
1751
1751
  const i = e ** t, o = new Uint16Array(i);
1752
1752
  let a = i;
@@ -1760,7 +1760,7 @@ class ua {
1760
1760
  a = 0;
1761
1761
  }, this.next = function() {
1762
1762
  const { samples: l } = this;
1763
- a >= o.length && (ca(o, r), this.reshuffle());
1763
+ a >= o.length && (ha(o, r), this.reshuffle());
1764
1764
  let h = o[a++];
1765
1765
  for (let d = 0; d < t; d++)
1766
1766
  l[d] = (h % e + r()) / e, h = Math.floor(h / e);
@@ -1768,7 +1768,7 @@ class ua {
1768
1768
  };
1769
1769
  }
1770
1770
  }
1771
- class ha {
1771
+ class da {
1772
1772
  constructor(e, t, r = Math.random) {
1773
1773
  let i = 0;
1774
1774
  for (const h of t)
@@ -1776,7 +1776,7 @@ class ha {
1776
1776
  const o = new Float32Array(i), a = [];
1777
1777
  let l = 0;
1778
1778
  for (const h of t) {
1779
- const d = new ua(e, h, r);
1779
+ const d = new fa(e, h, r);
1780
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() {
@@ -1792,7 +1792,7 @@ class ha {
1792
1792
  };
1793
1793
  }
1794
1794
  }
1795
- class fa {
1795
+ class ma {
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 fa {
1803
1803
  return this.nextInt() / (this.m - 1);
1804
1804
  }
1805
1805
  }
1806
- class da extends M {
1806
+ class pa 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 fa(), 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 ma(), 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 ha(r, o, this.random);
1814
+ const o = new Array(e * t).fill(4), a = new da(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 da extends M {
1821
1821
  this.sampler.reset(), this.generator.seed = 0;
1822
1822
  }
1823
1823
  }
1824
- function ma(s, e = Math.random) {
1824
+ function ga(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 pa(s, e) {
1830
+ function va(s, e) {
1831
1831
  s.fill(0);
1832
1832
  for (let t = 0; t < e; t++)
1833
1833
  s[t] = 1;
@@ -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 ga {
1912
+ class xa {
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 ga {
1923
1923
  } = this;
1924
1924
  e.resize(o), e.setSigma(r);
1925
1925
  const a = Math.floor(o * o * i), l = e.binaryPattern;
1926
- pa(l, a), ma(l, this.random);
1926
+ va(l, a), ga(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 (; ; ) {
@@ -1955,27 +1955,27 @@ class ga {
1955
1955
  return { data: h, maxValue: f };
1956
1956
  }
1957
1957
  }
1958
- function va(s) {
1958
+ function ba(s) {
1959
1959
  return s >= 3 ? 4 : s;
1960
1960
  }
1961
- function xa(s) {
1961
+ function ya(s) {
1962
1962
  switch (s) {
1963
1963
  case 1:
1964
1964
  return me;
1965
1965
  case 2:
1966
- return ht;
1966
+ return dt;
1967
1967
  default:
1968
1968
  return I;
1969
1969
  }
1970
1970
  }
1971
- class ba extends M {
1971
+ class Ta 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 ga();
1976
+ const e = this.channels, t = this.size, r = new xa();
1977
1977
  r.channels = e, r.size = t;
1978
- const i = va(e), o = xa(i);
1978
+ const i = ba(e), o = ya(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++) {
@@ -1988,7 +1988,7 @@ class ba extends M {
1988
1988
  this.needsUpdate = !0;
1989
1989
  }
1990
1990
  }
1991
- const ya = (
1991
+ const wa = (
1992
1992
  /* glsl */
1993
1993
  `
1994
1994
 
@@ -2003,7 +2003,7 @@ const ya = (
2003
2003
  };
2004
2004
 
2005
2005
  `
2006
- ), Ta = (
2006
+ ), Ia = (
2007
2007
  /* glsl */
2008
2008
  `
2009
2009
 
@@ -2018,7 +2018,7 @@ const ya = (
2018
2018
  };
2019
2019
 
2020
2020
  `
2021
- ), wa = (
2021
+ ), Ra = (
2022
2022
  /* glsl */
2023
2023
  `
2024
2024
 
@@ -2107,7 +2107,7 @@ const ya = (
2107
2107
  }
2108
2108
 
2109
2109
  `
2110
- ), Ia = (
2110
+ ), Sa = (
2111
2111
  /* glsl */
2112
2112
  `
2113
2113
 
@@ -2317,7 +2317,7 @@ const ya = (
2317
2317
  }
2318
2318
 
2319
2319
  `
2320
- ), Ra = (
2320
+ ), _a = (
2321
2321
  /* glsl */
2322
2322
  `
2323
2323
 
@@ -2382,7 +2382,7 @@ const ya = (
2382
2382
  };
2383
2383
 
2384
2384
  `
2385
- ), Sa = (
2385
+ ), Ma = (
2386
2386
  /* glsl */
2387
2387
  `
2388
2388
 
@@ -2452,7 +2452,7 @@ const ya = (
2452
2452
 
2453
2453
  }
2454
2454
  `
2455
- ), _a = (
2455
+ ), Aa = (
2456
2456
  /* glsl */
2457
2457
  `
2458
2458
 
@@ -2670,7 +2670,7 @@ const ya = (
2670
2670
  }
2671
2671
 
2672
2672
  `
2673
- ), Ma = (
2673
+ ), Ca = (
2674
2674
  /* glsl */
2675
2675
  `
2676
2676
 
@@ -2758,7 +2758,7 @@ const ya = (
2758
2758
 
2759
2759
 
2760
2760
  `
2761
- ), Aa = (
2761
+ ), Fa = (
2762
2762
  /* glsl */
2763
2763
  `
2764
2764
 
@@ -2864,7 +2864,7 @@ const ya = (
2864
2864
  }
2865
2865
 
2866
2866
  `
2867
- ), Fa = (
2867
+ ), Da = (
2868
2868
  /* glsl */
2869
2869
  `
2870
2870
 
@@ -2947,7 +2947,7 @@ const ya = (
2947
2947
  }
2948
2948
 
2949
2949
  `
2950
- ), Ca = (
2950
+ ), Pa = (
2951
2951
  /* glsl */
2952
2952
  `
2953
2953
 
@@ -3011,7 +3011,7 @@ const ya = (
3011
3011
  }
3012
3012
 
3013
3013
  `
3014
- ), Da = (
3014
+ ), Ea = (
3015
3015
  /*glsl */
3016
3016
  `
3017
3017
 
@@ -3037,7 +3037,7 @@ const ya = (
3037
3037
  }
3038
3038
 
3039
3039
  `
3040
- ), Rt = (
3040
+ ), _t = (
3041
3041
  /* glsl */
3042
3042
  `
3043
3043
 
@@ -3214,7 +3214,7 @@ const ya = (
3214
3214
 
3215
3215
  }
3216
3216
  `
3217
- ), Pa = (
3217
+ ), ka = (
3218
3218
  /* glsl */
3219
3219
  `
3220
3220
 
@@ -3266,7 +3266,7 @@ const ya = (
3266
3266
  }
3267
3267
 
3268
3268
  `
3269
- ), Ea = (
3269
+ ), Oa = (
3270
3270
  /* glsl */
3271
3271
  `
3272
3272
 
@@ -3707,7 +3707,7 @@ const ya = (
3707
3707
  }
3708
3708
 
3709
3709
  `
3710
- ), ka = (
3710
+ ), za = (
3711
3711
  /* glsl */
3712
3712
  `
3713
3713
 
@@ -3731,7 +3731,7 @@ const ya = (
3731
3731
  }
3732
3732
 
3733
3733
  `
3734
- ), Oa = (
3734
+ ), Na = (
3735
3735
  /* glsl */
3736
3736
  `
3737
3737
 
@@ -3835,7 +3835,7 @@ const ya = (
3835
3835
  }
3836
3836
 
3837
3837
  `
3838
- ), za = (
3838
+ ), Ha = (
3839
3839
  /* glsl */
3840
3840
  `
3841
3841
 
@@ -3972,7 +3972,7 @@ const ya = (
3972
3972
  }
3973
3973
 
3974
3974
  `
3975
- ), Na = (
3975
+ ), Ba = (
3976
3976
  /* glsl */
3977
3977
  `
3978
3978
 
@@ -4072,7 +4072,7 @@ const ya = (
4072
4072
  }
4073
4073
 
4074
4074
  `
4075
- ), Ha = (
4075
+ ), Wa = (
4076
4076
  /* glsl */
4077
4077
  `
4078
4078
 
@@ -4136,7 +4136,7 @@ bool bvhIntersectFogVolumeHit(
4136
4136
  }
4137
4137
 
4138
4138
  `
4139
- ), Ba = (
4139
+ ), La = (
4140
4140
  /* glsl */
4141
4141
  `
4142
4142
 
@@ -4316,7 +4316,7 @@ bool bvhIntersectFogVolumeHit(
4316
4316
  }
4317
4317
 
4318
4318
  `
4319
- ), Wa = (
4319
+ ), Ua = (
4320
4320
  /* glsl */
4321
4321
  `
4322
4322
 
@@ -4402,7 +4402,7 @@ bool bvhIntersectFogVolumeHit(
4402
4402
  }
4403
4403
 
4404
4404
  `
4405
- ), La = (
4405
+ ), Va = (
4406
4406
  /*glsl*/
4407
4407
  `
4408
4408
 
@@ -4501,7 +4501,7 @@ bool bvhIntersectFogVolumeHit(
4501
4501
  }
4502
4502
 
4503
4503
  `
4504
- ), Ua = (
4504
+ ), Ga = (
4505
4505
  /* glsl */
4506
4506
  `
4507
4507
 
@@ -4826,7 +4826,7 @@ bool bvhIntersectFogVolumeHit(
4826
4826
 
4827
4827
  }
4828
4828
  `
4829
- ), Va = (
4829
+ ), qa = (
4830
4830
  /* glsl */
4831
4831
  `
4832
4832
 
@@ -4878,7 +4878,7 @@ bool bvhIntersectFogVolumeHit(
4878
4878
  }
4879
4879
 
4880
4880
  `
4881
- ), Ga = (
4881
+ ), $a = (
4882
4882
  /* glsl */
4883
4883
  `
4884
4884
 
@@ -4929,7 +4929,7 @@ bool bvhIntersectFogVolumeHit(
4929
4929
 
4930
4930
  `
4931
4931
  );
4932
- class qa extends De {
4932
+ class ja extends Pe {
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 qa extends De {
4965
4965
  transmissiveBounces: { value: 10 },
4966
4966
  filterGlossyFactor: { value: 0 },
4967
4967
  // camera uniforms
4968
- physicalCamera: { value: new Lr() },
4968
+ physicalCamera: { value: new Vr() },
4969
4969
  cameraWorldMatrix: { value: new O() },
4970
4970
  invProjectionMatrix: { value: new O() },
4971
4971
  // scene uniforms
4972
- bvh: { value: new nr() },
4973
- attributesArray: { value: new Jr() },
4974
- materialIndexAttribute: { value: new vt() },
4975
- materials: { value: new sa() },
4972
+ bvh: { value: new cr() },
4973
+ attributesArray: { value: new ta() },
4974
+ materialIndexAttribute: { value: new bt() },
4975
+ materials: { value: new na() },
4976
4976
  textures: { value: new rt().texture },
4977
4977
  // light uniforms
4978
- lights: { value: new Kr() },
4978
+ lights: { value: new Jr() },
4979
4979
  iesProfiles: { value: new rt(360, 180, {
4980
4980
  type: D,
4981
4981
  wrapS: N,
@@ -4983,7 +4983,7 @@ class qa extends De {
4983
4983
  }).texture },
4984
4984
  environmentIntensity: { value: 1 },
4985
4985
  environmentRotation: { value: new O() },
4986
- envMapInfo: { value: new Gr() },
4986
+ envMapInfo: { value: new $r() },
4987
4987
  // background uniforms
4988
4988
  backgroundBlur: { value: 0 },
4989
4989
  backgroundMap: { value: null },
@@ -4993,8 +4993,8 @@ class qa extends De {
4993
4993
  // randomness uniforms
4994
4994
  seed: { value: 0 },
4995
4995
  sobolTexture: { value: null },
4996
- stratifiedTexture: { value: new da() },
4997
- stratifiedOffsetTexture: { value: new ba(64, 1) }
4996
+ stratifiedTexture: { value: new pa() },
4997
+ stratifiedOffsetTexture: { value: new Ta(64, 1) }
4998
4998
  },
4999
4999
  vertexShader: (
5000
5000
  /* glsl */
@@ -5026,27 +5026,27 @@ class qa extends De {
5026
5026
  #include <common>
5027
5027
 
5028
5028
  // bvh intersection
5029
- ${ur}
5030
5029
  ${fr}
5031
- ${hr}
5030
+ ${mr}
5031
+ ${dr}
5032
5032
 
5033
5033
  // uniform structs
5034
- ${ya}
5035
5034
  ${wa}
5036
- ${Ta}
5037
- ${Ia}
5038
5035
  ${Ra}
5036
+ ${Ia}
5037
+ ${Sa}
5038
+ ${_a}
5039
5039
 
5040
5040
  // random
5041
5041
  #if RANDOM_TYPE == 2 // Stratified List
5042
5042
 
5043
- ${Pa}
5043
+ ${ka}
5044
5044
 
5045
5045
  #elif RANDOM_TYPE == 1 // Sobol
5046
5046
 
5047
5047
  ${it}
5048
- ${wt}
5049
- ${Nr}
5048
+ ${Rt}
5049
+ ${Br}
5050
5050
 
5051
5051
  #define rand(v) sobol(v)
5052
5052
  #define rand2(v) sobol2(v)
@@ -5071,11 +5071,11 @@ class qa extends De {
5071
5071
  #endif
5072
5072
 
5073
5073
  // common
5074
- ${Da}
5075
- ${Aa}
5076
- ${Rt}
5074
+ ${Ea}
5077
5075
  ${Fa}
5078
- ${Ca}
5076
+ ${_t}
5077
+ ${Da}
5078
+ ${Pa}
5079
5079
 
5080
5080
  // environment
5081
5081
  uniform EquirectHdrInfo envMapInfo;
@@ -5131,16 +5131,16 @@ class qa extends De {
5131
5131
  float lightsDenom;
5132
5132
 
5133
5133
  // sampling
5134
+ ${Ca}
5134
5135
  ${Ma}
5135
- ${Sa}
5136
- ${_a}
5136
+ ${Aa}
5137
5137
 
5138
- ${Ha}
5139
- ${Oa}
5138
+ ${Wa}
5140
5139
  ${Na}
5140
+ ${Ba}
5141
+ ${Ha}
5141
5142
  ${za}
5142
- ${ka}
5143
- ${Ea}
5143
+ ${Oa}
5144
5144
 
5145
5145
  float applyFilteredGlossy( float roughness, float accumulatedRoughness ) {
5146
5146
 
@@ -5172,12 +5172,12 @@ class qa extends De {
5172
5172
 
5173
5173
  }
5174
5174
 
5175
+ ${qa}
5176
+ ${Ua}
5177
+ ${$a}
5178
+ ${La}
5175
5179
  ${Va}
5176
- ${Wa}
5177
5180
  ${Ga}
5178
- ${Ba}
5179
- ${La}
5180
- ${Ua}
5181
5181
 
5182
5182
  void main() {
5183
5183
 
@@ -5474,7 +5474,7 @@ class qa extends De {
5474
5474
  }), this.setValues(e);
5475
5475
  }
5476
5476
  }
5477
- function* $a() {
5477
+ function* Ya() {
5478
5478
  const {
5479
5479
  _renderer: s,
5480
5480
  _fsQuad: e,
@@ -5485,34 +5485,34 @@ function* $a() {
5485
5485
  _subframe: a,
5486
5486
  alpha: l,
5487
5487
  material: h
5488
- } = this, d = new J(), f = new J(), u = t.material;
5488
+ } = this, d = new Z(), f = new Z(), u = t.material;
5489
5489
  let [n, x] = i;
5490
5490
  for (; ; ) {
5491
- l ? (u.opacity = this._opacityFactor / (this.samples + 1), h.blending = ie, h.opacity = 1) : (h.opacity = this._opacityFactor / (this.samples + 1), h.blending = mt);
5491
+ l ? (u.opacity = this._opacityFactor / (this.samples + 1), h.blending = ie, h.opacity = 1) : (h.opacity = this._opacityFactor / (this.samples + 1), h.blending = gt);
5492
5492
  const [m, g, c, p] = a, v = r.width, b = r.height;
5493
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);
5494
+ const y = this.tiles.x || 1, w = this.tiles.y || 1, E = y * w, H = Math.ceil(v * c), ve = Math.ceil(b * p), ke = Math.floor(m * v), Oe = Math.floor(g * b), xe = Math.ceil(H / y), be = Math.ceil(ve / w);
5495
5495
  for (let oe = 0; oe < w; oe++)
5496
5496
  for (let ne = 0; ne < y; ne++) {
5497
- const Oe = s.getRenderTarget(), St = s.autoClear, _t = s.getScissorTest();
5497
+ const ze = s.getRenderTarget(), Mt = s.autoClear, At = s.getScissorTest();
5498
5498
  s.getScissor(d), s.getViewport(f);
5499
- let be = ne, ze = oe;
5499
+ let ye = ne, Ne = oe;
5500
5500
  if (!this.stableTiles) {
5501
- const ye = this._currentTile % (y * w);
5502
- be = ye % y, ze = ~~(ye / y), this._currentTile = ye + 1;
5501
+ const Te = this._currentTile % (y * w);
5502
+ ye = Te % y, Ne = ~~(Te / y), this._currentTile = Te + 1;
5503
5503
  }
5504
- const Ne = w - ze - 1;
5504
+ const He = w - Ne - 1;
5505
5505
  r.scissor.set(
5506
- Ee + be * ve,
5507
- ke + Ne * xe,
5508
- Math.min(ve, H - be * ve),
5509
- Math.min(xe, ge - Ne * xe)
5506
+ ke + ye * xe,
5507
+ Oe + He * be,
5508
+ Math.min(xe, H - ye * xe),
5509
+ Math.min(be, ve - He * be)
5510
5510
  ), r.viewport.set(
5511
- Ee,
5512
5511
  ke,
5512
+ Oe,
5513
5513
  H,
5514
- ge
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;
5514
+ ve
5515
+ ), s.setRenderTarget(r), s.setScissorTest(!0), s.autoClear = !1, e.render(s), s.setViewport(f), s.setScissor(d), s.setScissorTest(At), s.setRenderTarget(ze), s.autoClear = Mt, l && (u.target1 = n.texture, u.target2 = r.texture, s.setRenderTarget(x), t.render(s), s.setRenderTarget(ze)), this.samples += 1 / E, ne === y - 1 && oe === w - 1 && (this.samples = Math.round(this.samples)), yield;
5516
5516
  }
5517
5517
  [n, x] = [x, n];
5518
5518
  }
@@ -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 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, {
5541
+ this.camera = null, this.tiles = new j(3, 3), this.stableNoise = !1, this.stableTiles = !0, this.samples = 0, this._subframe = new Z(0, 0, 1, 1), this._opacityFactor = 1, this._renderer = e, this._alpha = !1, this._fsQuad = new J(new ja()), this._blendQuad = new J(new Nr()), this._task = null, this._currentTile = 0, this._compilePromise = null, this._sobolTarget = new Lr().generate(e), this._primaryTarget = new ae(1, 1, {
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 = $a.call(this)), this._task.next());
5589
+ this.material.onBeforeRender(), !this.isCompiling && (this._task || (this._task = Ya.call(this)), this._task.next());
5590
5590
  }
5591
5591
  }
5592
- const q = new j(), nt = new j(), fe = new Lt(), de = new se();
5593
- class ja extends M {
5592
+ const q = new j(), nt = new j(), fe = new Vt(), de = new se();
5593
+ class Xa extends M {
5594
5594
  constructor(e = 512, t = 512) {
5595
5595
  super(
5596
5596
  new Float32Array(e * t * 4),
@@ -5598,11 +5598,11 @@ class ja extends M {
5598
5598
  t,
5599
5599
  I,
5600
5600
  R,
5601
- pt,
5601
+ vt,
5602
5602
  z,
5603
5603
  N,
5604
- F,
5605
- F
5604
+ C,
5605
+ C
5606
5606
  ), this.generationCallback = null;
5607
5607
  }
5608
5608
  update() {
@@ -5619,8 +5619,8 @@ class ja extends M {
5619
5619
  return super.copy(e), this.generationCallback = e.generationCallback, this;
5620
5620
  }
5621
5621
  }
5622
- const lt = new C();
5623
- class Ya extends ja {
5622
+ const lt = new F();
5623
+ class Qa extends Xa {
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 Ya extends ja {
5632
5632
  return super.copy(e), this.topColor.copy(e.topColor), this.bottomColor.copy(e.bottomColor), this;
5633
5633
  }
5634
5634
  }
5635
- class Xa extends pe {
5635
+ class Ka extends ge {
5636
5636
  get map() {
5637
5637
  return this.uniforms.map.value;
5638
5638
  }
@@ -5719,7 +5719,7 @@ class Xa extends pe {
5719
5719
  }), this.setValues(e);
5720
5720
  }
5721
5721
  }
5722
- class Qa extends pe {
5722
+ class Za extends ge {
5723
5723
  constructor() {
5724
5724
  super({
5725
5725
  uniforms: {
@@ -5749,7 +5749,7 @@ class Qa extends pe {
5749
5749
  #include <common>
5750
5750
  #include <cube_uv_reflection_fragment>
5751
5751
 
5752
- ${Rt}
5752
+ ${_t}
5753
5753
 
5754
5754
  void main() {
5755
5755
 
@@ -5764,7 +5764,7 @@ class Qa extends pe {
5764
5764
  }
5765
5765
  class ct {
5766
5766
  constructor(e) {
5767
- this._renderer = e, this._quad = new ee(new Qa());
5767
+ this._renderer = e, this._quad = new J(new Za());
5768
5768
  }
5769
5769
  generate(e, t = null, r = null) {
5770
5770
  if (!e.isCubeTexture)
@@ -5783,17 +5783,17 @@ class ct {
5783
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
- return c.minFilter = Ut, c.magFilter = F, c.wrapS = z, c.wrapT = z, c.mapping = pt, c.needsUpdate = !0, c;
5786
+ return c.minFilter = Gt, c.magFilter = C, c.wrapS = z, c.wrapT = z, c.mapping = vt, c.needsUpdate = !0, c;
5787
5787
  }
5788
5788
  dispose() {
5789
5789
  this._quad.dispose();
5790
5790
  }
5791
5791
  }
5792
- function Ka(s) {
5792
+ function Ja(s) {
5793
5793
  return s.extensions.get("EXT_float_blend");
5794
5794
  }
5795
5795
  const Q = new j();
5796
- class Za {
5796
+ class ei {
5797
5797
  get multipleImportanceSampling() {
5798
5798
  return !!this._pathTracer.material.defines.FEATURE_MIS;
5799
5799
  }
@@ -5837,7 +5837,7 @@ class Za {
5837
5837
  return !!this._pathTracer.isCompiling;
5838
5838
  }
5839
5839
  constructor(e) {
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({
5840
+ this._renderer = e, this._generator = new Er(), this._pathTracer = new ot(e), this._queueReset = !1, this._clock = new qt(), this._compilePromise = null, this._lowResPathTracer = new ot(e), this._lowResPathTracer.tiles.set(1, 1), this._quad = new J(new Ka({
5841
5841
  map: null,
5842
5842
  transparent: !0,
5843
5843
  blending: ie,
@@ -5847,7 +5847,7 @@ class Za {
5847
5847
  }, this.renderToCanvasCallback = (t, r, i) => {
5848
5848
  const o = r.autoClear;
5849
5849
  r.autoClear = !1, i.render(r), r.autoClear = o;
5850
- }, this.setScene(new Gt(), new dt());
5850
+ }, this.setScene(new $t(), new pt());
5851
5851
  }
5852
5852
  setBVHWorker(e) {
5853
5853
  this._generator.setBVHWorker(e);
@@ -5875,11 +5875,11 @@ class Za {
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 = ra(r);
5878
+ const e = this._pathTracer.material, t = this._renderer, r = this._materials, i = this.textureSize, o = ia(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 = aa(e), o = ta(i);
5882
+ const e = this.scene, t = this._renderer, r = this._pathTracer.material, i = sa(e), o = aa(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 Za {
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 Ya(16);
5890
+ this._colorBackground = this._colorBackground || new Qa(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) {
@@ -5928,7 +5928,7 @@ class Za {
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 || !Ka(r), e.alpha = t.alpha, this.renderToCanvas) {
5931
+ if (!this.pausePathTracing && this.enablePathTracing && this.renderDelay <= l && !this.isCompiling && t.update(), t.alpha = t.material.backgroundAlpha !== 1 || !Ja(r), e.alpha = t.alpha, this.renderToCanvas) {
5932
5932
  const h = this._renderer, d = this.minSamples;
5933
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) {
@@ -5938,7 +5938,7 @@ class Za {
5938
5938
  }
5939
5939
  (!this.dynamicLowRes && this.rasterizeScene || this.dynamicLowRes && this.isCompiling) && this.rasterizeSceneCallback(this.scene, this.camera);
5940
5940
  }
5941
- this.enablePathTracing && o.material.opacity > 0 && (o.material.opacity < 1 && (o.material.blending = this.dynamicLowRes ? qt : mt), o.material.map = t.target.texture, this.renderToCanvasCallback(t.target, h, o), o.material.blending = ie);
5941
+ this.enablePathTracing && o.material.opacity > 0 && (o.material.opacity < 1 && (o.material.blending = this.dynamicLowRes ? jt : gt), o.material.map = t.target.texture, this.renderToCanvasCallback(t.target, h, o), o.material.blending = ie);
5942
5942
  }
5943
5943
  }
5944
5944
  reset() {
@@ -5958,13 +5958,16 @@ class Za {
5958
5958
  }
5959
5959
  }
5960
5960
  }
5961
- function K(s) {
5961
+ function ut(s) {
5962
+ return typeof s == "object" && s !== null && "getInternalRenderer" in s && typeof s.getInternalRenderer == "function";
5963
+ }
5964
+ function ee(s) {
5962
5965
  return s !== null && typeof s == "object" && "getInternalRenderer" in s && typeof s.getInternalRenderer == "function";
5963
5966
  }
5964
- class ti {
5967
+ const pe = class pe {
5965
5968
  constructor() {
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
- samples: ar,
5969
+ this.pathTracer = null, this.enabled = !1, this.renderer = null, this.sampleCount = 0, this.createAttempts = 0, this.maxCreateAttempts = 10, this.sceneInitialized = !1, this.environmentWaitFrames = 0, this.maxEnvironmentWaitFrames = 300, this.disposed = !1, this.convertedEnvTexture = null, this.resumable = !1, this.lastCameraMoveTime = -1 / 0, this.cameraDirty = !1, this.events = new ir(), this.settings = {
5970
+ samples: sr,
5968
5971
  bounces: 4,
5969
5972
  // Reduce bounces for better performance
5970
5973
  transmissiveBounces: 2,
@@ -5989,7 +5992,7 @@ class ti {
5989
5992
  const r = [];
5990
5993
  e.traverse((o) => {
5991
5994
  var a;
5992
- (a = o.userData) != null && a[ir] && o.visible && r.push(o);
5995
+ (a = o.userData) != null && a[or] && o.visible && r.push(o);
5993
5996
  }), r.forEach((o) => o.visible = !1);
5994
5997
  try {
5995
5998
  (i = this.pathTracer) == null || i.setScene(e, t);
@@ -6049,8 +6052,8 @@ class ti {
6049
6052
  )
6050
6053
  );
6051
6054
  try {
6052
- const e = K(this.renderer) ? this.renderer.getInternalRenderer() : null;
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(
6055
+ const e = ee(this.renderer) ? this.renderer.getInternalRenderer() : null;
6056
+ return e ? (this.pathTracer = new ei(e), this.pathTracer.tiles && "set" in this.pathTracer.tiles && this.pathTracer.tiles.set(1, 1), this.pathTracer.bounces = this.settings.bounces, this.settings.transmissiveBounces !== void 0 && (this.pathTracer.transmissiveBounces = this.settings.transmissiveBounces), this.pathTracer.renderScale = this.settings.renderScale, this.pathTracer.dynamicLowRes = this.settings.dynamicLowRes, this.pathTracer.lowResScale = this.settings.lowResScale, this.pathTracer.environmentIntensity !== void 0 && (this.pathTracer.environmentIntensity = 2), e.toneMapping !== B.ACESFilmicToneMapping && (e.toneMapping = B.ACESFilmicToneMapping, e.toneMappingExposure = 1.5), e.setRenderTarget(null), S.ok(void 0)) : S.err(
6054
6057
  new W(
6055
6058
  "Renderer not ready, will retry",
6056
6059
  L.RENDERER_NOT_INITIALIZED
@@ -6068,8 +6071,8 @@ class ti {
6068
6071
  }
6069
6072
  setEnabled(e) {
6070
6073
  if (this.enabled !== e && (this.enabled = e, !e)) {
6071
- this.reset(), this.sceneInitialized = !1;
6072
- const t = K(this.renderer) ? this.renderer.getInternalRenderer() : null;
6074
+ this.resumable = !1, this.reset(), this.sceneInitialized = !1;
6075
+ const t = ee(this.renderer) ? this.renderer.getInternalRenderer() : null;
6073
6076
  t && (t.autoClear = !0);
6074
6077
  }
6075
6078
  }
@@ -6083,7 +6086,7 @@ class ti {
6083
6086
  * frames forever and callers awaiting 'pathtracing:complete' hanging.
6084
6087
  */
6085
6088
  disableAfterSelfPause(e) {
6086
- this.enabled = !1, this.events.emit("pathtracing:paused", { samples: this.sampleCount, reason: e });
6089
+ this.enabled = !1, this.resumable = e === "completed", this.events.emit("pathtracing:paused", { samples: this.sampleCount, reason: e });
6087
6090
  }
6088
6091
  updateSettings(e) {
6089
6092
  this.settings = { ...this.settings, ...e }, e.enablePathTracing !== void 0 && this.setEnabled(e.enablePathTracing), this.pathTracer && (e.bounces !== void 0 && (this.pathTracer.bounces = e.bounces), e.transmissiveBounces !== void 0 && (this.pathTracer.transmissiveBounces = e.transmissiveBounces), e.renderScale !== void 0 && (this.pathTracer.renderScale = e.renderScale), e.lowResScale !== void 0 && (this.pathTracer.lowResScale = e.lowResScale), e.dynamicLowRes !== void 0 && (this.pathTracer.dynamicLowRes = e.dynamicLowRes));
@@ -6149,7 +6152,7 @@ class ti {
6149
6152
  /** Unwraps the Three.js scene/camera from their adapters, or null if either fails. */
6150
6153
  extractThreeObjects(e, t) {
6151
6154
  let r = null, i = null;
6152
- return Le(e) && (r = e.getInternalRenderer()), Le(t) && (i = t.getInternalRenderer()), !r || !i ? null : { threeScene: r, threeCamera: i };
6155
+ return ut(e) && (r = e.getInternalRenderer()), ut(t) && (i = t.getInternalRenderer()), !r || !i ? null : { threeScene: r, threeCamera: i };
6153
6156
  }
6154
6157
  /**
6155
6158
  * First-frame setup: waits for an environment texture, converts an
@@ -6165,7 +6168,15 @@ class ti {
6165
6168
  const l = i.__originalEnvironmentTexture;
6166
6169
  if (!i.environment && !l)
6167
6170
  return this.environmentWaitFrames++, this.environmentWaitFrames >= this.maxEnvironmentWaitFrames && (this.disableAfterSelfPause("gave-up"), this.environmentWaitFrames = 0), e.render(t, r);
6168
- if (this.environmentWaitFrames = 0, l && l.mapping === B.EquirectangularReflectionMapping) {
6171
+ if (this.environmentWaitFrames = 0, l && l.isCubeTexture) {
6172
+ const h = i.environment;
6173
+ i.environment = l;
6174
+ try {
6175
+ this.ingestSceneWithoutShadowHelpers(i, o), this.sceneInitialized = !0;
6176
+ } finally {
6177
+ i.environment = h;
6178
+ }
6179
+ } else if (l && l.mapping === B.EquirectangularReflectionMapping) {
6169
6180
  let h = l;
6170
6181
  if (l.image instanceof HTMLImageElement)
6171
6182
  if (this.convertedEnvTexture)
@@ -6205,29 +6216,29 @@ class ti {
6205
6216
  * feedback, accumulates a tracer sample, and detects completion.
6206
6217
  */
6207
6218
  accumulateSample(e, t, r) {
6208
- var o;
6219
+ var o, a;
6209
6220
  if (this.sampleCount === 0)
6210
6221
  try {
6211
6222
  (o = this.pathTracer) == null || o.updateLights();
6212
- } catch (a) {
6213
- console.warn("Failed to update lights for path tracing:", a);
6223
+ } catch (l) {
6224
+ console.warn("Failed to update lights for path tracing:", l);
6214
6225
  }
6215
6226
  const i = e.render(t, r);
6216
- return i.ok ? (this.accumulateOneSample(), this.sampleCount++, this.sampleCount === this.settings.samples ? this.captureCompletedFrame() : S.ok(void 0)) : i;
6227
+ return i.ok ? performance.now() - this.lastCameraMoveTime < pe.CAMERA_SETTLE_MS ? S.ok(void 0) : (this.cameraDirty && (this.cameraDirty = !1, (a = this.pathTracer) == null || a.updateCamera()), this.accumulateOneSample(), this.sampleCount++, this.sampleCount === this.settings.samples ? this.captureCompletedFrame() : S.ok(void 0)) : i;
6217
6228
  }
6218
6229
  /**
6219
6230
  * Render while path tracing is disabled: keep the final accumulated image on
6220
6231
  * screen if we just completed, otherwise delegate to the standard renderer.
6221
6232
  */
6222
6233
  renderWhileDisabled(e, t) {
6223
- return this.renderer ? this.sampleCount >= this.settings.samples && this.sampleCount > 0 ? (this.pathTracer && K(this.renderer) && this.renderer.getInternalRenderer().setRenderTarget(null), S.ok(void 0)) : this.renderer.render(e, t) : S.ok(void 0);
6234
+ return this.renderer ? this.sampleCount >= this.settings.samples && this.sampleCount > 0 ? (this.pathTracer && ee(this.renderer) && this.renderer.getInternalRenderer().setRenderTarget(null), S.ok(void 0)) : this.renderer.render(e, t) : S.ok(void 0);
6224
6235
  }
6225
6236
  /**
6226
6237
  * Render a single path-tracing sample into the internal buffer, preserving the
6227
6238
  * renderer's autoClear/render-target state so the standard view stays visible.
6228
6239
  */
6229
6240
  accumulateOneSample() {
6230
- const e = K(this.renderer) ? this.renderer.getInternalRenderer() : null;
6241
+ const e = ee(this.renderer) ? this.renderer.getInternalRenderer() : null;
6231
6242
  if (!e)
6232
6243
  throw new Error("Three.js renderer not available");
6233
6244
  const t = e.autoClear, r = e.getRenderTarget();
@@ -6235,12 +6246,13 @@ class ti {
6235
6246
  }
6236
6247
  /**
6237
6248
  * Path tracing reached its sample target: present the accumulated result on
6238
- * the canvas, emit completion, and schedule disposal. The final image stays on
6239
- * the canvas (kept by the renderer); presenting any DOM overlay is the
6240
- * presentation layer's concern, not this service's.
6249
+ * the canvas and pause. The final image stays on the canvas (kept by the
6250
+ * renderer); the tracer and its ingested scene stay warm so a camera move
6251
+ * can resume accumulation from the new viewpoint instead of leaving a
6252
+ * stale frame frozen on screen.
6241
6253
  */
6242
6254
  captureCompletedFrame() {
6243
- const e = K(this.renderer) ? this.renderer.getInternalRenderer() : null;
6255
+ const e = ee(this.renderer) ? this.renderer.getInternalRenderer() : null;
6244
6256
  if (e && this.pathTracer)
6245
6257
  try {
6246
6258
  const t = e.autoClear;
@@ -6250,9 +6262,7 @@ class ti {
6250
6262
  } catch (t) {
6251
6263
  console.warn("Failed to present path traced result:", t);
6252
6264
  }
6253
- return this.disableAfterSelfPause("completed"), this.disposeTimer = setTimeout(() => {
6254
- this.disposeTimer = null, !this.disposed && this.disposePathTracingResources();
6255
- }, 100), S.ok(void 0);
6265
+ return this.disableAfterSelfPause("completed"), S.ok(void 0);
6256
6266
  }
6257
6267
  getSampleCount() {
6258
6268
  return this.sampleCount;
@@ -6266,30 +6276,20 @@ class ti {
6266
6276
  isPathTracerDisposed() {
6267
6277
  return this.disposed;
6268
6278
  }
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));
6279
+ canResume() {
6280
+ return this.resumable && this.pathTracer !== null && !this.disposed;
6272
6281
  }
6273
- /**
6274
- * Dispose of path tracing resources after the final frame is on screen
6275
- */
6276
- disposePathTracingResources() {
6277
- if (this.pathTracer) {
6278
- try {
6279
- this.pathTracer.dispose();
6280
- } catch (e) {
6281
- console.warn("Failed to dispose path tracer:", e);
6282
+ reset(e = !1) {
6283
+ if (this.sampleCount = 0, !!this.pathTracer) {
6284
+ if (e) {
6285
+ this.pathTracer.reset(), this.sceneInitialized = !1;
6286
+ return;
6282
6287
  }
6283
- this.pathTracer = null;
6288
+ this.lastCameraMoveTime = performance.now(), this.cameraDirty = !0, this.pathTracer.reset();
6284
6289
  }
6285
- if (this.convertedEnvTexture && (this.convertedEnvTexture.dispose(), this.convertedEnvTexture = null), this.renderer) {
6286
- const e = K(this.renderer) ? this.renderer.getInternalRenderer() : null;
6287
- e && (e.autoClear = !0);
6288
- }
6289
- this.sceneInitialized = !1, this.createAttempts = 0;
6290
6290
  }
6291
6291
  dispose() {
6292
- if (this.disposed = !0, this.events.removeAllListeners(), this.disposeTimer !== null && (clearTimeout(this.disposeTimer), this.disposeTimer = null), this.pathTracer) {
6292
+ if (this.disposed = !0, this.events.removeAllListeners(), this.pathTracer) {
6293
6293
  try {
6294
6294
  this.pathTracer.dispose();
6295
6295
  } catch (e) {
@@ -6302,7 +6302,9 @@ class ti {
6302
6302
  isSupported() {
6303
6303
  return document.createElement("canvas").getContext("webgl2") !== null;
6304
6304
  }
6305
- }
6305
+ };
6306
+ pe.CAMERA_SETTLE_MS = 200;
6307
+ let ht = pe;
6306
6308
  export {
6307
- ti as ThreePathTracingService
6309
+ ht as ThreePathTracingService
6308
6310
  };