rayzee 11.1.1 → 11.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +24 -2
  2. package/dist/{ArchiveImporter-CFcggGqi.js → ArchiveImporter-D_x863yu.js} +882 -829
  3. package/dist/{BidirectionalIntegrator-DIPN8lJW.js → BidirectionalIntegrator-DmkxxEOR.js} +226 -226
  4. package/dist/{NeuralRetouch-Doo3a4vY.js → NeuralRetouch-Cr-otSW8.js} +2 -2
  5. package/dist/{NeuralSuperRes-B-rNIU_R.js → NeuralSuperRes-B7E3_M0t.js} +2 -2
  6. package/dist/{PathTracer-D_LmDeLh.js → PathTracer-D6nbknj5.js} +2958 -3000
  7. package/dist/{PhysicalSky-DYffGJ3O.js → PhysicalSky-Dq5VSiCQ.js} +1 -1
  8. package/dist/{RayzeeRenderer-DWx7D714.js → RayzeeRenderer-DbjqO6v-.js} +400 -361
  9. package/dist/SceneMetadata-D2Sh-0e-.js +110 -0
  10. package/dist/addons/archives.es.js +1 -1
  11. package/dist/addons/bidirectional.es.js +1 -1
  12. package/dist/addons/physical-sky.es.js +1 -1
  13. package/dist/addons/storage.es.js +1 -1
  14. package/dist/{identity-DrQsGT2o.js → identity-C1cLD1C0.js} +14 -4
  15. package/dist/{openStorage-DwcBRUj7.js → openStorage-Fe9BoS1_.js} +1 -1
  16. package/dist/rayzee-core.es.js +6 -6
  17. package/dist/rayzee.es.js +827 -827
  18. package/dist/rayzee.umd.js +95 -94
  19. package/dist/{sceneCachePolicy-Bk8sI5PZ.js → sceneCachePolicy-C4-4qwt6.js} +71 -29
  20. package/package.json +1 -1
  21. package/src/Processor/ArchiveImporter.js +130 -96
  22. package/src/Processor/ArchiveReader.js +46 -3
  23. package/src/Processor/AssetLoader.js +26 -1
  24. package/src/Processor/archiveFormats.js +35 -0
  25. package/src/RayzeeRenderer.js +42 -11
  26. package/src/Storage/identity.js +22 -1
  27. package/src/Storage/index.js +1 -1
  28. package/src/TSL/MaterialEvaluation.js +4 -3
  29. package/src/core.js +1 -1
  30. package/src/index.js +2 -2
  31. package/dist/archiveFormats-tnAoUL1j.js +0 -94
  32. /package/dist/{ToneMapGPU-CjU3osDd.js → ToneMapGPU-BOjpul7A.js} +0 -0
@@ -1,31 +1,31 @@
1
1
  import { dt as e } from "./SolarLimb-CPaeZVwz.js";
2
- import { Bt as t, Et as n, It as r, Lt as i, Tt as a, Vt as o, _t as s, bt as c, ct as l, gt as u, ht as d, n as f, ot as ee, st as p, vt as m, xt as h, zt as te } from "./PathTracer-D_LmDeLh.js";
3
- import { n as ne, t as g } from "./EngineEvents-Ci8dVWCP.js";
4
- import { A as _, C as re, D as v, E as ie, O as ae, T as oe, d as se, g as ce, j as le, l as ue, r as de, u as fe, w as pe } from "./sceneCachePolicy-Bk8sI5PZ.js";
5
- import { i as y, r as me } from "./Logger-dDDGj9Av.js";
6
- import { n as he, s as ge } from "./BufferLayout-D_IBo2ci.js";
7
- import { i as _e, n as b, t as ve } from "./EngineIssues-CIZnXHsF.js";
8
- import { n as ye, r as be } from "./shared-BGBcSxBQ.js";
9
- import { a as xe } from "./WorkingMatrix-C6y233hT.js";
10
- import { i as x, r as Se, t as S } from "./ActiveColor-YvuQq44O.js";
11
- import { n as C, r as Ce } from "./AssetConfig-DSEntE65.js";
12
- import { d as we, l as Te, m as Ee, p as De, t as Oe, u as w } from "./ViewTransforms-CYN7bq2w.js";
13
- import { n as ke, r as T } from "./identity-DrQsGT2o.js";
14
- import { t as Ae } from "./ToneMapGPU-CjU3osDd.js";
15
- import { n as je } from "./archiveFormats-tnAoUL1j.js";
16
- import { LinearSRGBColorSpace as Me, MeshBasicNodeMaterial as Ne, NodeMaterial as Pe, QuadMesh as E, RectAreaLightNode as Fe, SRGBColorSpace as Ie, TextureNode as Le, WebGPURenderer as Re } from "three/webgpu";
17
- import { Fn as ze, If as Be, cubeTexture as Ve, dot as He, float as D, int as O, ivec2 as Ue, mix as k, screenCoordinate as We, select as A, storage as Ge, texture as Ke, uint as qe, uniform as j, uv as M, vec3 as N, vec4 as Je } from "three/tsl";
18
- import { Box3 as Ye, BufferGeometry as Xe, CircleGeometry as Ze, Color as P, DataTexture as Qe, DirectionalLight as $e, DirectionalLightHelper as et, EquirectangularReflectionMapping as tt, EventDispatcher as F, FloatType as nt, LinearFilter as rt, LinearSRGBColorSpace as it, LoaderUtils as I, LoadingManager as at, MathUtils as L, Mesh as ot, MeshPhysicalMaterial as st, NearestFilter as ct, NoBlending as lt, NoToneMapping as ut, Object3D as R, OrthographicCamera as dt, PerspectiveCamera as ft, PointLight as pt, PointLightHelper as mt, REVISION as ht, RGBAFormat as gt, RectAreaLight as z, RenderTarget as _t, SRGBColorSpace as B, Scene as vt, SpotLight as yt, SpotLightHelper as bt, TextureLoader as xt, UnsignedByteType as St, Vector2 as Ct, Vector3 as V } from "three";
19
- import { RectAreaLightTexturesLib as wt } from "three/addons/lights/RectAreaLightTexturesLib.js";
20
- import { RectAreaLightHelper as Tt } from "three/addons/helpers/RectAreaLightHelper.js";
21
- import { GLTFLoader as Et } from "three/addons/loaders/GLTFLoader.js";
22
- import { HDRLoader as Dt } from "three/addons/loaders/HDRLoader.js";
23
- import { createMeshesFromMultiMaterialMesh as Ot } from "three/addons/utils/SceneUtils.js";
24
- import { clone as kt } from "three/addons/utils/SkeletonUtils.js";
2
+ import { Ft as t, It as n, Lt as r, Mt as i, Nt as a, St as o, _t as s, ct as c, gt as l, mt as u, n as d, ot as f, st as p, xt as m } from "./PathTracer-D6nbknj5.js";
3
+ import { n as h, t as g } from "./EngineEvents-Ci8dVWCP.js";
4
+ import { A as ee, C as _, F as te, L as v, M as ne, N as re, P as y, R as ie, d as ae, g as oe, j as se, l as ce, r as le, u as ue, x as de, y as b } from "./sceneCachePolicy-C4-4qwt6.js";
5
+ import { i as x, r as fe } from "./Logger-dDDGj9Av.js";
6
+ import { n as pe, s as me } from "./BufferLayout-D_IBo2ci.js";
7
+ import { i as he, n as S, t as ge } from "./EngineIssues-CIZnXHsF.js";
8
+ import { n as _e, r as ve } from "./shared-BGBcSxBQ.js";
9
+ import { a as ye } from "./WorkingMatrix-C6y233hT.js";
10
+ import { i as C, r as be, t as w } from "./ActiveColor-YvuQq44O.js";
11
+ import { n as T, r as xe } from "./AssetConfig-DSEntE65.js";
12
+ import { d as Se, l as Ce, m as we, p as Te, t as Ee, u as E } from "./ViewTransforms-CYN7bq2w.js";
13
+ import { i as D, n as De, r as Oe } from "./identity-C1cLD1C0.js";
14
+ import { a as ke, i as Ae, t as je } from "./SceneMetadata-D2Sh-0e-.js";
15
+ import { t as Me } from "./ToneMapGPU-BOjpul7A.js";
16
+ import { LinearSRGBColorSpace as Ne, MeshBasicNodeMaterial as Pe, NodeMaterial as Fe, QuadMesh as Ie, RectAreaLightNode as Le, SRGBColorSpace as Re, TextureNode as ze, WebGPURenderer as Be } from "three/webgpu";
17
+ import { Fn as Ve, If as He, cubeTexture as Ue, dot as We, float as O, int as k, ivec2 as Ge, mix as A, screenCoordinate as Ke, select as j, storage as qe, texture as Je, uint as Ye, uniform as M, uv as N, vec3 as P, vec4 as Xe } from "three/tsl";
18
+ import { Box3 as Ze, BufferGeometry as Qe, CircleGeometry as $e, Color as F, DataTexture as et, DirectionalLight as tt, DirectionalLightHelper as nt, EquirectangularReflectionMapping as rt, EventDispatcher as I, FloatType as it, LinearFilter as at, LinearSRGBColorSpace as ot, LoaderUtils as L, LoadingManager as st, MathUtils as R, Mesh as ct, MeshPhysicalMaterial as lt, NearestFilter as ut, NoBlending as dt, NoToneMapping as ft, Object3D as z, OrthographicCamera as pt, PerspectiveCamera as mt, PointLight as ht, PointLightHelper as gt, REVISION as _t, RGBAFormat as vt, RectAreaLight as B, RenderTarget as yt, SRGBColorSpace as V, Scene as H, SpotLight as bt, SpotLightHelper as xt, TextureLoader as St, UnsignedByteType as Ct, Vector2 as wt, Vector3 as U } from "three";
19
+ import { RectAreaLightTexturesLib as Tt } from "three/addons/lights/RectAreaLightTexturesLib.js";
20
+ import { RectAreaLightHelper as Et } from "three/addons/helpers/RectAreaLightHelper.js";
21
+ import { GLTFLoader as Dt } from "three/addons/loaders/GLTFLoader.js";
22
+ import { HDRLoader as Ot } from "three/addons/loaders/HDRLoader.js";
23
+ import { createMeshesFromMultiMaterialMesh as kt } from "three/addons/utils/SceneUtils.js";
24
+ import { clone as At } from "three/addons/utils/SkeletonUtils.js";
25
25
  //#region src/SceneHelpers.js
26
- var At = class {
26
+ var jt = class {
27
27
  constructor() {
28
- this.scene = new vt(), this._helpers = /* @__PURE__ */ new Map(), this.visible = !1;
28
+ this.scene = new H(), this._helpers = /* @__PURE__ */ new Map(), this.visible = !1;
29
29
  }
30
30
  add(e) {
31
31
  if (this._helpers.has(e.uuid)) return this._helpers.get(e.uuid);
@@ -63,16 +63,16 @@ var At = class {
63
63
  this.clear();
64
64
  }
65
65
  _createHelper(e) {
66
- return e.isRectAreaLight ? new Tt(e) : e.isPointLight ? new mt(e, .5) : e.isSpotLight ? new bt(e) : e.isDirectionalLight ? new et(e, .5) : null;
66
+ return e.isRectAreaLight ? new Et(e) : e.isPointLight ? new gt(e, .5) : e.isSpotLight ? new xt(e) : e.isDirectionalLight ? new nt(e, .5) : null;
67
67
  }
68
- }, jt = class extends t {
68
+ }, Mt = class extends n {
69
69
  constructor(t, n = {}) {
70
70
  super("Compositor", {
71
71
  ...n,
72
- executionMode: o.ALWAYS
73
- }), this.renderer = t, this._lightSources = [...n.displaySources ?? [], "pathtracer:color"], this.saturation = j(n.saturation ?? 1), this._transparentBackground = j(0, "int"), this._pathTracer = n.pathTracer ?? null, this._convergenceOverlay = !1, this._debugMaterial = null, this._debugQuad = null, this._debugTexNode = null, this._debugM2Attr = null, this._debugMaskAttr = null, this._debugExposureComp = j(1), this._sourceTexNode = new Le();
74
- let r = this._sourceTexNode.sample(M()), i = k(N(He(r.xyz, e)), r.xyz, this.saturation), a = A(this._transparentBackground, r.w, 1);
75
- this.compositorMaterial = new Ne(), this.compositorMaterial.colorNode = Je(i, a), this.compositorMaterial.blending = lt, this.compositorQuad = new E(this.compositorMaterial);
72
+ executionMode: r.ALWAYS
73
+ }), this.renderer = t, this._lightSources = [...n.displaySources ?? [], "pathtracer:color"], this.saturation = M(n.saturation ?? 1), this._transparentBackground = M(0, "int"), this._pathTracer = n.pathTracer ?? null, this._convergenceOverlay = !1, this._debugMaterial = null, this._debugQuad = null, this._debugTexNode = null, this._debugM2Attr = null, this._debugMaskAttr = null, this._debugExposureComp = M(1), this._sourceTexNode = new ze();
74
+ let i = this._sourceTexNode.sample(N()), a = A(P(We(i.xyz, e)), i.xyz, this.saturation), o = j(this._transparentBackground, i.w, 1);
75
+ this.compositorMaterial = new Pe(), this.compositorMaterial.colorNode = Xe(a, o), this.compositorMaterial.blending = dt, this.compositorQuad = new Ie(this.compositorMaterial);
76
76
  }
77
77
  resolveLightTexture(e) {
78
78
  return this.resolveLightSource(e)?.texture ?? null;
@@ -91,17 +91,17 @@ var At = class {
91
91
  let t = this._pathTracer?.getConvergenceDebugSource?.();
92
92
  if (!t) return !1;
93
93
  if (this._debugMaterial && this._debugM2Attr === t.m2 && this._debugMaskAttr === t.frozenMask) return !0;
94
- this._debugMaterial?.dispose(), this._debugTexNode?.dispose(), this._debugM2Attr = t.m2, this._debugMaskAttr = t.frozenMask, this._debugTexNode = new Le();
95
- let n = ze(() => {
96
- let n = He(this._debugTexNode.sample(M()).toVar().xyz, e).toVar(), r = t.renderWidth, i = t.renderHeight, a = O(M().x.mul(D(r))).min(r.sub(O(1))).max(O(0)), o = qe(O(M().y.mul(D(i))).min(i.sub(O(1))).max(O(0)).mul(r).add(a)).toVar(), s = Ge(t.m2, "float").toReadOnly().element(o).toVar(), c = Ge(t.frozenMask, "uint").toReadOnly().element(o).toVar(), l = s.sub(n.mul(n)).max(D(0)).div(D(t.frame).add(1)).sqrt().toVar(), u = t.usePixelFreeze.greaterThan(O(0)), d = A(n.lessThan(D(1)), n.sqrt(), n).toVar(), f = A(u, l.div(n.add(D(1e-4))), l.div(d.add(D(1e-4)))).toVar(), ee = A(u, t.pixelFreezeThreshold, t.noiseThreshold).toVar(), p = f.div(ee.max(D(1e-6))).toVar(), m = N(n.div(n.add(D(1))).sqrt().mul(.55)).toVar(), h = m.toVar(), te = D(t.frame).greaterThanEqual(D(t.adaptiveMinSamples));
97
- return Be(p.greaterThanEqual(D(1)).or(te.not()), () => {
98
- let e = k(N(1, .8, .1), N(1, .1, .05), p.sub(1).div(3).clamp(0, 1));
99
- h.assign(k(m, e, .85));
100
- }), Be(c.equal(qe(1)).and(u), () => {
101
- h.assign(k(m, N(.1, .45, 1), .55));
102
- }), h;
94
+ this._debugMaterial?.dispose(), this._debugTexNode?.dispose(), this._debugM2Attr = t.m2, this._debugMaskAttr = t.frozenMask, this._debugTexNode = new ze();
95
+ let n = Ve(() => {
96
+ let n = We(this._debugTexNode.sample(N()).toVar().xyz, e).toVar(), r = t.renderWidth, i = t.renderHeight, a = k(N().x.mul(O(r))).min(r.sub(k(1))).max(k(0)), o = Ye(k(N().y.mul(O(i))).min(i.sub(k(1))).max(k(0)).mul(r).add(a)).toVar(), s = qe(t.m2, "float").toReadOnly().element(o).toVar(), c = qe(t.frozenMask, "uint").toReadOnly().element(o).toVar(), l = s.sub(n.mul(n)).max(O(0)).div(O(t.frame).add(1)).sqrt().toVar(), u = t.usePixelFreeze.greaterThan(k(0)), d = j(n.lessThan(O(1)), n.sqrt(), n).toVar(), f = j(u, l.div(n.add(O(1e-4))), l.div(d.add(O(1e-4)))).toVar(), p = j(u, t.pixelFreezeThreshold, t.noiseThreshold).toVar(), m = f.div(p.max(O(1e-6))).toVar(), h = P(n.div(n.add(O(1))).sqrt().mul(.55)).toVar(), g = h.toVar(), ee = O(t.frame).greaterThanEqual(O(t.adaptiveMinSamples));
97
+ return He(m.greaterThanEqual(O(1)).or(ee.not()), () => {
98
+ let e = A(P(1, .8, .1), P(1, .1, .05), m.sub(1).div(3).clamp(0, 1));
99
+ g.assign(A(h, e, .85));
100
+ }), He(c.equal(Ye(1)).and(u), () => {
101
+ g.assign(A(h, P(.1, .45, 1), .55));
102
+ }), g;
103
103
  });
104
- return this._debugMaterial = new Ne(), this._debugMaterial.colorNode = Je(n().pow(2.2).mul(this._debugExposureComp), 1), this._debugMaterial.blending = lt, this._debugQuad = new E(this._debugMaterial), !0;
104
+ return this._debugMaterial = new Pe(), this._debugMaterial.colorNode = Xe(n().pow(2.2).mul(this._debugExposureComp), 1), this._debugMaterial.blending = dt, this._debugQuad = new Ie(this._debugMaterial), !0;
105
105
  }
106
106
  render(e) {
107
107
  if (!this.enabled) return;
@@ -109,7 +109,7 @@ var At = class {
109
109
  let t = e.getTexture("pathtracer:color");
110
110
  if (t) {
111
111
  this._debugTexNode.value = t;
112
- let e = this.renderer.toneMapping !== ut;
112
+ let e = this.renderer.toneMapping !== ft;
113
113
  this._debugExposureComp.value = e ? 1 / Math.max(this.renderer.toneMappingExposure, 1e-4) : 1, this.renderer.setRenderTarget(null), this._debugQuad.render(this.renderer);
114
114
  return;
115
115
  }
@@ -129,7 +129,7 @@ var At = class {
129
129
  dispose() {
130
130
  this._sourceTexNode?.dispose(), this.compositorMaterial?.dispose(), this._debugTexNode?.dispose(), this._debugMaterial?.dispose(), this.compositorQuad = null, this._debugQuad = null, this._debugMaterial = null, this._debugTexNode = null, this._pathTracer = null;
131
131
  }
132
- }, Mt = class {
132
+ }, Nt = class {
133
133
  constructor() {
134
134
  this.textures = /* @__PURE__ */ new Map(), this.renderTargets = /* @__PURE__ */ new Map(), this.uniforms = /* @__PURE__ */ new Map(), this.state = {
135
135
  frame: 0,
@@ -249,7 +249,7 @@ var At = class {
249
249
  dispose() {
250
250
  this.textures.clear(), this.renderTargets.clear(), this.uniforms.clear(), this._stateChangeCallbacks.clear(), this.state = {};
251
251
  }
252
- }, Nt = class extends F {
252
+ }, Pt = class extends I {
253
253
  constructor() {
254
254
  super(), this._onceCallbacks = /* @__PURE__ */ new Map();
255
255
  }
@@ -287,38 +287,38 @@ var At = class {
287
287
  eventNames() {
288
288
  return this._listeners ? Object.keys(this._listeners) : [];
289
289
  }
290
- }, Pt = !1, H = [], Ft = /* @__PURE__ */ new WeakMap();
291
- function It(e) {
292
- Pt = !!e;
293
- }
294
- function Lt() {
295
- return H.slice();
290
+ }, Ft = !1, W = [], It = /* @__PURE__ */ new WeakMap();
291
+ function Lt(e) {
292
+ Ft = !!e;
296
293
  }
297
294
  function Rt() {
298
- H.length = 0;
295
+ return W.slice();
296
+ }
297
+ function zt() {
298
+ W.length = 0;
299
299
  }
300
- function zt(e) {
300
+ function Bt(e) {
301
301
  let t = [];
302
302
  for (let n of Object.keys(e)) e[n]?.isTextureNode === !0 && t.push(n);
303
303
  return t;
304
304
  }
305
- var Bt = (e) => !e || !e.image || !(e.image.width > 0);
306
- function Vt(e, t, n) {
307
- if (!Pt) {
305
+ var Vt = (e) => !e || !e.image || !(e.image.width > 0);
306
+ function Ht(e, t, n) {
307
+ if (!Ft) {
308
308
  n();
309
309
  return;
310
310
  }
311
- let r = Ft.get(e);
311
+ let r = It.get(e);
312
312
  if (r || (r = {
313
313
  phase: "pending",
314
314
  unboundAtCompile: []
315
- }, Ft.set(e, r)), r.phase !== "pending") {
316
- n(), r.phase === "watch" && Ht(e, r);
315
+ }, It.set(e, r)), r.phase !== "pending") {
316
+ n(), r.phase === "watch" && Ut(e, r);
317
317
  return;
318
318
  }
319
319
  let i = Object.prototype.hasOwnProperty.call(t, "compute"), a = t.compute;
320
320
  t.compute = function(...t) {
321
- return r.phase === "pending" && (r.unboundAtCompile = zt(e).filter((t) => Bt(e[t].value)), r.phase = r.unboundAtCompile.length < 2 ? "done" : "watch"), a.apply(this, t);
321
+ return r.phase === "pending" && (r.unboundAtCompile = Bt(e).filter((t) => Vt(e[t].value)), r.phase = r.unboundAtCompile.length < 2 ? "done" : "watch"), a.apply(this, t);
322
322
  };
323
323
  try {
324
324
  n();
@@ -326,14 +326,14 @@ function Vt(e, t, n) {
326
326
  i ? t.compute = a : delete t.compute;
327
327
  }
328
328
  }
329
- function Ht(e, t) {
329
+ function Ut(e, t) {
330
330
  let n = [];
331
331
  for (let r of t.unboundAtCompile) {
332
332
  let t = e[r]?.value;
333
- if (Bt(t)) return;
333
+ if (Vt(t)) return;
334
334
  t.isStorageTexture !== !0 && n.push(r);
335
335
  }
336
- t.phase = "done", n.length !== 0 && H.push({
336
+ t.phase = "done", n.length !== 0 && W.push({
337
337
  stage: e.name,
338
338
  nodes: n,
339
339
  unboundAtCompile: t.unboundAtCompile.slice(),
@@ -342,18 +342,18 @@ function Ht(e, t) {
342
342
  }
343
343
  //#endregion
344
344
  //#region src/Pipeline/RenderPipeline.js
345
- var Ut = class {
345
+ var Wt = class {
346
346
  _reportStageFailure(e, t, n) {
347
347
  console.error(`[Pipeline] Error in stage '${e}' (${t}):`, n);
348
348
  let r = `${e}:${t}`;
349
- this._reportedStageFailures.has(r) || (this._reportedStageFailures.add(r), this._issues?.record(b.STAGE_RENDER_FAILED, `stage "${e}" threw during ${t} — the frame is incomplete`, {
349
+ this._reportedStageFailures.has(r) || (this._reportedStageFailures.add(r), this._issues?.record(S.STAGE_RENDER_FAILED, `stage "${e}" threw during ${t} — the frame is incomplete`, {
350
350
  stage: e,
351
351
  phase: t,
352
352
  cause: String(n?.message ?? n)
353
353
  }));
354
354
  }
355
355
  constructor(e, t, n, { issues: r = null } = {}) {
356
- this.renderer = e, this._issues = r, this._reportedStageFailures = /* @__PURE__ */ new Set(), this.width = t, this.height = n, this.stages = [], this.context = new Mt(), this.eventBus = new Nt(), this.context.setState("width", t), this.context.setState("height", n), this.stats = {
356
+ this.renderer = e, this._issues = r, this._reportedStageFailures = /* @__PURE__ */ new Set(), this.width = t, this.height = n, this.stages = [], this.context = new Nt(), this.eventBus = new Pt(), this.context.setState("width", t), this.context.setState("height", n), this.stats = {
357
357
  enabled: !1,
358
358
  logSkipped: !1,
359
359
  timings: /* @__PURE__ */ new Map(),
@@ -387,7 +387,7 @@ var Ut = class {
387
387
  }
388
388
  try {
389
389
  let n = this.stats.enabled ? performance.now() : 0;
390
- if (Vt(t, this.renderer, () => t.render(this.context, e)), this.stats.enabled) {
390
+ if (Ht(t, this.renderer, () => t.render(this.context, e)), this.stats.enabled) {
391
391
  let e = performance.now() - n;
392
392
  this.stats.timings.has(t.name) || this.stats.timings.set(t.name, []);
393
393
  let r = this.stats.timings.get(t.name);
@@ -485,7 +485,7 @@ var Ut = class {
485
485
  let e = this.getInfo();
486
486
  console.group("[Pipeline] Info"), console.log("Stages:", e.stages), console.log("Context Textures:", e.textures), console.log("Context Render Targets:", e.renderTargets), console.log("Context Uniforms:", e.uniforms), console.log("Event Types:", e.events), console.log("State:", e.contextState), console.groupEnd();
487
487
  }
488
- }, Wt = me("engine"), Gt = class {
488
+ }, Gt = fe("engine"), Kt = class {
489
489
  constructor() {
490
490
  this.timeElapsed = 0, this.lastResetTime = performance.now(), this.renderCompleteDispatched = !1, this.budgetOverrun = !1, this._budgetHeldWarned = !1;
491
491
  }
@@ -493,7 +493,7 @@ var Ut = class {
493
493
  this.timeElapsed = (performance.now() - this.lastResetTime) / 1e3;
494
494
  }
495
495
  isTimeLimitReached(e, t, n) {
496
- return t !== "time" || !(n > 0) || this.timeElapsed < n ? !1 : e?.frameCount > 0 ? (this.budgetOverrun = !0, !0) : (this._budgetHeldWarned || (this._budgetHeldWarned = !0, Wt.warn(`render time limit (${n}s) expired before the first sample landed — holding the deadline open to avoid capturing an empty frame`)), !1);
496
+ return t !== "time" || !(n > 0) || this.timeElapsed < n ? !1 : e?.frameCount > 0 ? (this.budgetOverrun = !0, !0) : (this._budgetHeldWarned || (this._budgetHeldWarned = !0, Gt.warn(`render time limit (${n}s) expired before the first sample landed — holding the deadline open to avoid capturing an empty frame`)), !1);
497
497
  }
498
498
  isLimitReached(e, t, n) {
499
499
  return e ? this.isTimeLimitReached(e, t, n) ? !0 : this.stopCondition(e) !== null : !1;
@@ -510,17 +510,17 @@ var Ut = class {
510
510
  resumeFromPause() {
511
511
  this.renderCompleteDispatched = !1, this.lastResetTime = performance.now() - this.timeElapsed * 1e3;
512
512
  }
513
- }, Kt = class {
513
+ }, qt = class {
514
514
  constructor(e) {
515
- this.renderer = e, this.target = null, this.material = new Pe(), this.material.name = "rayzee:texture-readback", this.quad = new E(this.material), this._node = null, this._source = null;
515
+ this.renderer = e, this.target = null, this.material = new Fe(), this.material.name = "rayzee:texture-readback", this.quad = new Ie(this.material), this._node = null, this._source = null;
516
516
  }
517
517
  _ensureTarget(e, t) {
518
- this.target && this.target.width === e && this.target.height === t || (this.target?.dispose(), this.target = new _t(e, t, {
519
- type: nt,
520
- format: gt,
518
+ this.target && this.target.width === e && this.target.height === t || (this.target?.dispose(), this.target = new yt(e, t, {
519
+ type: it,
520
+ format: vt,
521
521
  depthBuffer: !1,
522
- minFilter: ct,
523
- magFilter: ct
522
+ minFilter: ut,
523
+ magFilter: ut
524
524
  }));
525
525
  }
526
526
  async read(e, t, n) {
@@ -531,7 +531,7 @@ var Ut = class {
531
531
  }
532
532
  }
533
533
  draw(e, t, n) {
534
- this._ensureTarget(t, n), this._source !== e && (this._node = Ke(e).load(Ue(We.xy)), this.material.outputNode = this._node, this.material.needsUpdate = !0, this._source = e);
534
+ this._ensureTarget(t, n), this._source !== e && (this._node = Je(e).load(Ge(Ke.xy)), this.material.outputNode = this._node, this.material.needsUpdate = !0, this._source = e);
535
535
  let r = this.renderer.getRenderTarget();
536
536
  return this.renderer.setRenderTarget(this.target), this.quad.render(this.renderer), this.renderer.setRenderTarget(r), this.target;
537
537
  }
@@ -541,16 +541,16 @@ var Ut = class {
541
541
  dispose() {
542
542
  this.target?.dispose(), this.material.dispose(), this.target = null, this._source = null, this._node = null;
543
543
  }
544
- }, qt = 864e5, U = Object.freeze({
544
+ }, Jt = 864e5, G = Object.freeze({
545
545
  IMMUTABLE: "immutable",
546
546
  REVALIDATE: "revalidate",
547
547
  NETWORK: "network"
548
- }), W = (e, t) => ({
548
+ }), Yt = (e, t) => ({
549
549
  loaded: e,
550
550
  total: t,
551
551
  lengthComputable: t > 0 && e <= t
552
- }), G = (e, t) => e.headers?.get?.(t) ?? null, Jt = (e) => e.reason ?? new DOMException("aborted", "AbortError");
553
- function K(e) {
552
+ }), K = (e, t) => e.headers?.get?.(t) ?? null, Xt = (e) => e.reason ?? new DOMException("aborted", "AbortError");
553
+ function q(e) {
554
554
  try {
555
555
  let t = new URL(e, globalThis.location?.href ?? "http://localhost/").pathname;
556
556
  return decodeURIComponent(t.split("/").pop()) || "download";
@@ -558,36 +558,36 @@ function K(e) {
558
558
  return "download";
559
559
  }
560
560
  }
561
- async function Yt(e, { onProgress: t, signal: n }) {
562
- let r = Number(G(e, "content-length")) || 0, i = G(e, "content-type") ?? "";
561
+ async function Zt(e, { onProgress: t, signal: n }) {
562
+ let r = Number(K(e, "content-length")) || 0, i = K(e, "content-type") ?? "";
563
563
  if (!e.body) return new Blob([await e.arrayBuffer()], { type: i });
564
564
  let a = e.body.getReader(), o = [], s = 0;
565
565
  for (;;) {
566
- if (n?.aborted) throw a.cancel().catch(() => {}), Jt(n);
566
+ if (n?.aborted) throw a.cancel().catch(() => {}), Xt(n);
567
567
  let { done: e, value: i } = await a.read();
568
568
  if (e) break;
569
- o.push(i), s += i.length, t?.(W(s, r));
569
+ o.push(i), s += i.length, t?.(Yt(s, r));
570
570
  }
571
571
  return new Blob(o, { type: i });
572
572
  }
573
- var q = (e, t, n) => new File([e], t, {
573
+ var Qt = (e, t, n) => new File([e], t, {
574
574
  type: n || e.type,
575
575
  lastModified: e.lastModified ?? Date.now()
576
- }), Xt = () => {}, J = class {
576
+ }), $t = () => {}, J = class {
577
577
  constructor(e) {
578
578
  this._storage = e, this._revalidating = /* @__PURE__ */ new Set();
579
579
  }
580
580
  get _area() {
581
- return this._storage?.area(be.DOWNLOADS) ?? null;
581
+ return this._storage?.area(ve.DOWNLOADS) ?? null;
582
582
  }
583
- async fetch(e, { key: t = e, name: n = K(e), policy: r = U.REVALIDATE, maxAgeMs: i = qt, onProgress: a = null, signal: o = null, fetchOptions: s = {} } = {}) {
583
+ async fetch(e, { key: t = e, name: n = q(e), policy: r = G.REVALIDATE, maxAgeMs: i = Jt, onProgress: a = null, signal: o = null, fetchOptions: s = {} } = {}) {
584
584
  let c = this._area;
585
- if (c && r !== U.NETWORK) {
585
+ if (c && r !== G.NETWORK) {
586
586
  let o = await c.open(t);
587
587
  if (o) {
588
588
  let c = await o.file("data");
589
- if (c) return r === U.REVALIDATE && Date.now() - (o.extra.checkedAt ?? 0) >= i && this._revalidate(e, t, n, o.extra, s), a?.(W(c.size, c.size)), {
590
- file: q(c, n, o.extra.contentType),
589
+ if (c) return r === G.REVALIDATE && Date.now() - (o.extra.checkedAt ?? 0) >= i && this._revalidate(e, t, n, o.extra, s), a?.(Yt(c.size, c.size)), {
590
+ file: Qt(c, n, o.extra.contentType),
591
591
  release: () => o.release(),
592
592
  fromCache: !0
593
593
  };
@@ -605,16 +605,16 @@ var q = (e, t, n) => new File([e], t, {
605
605
  return await this._area?.has(e) === !0;
606
606
  }
607
607
  async _download(e, t, n, { onProgress: r, signal: i, fetchOptions: a, cache: o }) {
608
- if (i?.aborted) throw Jt(i);
608
+ if (i?.aborted) throw Xt(i);
609
609
  let s = await fetch(e, {
610
610
  ...a,
611
611
  signal: i
612
612
  });
613
613
  if (!s.ok) throw Error(`HTTP ${s.status} fetching ${e}`);
614
- let c = Number(G(s, "content-length")) || 0, l = {
614
+ let c = Number(K(s, "content-length")) || 0, l = {
615
615
  url: e,
616
- contentType: G(s, "content-type") ?? "",
617
- lastModified: G(s, "last-modified"),
616
+ contentType: K(s, "content-type") ?? "",
617
+ lastModified: K(s, "last-modified"),
618
618
  contentLength: c || null,
619
619
  checkedAt: Date.now()
620
620
  }, u = o && s.body ? await this._area.create(t, {
@@ -622,17 +622,17 @@ var q = (e, t, n) => new File([e], t, {
622
622
  expectedBytes: c
623
623
  }) : null;
624
624
  if (!u) return {
625
- file: q(await Yt(s, {
625
+ file: Qt(await Zt(s, {
626
626
  onProgress: r,
627
627
  signal: i
628
628
  }), n, l.contentType),
629
- release: Xt,
629
+ release: $t,
630
630
  fromCache: !1
631
631
  };
632
632
  try {
633
633
  await u.writeStream("data", s.body, {
634
634
  signal: i,
635
- onProgress: (e) => r?.(W(e, c))
635
+ onProgress: (e) => r?.(Yt(e, c))
636
636
  }), await u.commit(l);
637
637
  } catch (o) {
638
638
  if (await u.abort(), o?.name !== "QuotaExceededError") throw o;
@@ -646,7 +646,7 @@ var q = (e, t, n) => new File([e], t, {
646
646
  let d = await this._area.open(t, { wait: !0 }), f = d && await d.file("data");
647
647
  if (!f) throw d?.release(), Error(`storage: ${n} vanished right after it was saved`);
648
648
  return {
649
- file: q(f, n, l.contentType),
649
+ file: Qt(f, n, l.contentType),
650
650
  release: () => d.release(),
651
651
  fromCache: !1
652
652
  };
@@ -663,7 +663,7 @@ var q = (e, t, n) => new File([e], t, {
663
663
  headers: t
664
664
  });
665
665
  if (n.body?.cancel().catch(() => {}), n.ok) {
666
- let e = G(n, "last-modified"), t = n.status === 206 ? Number(G(n, "content-range")?.match(/\/(\d+)$/)?.[1]) || null : Number(G(n, "content-length")) || null;
666
+ let e = K(n, "last-modified"), t = n.status === 206 ? Number(K(n, "content-range")?.match(/\/(\d+)$/)?.[1]) || null : Number(K(n, "content-length")) || null;
667
667
  a = !!(e && r.lastModified && e !== r.lastModified || t && r.contentLength && t !== r.contentLength);
668
668
  }
669
669
  } catch {}
@@ -683,16 +683,16 @@ var q = (e, t, n) => new File([e], t, {
683
683
  }
684
684
  }
685
685
  };
686
- function Zt(e, t, n) {
686
+ function en(e, t, n) {
687
687
  return new J(t).fetch(e, n);
688
688
  }
689
- function Qt() {
690
- return new J(ye(C().cacheNamespace));
689
+ function tn() {
690
+ return new J(_e(T().cacheNamespace));
691
691
  }
692
- async function $t(e, { downloads: t = Qt(), ...n } = {}) {
692
+ async function nn(e, { downloads: t = tn(), ...n } = {}) {
693
693
  if (!t._storage || !/^https?:/i.test(e)) return {
694
694
  url: e,
695
- release: Xt,
695
+ release: $t,
696
696
  cached: !1
697
697
  };
698
698
  let { file: r, release: i } = await t.fetch(e, n), a = URL.createObjectURL(r);
@@ -706,7 +706,7 @@ async function $t(e, { downloads: t = Qt(), ...n } = {}) {
706
706
  }
707
707
  //#endregion
708
708
  //#region src/RenderSettings.js
709
- var en = {
709
+ var rn = {
710
710
  maxBounces: {
711
711
  uniform: "maxBounces",
712
712
  reset: !0
@@ -932,9 +932,9 @@ var en = {
932
932
  HOST: "host",
933
933
  SCENE_METADATA: "scene-metadata",
934
934
  MODE_PRESET: "mode-preset"
935
- }), tn = class extends F {
936
- constructor(e = n, { issues: t = null } = {}) {
937
- super(), this._issues = t, this._defaults = e, this._routes = new Map(Object.entries(en)), this._values = /* @__PURE__ */ new Map(), this._sources = /* @__PURE__ */ new Map(), this._pathTracer = null, this._resetCallback = null, this._handlers = {}, this._initDefaults(e);
935
+ }), an = class extends I {
936
+ constructor(e = o, { issues: t = null } = {}) {
937
+ super(), this._issues = t, this._defaults = e, this._routes = new Map(Object.entries(rn)), this._values = /* @__PURE__ */ new Map(), this._sources = /* @__PURE__ */ new Map(), this._pathTracer = null, this._resetCallback = null, this._handlers = {}, this._initDefaults(e);
938
938
  }
939
939
  bind(e) {
940
940
  this._pathTracer = e.stages.pathTracer, this._resetCallback = e.resetCallback, this._handlers = this._buildHandlers(e);
@@ -949,21 +949,21 @@ var en = {
949
949
  !this._values.has(e) && i !== void 0 && (this._values.set(e, i), this._sources.set(e, Y.DEFAULT));
950
950
  }
951
951
  _buildHandlers({ stages: e, resetCallback: t, reconcileCompletion: n, applyExposure: r, onCameraProjection: i }) {
952
- let o = new Ct(), s = (t, n) => {
953
- o.set(n?.[0] ?? 0, n?.[1] ?? 0).multiplyScalar(L.DEG2RAD), e.pathTracer?.setUniform(t, o);
952
+ let a = new wt(), o = (t, n) => {
953
+ a.set(n?.[0] ?? 0, n?.[1] ?? 0).multiplyScalar(R.DEG2RAD), e.pathTracer?.setUniform(t, a);
954
954
  };
955
955
  return {
956
956
  handleCameraProjection: (t) => {
957
- e.pathTracer?.setUniform("cameraProjection", a[t] ?? a.perspective), i?.(t);
957
+ e.pathTracer?.setUniform("cameraProjection", m[t] ?? m.perspective), i?.(t);
958
958
  },
959
959
  handleDofMode: (t) => e.pathTracer?.setUniform("dofMode", +(t === "look")),
960
- handlePanoramaLonRange: (e) => s("panoLonRange", e),
961
- handlePanoramaLatRange: (e) => s("panoLatRange", e),
960
+ handlePanoramaLonRange: (e) => o("panoLonRange", e),
961
+ handlePanoramaLatRange: (e) => o("panoLatRange", e),
962
962
  handleTransparentBackground: (t) => {
963
963
  e.pathTracer?.setUniform("transparentBackground", t), e.compositor?.setTransparentBackground(t);
964
964
  },
965
965
  handleBackgroundColor: (t) => {
966
- let n = t?.isColor ? t : new P(t);
966
+ let n = t?.isColor ? t : new F(t);
967
967
  e.pathTracer?.setUniform("backgroundColor", n);
968
968
  },
969
969
  handleExposure: (e) => {
@@ -1040,7 +1040,7 @@ var en = {
1040
1040
  });
1041
1041
  }
1042
1042
  _reportUnknownKey(e) {
1043
- this._issues?.record(b.SETTING_UNKNOWN_KEY, `unknown setting "${e}" — stored but never applied to any stage`, { key: e });
1043
+ this._issues?.record(S.SETTING_UNKNOWN_KEY, `unknown setting "${e}" — stored but never applied to any stage`, { key: e });
1044
1044
  }
1045
1045
  get(e) {
1046
1046
  return this._values.get(e);
@@ -1061,14 +1061,14 @@ var en = {
1061
1061
  let e = {};
1062
1062
  for (let [t, n] of this._values) {
1063
1063
  if (this._sources.get(t) !== Y.HOST || !this._routes.has(t)) continue;
1064
- let r = h(n);
1064
+ let r = s(n);
1065
1065
  r !== void 0 && (e[t] = r);
1066
1066
  }
1067
1067
  return e;
1068
1068
  }
1069
1069
  restore(e) {
1070
1070
  let t = {}, n = [];
1071
- for (let [r, i] of Object.entries(e ?? {})) this._routes.has(r) ? t[r] = c(i) : n.push(r);
1071
+ for (let [r, i] of Object.entries(e ?? {})) this._routes.has(r) ? t[r] = l(i) : n.push(r);
1072
1072
  return this.setMany(t), n;
1073
1073
  }
1074
1074
  applyAll() {
@@ -1081,19 +1081,19 @@ var en = {
1081
1081
  e.uniform ? this._pathTracer?.setUniform(e.uniform, t) : e.handler ? this._handlers[e.handler]?.(t, n) : e.apply?.(t, n);
1082
1082
  }
1083
1083
  _initDefaults(e) {
1084
- for (let t of Object.keys(en)) t in e && (this._values.set(t, e[t]), this._sources.set(t, Y.DEFAULT));
1084
+ for (let t of Object.keys(rn)) t in e && (this._values.set(t, e[t]), this._sources.set(t, Y.DEFAULT));
1085
1085
  }
1086
- }, nn = class {
1086
+ }, on = class {
1087
1087
  constructor({ issues: e = null } = {}) {
1088
- this._issues = e, this._renderer = null, this._offRegistry = De(() => {
1089
- this._renderer && Ee(this._renderer);
1088
+ this._issues = e, this._renderer = null, this._offRegistry = Te(() => {
1089
+ this._renderer && we(this._renderer);
1090
1090
  });
1091
1091
  }
1092
1092
  get hasConfig() {
1093
1093
  return !1;
1094
1094
  }
1095
1095
  get workingSpace() {
1096
- return S;
1096
+ return w;
1097
1097
  }
1098
1098
  get workingSpaceAdopted() {
1099
1099
  return !1;
@@ -1103,41 +1103,41 @@ var en = {
1103
1103
  }
1104
1104
  attachRenderer(e) {
1105
1105
  this._renderer = e;
1106
- let t = Ee(e);
1107
- return e.outputColorSpace = B, t;
1106
+ let t = we(e);
1107
+ return e.outputColorSpace = V, t;
1108
1108
  }
1109
1109
  listViews() {
1110
- return we();
1110
+ return Se();
1111
1111
  }
1112
1112
  get activeView() {
1113
1113
  return null;
1114
1114
  }
1115
1115
  setActiveView(e) {
1116
- let t = w(e);
1116
+ let t = E(e);
1117
1117
  if (!t) throw Error(`no view transform with id ${e}`);
1118
1118
  if (t.outputEncoded) throw Error(`"${t.name}" returns display-encoded colour: it needs rayzee/addons/color`);
1119
1119
  return this._renderer && (this._renderer.toneMapping = e), t;
1120
1120
  }
1121
1121
  _publishWorkingMatrix() {
1122
- xe(null, S);
1122
+ ye(null, w);
1123
1123
  }
1124
1124
  loadConfig() {
1125
1125
  let e = "colour configs need the OCIO pipeline: renderer.setColorManagement( ColorManagement ), from rayzee/addons/color";
1126
- return this._issues?.record(b.CAPABILITY_MISSING, e, { capability: "color" }), Promise.reject(Error(e));
1126
+ return this._issues?.record(S.CAPABILITY_MISSING, e, { capability: "color" }), Promise.reject(Error(e));
1127
1127
  }
1128
1128
  unloadConfig() {}
1129
1129
  setWorkingSpace() {}
1130
1130
  exportPixels(e) {
1131
1131
  return {
1132
1132
  rgba: e,
1133
- colorSpace: S
1133
+ colorSpace: w
1134
1134
  };
1135
1135
  }
1136
1136
  status() {
1137
- let e = this._renderer ? w(this._renderer.toneMapping) : null;
1137
+ let e = this._renderer ? E(this._renderer.toneMapping) : null;
1138
1138
  return {
1139
1139
  config: null,
1140
- workingSpace: S,
1140
+ workingSpace: w,
1141
1141
  workingSpaceAdopted: !1,
1142
1142
  activeTransform: e ? {
1143
1143
  id: e.id,
@@ -1147,23 +1147,23 @@ var en = {
1147
1147
  activeView: null,
1148
1148
  context: null,
1149
1149
  exportSpace: null,
1150
- views: we(),
1151
- registryVersion: Te(),
1150
+ views: Se(),
1151
+ registryVersion: Ce(),
1152
1152
  bakeError: e?.error ?? null
1153
1153
  };
1154
1154
  }
1155
1155
  dispose() {
1156
- this._offRegistry?.(), this._renderer = null, this._issues = null, Se() === this && (xe(null), x(null));
1156
+ this._offRegistry?.(), this._renderer = null, this._issues = null, be() === this && (ye(null), C(null));
1157
1157
  }
1158
- }, rn = [
1158
+ }, sn = [
1159
1159
  [/\.jpe?g(\?|#|$)/i, "image/jpeg"],
1160
1160
  [/\.webp(\?|#|$)/i, "image/webp"],
1161
1161
  [/\.avif(\?|#|$)/i, "image/avif"]
1162
1162
  ];
1163
- function an(e) {
1164
- return e.mimeType ? e.mimeType : e.uri?.startsWith("data:") ? e.uri.slice(5, e.uri.indexOf(";")) : rn.find(([t]) => t.test(e.uri ?? ""))?.[1] ?? "image/png";
1163
+ function cn(e) {
1164
+ return e.mimeType ? e.mimeType : e.uri?.startsWith("data:") ? e.uri.slice(5, e.uri.indexOf(";")) : sn.find(([t]) => t.test(e.uri ?? ""))?.[1] ?? "image/png";
1165
1165
  }
1166
- function on(e) {
1166
+ function ln(e) {
1167
1167
  for (let t = 8; t + 12 <= e.length;) {
1168
1168
  let n = (e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3]) >>> 0, r = t + 12 + n;
1169
1169
  if (e[t + 4] === 73 && e[t + 5] === 69 && e[t + 6] === 78 && e[t + 7] === 68) return e.subarray(0, r);
@@ -1171,48 +1171,48 @@ function on(e) {
1171
1171
  }
1172
1172
  return e;
1173
1173
  }
1174
- function sn({ data: e, width: t, height: n }, { shared: r = !1 } = {}) {
1174
+ function un({ data: e, width: t, height: n }, { shared: r = !1 } = {}) {
1175
1175
  let i = new Uint8Array(e.buffer, e.byteOffset, t * n * 4), a = i;
1176
1176
  r && typeof SharedArrayBuffer < "u" && !(i.buffer instanceof SharedArrayBuffer) && (a = new Uint8Array(new SharedArrayBuffer(i.byteLength)), a.set(i));
1177
- let o = new Qe(a, t, n, gt, St);
1177
+ let o = new et(a, t, n, vt, Ct);
1178
1178
  return o.needsUpdate = !0, o;
1179
1179
  }
1180
- function cn(e, t) {
1181
- return d().decodeImage(t === "image/png" ? on(e) : e, t);
1180
+ function dn(e, t) {
1181
+ return b().decodeImage(t === "image/png" ? ln(e) : e, t);
1182
1182
  }
1183
- async function ln(e) {
1183
+ async function fn(e) {
1184
1184
  let t = await fetch(e);
1185
1185
  if (!t.ok) throw Error(`HTTP ${t.status}`);
1186
1186
  return new Uint8Array(await t.arrayBuffer());
1187
1187
  }
1188
- function un(e, t) {
1189
- return t.bufferView === void 0 ? ln(e.options.manager.resolveURL(I.resolveURL(t.uri, e.options.path))) : e.getDependency("bufferView", t.bufferView).then((e) => new Uint8Array(e));
1188
+ function pn(e, t) {
1189
+ return t.bufferView === void 0 ? fn(e.options.manager.resolveURL(L.resolveURL(t.uri, e.options.path))) : e.getDependency("bufferView", t.bufferView).then((e) => new Uint8Array(e));
1190
1190
  }
1191
- var dn = (e, t) => !!t && t !== e.textureLoader && typeof t.parse == "function";
1192
- function fn(e, t, n) {
1191
+ var mn = (e, t) => !!t && t !== e.textureLoader && typeof t.parse == "function";
1192
+ function hn(e, t, n) {
1193
1193
  if (e.sourceCache[t] !== void 0) return e.sourceCache[t].then((e) => e.clone());
1194
- let r = un(e, e.json.images[t]).then((e) => new Promise((t, r) => {
1194
+ let r = pn(e, e.json.images[t]).then((e) => new Promise((t, r) => {
1195
1195
  n.parse(e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength), t, r);
1196
1196
  }));
1197
1197
  return e.sourceCache[t] = r, r;
1198
1198
  }
1199
- async function pn(e, t = an({ uri: e })) {
1200
- let n = sn(await cn(await ln(e), t));
1199
+ async function gn(e, t = cn({ uri: e })) {
1200
+ let n = un(await dn(await fn(e), t));
1201
1201
  return n.flipY = !0, n;
1202
1202
  }
1203
- function mn(e, t = null) {
1203
+ function _n(e, t = null) {
1204
1204
  return e.loadImageSource = function(e, n) {
1205
- if (dn(this, n)) return fn(this, e, n);
1205
+ if (mn(this, n)) return hn(this, e, n);
1206
1206
  let r = this.json.images[e], i = /* @__PURE__ */ Error("no image decoder in this runtime: configurePlatform( nodePlatform( { decodeImage } ) ) — see \"Running in Node\"");
1207
1207
  return t?.(r.uri ?? `bufferView ${r.bufferView}`, i), Promise.reject(i);
1208
1208
  }, { name: "RAYZEE_missing_image_decoder" };
1209
1209
  }
1210
- function hn(e, t = null) {
1210
+ function vn(e, t = null) {
1211
1211
  return e.loadImageSource = function(e, n) {
1212
- if (dn(this, n)) return fn(this, e, n);
1212
+ if (mn(this, n)) return hn(this, e, n);
1213
1213
  if (this.sourceCache[e] !== void 0) return this.sourceCache[e].then((e) => e.clone());
1214
- let r = this.json.images[e], i = an(r), a = r.uri ?? `bufferView ${r.bufferView}`, o = un(this, r).then((e) => cn(e, i)).then((e) => {
1215
- let t = sn(e, { shared: !0 });
1214
+ let r = this.json.images[e], i = cn(r), a = r.uri ?? `bufferView ${r.bufferView}`, o = pn(this, r).then((e) => dn(e, i)).then((e) => {
1215
+ let t = un(e, { shared: !0 });
1216
1216
  return r.extras && typeof r.extras == "object" && Object.assign(t.userData, r.extras), t.userData.mimeType = i, t;
1217
1217
  }).catch((e) => {
1218
1218
  throw t?.(a, e), e;
@@ -1222,8 +1222,8 @@ function hn(e, t = null) {
1222
1222
  }
1223
1223
  //#endregion
1224
1224
  //#region src/Processor/GLTFDiffuseTransmission.js
1225
- var gn = "KHR_materials_diffuse_transmission";
1226
- function _n(e) {
1225
+ var yn = "KHR_materials_diffuse_transmission";
1226
+ function bn(e) {
1227
1227
  let t = (t, n, r, i) => {
1228
1228
  let a = {};
1229
1229
  return e.assignTexture(a, n, r, i).then(() => {
@@ -1231,7 +1231,7 @@ function _n(e) {
1231
1231
  });
1232
1232
  };
1233
1233
  return {
1234
- name: gn,
1234
+ name: yn,
1235
1235
  afterRoot(n) {
1236
1236
  let r = e.json.materials ?? [], i = /* @__PURE__ */ new Set(), a = [];
1237
1237
  for (let o of n.scenes ?? []) o.traverse((n) => {
@@ -1239,7 +1239,7 @@ function _n(e) {
1239
1239
  for (let n of o) {
1240
1240
  if (i.has(n)) continue;
1241
1241
  i.add(n);
1242
- let o = e.associations.get(n)?.materials, s = o === void 0 ? null : r[o]?.extensions?.[gn];
1242
+ let o = e.associations.get(n)?.materials, s = o === void 0 ? null : r[o]?.extensions?.[yn];
1243
1243
  if (!s) continue;
1244
1244
  n.diffuseTransmission = s.diffuseTransmissionFactor ?? 0;
1245
1245
  let [c, l, u] = s.diffuseTransmissionColorFactor ?? [
@@ -1247,7 +1247,7 @@ function _n(e) {
1247
1247
  1,
1248
1248
  1
1249
1249
  ];
1250
- n.diffuseTransmissionColor = new P().setRGB(c, l, u, it), s.diffuseTransmissionTexture && a.push(t(n, "diffuseTransmissionMap", s.diffuseTransmissionTexture)), s.diffuseTransmissionColorTexture && a.push(t(n, "diffuseTransmissionColorMap", s.diffuseTransmissionColorTexture, B));
1250
+ n.diffuseTransmissionColor = new F().setRGB(c, l, u, ot), s.diffuseTransmissionTexture && a.push(t(n, "diffuseTransmissionMap", s.diffuseTransmissionTexture)), s.diffuseTransmissionColorTexture && a.push(t(n, "diffuseTransmissionColorMap", s.diffuseTransmissionColorTexture, V));
1251
1251
  }
1252
1252
  });
1253
1253
  return Promise.all(a);
@@ -1256,20 +1256,20 @@ function _n(e) {
1256
1256
  }
1257
1257
  //#endregion
1258
1258
  //#region src/Processor/GLTFDecoders.js
1259
- var vn = "KHR_draco_mesh_compression", yn = "KHR_texture_basisu", bn = ["EXT_meshopt_compression", "KHR_meshopt_compression"], xn = new TextDecoder();
1260
- function Sn(e) {
1259
+ var xn = "KHR_draco_mesh_compression", Sn = "KHR_texture_basisu", Cn = ["EXT_meshopt_compression", "KHR_meshopt_compression"], wn = new TextDecoder();
1260
+ function Tn(e) {
1261
1261
  if (typeof e == "string") return e;
1262
1262
  if (!(e instanceof ArrayBuffer)) return JSON.stringify(e?.extensionsUsed ?? []);
1263
1263
  let t = new DataView(e);
1264
- if (!(e.byteLength >= 20 && t.getUint32(0, !0) === 1179937895)) return xn.decode(e);
1264
+ if (!(e.byteLength >= 20 && t.getUint32(0, !0) === 1179937895)) return wn.decode(e);
1265
1265
  let n = Math.min(t.getUint32(12, !0), e.byteLength - 20);
1266
- return xn.decode(new Uint8Array(e, 20, n));
1266
+ return wn.decode(new Uint8Array(e, 20, n));
1267
1267
  }
1268
- async function Cn(e, t, n) {
1269
- let { dracoDecoderPath: r, ktx2TranscoderPath: i } = C(), [a, o, s] = await Promise.all([
1270
- t.includes(vn) && !e.dracoLoader ? import("three/addons/loaders/DRACOLoader.js") : null,
1271
- t.includes(yn) && !e.ktx2Loader ? import("three/addons/loaders/KTX2Loader.js") : null,
1272
- bn.some((e) => t.includes(e)) && !e.meshoptDecoder ? import("three/addons/libs/meshopt_decoder.module.js") : null
1268
+ async function En(e, t, n) {
1269
+ let { dracoDecoderPath: r, ktx2TranscoderPath: i } = T(), [a, o, s] = await Promise.all([
1270
+ t.includes(xn) && !e.dracoLoader ? import("three/addons/loaders/DRACOLoader.js") : null,
1271
+ t.includes(Sn) && !e.ktx2Loader ? import("three/addons/loaders/KTX2Loader.js") : null,
1272
+ Cn.some((e) => t.includes(e)) && !e.meshoptDecoder ? import("three/addons/libs/meshopt_decoder.module.js") : null
1273
1273
  ]);
1274
1274
  if (a) {
1275
1275
  let t = new a.DRACOLoader();
@@ -1288,15 +1288,15 @@ async function Cn(e, t, n) {
1288
1288
  }
1289
1289
  s && e.setMeshoptDecoder(s.MeshoptDecoder);
1290
1290
  }
1291
- function wn(e, t) {
1291
+ function Dn(e, t) {
1292
1292
  let n = e.parse.bind(e);
1293
1293
  return e.parse = (r, i, a, o) => {
1294
- Cn(e, Sn(r), t).then(() => n(r, i, a, o), (e) => o?.(e));
1294
+ En(e, Tn(r), t).then(() => n(r, i, a, o), (e) => o?.(e));
1295
1295
  }, e;
1296
1296
  }
1297
1297
  //#endregion
1298
1298
  //#region src/Processor/AssetLoader.js
1299
- var Tn = {
1299
+ var On = {
1300
1300
  glb: {
1301
1301
  type: "model",
1302
1302
  name: "GLB (GLTF Binary)"
@@ -1331,7 +1331,7 @@ var Tn = {
1331
1331
  }, Z = {
1332
1332
  addOn: "rayzee/addons/formats",
1333
1333
  install: "assetLoader.registerFormat()"
1334
- }, En = {
1334
+ }, kn = {
1335
1335
  zip: X,
1336
1336
  gz: X,
1337
1337
  tgz: X,
@@ -1348,23 +1348,23 @@ var Tn = {
1348
1348
  usdz: Z,
1349
1349
  exr: Z
1350
1350
  };
1351
- function Dn(e) {
1352
- let t = new Xe();
1351
+ function An(e) {
1352
+ let t = new Qe();
1353
1353
  for (let n in e.attributes) t.setAttribute(n, e.attributes[n]);
1354
1354
  e.index && t.setIndex(e.index);
1355
1355
  for (let n of e.groups) t.addGroup(n.start, n.count, n.materialIndex);
1356
1356
  return t;
1357
1357
  }
1358
- var On = 683;
1359
- function kn(e, t, n, r) {
1358
+ var jn = 683;
1359
+ function Mn(e, t, n, r) {
1360
1360
  if (!(r.normalize ?? !0)) return Math.PI;
1361
- let i = r.shape === "ellipse" || r.shape === "disk" ? Math.PI / 4 : 1, a = e.getWorldScale(new V()), o = Math.PI * i * Math.abs(t * a.x * n * a.y);
1361
+ let i = r.shape === "ellipse" || r.shape === "disk" ? Math.PI / 4 : 1, a = e.getWorldScale(new U()), o = Math.PI * i * Math.abs(t * a.x * n * a.y);
1362
1362
  return Number.isFinite(o) ? o : Math.PI;
1363
1363
  }
1364
- var An = class e extends F {
1365
- constructor(e, t, r, { issues: i = null, areaLightIntensityScale: a = null } = {}) {
1366
- super(), this.scene = e, this.camera = t, this.controls = r, this.targetModel = null, this.floorPlane = null, this.sceneScale = 1, this.sceneSize = new V(1, 1, 1), this.loaderCache = {}, this.uploadedFileInfo = null, this.animations = [], this.renderer = null, this.sceneMetadata = null, this._loadingManager = new at(), this._loadCancelled = !1, this._urlAbort = null, this.storage = null, this._downloads = null, this._sourceKey = null, this._appended = !1, this.archives = null, this._archiveLoader = null, this._formats = /* @__PURE__ */ new Map(), this._issues = i, this._areaLightIntensityScale = a ?? (() => n.areaLightIntensityScale), this._loadingManager.onError = (e) => {
1367
- this._loadCancelled || this._issues?.record(b.ASSET_UNREACHABLE, `asset "${e}" could not be fetched — anything depending on it renders without it`, { url: e });
1364
+ var Nn = class e extends I {
1365
+ constructor(e, t, n, { issues: r = null, areaLightIntensityScale: i = null } = {}) {
1366
+ super(), this.scene = e, this.camera = t, this.controls = n, this.targetModel = null, this.floorPlane = null, this.sceneScale = 1, this.sceneSize = new U(1, 1, 1), this.loaderCache = {}, this.uploadedFileInfo = null, this.animations = [], this.renderer = null, this.sceneMetadata = null, this._loadingManager = new st(), this._loadCancelled = !1, this._urlAbort = null, this.storage = null, this._downloads = null, this._sourceKey = null, this._appended = !1, this.archives = null, this._archiveLoader = null, this._formats = /* @__PURE__ */ new Map(), this._issues = r, this._areaLightIntensityScale = i ?? (() => o.areaLightIntensityScale), this._loadingManager.onError = (e) => {
1367
+ this._loadCancelled || this._issues?.record(S.ASSET_UNREACHABLE, `asset "${e}" could not be fetched — anything depending on it renders without it`, { url: e });
1368
1368
  };
1369
1369
  }
1370
1370
  cancelActiveLoad() {
@@ -1379,11 +1379,11 @@ var An = class e extends F {
1379
1379
  let o = new AbortController();
1380
1380
  this._urlAbort = o;
1381
1381
  try {
1382
- return await $t(t, {
1382
+ return await nn(t, {
1383
1383
  downloads: this.downloads,
1384
1384
  key: i,
1385
1385
  policy: a,
1386
- name: K(t),
1386
+ name: q(t),
1387
1387
  signal: o.signal,
1388
1388
  onProgress: this._downloadProgress(n, r)
1389
1389
  });
@@ -1412,7 +1412,7 @@ var An = class e extends F {
1412
1412
  _downloadProgress(e, t) {
1413
1413
  return (n) => {
1414
1414
  let r = n?.loaded || 0, i = n?.lengthComputable && n.total || 0;
1415
- _({
1415
+ v({
1416
1416
  isLoading: !0,
1417
1417
  status: e,
1418
1418
  loadedBytes: r,
@@ -1423,7 +1423,7 @@ var An = class e extends F {
1423
1423
  };
1424
1424
  }
1425
1425
  _downloadComplete(e = "Processing Data...", t = 62) {
1426
- _({
1426
+ v({
1427
1427
  status: e,
1428
1428
  progress: t,
1429
1429
  canCancel: !1,
@@ -1437,7 +1437,7 @@ var An = class e extends F {
1437
1437
  _adoptExternalObject(e) {
1438
1438
  let t;
1439
1439
  try {
1440
- t = kt(e);
1440
+ t = At(e);
1441
1441
  } catch (t) {
1442
1442
  throw Error(`Cannot render "${e.name || e.type}": its userData must be JSON-serializable.`, { cause: t });
1443
1443
  }
@@ -1471,10 +1471,10 @@ var An = class e extends F {
1471
1471
  }
1472
1472
  getFileFormat(e) {
1473
1473
  let t = e.split(".").pop().toLowerCase();
1474
- return Tn[t] || this._formats.get(t) || this._archiveFormats?.[t] || null;
1474
+ return On[t] || this._formats.get(t) || this._archiveFormats?.[t] || null;
1475
1475
  }
1476
1476
  formatError(e) {
1477
- let t = En[e.split(".").pop().toLowerCase()];
1477
+ let t = kn[e.split(".").pop().toLowerCase()];
1478
1478
  return /* @__PURE__ */ Error(t ? `${e}: this format is read by ${t.addOn} — install it with ${t.install}` : `Unsupported file format: ${e}`);
1479
1479
  }
1480
1480
  async inspectArchive(e) {
@@ -1494,7 +1494,7 @@ var An = class e extends F {
1494
1494
  async loadAssetFromFile(e, t = {}) {
1495
1495
  let n = e.name, r = this.getFileFormat(n);
1496
1496
  if (!r) throw this.formatError(n);
1497
- _({
1497
+ v({
1498
1498
  isLoading: !0,
1499
1499
  status: `Loading ${r.name}...`,
1500
1500
  progress: 2
@@ -1516,19 +1516,37 @@ var An = class e extends F {
1516
1516
  }
1517
1517
  return i;
1518
1518
  } catch (e) {
1519
- throw this.dispatchEvent({
1519
+ throw e?.code !== "ARCHIVE_NEEDS_ELEMENT" && this.dispatchEvent({
1520
1520
  type: "error",
1521
1521
  message: e.message,
1522
1522
  filename: n
1523
1523
  }), e;
1524
1524
  }
1525
1525
  }
1526
+ async loadFolder(e, t = {}) {
1527
+ let n = await this._archiveImporter();
1528
+ if (!n) throw Error(`${e.name}: folders are read by ${X.addOn} — install it with ${X.install}`);
1529
+ v({
1530
+ isLoading: !0,
1531
+ status: `Loading ${e.name}...`,
1532
+ progress: 2
1533
+ });
1534
+ try {
1535
+ return await n.loadFolder(e, t);
1536
+ } catch (t) {
1537
+ throw t?.code === "ARCHIVE_NEEDS_ELEMENT" ? t.file = e : this.dispatchEvent({
1538
+ type: "error",
1539
+ message: t.message,
1540
+ filename: e.name
1541
+ }), t;
1542
+ }
1543
+ }
1526
1544
  async loadAssetFromUrl(t, n = {}) {
1527
- let { filename: r = K(t), cacheKey: i = t, cachePolicy: a, ...o } = n;
1545
+ let { filename: r = q(t), cacheKey: i = t, cachePolicy: a, ...o } = n;
1528
1546
  if (!this.getFileFormat(r)) throw this.formatError(r);
1529
1547
  this._loadCancelled = !1;
1530
1548
  let s = e._isNetworkUrl(t), c = `Downloading ${r}...`, l = new AbortController();
1531
- this._urlAbort = l, _({
1549
+ this._urlAbort = l, v({
1532
1550
  isLoading: !0,
1533
1551
  status: c,
1534
1552
  progress: 2,
@@ -1560,7 +1578,7 @@ var An = class e extends F {
1560
1578
  }
1561
1579
  }
1562
1580
  async loadModelFromFile(e, t) {
1563
- let n = this.storage ? this._keyed("file", T(await ke(e))) : null, r = await this._loadModelFileByExtension(e, t);
1581
+ let n = this.storage ? this._keyed("file", D(await De(e))) : null, r = await this._loadModelFileByExtension(e, t);
1564
1582
  return this._sourceKey = n, r;
1565
1583
  }
1566
1584
  async _loadModelFileByExtension(e, t) {
@@ -1572,7 +1590,7 @@ var An = class e extends F {
1572
1590
  }
1573
1591
  async _loadModelWithFormat(e, t, n) {
1574
1592
  try {
1575
- _({
1593
+ v({
1576
1594
  isLoading: !0,
1577
1595
  status: `Processing ${e.label} Data...`,
1578
1596
  progress: 5
@@ -1581,7 +1599,7 @@ var An = class e extends F {
1581
1599
  filename: n,
1582
1600
  cache: this.loaderCache
1583
1601
  });
1584
- return this.releaseTargetModel(), this.targetModel = r, _({
1602
+ return this.releaseTargetModel(), this.targetModel = r, v({
1585
1603
  isLoading: !0,
1586
1604
  status: "Processing Data...",
1587
1605
  progress: 10
@@ -1607,7 +1625,7 @@ var An = class e extends F {
1607
1625
  };
1608
1626
  try {
1609
1627
  let r = await this.loadEnvironment(n);
1610
- return ce(r, T(await ke(e))), this.dispatchEvent({
1628
+ return oe(r, D(await De(e))), this.dispatchEvent({
1611
1629
  type: "load",
1612
1630
  texture: r,
1613
1631
  filename: t
@@ -1629,7 +1647,7 @@ var An = class e extends F {
1629
1647
  let e = t.split(/[?#]/)[0].split(".").pop().toLowerCase();
1630
1648
  n = await this.loadEnvironmentByExtension(t, e);
1631
1649
  }
1632
- return n.generateMipmaps = !0, e._isNetworkUrl(t) && ce(n, t), this.applyEnvironmentToScene(n), this.dispatchEvent({
1650
+ return n.generateMipmaps = !0, e._isNetworkUrl(t) && oe(n, t), this.applyEnvironmentToScene(n), this.dispatchEvent({
1633
1651
  type: "load",
1634
1652
  texture: n,
1635
1653
  url: t,
@@ -1666,25 +1684,25 @@ var An = class e extends F {
1666
1684
  }
1667
1685
  async loadEnvironmentByExtension(t, n, { loader: r = null } = {}) {
1668
1686
  let i = this._formats.get(n);
1669
- if (!r && i?.type === "environment" && (r = this.loaderCache[n] ??= await i.createLoader(this._loadingManager)), !r && n === "hdr" && (r = this.loaderCache.hdr ??= new Dt(this._loadingManager).setDataType(nt)), !r && En[n]) throw this.formatError(`environment.${n}`);
1687
+ if (!r && i?.type === "environment" && (r = this.loaderCache[n] ??= await i.createLoader(this._loadingManager)), !r && n === "hdr" && (r = this.loaderCache.hdr ??= new Ot(this._loadingManager).setDataType(it)), !r && kn[n]) throw this.formatError(`environment.${n}`);
1670
1688
  let a = e._isNetworkUrl(t), o = "Downloading Environment...", s = await this._viaCache(t, o, a), c = s.cached ? void 0 : this._downloadProgress(o, a), l;
1671
1689
  try {
1672
- r ? l = await r.loadAsync(s.url, c) : d().decodeImage ? (l = await pn(s.url, `image/${n === "jpg" ? "jpeg" : n}`), l.colorSpace = B) : (this.loaderCache.texture || (this.loaderCache.texture = new xt(this._loadingManager)), l = await this.loaderCache.texture.loadAsync(s.url, c), l.colorSpace = B);
1690
+ r ? l = await r.loadAsync(s.url, c) : b().decodeImage ? (l = await gn(s.url, `image/${n === "jpg" ? "jpeg" : n}`), l.colorSpace = V) : (this.loaderCache.texture || (this.loaderCache.texture = new St(this._loadingManager)), l = await this.loaderCache.texture.loadAsync(s.url, c), l.colorSpace = V);
1673
1691
  } finally {
1674
1692
  s.release();
1675
1693
  }
1676
- return this._downloadComplete("Processing Environment...", 62), l.mapping = tt, l.minFilter = rt, l.magFilter = rt, l;
1694
+ return this._downloadComplete("Processing Environment...", 62), l.mapping = rt, l.minFilter = at, l.magFilter = at, l;
1677
1695
  }
1678
1696
  applyEnvironmentToScene(e) {
1679
1697
  this.scene.background = e, this.scene.environment = e;
1680
1698
  }
1681
1699
  async createGLTFLoader() {
1682
- let e = wn(new Et(this._loadingManager), this.renderer), t = (e, t) => this._reportImageFailure(e, t);
1683
- return d().decodeImage ? e.register((e) => hn(e, t)) : u() || e.register((e) => mn(e, t)), e.register((e) => _n(e)), e;
1700
+ let e = Dn(new Dt(this._loadingManager), this.renderer), t = (e, t) => this._reportImageFailure(e, t);
1701
+ return b().decodeImage ? e.register((e) => vn(e, t)) : de() || e.register((e) => _n(e, t)), e.register((e) => bn(e)), e;
1684
1702
  }
1685
1703
  _reportImageFailure(e, t) {
1686
1704
  try {
1687
- this._issues?.record(b.TEXTURE_BUILD_FAILED, `image ${e} could not be decoded (${t?.message ?? t}) — the surfaces using it render untextured`, {
1705
+ this._issues?.record(S.TEXTURE_BUILD_FAILED, `image ${e} could not be decoded (${t?.message ?? t}) — the surfaces using it render untextured`, {
1688
1706
  image: e,
1689
1707
  cause: String(t?.message ?? t)
1690
1708
  });
@@ -1708,15 +1726,15 @@ var An = class e extends F {
1708
1726
  this._loadCancelled = !1;
1709
1727
  let r = await this.createGLTFLoader(), i = e._isNetworkUrl(t), a = null;
1710
1728
  try {
1711
- _({
1729
+ v({
1712
1730
  isLoading: !0,
1713
1731
  status: "Downloading Model...",
1714
1732
  progress: 2,
1715
1733
  canCancel: i,
1716
1734
  loadedBytes: 0,
1717
1735
  totalBytes: 0
1718
- }), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(I.extractUrlBase(t));
1719
- let e = await s(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
1736
+ }), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(L.extractUrlBase(t));
1737
+ let e = await _(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
1720
1738
  return this._downloadComplete(), this._throwDeferred(), this.releaseTargetModel(), this._sourceKey = i ? this._keyed("url", n.cacheKey ?? t) : null, this.targetModel = e.scene, this.animations = e.animations || [], this.sceneMetadata = je(e), await this.onModelLoad(this.targetModel), this.dispatchEvent({
1721
1739
  type: "load",
1722
1740
  model: e.scene,
@@ -1739,15 +1757,15 @@ var An = class e extends F {
1739
1757
  this._loadCancelled = !1;
1740
1758
  let r = await this.createGLTFLoader(), i = e._isNetworkUrl(t), a = null;
1741
1759
  try {
1742
- _({
1760
+ v({
1743
1761
  isLoading: !0,
1744
1762
  status: "Downloading Model...",
1745
1763
  progress: 2,
1746
1764
  canCancel: i,
1747
1765
  loadedBytes: 0,
1748
1766
  totalBytes: 0
1749
- }), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(I.extractUrlBase(t));
1750
- let e = await s(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
1767
+ }), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(L.extractUrlBase(t));
1768
+ let e = await _(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
1751
1769
  return this._downloadComplete(), this._throwDeferred(), this._appended = !0, this._processAndParent(e.scene), {
1752
1770
  root: e.scene,
1753
1771
  animations: e.animations || []
@@ -1764,18 +1782,18 @@ var An = class e extends F {
1764
1782
  return n.name = e.name || t, this._processAndParent(n), { root: n };
1765
1783
  }
1766
1784
  removeModelRoot(e) {
1767
- e && (e.userData.__rayzeeExternal ? (re(e), e.parent?.remove(e)) : pe(e));
1785
+ e && (e.userData.__rayzeeExternal ? (ee(e), e.parent?.remove(e)) : se(e));
1768
1786
  }
1769
1787
  async loadGLBFromArrayBuffer(e, t = "model.glb") {
1770
1788
  let n = await this.createGLTFLoader();
1771
1789
  try {
1772
- _({
1790
+ v({
1773
1791
  isLoading: !0,
1774
1792
  status: "Processing GLB Data...",
1775
1793
  progress: 5
1776
1794
  }), await new Promise((e) => setTimeout(e, 0));
1777
- let r = await s(() => n.parseAsync(e, ""));
1778
- return this._throwDeferred(), this.releaseTargetModel(), this.targetModel = r.scene, this.animations = r.animations || [], this.sceneMetadata = je(r), _({
1795
+ let r = await _(() => n.parseAsync(e, ""));
1796
+ return this._throwDeferred(), this.releaseTargetModel(), this.targetModel = r.scene, this.animations = r.animations || [], this.sceneMetadata = je(r), v({
1779
1797
  isLoading: !0,
1780
1798
  status: "Processing Data...",
1781
1799
  progress: 10
@@ -1797,7 +1815,7 @@ var An = class e extends F {
1797
1815
  async loadObject3D(e, t = "object3d") {
1798
1816
  this.releaseTargetModel();
1799
1817
  let n = this._adoptExternalObject(e);
1800
- return n.name = e.name || t, this.targetModel = n, _({
1818
+ return n.name = e.name || t, this.targetModel = n, v({
1801
1819
  isLoading: !0,
1802
1820
  status: "Processing Data...",
1803
1821
  progress: 10
@@ -1812,9 +1830,9 @@ var An = class e extends F {
1812
1830
  t.start("Camera extraction");
1813
1831
  let n = this.extractCamerasFromModel(e);
1814
1832
  t.end("Camera extraction"), t.start("Camera setup");
1815
- let r = new Ye().setFromObject(e), i = r.getCenter(new V()), a = r.getSize(new V());
1833
+ let r = new Ze().setFromObject(e), i = r.getCenter(new U()), a = r.getSize(new U());
1816
1834
  this.controls?.target.copy(i);
1817
- let o = Math.max(a.x, a.y, a.z), s = this.camera.fov * (Math.PI / 180), c = Math.abs(o / Math.sin(s / 2) / 2), l = Math.PI / 6, u = new V(Math.cos(l) * c, c / Math.sqrt(2), Math.sin(l) * c);
1835
+ let o = Math.max(a.x, a.y, a.z), s = this.camera.fov * (Math.PI / 180), c = Math.abs(o / Math.sin(s / 2) / 2), l = Math.PI / 6, u = new U(Math.cos(l) * c, c / Math.sqrt(2), Math.sin(l) * c);
1818
1836
  if (this.camera.position.copy(u.add(i)), this.camera.lookAt(i), this.camera.near = o / 100, this.camera.far = o * 100, this.camera.updateProjectionMatrix(), this.controls && (this.controls.maxDistance = c * 10, this.controls.saveState(), this.controls.update()), t.end("Camera setup"), this.floorPlane) {
1819
1837
  let e = r.min.y;
1820
1838
  this.floorPlane.position.y = e, this.floorPlane.rotation.x = -Math.PI / 2, this.floorPlane.scale.setScalar(o * 5);
@@ -1851,22 +1869,22 @@ var An = class e extends F {
1851
1869
  let t = [], n = [];
1852
1870
  e.traverse((e) => {
1853
1871
  let r = e.userData;
1854
- e.isRectAreaLight && !r.__radianceConverted && (e.intensity *= kn(e, e.width, e.height, r), r.__radianceConverted = !0), (e.isPointLight || e.isSpotLight) && !r.__candelaConverted && (e.intensity *= 4 * Math.PI / On, r.__candelaConverted = !0), e.isDirectionalLight && !r.__luxConverted && (e.intensity /= On, r.__luxConverted = !0);
1872
+ e.isRectAreaLight && !r.__radianceConverted && (e.intensity *= Mn(e, e.width, e.height, r), r.__radianceConverted = !0), (e.isPointLight || e.isSpotLight) && !r.__candelaConverted && (e.intensity *= 4 * Math.PI / jn, r.__candelaConverted = !0), e.isDirectionalLight && !r.__luxConverted && (e.intensity /= jn, r.__luxConverted = !0);
1855
1873
  let i = e.name.startsWith("RectAreaLightPlaceholder");
1856
1874
  if (i && !(r.name && r.type === "RectAreaLight") && !e.parent?.name?.startsWith("RectAreaLightPlaceholder") && n.push(e.name), i && r.name && r.type === "RectAreaLight") {
1857
- let t = r.normalize ?? !0, n = r.shape ?? "rectangle", i = r.intensity * kn(e, r.width, r.height, r), a = new z(new P(...r.color), i * this._areaLightIntensityScale(), r.width, r.height);
1875
+ let t = r.normalize ?? !0, n = r.shape ?? "rectangle", i = r.intensity * Mn(e, r.width, r.height, r), a = new B(new F(...r.color), i * this._areaLightIntensityScale(), r.width, r.height);
1858
1876
  a.userData.normalize = t, a.userData.spread = Number.isFinite(r.spread) ? r.spread : Math.PI, a.userData.shape = n, a.userData.__radianceConverted = !0, a.name = r.name, e.add(a);
1859
1877
  }
1860
1878
  e.isMesh && Array.isArray(e.material) && t.push(e);
1861
- }), n.length && this._issues?.record(b.LIGHT_PLACEHOLDER_SKIPPED, `${n.length} area-light placeholder(s) lack userData.name or userData.type 'RectAreaLight' — no light was made for them`, {
1879
+ }), n.length && this._issues?.record(S.LIGHT_PLACEHOLDER_SKIPPED, `${n.length} area-light placeholder(s) lack userData.name or userData.type 'RectAreaLight' — no light was made for them`, {
1862
1880
  count: n.length,
1863
1881
  names: n.slice(0, 10)
1864
1882
  });
1865
1883
  let r = e.userData.__rayzeeExternal === !0;
1866
1884
  for (let e of t) {
1867
1885
  if (!e.parent) continue;
1868
- console.log("Found multi-material mesh:", e.name), r && (e.geometry = Dn(e.geometry));
1869
- let t = Ot(e);
1886
+ console.log("Found multi-material mesh:", e.name), r && (e.geometry = An(e.geometry));
1887
+ let t = kt(e);
1870
1888
  for (let e of t.children) e.geometry.userData.__rayzeeOwned = !0;
1871
1889
  e.parent.add(t), e.parent.remove(e);
1872
1890
  }
@@ -1875,7 +1893,7 @@ var An = class e extends F {
1875
1893
  this.sceneScale = t;
1876
1894
  }
1877
1895
  createFloorPlane() {
1878
- this.floorPlane = new ot(new Ze(), new st({
1896
+ this.floorPlane = new ct(new $e(), new lt({
1879
1897
  transparent: !1,
1880
1898
  color: 3158064,
1881
1899
  roughness: 1,
@@ -1898,7 +1916,7 @@ var An = class e extends F {
1898
1916
  }
1899
1917
  getSupportedFormats(e = null) {
1900
1918
  let t = {
1901
- ...Tn,
1919
+ ...On,
1902
1920
  ...this._archiveFormats
1903
1921
  };
1904
1922
  for (let [e, { type: n, name: r }] of this._formats) t[e] = {
@@ -1922,13 +1940,13 @@ var An = class e extends F {
1922
1940
  removeAllEventListeners() {
1923
1941
  this._listeners = void 0;
1924
1942
  }
1925
- }, jn = {
1943
+ }, Pn = {
1926
1944
  addEventListener() {},
1927
1945
  removeEventListener() {},
1928
1946
  dispatchEvent() {
1929
1947
  return !0;
1930
1948
  }
1931
- }, Mn = class {
1949
+ }, Fn = class {
1932
1950
  constructor(e) {
1933
1951
  this.canvas = e, this._configuration = null, this._texture = null;
1934
1952
  }
@@ -1956,12 +1974,12 @@ var An = class e extends F {
1956
1974
  return this._texture;
1957
1975
  }
1958
1976
  };
1959
- function Nn(e = 1, t = 1) {
1977
+ function In(e = 1, t = 1) {
1960
1978
  let n = {
1961
- ...jn,
1979
+ ...Pn,
1962
1980
  defaultView: null
1963
1981
  }, r = {
1964
- ...jn,
1982
+ ...Pn,
1965
1983
  isHeadlessCanvas: !0,
1966
1984
  width: e,
1967
1985
  height: t,
@@ -1988,12 +2006,12 @@ function Nn(e = 1, t = 1) {
1988
2006
  hasPointerCapture: () => !1,
1989
2007
  focus() {},
1990
2008
  getContext: (e) => e === "webgpu" ? i : null
1991
- }, i = new Mn(r);
2009
+ }, i = new Fn(r);
1992
2010
  return r;
1993
2011
  }
1994
2012
  //#endregion
1995
2013
  //#region src/managers/ViewCamera.js
1996
- var Pn = class extends ft {
2014
+ var Ln = class extends mt {
1997
2015
  constructor(e, t, n, r) {
1998
2016
  super(e, t, n, r), this.orthographic = !1, this.orthoHalfHeight = 1;
1999
2017
  }
@@ -2017,17 +2035,17 @@ var Pn = class extends ft {
2017
2035
  return -this.orthoHalfHeight * this.aspect;
2018
2036
  }
2019
2037
  updateProjectionMatrix() {
2020
- this.orthographic ? dt.prototype.updateProjectionMatrix.call(this) : super.updateProjectionMatrix();
2038
+ this.orthographic ? pt.prototype.updateProjectionMatrix.call(this) : super.updateProjectionMatrix();
2021
2039
  }
2022
2040
  copy(e, t) {
2023
2041
  return super.copy(e, t), this.orthographic = e.orthographic === !0, this.orthoHalfHeight = e.orthoHalfHeight ?? this.orthoHalfHeight, this;
2024
2042
  }
2025
- }, Fn = "__rayzeeUserLight", In = {
2026
- DirectionalLight: $e,
2027
- PointLight: pt,
2028
- SpotLight: yt,
2029
- RectAreaLight: z
2030
- }, Ln = class extends F {
2043
+ }, Rn = "__rayzeeUserLight", zn = {
2044
+ DirectionalLight: tt,
2045
+ PointLight: ht,
2046
+ SpotLight: bt,
2047
+ RectAreaLight: B
2048
+ }, Bn = class extends I {
2031
2049
  constructor(e, t, n, r = {}) {
2032
2050
  super(), this.scene = e, this.sceneHelpers = t, this.pathTracer = n, this._onReset = r.onReset || null, this._onLightRemoved = r.onLightRemoved || null;
2033
2051
  }
@@ -2075,14 +2093,14 @@ var Pn = class extends ft {
2075
2093
  }[e];
2076
2094
  if (!t) return null;
2077
2095
  let n;
2078
- if (e === "DirectionalLight") n = new $e(t.color, t.intensity), n.position.fromArray(t.position);
2079
- else if (e === "PointLight") n = new pt(t.color, t.intensity), n.position.fromArray(t.position);
2096
+ if (e === "DirectionalLight") n = new tt(t.color, t.intensity), n.position.fromArray(t.position);
2097
+ else if (e === "PointLight") n = new ht(t.color, t.intensity), n.position.fromArray(t.position);
2080
2098
  else if (e === "SpotLight") {
2081
- n = new yt(t.color, t.intensity), n.position.fromArray(t.position), n.angle = L.degToRad(t.angle);
2082
- let e = new R();
2099
+ n = new bt(t.color, t.intensity), n.position.fromArray(t.position), n.angle = R.degToRad(t.angle);
2100
+ let e = new z();
2083
2101
  this.scene.add(e), n.target = e;
2084
- } else e === "RectAreaLight" && (n = new z(t.color, t.intensity, t.width, t.height), n.position.fromArray(t.position), n.lookAt(0, 0, 0), n.userData.normalize = !0, n.userData.spread = Math.PI, n.userData.shape = "rectangle");
2085
- n.userData[Fn] = !0, n.userData.temperature = 6500, n.userData.useTemperature = !1, n.userData.exposure = 0;
2102
+ } else e === "RectAreaLight" && (n = new B(t.color, t.intensity, t.width, t.height), n.position.fromArray(t.position), n.lookAt(0, 0, 0), n.userData.normalize = !0, n.userData.spread = Math.PI, n.userData.shape = "rectangle");
2103
+ n.userData[Rn] = !0, n.userData.temperature = 6500, n.userData.useTemperature = !1, n.userData.exposure = 0;
2086
2104
  let r = this.scene.getObjectsByProperty("isLight", !0).length;
2087
2105
  return n.name = `${e.replace("Light", "")} ${r + 1}`, this.scene.add(n), this.updateLights(), this._syncHelpers(), this._onReset?.(), this._buildDescriptor(n);
2088
2106
  }
@@ -2108,7 +2126,7 @@ var Pn = class extends ft {
2108
2126
  this.pathTracer?.updateLights(), this.sceneHelpers?.visible && this.sceneHelpers.update();
2109
2127
  }
2110
2128
  transferSceneLights(e, { keepUserLights: t = !1 } = {}) {
2111
- this._removeAllLights(t ? (e) => !e.userData?.[Fn] : void 0);
2129
+ this._removeAllLights(t ? (e) => !e.userData?.[Rn] : void 0);
2112
2130
  let n = e.getObjectsByProperty("isLight", !0);
2113
2131
  if (!n || n.length === 0) {
2114
2132
  this.updateLights();
@@ -2117,7 +2135,7 @@ var Pn = class extends ft {
2117
2135
  for (let e of n) {
2118
2136
  let t = e.clone();
2119
2137
  if (e.updateWorldMatrix(!0, !1), e.getWorldPosition(t.position), e.getWorldQuaternion(t.quaternion), e.getWorldScale(t.scale), t.isRectAreaLight && (t.width *= t.scale.x, t.height *= t.scale.y, t.scale.set(1, 1, 1)), (e.isSpotLight || e.isDirectionalLight) && e.target) {
2120
- let n = new R();
2138
+ let n = new z();
2121
2139
  e.target.updateWorldMatrix(!0, !1), e.target.getWorldPosition(n.position), this.scene.add(n), t.target = n;
2122
2140
  }
2123
2141
  this.scene.add(t);
@@ -2142,7 +2160,7 @@ var Pn = class extends ft {
2142
2160
  position: e.position.toArray(),
2143
2161
  quaternion: e.quaternion.toArray(),
2144
2162
  scale: e.scale.toArray(),
2145
- userData: h(e.userData) ?? {}
2163
+ userData: s(e.userData) ?? {}
2146
2164
  };
2147
2165
  return e.isSpotLight && Object.assign(t, {
2148
2166
  angle: e.angle,
@@ -2162,14 +2180,14 @@ var Pn = class extends ft {
2162
2180
  this.sceneHelpers?.clear(), this._removeAllLights();
2163
2181
  let t = [];
2164
2182
  for (let n of e ?? []) {
2165
- let e = In[n.type];
2183
+ let e = zn[n.type];
2166
2184
  if (!e) continue;
2167
2185
  let r = new e();
2168
2186
  r.name = n.name ?? "", r.visible = n.visible !== !1, r.color.setRGB(...n.color), r.intensity = n.intensity, r.position.fromArray(n.position), r.quaternion.fromArray(n.quaternion), r.scale.fromArray(n.scale ?? [
2169
2187
  1,
2170
2188
  1,
2171
2189
  1
2172
- ]), r.userData = c(n.userData) ?? {};
2190
+ ]), r.userData = l(n.userData) ?? {};
2173
2191
  for (let e of [
2174
2192
  "angle",
2175
2193
  "penumbra",
@@ -2179,7 +2197,7 @@ var Pn = class extends ft {
2179
2197
  "height"
2180
2198
  ]) typeof n[e] == "number" && (r[e] = n[e]);
2181
2199
  if (n.target) {
2182
- let e = new R();
2200
+ let e = new z();
2183
2201
  e.position.fromArray(n.target), this.scene.add(e), r.target = e;
2184
2202
  }
2185
2203
  this.scene.add(r), t.push(r);
@@ -2219,7 +2237,7 @@ var Pn = class extends ft {
2219
2237
  }
2220
2238
  _buildDescriptor(e) {
2221
2239
  let t = 0;
2222
- e.type === "SpotLight" && e.angle !== void 0 ? t = L.radToDeg(e.angle) : e.type === "DirectionalLight" && (t = L.radToDeg(e.userData?.angle ?? 0));
2240
+ e.type === "SpotLight" && e.angle !== void 0 ? t = R.radToDeg(e.angle) : e.type === "DirectionalLight" && (t = R.radToDeg(e.userData?.angle ?? 0));
2223
2241
  let n = {
2224
2242
  uuid: e.uuid,
2225
2243
  name: e.name,
@@ -2238,7 +2256,7 @@ var Pn = class extends ft {
2238
2256
  exposure: e.userData?.exposure ?? 0
2239
2257
  };
2240
2258
  if (e.type === "RectAreaLight") {
2241
- n.width = e.width, n.height = e.height, n.normalize = e.userData?.normalize ?? !0, n.spread = L.radToDeg(e.userData?.spread ?? Math.PI);
2259
+ n.width = e.width, n.height = e.height, n.normalize = e.userData?.normalize ?? !0, n.spread = R.radToDeg(e.userData?.spread ?? Math.PI);
2242
2260
  let t = e.userData?.shape;
2243
2261
  n.shape = t === "square" || t === "rectangle" || t === "disk" || t === "ellipse" ? t : t === 1 ? "ellipse" : "rectangle";
2244
2262
  let r = e.getWorldDirection(e.position.clone());
@@ -2254,11 +2272,11 @@ var Pn = class extends ft {
2254
2272
  ], n.distance = e.distance ?? 0, n.penumbra = e.penumbra ?? 0, n.decay = e.decay ?? 2) : e.type === "PointLight" && (n.distance = e.distance ?? 0, n.decay = e.decay ?? 2);
2255
2273
  return (e.type === "SpotLight" || e.type === "DirectionalLight") && e.userData?.gobo && (n.gobo = e.userData.gobo.name, n.goboIntensity = e.userData.gobo.intensity, n.goboInverted = !!e.userData.gobo.inverted, e.type === "DirectionalLight" && (n.goboScale = e.userData.gobo.scale ?? 5)), e.type === "SpotLight" && e.userData?.ies && (n.ies = e.userData.ies.name, n.iesIntensity = e.userData.ies.intensity ?? 1, n.fixtureLumens = e.userData.ies.fixtureLumens ?? null), n;
2256
2274
  }
2257
- }, Rn = ({ element: e, pbrtEntry: t } = {}) => ({
2275
+ }, Vn = ({ element: e, pbrtEntry: t } = {}) => ({
2258
2276
  ...e === void 0 ? {} : { element: e },
2259
2277
  ...t === void 0 ? {} : { pbrtEntry: t }
2260
- }), Q = /* @__PURE__ */ new WeakMap(), zn = new Set([...Object.values(g), ...Object.values(ne)]), Bn = /* @__PURE__ */ new Set();
2261
- async function Vn(e, t) {
2278
+ }), Q = /* @__PURE__ */ new WeakMap(), Hn = new Set([...Object.values(g), ...Object.values(h)]), Un = /* @__PURE__ */ new Set();
2279
+ async function Wn(e, t) {
2262
2280
  if (!t || typeof self < "u") return e.init();
2263
2281
  globalThis.self = {
2264
2282
  requestAnimationFrame: () => 0,
@@ -2270,43 +2288,43 @@ async function Vn(e, t) {
2270
2288
  delete globalThis.self;
2271
2289
  }
2272
2290
  }
2273
- var $ = me("engine");
2274
- function Hn() {
2291
+ var $ = fe("engine");
2292
+ function Gn() {
2275
2293
  let e = new Float32Array(16);
2276
- return new Uint32Array(e.buffer)[3] = he.TRIANGLE_LEAF, e;
2294
+ return new Uint32Array(e.buffer)[3] = pe.TRIANGLE_LEAF, e;
2277
2295
  }
2278
- function Un(e, t) {
2296
+ function Kn(e, t) {
2279
2297
  e.lost.then((e) => {
2280
2298
  t.app && t.app._handleDeviceLost(e);
2281
2299
  });
2282
2300
  }
2283
- var Wn = /swiftshader|llvmpipe|lavapipe|basic render|microsoft basic|warp/i;
2284
- function Gn(e) {
2301
+ var qn = /swiftshader|llvmpipe|lavapipe|basic render|microsoft basic|warp/i;
2302
+ function Jn(e) {
2285
2303
  let t = e.info ?? {}, n = `${t.vendor ?? ""} ${t.architecture ?? ""} ${t.device ?? ""} ${t.description ?? ""}`;
2286
2304
  return {
2287
2305
  vendor: t.vendor ?? "",
2288
2306
  architecture: t.architecture ?? "",
2289
2307
  device: t.device ?? "",
2290
2308
  description: t.description ?? "",
2291
- isSoftware: t.isFallbackAdapter === !0 || e.isFallbackAdapter === !0 || Wn.test(n)
2309
+ isSoftware: t.isFallbackAdapter === !0 || e.isFallbackAdapter === !0 || qn.test(n)
2292
2310
  };
2293
2311
  }
2294
- var Kn = class extends F {
2312
+ var Yn = class extends I {
2295
2313
  constructor(e, t = {}) {
2296
- super(), this._headless = t.headless === !0 || !e, e ??= Nn();
2314
+ super(), this._headless = t.headless === !0 || !e, e ??= In();
2297
2315
  try {
2298
2316
  Q.get(e)?.dispose();
2299
2317
  } catch (e) {
2300
2318
  $.warn("prior canvas owner dispose failed", e);
2301
2319
  }
2302
2320
  if (Q.set(e, this), this.canvas = e, this._autoResize = !this._headless && t.autoResize !== !1, this._maxSceneBytes = t.maxSceneBytes, this._hostMemoryGB = t.hostMemoryGB, this._storageOption = t.storage, this._storageOpener = null, this._memorySpill = t.memorySpill === !0, this.storage = null, this._storageRelease = null, this._applySceneMetadataEnabled = t.applySceneMetadata !== !1, this._unlitRestore = null, this._applyingSceneMetadata = !1, t.profile !== void 0) throw Error("the `profile` option was removed: the engine has one set of defaults. For the old 'physical' profile set `areaLightIntensityScale: 1` and `dofMode: 'physical'` through `settings`.");
2303
- this._issues = new _e({
2321
+ this._issues = new he({
2304
2322
  strict: t.strict === !0,
2305
2323
  onIssue: (e) => this.dispatchEvent({
2306
2324
  type: g.ISSUE,
2307
2325
  issue: e
2308
2326
  })
2309
- }), this.color = new nn({ issues: this._issues }), x(this.color), this.settings = new tn(n, { issues: this._issues }), this.renderer = null, this.scene = null, this.meshScene = null, this._sceneHelpers = null, this.assetLoader = null, this._sdf = null, this.pipeline = null, this._pendingReservedRenderSize = null, this.stages = {}, this.camera = null, this.lightManager = null, this.environmentManager = null, this.isInitialized = !1, this.pauseRendering = !1, this._pathTracerEnabled = !0, this._rasterPrecompile = null, this.animationManagerId = null, this.needsReset = !1, this._loadingInProgress = !1, this._needsDisplayRefresh = !1, this._paused = !1, this._emissiveSamplingUserSet = !1, this.completion = new Gt(), this._resizeDebounceTimer = null, this._displayWidth = 0, this._displayHeight = 0, this._renderScale = 1, this._renderWidth = 0, this._renderHeight = 0, this._trackedListeners = [], this._disposed = !1, this._deviceLost = !1, this._gpuDevice = null, this._deviceLostHolder = null, this._deterministic = !1, this._dispatchPinned = !1, this._deterministicRestore = null, this.adapterInfo = null;
2327
+ }), this.color = new on({ issues: this._issues }), C(this.color), this.settings = new an(o, { issues: this._issues }), this.renderer = null, this.scene = null, this.meshScene = null, this._sceneHelpers = null, this.assetLoader = null, this._sdf = null, this.pipeline = null, this._pendingReservedRenderSize = null, this.stages = {}, this.camera = null, this.lightManager = null, this.environmentManager = null, this.isInitialized = !1, this.pauseRendering = !1, this._pathTracerEnabled = !0, this._rasterPrecompile = null, this.animationManagerId = null, this.needsReset = !1, this._loadingInProgress = !1, this._needsDisplayRefresh = !1, this._paused = !1, this._emissiveSamplingUserSet = !1, this.completion = new Kt(), this._resizeDebounceTimer = null, this._displayWidth = 0, this._displayHeight = 0, this._renderScale = 1, this._renderWidth = 0, this._renderHeight = 0, this._trackedListeners = [], this._disposed = !1, this._deviceLost = !1, this._gpuDevice = null, this._deviceLostHolder = null, this._deterministic = !1, this._dispatchPinned = !1, this._deterministicRestore = null, this.adapterInfo = null;
2310
2328
  }
2311
2329
  _addTrackedListener(e, t, n) {
2312
2330
  e && (e.addEventListener(t, n), this._trackedListeners.push({
@@ -2325,27 +2343,27 @@ var Kn = class extends F {
2325
2343
  }
2326
2344
  async init() {
2327
2345
  let e = this._initStorage();
2328
- return await this._initRenderer(), this._applyPendingReservedRenderSize(), this.camera = this._createCamera(), this._initScenes(), this._initAssetPipeline(), this._initPipeline(), await this._initManagers(), this._wireEvents(), await e, this._attachStorage(), this.stages.pathTracer.setTriangleData(new Uint32Array(ge.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(Hn()), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setupMaterial(), this.isInitialized = !0, $.debug("WebGPU path tracer app initialized"), this;
2346
+ return await this._initRenderer(), this._applyPendingReservedRenderSize(), this.camera = this._createCamera(), this._initScenes(), this._initAssetPipeline(), this._initPipeline(), await this._initManagers(), this._wireEvents(), await e, this._attachStorage(), this.stages.pathTracer.setTriangleData(new Uint32Array(me.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(Gn()), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setupMaterial(), this.isInitialized = !0, $.debug("WebGPU path tracer app initialized"), this;
2329
2347
  }
2330
2348
  async setStorageOpener(e) {
2331
2349
  this._storageOpener = e, !(!this.isInitialized || this.storage || this._disposed) && (await this._initStorage(), this._attachStorage());
2332
2350
  }
2333
2351
  async _initStorage() {
2334
- let e = this._storageOption ?? (this._issues.strict && !Ce("storage") ? !1 : C().storage);
2352
+ let e = this._storageOption ?? (this._issues.strict && !xe("storage") ? !1 : T().storage);
2335
2353
  if (e !== !1) {
2336
2354
  if (e && typeof e == "object") this.storage = e;
2337
2355
  else {
2338
2356
  if (!this._storageOpener) {
2339
- (this._storageOption !== void 0 || Ce("storage")) && this._issues.warn(b.CAPABILITY_MISSING, "on-disk storage needs rayzee/addons/storage: setStorageOpener( acquireSharedStorage )");
2357
+ (this._storageOption !== void 0 || xe("storage")) && this._issues.warn(S.CAPABILITY_MISSING, "on-disk storage needs rayzee/addons/storage: setStorageOpener( acquireSharedStorage )");
2340
2358
  return;
2341
2359
  }
2342
- let { storage: e, reason: t, release: n } = await this._storageOpener(C().cacheNamespace);
2360
+ let { storage: e, reason: t, release: n } = await this._storageOpener(T().cacheNamespace);
2343
2361
  if (this._disposed) {
2344
2362
  n();
2345
2363
  return;
2346
2364
  }
2347
2365
  if (!e) {
2348
- this._issues.warn(b.STORAGE_UNAVAILABLE, `on-disk storage is off: ${t}`, { reason: t });
2366
+ this._issues.warn(S.STORAGE_UNAVAILABLE, `on-disk storage is off: ${t}`, { reason: t });
2349
2367
  return;
2350
2368
  }
2351
2369
  this.storage = e, this._storageRelease = n;
@@ -2361,14 +2379,14 @@ var Kn = class extends F {
2361
2379
  }
2362
2380
  dispatchEvent(e) {
2363
2381
  super.dispatchEvent(e);
2364
- let t = ne[e.type];
2382
+ let t = h[e.type];
2365
2383
  t && super.dispatchEvent({
2366
2384
  ...e,
2367
2385
  type: t
2368
2386
  });
2369
2387
  }
2370
2388
  addEventListener(e, t) {
2371
- !zn.has(e) && !Bn.has(e) && (Bn.add(e), $.warn(`no engine event is named "${e}", so this listener will never fire — see EngineEvents`)), super.addEventListener(e, t);
2389
+ !Hn.has(e) && !Un.has(e) && (Un.add(e), $.warn(`no engine event is named "${e}", so this listener will never fire — see EngineEvents`)), super.addEventListener(e, t);
2372
2390
  }
2373
2391
  animate() {
2374
2392
  if (this._headless) throw Error("a headless app has no render loop — drive it with renderFrames() or renderUntilComplete()");
@@ -2409,9 +2427,9 @@ var Kn = class extends F {
2409
2427
  let t = this.stages.pathTracer;
2410
2428
  this.pipeline.render(), this._afterTrace(t, e), t.isComplete || this.completion.updateTime(), this._ensureVRAMWiring();
2411
2429
  let n = t.vramTracker, r = t.frameCount ?? 0;
2412
- n && (r <= 1 || r % 30 == 0) && n.measure(), le({
2430
+ n && (r <= 1 || r % 30 == 0) && n.measure(), ie({
2413
2431
  timeElapsed: this.completion.timeElapsed,
2414
- samples: ie(t),
2432
+ samples: re(t),
2415
2433
  memoryUsed: n?.current ?? 0,
2416
2434
  memoryPeak: n?.peak ?? 0
2417
2435
  }), this.completion.isTimeLimitReached(t, this.settings.get("renderLimitMode"), this.settings.get("renderTimeLimit")) && (t.isComplete = !0);
@@ -2448,25 +2466,25 @@ var Kn = class extends F {
2448
2466
  }
2449
2467
  dispose() {
2450
2468
  if (!this._disposed) {
2451
- if (this._disposed = !0, this.dispatchEvent({ type: g.DISPOSE }), this.stopAnimation(), clearTimeout(this._resizeDebounceTimer), this._resizeDebounceTimer = null, this._removeTrackedListeners(), ae(null), this._storageRelease?.(), this._storageRelease = null, this.storage = null, this._sceneSource = this._sceneSourceFile = null, this._issues.detach(), this.color?.dispose(), this.color = null, this._textureReadback?.dispose(), this._textureReadback = null, this._readbackToneMapper?.dispose(), this._readbackToneMapper = null, this._disposeExtensions(), this.lightManager?.dispose(), this.pipeline?.dispose(), this._sdf?.dispose(), this._sdf = null, this.assetLoader?.dispose(), this.assetLoader = null, this.meshScene) {
2469
+ if (this._disposed = !0, this.dispatchEvent({ type: g.DISPOSE }), this.stopAnimation(), clearTimeout(this._resizeDebounceTimer), this._resizeDebounceTimer = null, this._removeTrackedListeners(), te(null), this._storageRelease?.(), this._storageRelease = null, this.storage = null, this._sceneSource = this._sceneSourceInput = null, this._issues.detach(), this.color?.dispose(), this.color = null, this._textureReadback?.dispose(), this._textureReadback = null, this._readbackToneMapper?.dispose(), this._readbackToneMapper = null, this._disposeExtensions(), this.lightManager?.dispose(), this.pipeline?.dispose(), this._sdf?.dispose(), this._sdf = null, this.assetLoader?.dispose(), this.assetLoader = null, this.meshScene) {
2452
2470
  this.meshScene.environment?.dispose(), this.meshScene.environment = null;
2453
- for (let e of [...this.meshScene.children]) pe(e);
2471
+ for (let e of [...this.meshScene.children]) se(e);
2454
2472
  this.meshScene.clear(), this.meshScene = null;
2455
2473
  }
2456
2474
  this._sceneHelpers?.clear(), this._sceneHelpers = null, this.scene?.clear(), this.scene = null;
2457
2475
  try {
2458
- let e = Ke().value, t = Ve().value;
2476
+ let e = Je().value, t = Ue().value;
2459
2477
  e?._listeners?.dispose && (e._listeners.dispose.length = 0), t?._listeners?.dispose && (t._listeners.dispose.length = 0);
2460
2478
  } catch (e) {
2461
2479
  $.warn("failed to clear TSL texture singleton listeners", e);
2462
2480
  }
2463
- this.canvas && Q.get(this.canvas) === this && Q.delete(this.canvas), this._gpuDevice &&= (this._gpuDevice.onuncapturederror = null, null), this._deviceLostHolder &&= (this._deviceLostHolder.app = null, null), oe(this.renderer), this.renderer = null, this.stages = {}, this.isInitialized = !1;
2481
+ this.canvas && Q.get(this.canvas) === this && Q.delete(this.canvas), this._gpuDevice &&= (this._gpuDevice.onuncapturederror = null, null), this._deviceLostHolder &&= (this._deviceLostHolder.app = null, null), ne(this.renderer), this.renderer = null, this.stages = {}, this.isInitialized = !1;
2464
2482
  }
2465
2483
  }
2466
2484
  unloadScene() {
2467
2485
  if (this.isInitialized) {
2468
2486
  if (this._loadingInProgress) throw Error("PathTracerApp.unloadScene: cannot unload while a load is in progress");
2469
- this._disposed || (this._releaseSceneState(), this.assetLoader?.releaseTargetModel(), this._sceneSource = this._sceneSourceFile = null, this.lightManager?.clearLights?.(), this.stages.pathTracer && (this.stages.pathTracer.setTriangleData(new Uint32Array(ge.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(Hn()), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setEmissiveTriangleData?.(new Float32Array(), 0, 0), this.stages.pathTracer.setupMaterial()), this._dropDisplay(), this.reset(), this.dispatchEvent({ type: g.SCENE_UNLOADED }));
2487
+ this._disposed || (this._releaseSceneState(), this.assetLoader?.releaseTargetModel(), this._sceneSource = this._sceneSourceInput = null, this.lightManager?.clearLights?.(), this.stages.pathTracer && (this.stages.pathTracer.setTriangleData(new Uint32Array(me.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(Gn()), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setEmissiveTriangleData?.(new Float32Array(), 0, 0), this.stages.pathTracer.setupMaterial()), this._dropDisplay(), this.reset(), this.dispatchEvent({ type: g.SCENE_UNLOADED }));
2470
2488
  }
2471
2489
  }
2472
2490
  async loadModel(e, t = {}) {
@@ -2511,7 +2529,7 @@ var Kn = class extends F {
2511
2529
  }
2512
2530
  async loadFile(e, t = {}) {
2513
2531
  if (t = this._sceneBudgets(t), typeof e == "string") {
2514
- let n = t.filename ?? K(e), r = this.assetLoader?.getFileFormat(n);
2532
+ let n = t.filename ?? q(e), r = this.assetLoader?.getFileFormat(n);
2515
2533
  if (!r) throw this.assetLoader.formatError(n);
2516
2534
  if (r.type === "environment" || r.type === "image") return this.loadEnvironment(e);
2517
2535
  await this._loadWithSceneRebuild(() => this.assetLoader.loadAssetFromUrl(e, {
@@ -2525,14 +2543,32 @@ var Kn = class extends F {
2525
2543
  url: e,
2526
2544
  filename: n,
2527
2545
  cacheKey: t.cacheKey ?? null,
2528
- ...Rn(t)
2546
+ ...Vn(t)
2529
2547
  });
2530
2548
  return;
2531
2549
  }
2550
+ if (Ae(e)) {
2551
+ let n = ke(e, { isModel: (e) => this.assetLoader?.getFileFormat(e)?.type === "model" });
2552
+ if (n.files.length === 0) throw Error(`${n.name} holds no files to load`);
2553
+ await this._loadWithSceneRebuild(() => this.assetLoader.loadFolder(n, t), {
2554
+ type: g.MODEL_LOADED,
2555
+ filename: n.name
2556
+ }, async () => {
2557
+ let e = await Oe(n);
2558
+ return {
2559
+ kind: "local-folder",
2560
+ folder: e,
2561
+ key: D(e),
2562
+ ...n.flat ? { flat: !0 } : {},
2563
+ ...Vn(t)
2564
+ };
2565
+ }), this._sceneSourceInput = n;
2566
+ return;
2567
+ }
2532
2568
  let n = this.assetLoader?.getFileFormat(e?.name || "");
2533
2569
  if (!n) throw this.assetLoader.formatError(e?.name || "");
2534
2570
  if (n.type !== "environment" && n.type !== "image") {
2535
- let n = ke(e).catch(() => ({
2571
+ let n = De(e).catch(() => ({
2536
2572
  name: e.name,
2537
2573
  size: e.size,
2538
2574
  lastModified: e.lastModified ?? 0,
@@ -2546,10 +2582,10 @@ var Kn = class extends F {
2546
2582
  return {
2547
2583
  kind: "local-file",
2548
2584
  file: e,
2549
- key: e.sample ? T(e) : null,
2550
- ...Rn(t)
2585
+ key: e.sample ? D(e) : null,
2586
+ ...Vn(t)
2551
2587
  };
2552
- }), this._sceneSourceFile = e;
2588
+ }), this._sceneSourceInput = e;
2553
2589
  return;
2554
2590
  }
2555
2591
  if (this._loadingInProgress) throw this._busyError("PathTracerApp.loadFile");
@@ -2596,15 +2632,18 @@ var Kn = class extends F {
2596
2632
  return this._sceneSource ?? null;
2597
2633
  }
2598
2634
  get sceneSourceFile() {
2599
- return this._sceneSourceFile ?? null;
2635
+ return this._sceneSourceInput && !Ae(this._sceneSourceInput) ? this._sceneSourceInput : null;
2636
+ }
2637
+ get sceneSourceFolder() {
2638
+ return Ae(this._sceneSourceInput) ? this._sceneSourceInput : null;
2600
2639
  }
2601
2640
  async _loadWithSceneRebuild(e, t, n = null) {
2602
2641
  if (this._loadingInProgress) throw this._busyError("PathTracerApp");
2603
2642
  this._loadingInProgress = !0;
2604
2643
  try {
2605
- await e(), this._sceneSource = typeof n == "function" ? await n() : n, this._sceneSourceFile = null, this._emissiveSamplingUserSet = !1, this._clearAppendedModels(), this._modelReplaced(), await this.loadSceneData({ pendingEnvironment: this._beginSceneMetadataEnvironment() }), this._maybeSpill(), this.pipeline?.eventBus.emit("pipeline:lightingChanged"), this._dropDisplay(), this.reset(), this.dispatchEvent(t), this._modelAnnounced();
2644
+ await e(), this._sceneSource = typeof n == "function" ? await n() : n, this._sceneSourceInput = null, this._emissiveSamplingUserSet = !1, this._clearAppendedModels(), this._modelReplaced(), await this.loadSceneData({ pendingEnvironment: this._beginSceneMetadataEnvironment() }), this._maybeSpill(), this.pipeline?.eventBus.emit("pipeline:lightingChanged"), this._dropDisplay(), this.reset(), this.dispatchEvent(t), this._modelAnnounced();
2606
2645
  } catch (e) {
2607
- throw (!e || e.code !== "LOAD_IN_PROGRESS") && this._discardFailedLoad(), e?.code === "ARCHIVE_NEEDS_ELEMENT" ? v() : e?.code !== "LOAD_IN_PROGRESS" && _({
2646
+ throw (!e || e.code !== "LOAD_IN_PROGRESS") && this._discardFailedLoad(), e?.code === "ARCHIVE_NEEDS_ELEMENT" ? y() : e?.code !== "LOAD_IN_PROGRESS" && v({
2608
2647
  status: `Error: ${e?.message ?? e}`,
2609
2648
  failed: !0,
2610
2649
  progress: 100
@@ -2614,7 +2653,7 @@ var Kn = class extends F {
2614
2653
  }
2615
2654
  }
2616
2655
  _discardFailedLoad() {
2617
- this._sceneSource = this._sceneSourceFile = null;
2656
+ this._sceneSource = this._sceneSourceInput = null;
2618
2657
  try {
2619
2658
  this._clearAppendedModels(), this.assetLoader?.releaseTargetModel(), this._dropDisplay(), this.reset();
2620
2659
  } catch (e) {
@@ -2627,7 +2666,7 @@ var Kn = class extends F {
2627
2666
  _beginSceneMetadataEnvironment() {
2628
2667
  this._restoreUnlitSettings();
2629
2668
  let e = this.sceneMetadata?.environment;
2630
- return this._applySceneMetadataEnabled && e?.enabled === !1 ? (this._applyUnlitSettings(), null) : !this._applySceneMetadataEnabled || !e?.sourceFile || !this.stages.pathTracer ? null : (this.stages.pathTracer.environment.beginHDRI(), this._applyingSceneMetadata = !0, this.assetLoader.loadEnvironment(e.sourceFile).catch((t) => (this._issues.record(b.ENVIRONMENT_LOAD_FAILED, `authored environment "${e.sourceFile}" failed to load — lighting falls back to the previous environment`, {
2669
+ return this._applySceneMetadataEnabled && e?.enabled === !1 ? (this._applyUnlitSettings(), null) : !this._applySceneMetadataEnabled || !e?.sourceFile || !this.stages.pathTracer ? null : (this.stages.pathTracer.environment.beginHDRI(), this._applyingSceneMetadata = !0, this.assetLoader.loadEnvironment(e.sourceFile).catch((t) => (this._issues.record(S.ENVIRONMENT_LOAD_FAILED, `authored environment "${e.sourceFile}" failed to load — lighting falls back to the previous environment`, {
2631
2670
  sourceFile: e.sourceFile,
2632
2671
  cause: String(t?.message ?? t)
2633
2672
  }), null)).finally(() => {
@@ -2691,19 +2730,19 @@ var Kn = class extends F {
2691
2730
  }), r = () => this.stages.pathTracer.environment.envParams.mode === "hdri" ? this.meshScene.environment : null, i = r(), a = null;
2692
2731
  if (e ? (n.start("Environment fetch + CDF (concurrent)"), a = e.then(async (e) => {
2693
2732
  e && (await this.stages.pathTracer.environment.applyHDRI(e), this._applySceneMetadataSettings(e));
2694
- }).catch((e) => this._issues.record(b.ENVIRONMENT_LOAD_FAILED, "authored environment failed to install — the scene is lit by whatever was already loaded", { cause: String(e?.message ?? e) })).finally(() => n.end("Environment fetch + CDF (concurrent)"))) : i?.image?.data && (n.start("Environment CDF build (worker)"), this.stages.pathTracer.scene.environment = i, a = this.stages.pathTracer.environment.buildEnvironmentCDF().then(() => {
2733
+ }).catch((e) => this._issues.record(S.ENVIRONMENT_LOAD_FAILED, "authored environment failed to install — the scene is lit by whatever was already loaded", { cause: String(e?.message ?? e) })).finally(() => n.end("Environment fetch + CDF (concurrent)"))) : i?.image?.data && (n.start("Environment CDF build (worker)"), this.stages.pathTracer.scene.environment = i, a = this.stages.pathTracer.environment.buildEnvironmentCDF().then(() => {
2695
2734
  n.end("Environment CDF build (worker)"), this._applySceneMetadataEnabled && this._applySceneMetadataSettings(i);
2696
2735
  })), n.start("BVH build (SceneProcessor)"), this._sdf.setMaxTextureSize(this.settings.get("maxTextureSize")), await this._sdf.buildBVH(this.meshScene, {
2697
2736
  sceneKey: this.assetLoader?.sceneSourceKey ?? null,
2698
2737
  progressive: this._progressiveSpill()
2699
- }), this.assetLoader?.flushPendingGraph(this._sdf.performanceMetrics.totalProcessingTime), n.end("BVH build (SceneProcessor)"), _({
2738
+ }), this.assetLoader?.flushPendingGraph(this._sdf.performanceMetrics.totalProcessingTime), n.end("BVH build (SceneProcessor)"), v({
2700
2739
  status: "Transferring data to GPU...",
2701
2740
  progress: 86
2702
2741
  }), await new Promise((e) => setTimeout(e, 0)), n.start("GPU data transfer"), !this._sdf.uploadToPathTracer(this.stages.pathTracer, this.lightManager, this.meshScene, r(), { keepUserLights: t })) return !1;
2703
- this.stages.pathTracer._meshRefs = this.stages.pathTracer._collectMeshRefs(this.meshScene), this.stages.pathTracer.setMeshVisibilityData(this.stages.pathTracer._meshRefs), this._refreshEmissiveForVisibility(), n.end("GPU data transfer"), _({
2742
+ this.stages.pathTracer._meshRefs = this.stages.pathTracer._collectMeshRefs(this.meshScene), this.stages.pathTracer.setMeshVisibilityData(this.stages.pathTracer._meshRefs), this._refreshEmissiveForVisibility(), n.end("GPU data transfer"), v({
2704
2743
  status: "Compiling shaders...",
2705
2744
  progress: 90
2706
- }), await new Promise((e) => setTimeout(e, 0)), n.start("Material setup (TSL compile)"), this.stages.pathTracer.setupMaterial(), n.end("Material setup (TSL compile)"), this._rasterPrecompile = null, this._pathTracerEnabled || (n.start("Pipeline precompile"), await this.precompileRaster(), n.end("Pipeline precompile")), a && (_({
2745
+ }), await new Promise((e) => setTimeout(e, 0)), n.start("Material setup (TSL compile)"), this.stages.pathTracer.setupMaterial(), n.end("Material setup (TSL compile)"), this._rasterPrecompile = null, this._pathTracerEnabled || (n.start("Pipeline precompile"), await this.precompileRaster(), n.end("Pipeline precompile")), a && (v({
2707
2746
  status: "Finalizing environment map...",
2708
2747
  progress: 95
2709
2748
  }), await a, this.stages.pathTracer.environment.applyCDFResults());
@@ -2712,16 +2751,16 @@ var Kn = class extends F {
2712
2751
  let e = (this._sdf?.emissiveTriangleBuilder?.emissiveTriangles?.length ?? this._sdf?.emissiveTriangleCount ?? 0) > 0;
2713
2752
  this.settings.set("enableEmissiveTriangleSampling", e, { reset: !1 });
2714
2753
  }
2715
- return n.start("Apply settings"), this.settings.applyAll(), this.stages.compositor.setTransparentBackground(this.settings.get("transparentBackground")), n.end("Apply settings"), n.print(this._sceneSummaryParts()), v(), this._sceneRebuilt(), this.dispatchEvent({ type: g.SCENE_REBUILD }), !0;
2754
+ return n.start("Apply settings"), this.settings.applyAll(), this.stages.compositor.setTransparentBackground(this.settings.get("transparentBackground")), n.end("Apply settings"), n.print(this._sceneSummaryParts()), y(), this._sceneRebuilt(), this.dispatchEvent({ type: g.SCENE_REBUILD }), !0;
2716
2755
  }
2717
2756
  _sceneSummaryParts() {
2718
2757
  let e = this.stages.pathTracer, t = this._sdf?.instanceTable?.setCount ?? 0, n = this._sdf?.geometryExtractor?.maps?.length ?? 0;
2719
2758
  return [
2720
- y.count(e.triangleCount, "tri"),
2721
- t ? y.count(t, "mesh", "meshes") : null,
2722
- y.count(e.materialData.materialCount, "material"),
2723
- n ? y.count(n, "map") : null,
2724
- y.count(e.bvhNodeCount, "BVH node")
2759
+ x.count(e.triangleCount, "tri"),
2760
+ t ? x.count(t, "mesh", "meshes") : null,
2761
+ x.count(e.materialData.materialCount, "material"),
2762
+ n ? x.count(n, "map") : null,
2763
+ x.count(e.bvhNodeCount, "BVH node")
2725
2764
  ];
2726
2765
  }
2727
2766
  _tagPrimarySceneObject() {
@@ -2786,8 +2825,8 @@ var Kn = class extends F {
2786
2825
  }
2787
2826
  _sceneBudgets(e) {
2788
2827
  return !this._memorySpill || !this.storage ? e : {
2789
- maxTriangles: fe,
2790
- maxPlacements: ue,
2828
+ maxTriangles: ue,
2829
+ maxPlacements: ce,
2791
2830
  ...e
2792
2831
  };
2793
2832
  }
@@ -2803,7 +2842,7 @@ var Kn = class extends F {
2803
2842
  !this._memorySpill || !this.storage || (this.assetLoader?.animations?.length ?? 0) > 0 || this._sdf?.spillToDisk(this.storage).then((e) => e && this.dispatchEvent({
2804
2843
  type: g.SCENE_SPILLED,
2805
2844
  ...e
2806
- })).catch((e) => this._issues.warn(b.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`));
2845
+ })).catch((e) => this._issues.warn(S.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`));
2807
2846
  }
2808
2847
  async ensureSceneResident() {
2809
2848
  this._sdf?.spilled && await this._sdf.ensureResident();
@@ -2836,35 +2875,35 @@ var Kn = class extends F {
2836
2875
  let t = this._sdf.updateMeshTransforms(e);
2837
2876
  return this.stages.pathTracer.updateBufferRanges([], [this._sdf.computeTLASDirtyRange()]), this.reset(!1, { motion: !0 }), t;
2838
2877
  }
2839
- setReservedRenderResolution(e, { allowLower: t = !1 } = {}) {
2840
- let n = t ? e : Math.max(e, i);
2878
+ setReservedRenderResolution(e, { allowLower: n = !1 } = {}) {
2879
+ let r = n ? e : Math.max(e, a);
2841
2880
  if (!this.renderer) return this._pendingReservedRenderSize = {
2842
2881
  requestedPx: e,
2843
- allowLower: t
2844
- }, Math.max(256, Math.min(r, Math.floor(n) || 256));
2845
- let a = this.renderer.backend?.device?.limits?.maxStorageBufferBindingSize || 128 * 1024 * 1024, o = se(this._hostMemoryGB), s = o.gb >= 8 && a >= 1024 * 1024 * 1024 ? r : 2048, c = te(Math.min(n, s));
2846
- if (c < Math.floor(e) && this._issues.warn(b.RENDER_RESERVE_CAPPED, `reserved render size ${y.n(e)}px was capped to ${y.n(c)}px by this device's limits — renders above ${y.n(c)}px will be declined` + (o.assumed && o.gb < 8 ? " (host memory unknown, 4 GB assumed: pass hostMemoryGB)" : ""), {
2882
+ allowLower: n
2883
+ }, Math.max(256, Math.min(i, Math.floor(r) || 256));
2884
+ let o = this.renderer.backend?.device?.limits?.maxStorageBufferBindingSize || 128 * 1024 * 1024, s = ae(this._hostMemoryGB), c = s.gb >= 8 && o >= 1024 * 1024 * 1024 ? i : 2048, l = t(Math.min(r, c));
2885
+ if (l < Math.floor(e) && this._issues.warn(S.RENDER_RESERVE_CAPPED, `reserved render size ${x.n(e)}px was capped to ${x.n(l)}px by this device's limits — renders above ${x.n(l)}px will be declined` + (s.assumed && s.gb < 8 ? " (host memory unknown, 4 GB assumed: pass hostMemoryGB)" : ""), {
2847
2886
  requested: e,
2848
- applied: c,
2849
- deviceMemoryGB: o.gb,
2850
- assumed: o.assumed,
2851
- maxStorageBufferBindingSize: a
2852
- }), (this.stages?.pathTracer?.storageTextures?.writeColor?.image?.width ?? c) !== c) {
2887
+ applied: l,
2888
+ deviceMemoryGB: s.gb,
2889
+ assumed: s.assumed,
2890
+ maxStorageBufferBindingSize: o
2891
+ }), (this.stages?.pathTracer?.storageTextures?.writeColor?.image?.width ?? l) !== l) {
2853
2892
  let e = this.pauseRendering;
2854
2893
  this.pauseRendering = !0;
2855
2894
  try {
2856
2895
  let e = this.renderer.domElement;
2857
- (e.width > c || e.height > c) && this.renderer.setSize(Math.min(e.width, c), Math.min(e.height, c), !1);
2896
+ (e.width > l || e.height > l) && this.renderer.setSize(Math.min(e.width, l), Math.min(e.height, l), !1);
2858
2897
  for (let e of Object.values(this.stages)) e?.reallocateReservedStorage?.();
2859
2898
  } finally {
2860
2899
  this.pauseRendering = e;
2861
2900
  }
2862
2901
  this.reset(), this.dispatchEvent({
2863
2902
  type: g.RESERVED_RENDER_SIZE_CHANGED,
2864
- size: c
2903
+ size: l
2865
2904
  });
2866
2905
  }
2867
- return c;
2906
+ return l;
2868
2907
  }
2869
2908
  _applyPendingReservedRenderSize() {
2870
2909
  let e = this._pendingReservedRenderSize;
@@ -2877,13 +2916,13 @@ var Kn = class extends F {
2877
2916
  });
2878
2917
  }
2879
2918
  getReservedRenderResolution() {
2880
- return i;
2919
+ return a;
2881
2920
  }
2882
2921
  _isRenderSizeSupported(e, t) {
2883
- return e > i || t > i ? (this._issues.record(b.RENDER_SIZE_DECLINED, `render resolution ${e}×${t} exceeds the ${i}px storage reserve — resize ignored, so output stays at the previous size. Raise it with setReservedRenderResolution( ${Math.max(e, t)} ) before init().`, {
2922
+ return e > a || t > a ? (this._issues.record(S.RENDER_SIZE_DECLINED, `render resolution ${e}×${t} exceeds the ${a}px storage reserve — resize ignored, so output stays at the previous size. Raise it with setReservedRenderResolution( ${Math.max(e, t)} ) before init().`, {
2884
2923
  width: e,
2885
2924
  height: t,
2886
- reserve: i
2925
+ reserve: a
2887
2926
  }), !1) : !0;
2888
2927
  }
2889
2928
  onResize() {
@@ -3033,9 +3072,9 @@ var Kn = class extends F {
3033
3072
  }
3034
3073
  getProvenance() {
3035
3074
  let e = this.stages.pathTracer, t = this.color?.status();
3036
- return h({
3037
- engine: de,
3038
- three: ht,
3075
+ return s({
3076
+ engine: le,
3077
+ three: _t,
3039
3078
  adapter: this.adapterInfo ?? null,
3040
3079
  mode: {
3041
3080
  headless: this._headless,
@@ -3077,7 +3116,7 @@ var Kn = class extends F {
3077
3116
  let t = await e.captureAccumulation();
3078
3117
  return {
3079
3118
  v: 1,
3080
- engine: de,
3119
+ engine: le,
3081
3120
  savedAt: Date.now(),
3082
3121
  samples: t.state.frameCount,
3083
3122
  ...t
@@ -3103,17 +3142,17 @@ var Kn = class extends F {
3103
3142
  toneMapping: this.renderer.toneMapping,
3104
3143
  saturation: this.settings.get("saturation") ?? 1,
3105
3144
  preserveAlpha: t
3106
- }, c = await this._toneMapOnGPU(r?.texture ?? null, i, a, o, s);
3145
+ }, l = await this._toneMapOnGPU(r?.texture ?? null, i, a, o, s);
3107
3146
  return {
3108
- data: c ?? l(r ? await this._readTexture(r.texture, a, o) : await this.renderer.readRenderTargetPixelsAsync(i, 0, 0, a, o, 0), s),
3147
+ data: l ?? c(r ? await this._readTexture(r.texture, a, o) : await this.renderer.readRenderTargetPixelsAsync(i, 0, 0, a, o, 0), s),
3109
3148
  width: a,
3110
3149
  height: o,
3111
3150
  colorSpace: e,
3112
3151
  source: r?.source ?? "accumulation",
3113
- toneMappedOn: c ? "gpu" : "cpu"
3152
+ toneMappedOn: l ? "gpu" : "cpu"
3114
3153
  };
3115
3154
  }
3116
- let { data: s, source: c } = n === "display" ? await this._readDisplaySource(i, a, o) : {
3155
+ let { data: s, source: l } = n === "display" ? await this._readDisplaySource(i, a, o) : {
3117
3156
  data: await this.renderer.readRenderTargetPixelsAsync(i, 0, 0, a, o, 0),
3118
3157
  source: "accumulation"
3119
3158
  };
@@ -3123,7 +3162,7 @@ var Kn = class extends F {
3123
3162
  height: o,
3124
3163
  colorSpace: e,
3125
3164
  workingSpace: this.color?.workingSpace ?? null,
3126
- source: c
3165
+ source: l
3127
3166
  };
3128
3167
  let { rgba: u, colorSpace: d } = this.color.exportPixels(s, e);
3129
3168
  return {
@@ -3131,7 +3170,7 @@ var Kn = class extends F {
3131
3170
  width: a,
3132
3171
  height: o,
3133
3172
  colorSpace: d,
3134
- source: c
3173
+ source: l
3135
3174
  };
3136
3175
  }
3137
3176
  async _toneMapOnGPU(e, t, n, r, i) {
@@ -3139,9 +3178,9 @@ var Kn = class extends F {
3139
3178
  if (!a?.device) return this._toneMapFallback("the renderer has no WebGPU device");
3140
3179
  try {
3141
3180
  let o = e ? this._readbackPass().draw(e, n, r).texture : t.textures[0], s = a.get(o).texture;
3142
- return s ? (this._readbackToneMapper ??= new Ae(a.device, "rayzee:readback-tonemap", { input: "texture" }), this._readbackToneMapper.ensureSize(n, r), await this._readbackToneMapper.toRGBA8(s, i)) : this._toneMapFallback("the picture has no GPU texture yet");
3181
+ return s ? (this._readbackToneMapper ??= new Me(a.device, "rayzee:readback-tonemap", { input: "texture" }), this._readbackToneMapper.ensureSize(n, r), await this._readbackToneMapper.toRGBA8(s, i)) : this._toneMapFallback("the picture has no GPU texture yet");
3143
3182
  } catch (e) {
3144
- if (e instanceof ve) throw e;
3183
+ if (e instanceof ge) throw e;
3145
3184
  return this._toneMapFallback("the GPU pass threw", e);
3146
3185
  } finally {
3147
3186
  this._readbackToneMapper?.release(), e && this._textureReadback?.release();
@@ -3149,7 +3188,7 @@ var Kn = class extends F {
3149
3188
  }
3150
3189
  _toneMapFallback(e, t = null) {
3151
3190
  let n = t ? String(t?.message ?? t) : null, r = `renderToBuffer: tone mapped on the CPU — ${e}${n ? `: ${n}` : ""}`;
3152
- return $.warn(r), this._issues.warn(b.OUTPUT_TONEMAP_FALLBACK, r, {
3191
+ return $.warn(r), this._issues.warn(S.OUTPUT_TONEMAP_FALLBACK, r, {
3153
3192
  reason: e,
3154
3193
  cause: n
3155
3194
  }), null;
@@ -3279,7 +3318,7 @@ var Kn = class extends F {
3279
3318
  }
3280
3319
  getSceneMinY() {
3281
3320
  if (!this.meshScene) return 0;
3282
- let e = new Ye().setFromObject(this.meshScene);
3321
+ let e = new Ze().setFromObject(this.meshScene);
3283
3322
  return Number.isFinite(e.min.y) ? e.min.y : 0;
3284
3323
  }
3285
3324
  getMaterialProperty(e, t) {
@@ -3289,7 +3328,7 @@ var Kn = class extends F {
3289
3328
  return this.stages.pathTracer?.materialData.getMaterialPropertySource(e, t);
3290
3329
  }
3291
3330
  setMaterialProperty(e, t, n) {
3292
- if (this._sdf?.spilled && m.has(t)) {
3331
+ if (this._sdf?.spilled && u.has(t)) {
3293
3332
  this.ensureSceneResident().then(() => this.setMaterialProperty(e, t, n));
3294
3333
  return;
3295
3334
  }
@@ -3334,7 +3373,7 @@ var Kn = class extends F {
3334
3373
  return n && n.key !== "pathtracer:color" && n.texture !== e.texture ? {
3335
3374
  texture: n.texture,
3336
3375
  source: n.key.split(":")[0]
3337
- } : (this._denoiserInUse() && this._issues.record(b.OUTPUT_SOURCE_FALLBACK, "renderToBuffer: 'display' was asked for, but no denoiser has published a picture — returned the raw accumulation", {
3376
+ } : (this._denoiserInUse() && this._issues.record(S.OUTPUT_SOURCE_FALLBACK, "renderToBuffer: 'display' was asked for, but no denoiser has published a picture — returned the raw accumulation", {
3338
3377
  requested: "display",
3339
3378
  read: "accumulation"
3340
3379
  }), null);
@@ -3350,7 +3389,7 @@ var Kn = class extends F {
3350
3389
  };
3351
3390
  }
3352
3391
  _readbackPass() {
3353
- return this._textureReadback ??= new Kt(this.renderer);
3392
+ return this._textureReadback ??= new qt(this.renderer);
3354
3393
  }
3355
3394
  _readTexture(e, t, n) {
3356
3395
  return this._readbackPass().read(e, t, n);
@@ -3361,20 +3400,20 @@ var Kn = class extends F {
3361
3400
  n.__rayzeeOriginalColorSpace === void 0 && (n.__rayzeeOriginalColorSpace = e.colorSpace);
3362
3401
  let r = n.__rayzeeOriginalColorSpace;
3363
3402
  if (delete n.ocioColorSpace, delete n.__rayzeeColorSpaceChoice, t == null) e.colorSpace = r, delete n.__rayzeeOriginalColorSpace;
3364
- else if (t === "srgb" || t === "linear") e.colorSpace = t === "srgb" ? Ie : Me, n.__rayzeeColorSpaceChoice = t;
3403
+ else if (t === "srgb" || t === "linear") e.colorSpace = t === "srgb" ? Re : Ne, n.__rayzeeColorSpaceChoice = t;
3365
3404
  else {
3366
3405
  if (!this.color?.hasConfig) throw Error(`"${t}" needs a colour config loaded`);
3367
- n.ocioColorSpace = t, e.colorSpace = Ie;
3406
+ n.ocioColorSpace = t, e.colorSpace = Re;
3368
3407
  }
3369
3408
  e.needsUpdate = !0, this.stages.pathTracer?.sdfs && await this.rebuildMaterials();
3370
3409
  }
3371
3410
  setColorManagement(e) {
3372
- this.color?.dispose(), this.color = new e({ issues: this._issues }), x(this.color), this.renderer && this.color.attachRenderer(this.renderer);
3411
+ this.color?.dispose(), this.color = new e({ issues: this._issues }), C(this.color), this.renderer && this.color.attachRenderer(this.renderer);
3373
3412
  }
3374
3413
  async loadColorConfig(e = {}) {
3375
3414
  await this._leaveColorWorkingSpace();
3376
- let t = w(this.renderer?.toneMapping), n = await this.color.loadConfig(e);
3377
- return this.color.workingSpaceAdopted && await this.applyColorWorkingSpace(), (!(t?.source === "ocio" && w(this.renderer?.toneMapping) === t) || this.color.workingSpaceAdopted) && this.reset(), n;
3415
+ let t = E(this.renderer?.toneMapping), n = await this.color.loadConfig(e);
3416
+ return this.color.workingSpaceAdopted && await this.applyColorWorkingSpace(), (!(t?.source === "ocio" && E(this.renderer?.toneMapping) === t) || this.color.workingSpaceAdopted) && this.reset(), n;
3378
3417
  }
3379
3418
  async unloadColorConfig() {
3380
3419
  await this._leaveColorWorkingSpace(), this.color.unloadConfig(), this.reset();
@@ -3395,10 +3434,10 @@ var Kn = class extends F {
3395
3434
  await this.ensureSceneResident(), await this.stages.pathTracer?.rebuildMaterials(e || this.meshScene), this.reset();
3396
3435
  }
3397
3436
  async _initRenderer() {
3398
- if (ae((e) => this.dispatchEvent(e)), typeof navigator > "u" || !navigator.gpu) throw Error("WebGPU is not available — outside a browser, install one as navigator.gpu (for Node, the `webgpu` package)");
3437
+ if (te((e) => this.dispatchEvent(e)), typeof navigator > "u" || !navigator.gpu) throw Error("WebGPU is not available — outside a browser, install one as navigator.gpu (for Node, the `webgpu` package)");
3399
3438
  let e = await navigator.gpu.requestAdapter({ powerPreference: "high-performance" });
3400
3439
  if (!e) throw Error("Failed to get WebGPU adapter");
3401
- this.adapterInfo = Gn(e), this.adapterInfo.isSoftware && (this._issues.warn(b.ADAPTER_SOFTWARE, `software GPU adapter "${this.adapterInfo.description || this.adapterInfo.vendor}" — renders are correct but orders of magnitude slower than hardware`, { ...this.adapterInfo }), $.warn(`software GPU adapter — check app.adapterInfo.isSoftware. ${this.adapterInfo.description}`));
3440
+ this.adapterInfo = Jn(e), this.adapterInfo.isSoftware && (this._issues.warn(S.ADAPTER_SOFTWARE, `software GPU adapter "${this.adapterInfo.description || this.adapterInfo.vendor}" — renders are correct but orders of magnitude slower than hardware`, { ...this.adapterInfo }), $.warn(`software GPU adapter — check app.adapterInfo.isSoftware. ${this.adapterInfo.description}`));
3402
3441
  let t = e.limits, n = { maxColorAttachmentBytesPerSample: 128 };
3403
3442
  for (let e of [
3404
3443
  "maxBufferSize",
@@ -3416,23 +3455,23 @@ var Kn = class extends F {
3416
3455
  let r = t[e];
3417
3456
  r !== void 0 && (n[e] = r);
3418
3457
  }
3419
- if (n.maxStorageBuffersPerShaderStage = Math.min(t.maxStorageBuffersPerShaderStage, 10), this.renderer = new Re({
3458
+ if (n.maxStorageBuffersPerShaderStage = Math.min(t.maxStorageBuffersPerShaderStage, 10), this.renderer = new Be({
3420
3459
  canvas: this.canvas,
3421
3460
  alpha: !0,
3422
3461
  powerPreference: "high-performance",
3423
3462
  requiredLimits: n
3424
- }), await Vn(this.renderer, this._headless), !this.renderer.backend?.isWebGPUBackend) throw Error("WebGPU backend unavailable — three.js fell back to WebGL2, which cannot run the path tracer's compute kernels. Check GPU process flags and driver support.");
3463
+ }), await Wn(this.renderer, this._headless), !this.renderer.backend?.isWebGPUBackend) throw Error("WebGPU backend unavailable — three.js fell back to WebGL2, which cannot run the path tracer's compute kernels. Check GPU process flags and driver support.");
3425
3464
  let r = this.renderer.backend?.device;
3426
- r?.lost && (this._gpuDevice = r, this._deviceLostHolder = { app: this }, Un(r, this._deviceLostHolder), r.onuncapturederror = (e) => $.error("WebGPU uncaptured error:", e.error)), Fe.setLTC(wt.init()), this.renderer.outputColorSpace = Ie, this.renderer.toneMapping = Oe, this.renderer.toneMappingExposure = 1, this.renderer.setPixelRatio(1), this.color.attachRenderer(this.renderer);
3465
+ r?.lost && (this._gpuDevice = r, this._deviceLostHolder = { app: this }, Kn(r, this._deviceLostHolder), r.onuncapturederror = (e) => $.error("WebGPU uncaptured error:", e.error)), Le.setLTC(Tt.init()), this.renderer.outputColorSpace = Re, this.renderer.toneMapping = Ee, this.renderer.toneMappingExposure = 1, this.renderer.setPixelRatio(1), this.color.attachRenderer(this.renderer);
3427
3466
  }
3428
3467
  _initScenes() {
3429
- this.scene = new vt(), this.meshScene = new vt(), this._sceneHelpers = new At();
3468
+ this.scene = new H(), this.meshScene = new H(), this._sceneHelpers = new jt();
3430
3469
  }
3431
3470
  _initAssetPipeline() {
3432
- this._sdf = new ee({
3471
+ this._sdf = new f({
3433
3472
  issues: this._issues,
3434
3473
  ...this._maxSceneBytes === void 0 ? {} : { maxSceneBytes: this._maxSceneBytes }
3435
- }), this.assetLoader = new An(this.meshScene, this.camera, null, {
3474
+ }), this.assetLoader = new Nn(this.meshScene, this.camera, null, {
3436
3475
  issues: this._issues,
3437
3476
  areaLightIntensityScale: () => this.settings.get("areaLightIntensityScale")
3438
3477
  }), this.assetLoader.setRenderer(this.renderer), this.assetLoader.createFloorPlane();
@@ -3440,14 +3479,14 @@ var Kn = class extends F {
3440
3479
  _initPipeline() {
3441
3480
  this._createStages();
3442
3481
  let { clientWidth: e, clientHeight: t } = this.canvas;
3443
- this.pipeline = new Ut(this.renderer, e || 1, t || 1, { issues: this._issues }), this.pipeline.addStage(this.stages.pathTracer);
3482
+ this.pipeline = new Wt(this.renderer, e || 1, t || 1, { issues: this._issues }), this.pipeline.addStage(this.stages.pathTracer);
3444
3483
  for (let e of this._extraStages) this.pipeline.addStage(e);
3445
3484
  this.pipeline.addStage(this.stages.compositor);
3446
3485
  let n = this.canvas.clientWidth || 1, r = this.canvas.clientHeight || 1;
3447
3486
  this._displayWidth = n, this._displayHeight = r, this._renderWidth = n, this._renderHeight = r, this.pipeline.setSize(n, r);
3448
3487
  }
3449
3488
  async _initManagers() {
3450
- this.lightManager = new Ln(this.scene, this._sceneHelpers, this.stages.pathTracer, {
3489
+ this.lightManager = new Bn(this.scene, this._sceneHelpers, this.stages.pathTracer, {
3451
3490
  onReset: () => this.reset(),
3452
3491
  onLightRemoved: (e) => this._lightRemoved(e)
3453
3492
  }), this.environmentManager = this.stages.pathTracer.environment, this.environmentManager.issues = this._issues, this.stages.pathTracer.issues = this._issues, this.environmentManager.callbacks.onLightingChanged = () => this.pipeline.eventBus.emit("pipeline:lightingChanged"), this.environmentManager.callbacks.onReset = () => this.reset();
@@ -3458,7 +3497,7 @@ var Kn = class extends F {
3458
3497
  if (e.model) this._clearAppendedModels(), await this.loadSceneData({ pendingEnvironment: this._beginSceneMetadataEnvironment() });
3459
3498
  else if (e.texture) {
3460
3499
  let e = this.meshScene.environment;
3461
- e && this.stages.pathTracer && await this.stages.pathTracer.environment.setEnvironmentMap(e), v();
3500
+ e && this.stages.pathTracer && await this.stages.pathTracer.environment.setEnvironmentMap(e), y();
3462
3501
  }
3463
3502
  this.pauseRendering = !1, this.reset();
3464
3503
  }
@@ -3468,11 +3507,11 @@ var Kn = class extends F {
3468
3507
  }));
3469
3508
  }
3470
3509
  _createStages() {
3471
- this.stages.pathTracer = new f(this.renderer, this.scene, this.camera, {
3510
+ this.stages.pathTracer = new d(this.renderer, this.scene, this.camera, {
3472
3511
  hostMemoryGB: this._hostMemoryGB,
3473
3512
  sortMaterials: this.settings.get("wavefrontSortMaterials")
3474
- }), this._extraStages = this._createExtraStages(), this.stages.compositor = new jt(this.renderer, {
3475
- saturation: this.settings.get("saturation") ?? n.saturation,
3513
+ }), this._extraStages = this._createExtraStages(), this.stages.compositor = new Mt(this.renderer, {
3514
+ saturation: this.settings.get("saturation") ?? o.saturation,
3476
3515
  pathTracer: this.stages.pathTracer,
3477
3516
  displaySources: this._displaySources()
3478
3517
  });
@@ -3487,7 +3526,7 @@ var Kn = class extends F {
3487
3526
  if (e) for (let n of t) this._addTrackedListener(e, n, (e) => this.dispatchEvent(e));
3488
3527
  }
3489
3528
  _createCamera() {
3490
- let e = new Pn(60, this.canvas.clientWidth / this.canvas.clientHeight || 1, .01, 1e3);
3529
+ let e = new Ln(60, this.canvas.clientWidth / this.canvas.clientHeight || 1, .01, 1e3);
3491
3530
  return e.position.set(0, 0, 5), e;
3492
3531
  }
3493
3532
  _createExtraStages() {
@@ -3548,4 +3587,4 @@ var Kn = class extends F {
3548
3587
  _disposeExtensions() {}
3549
3588
  };
3550
3589
  //#endregion
3551
- export { Mt as _, tn as a, J as c, K as d, Qt as f, It as g, Lt as h, Pn as i, $t as l, Rt as m, Gn as n, Y as o, Ut as p, Ln as r, U as s, Kn as t, Zt as u };
3590
+ export { Nt as _, an as a, J as c, q as d, tn as f, Lt as g, Rt as h, Ln as i, nn as l, zt as m, Jn as n, Y as o, Wt as p, Bn as r, G as s, Yn as t, en as u };