rayzee 11.5.0 → 11.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +14 -14
  2. package/dist/{ArchiveImporter-29Nl1567.js → ArchiveImporter-DYcRXeKE.js} +2 -2
  3. package/dist/{BidirectionalIntegrator-CJay8tXK.js → BidirectionalIntegrator-BvjRpbTP.js} +289 -289
  4. package/dist/{EngineEvents-Ci8dVWCP.js → EngineEvents-CLckhYbL.js} +1 -0
  5. package/dist/{NeuralRetouch-KqGVPV7u.js → NeuralRetouch-ClaMiKYg.js} +1 -1
  6. package/dist/{NeuralSuperRes-BHxhYzlD.js → NeuralSuperRes-WNEXun9s.js} +2 -2
  7. package/dist/{PathTracer-Cldt0mXi.js → PathTracer-B9wZPPVL.js} +3197 -3167
  8. package/dist/{PhysicalSky-CUWrTcmT.js → PhysicalSky-DcjItqKi.js} +1 -1
  9. package/dist/{RayzeeRenderer-Dd-Dit0v.js → RayzeeRenderer-p-NeE6E2.js} +405 -437
  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/rayzee-core.es.js +5 -5
  14. package/dist/rayzee.es.js +1003 -1686
  15. package/dist/rayzee.umd.js +104 -143
  16. package/dist/{sceneCachePolicy--ta6moJu.js → sceneCachePolicy-B9w3BnaP.js} +2 -2
  17. package/package.json +2 -2
  18. package/src/EngineEvents.js +2 -0
  19. package/src/Passes/OIDNDenoiser.js +106 -100
  20. package/src/PathTracerApp.js +8 -19
  21. package/src/Pipeline/BindingAudit.js +2 -3
  22. package/src/Pipeline/PipelineContext.js +0 -1
  23. package/src/Pipeline/RenderPipeline.js +1 -2
  24. package/src/Pipeline/RenderStage.js +1 -1
  25. package/src/Processor/PackedRayBuffer.js +2 -2
  26. package/src/Processor/StorageTexturePool.js +1 -1
  27. package/src/Processor/TextureReadback.js +18 -1
  28. package/src/RayzeeRenderer.js +5 -5
  29. package/src/Stages/DenoiserSettings.js +5 -81
  30. package/src/Stages/MotionVector.js +21 -215
  31. package/src/Stages/NormalDepth.js +5 -5
  32. package/src/Stages/PathTracer.js +3 -11
  33. package/src/Stages/PathTracerStage.js +4 -17
  34. package/src/TSL/FinalWriteKernel.js +2 -2
  35. package/src/TSL/ShadeKernel.js +3 -3
  36. package/src/index.js +1 -1
  37. package/src/managers/DenoisingManager.js +93 -187
  38. package/src/Stages/ASVGF.js +0 -932
  39. package/src/Stages/BilateralFilter.js +0 -486
  40. package/src/Stages/EdgeFilter.js +0 -545
  41. package/src/Stages/Variance.js +0 -443
@@ -1,31 +1,31 @@
1
1
  import { dt as e } from "./SolarLimb-bZE6y63S.js";
2
- import { Dt as t, Ot as n, Tt as r, _t as i, ct as a, gt as o, kt as s, mt as c, n as l, ot as u, st as d, wt as f } from "./PathTracer-Cldt0mXi.js";
3
- import { n as p, t as m } from "./EngineEvents-Ci8dVWCP.js";
4
- import { $ as h, C as g, G as _, M as ee, Q as te, T as ne, W as re, at as v, d as ie, et as ae, f as oe, l as se, nt as y, ot as ce, r as le, rt as ue, tt as de, u as fe, v as pe, x as b } from "./sceneCachePolicy--ta6moJu.js";
5
- import { i as x, r as me } from "./Logger-dDDGj9Av.js";
6
- import { f as he, r as ge } from "./BufferLayout-xPRH9jYD.js";
7
- import { i as _e, n as S, 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 Se, r as Ce, t as C } from "./ActiveColor-YvuQq44O.js";
11
- import { n as w, r as we } from "./AssetConfig-DSEntE65.js";
12
- import { d as Te, l as Ee, m as De, p as Oe, t as ke, u as T } from "./ViewTransforms-CYN7bq2w.js";
13
- import { i as E, n as Ae, r as je } from "./identity-C1cLD1C0.js";
2
+ import { At as t, Dt as n, Et as r, ct as i, gt as a, i as o, jt as s, kt as c, lt as l, n as u, r as d, ut as f, vt as p, yt as m } from "./PathTracer-B9wZPPVL.js";
3
+ import { n as h, t as g } from "./EngineEvents-CLckhYbL.js";
4
+ import { $ as ee, C as te, G as _, M as ne, Q as re, T as v, W as ie, at as y, d as ae, et as oe, f as se, l as ce, nt as le, ot as ue, r as de, rt as fe, tt as pe, u as me, v as he, x as b } from "./sceneCachePolicy-B9w3BnaP.js";
5
+ import { i as x, r as S } from "./Logger-dDDGj9Av.js";
6
+ import { f as ge, r as _e } from "./BufferLayout-xPRH9jYD.js";
7
+ import { i as ve, n as C, t as ye } from "./EngineIssues-CIZnXHsF.js";
8
+ import { n as be, r as xe } from "./shared-BGBcSxBQ.js";
9
+ import { a as Se } from "./WorkingMatrix-C6y233hT.js";
10
+ import { i as w, r as Ce, t as T } from "./ActiveColor-YvuQq44O.js";
11
+ import { n as E, r as we } from "./AssetConfig-DSEntE65.js";
12
+ import { d as Te, l as Ee, m as De, p as Oe, t as ke, u as D } from "./ViewTransforms-CYN7bq2w.js";
13
+ import { i as O, n as Ae, r as je } from "./identity-C1cLD1C0.js";
14
14
  import { a as Me, i as Ne, t as Pe } from "./SceneMetadata-D2Sh-0e-.js";
15
15
  import { t as Fe } from "./ToneMapGPU-sAs8wdgI.js";
16
- import { LinearSRGBColorSpace as Ie, MeshBasicNodeMaterial as Le, NodeMaterial as Re, QuadMesh as D, RectAreaLightNode as ze, SRGBColorSpace as O, TextureNode as Be, WebGPURenderer as Ve } from "three/webgpu";
17
- import { Fn as He, If as Ue, cubeTexture as We, dot as Ge, float as k, int as A, ivec2 as Ke, mix as j, screenCoordinate as qe, screenUV as Je, select as M, storage as Ye, texture as Xe, uint as Ze, uniform as N, uv as P, vec3 as F, vec4 as Qe } from "three/tsl";
18
- import { Box3 as $e, BufferGeometry as et, CircleGeometry as tt, Color as nt, DataTexture as rt, DirectionalLight as it, DirectionalLightHelper as at, EquirectangularReflectionMapping as ot, EventDispatcher as I, FloatType as st, LinearFilter as ct, LinearSRGBColorSpace as lt, LoaderUtils as L, LoadingManager as ut, MathUtils as R, Mesh as dt, MeshPhysicalMaterial as ft, NearestFilter as pt, NoBlending as mt, NoToneMapping as ht, Object3D as gt, OrthographicCamera as _t, PerspectiveCamera as vt, PointLight as yt, PointLightHelper as bt, REVISION as xt, RGBAFormat as St, RectAreaLight as z, RenderTarget as Ct, SRGBColorSpace as B, Scene as V, SpotLight as wt, SpotLightHelper as Tt, TextureLoader as Et, UnsignedByteType as Dt, Vector2 as Ot, Vector3 as H } from "three";
19
- import { RectAreaLightTexturesLib as kt } from "three/addons/lights/RectAreaLightTexturesLib.js";
20
- import { RectAreaLightHelper as At } from "three/addons/helpers/RectAreaLightHelper.js";
21
- import { GLTFLoader as jt } from "three/addons/loaders/GLTFLoader.js";
22
- import { HDRLoader as Mt } from "three/addons/loaders/HDRLoader.js";
23
- import { createMeshesFromMultiMaterialMesh as Nt } from "three/addons/utils/SceneUtils.js";
24
- import { clone as Pt } from "three/addons/utils/SkeletonUtils.js";
16
+ import { LinearSRGBColorSpace as Ie, MeshBasicNodeMaterial as Le, QuadMesh as Re, RectAreaLightNode as ze, SRGBColorSpace as Be, TextureNode as Ve, WebGPURenderer as He } from "three/webgpu";
17
+ import { Fn as Ue, If as We, cubeTexture as Ge, dot as Ke, float as k, int as A, mix as j, screenUV as qe, select as M, storage as Je, texture as Ye, uint as Xe, uniform as N, uv as P, vec3 as F, vec4 as Ze } from "three/tsl";
18
+ import { Box3 as Qe, BufferGeometry as $e, CircleGeometry as et, Color as I, DataTexture as tt, DirectionalLight as nt, DirectionalLightHelper as rt, EquirectangularReflectionMapping as it, EventDispatcher as L, FloatType as at, LinearFilter as ot, LinearSRGBColorSpace as st, LoaderUtils as R, LoadingManager as ct, MathUtils as z, Mesh as lt, MeshPhysicalMaterial as ut, NoBlending as dt, NoToneMapping as ft, Object3D as B, OrthographicCamera as pt, PerspectiveCamera as mt, PointLight as ht, PointLightHelper as gt, REVISION as _t, RGBAFormat as vt, RectAreaLight as V, SRGBColorSpace as H, Scene as yt, 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 Ft = class {
26
+ var jt = class {
27
27
  constructor() {
28
- this.scene = new V(), this._helpers = /* @__PURE__ */ new Map(), this.visible = !1;
28
+ this.scene = new yt(), 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,18 +63,18 @@ var Ft = class {
63
63
  this.clear();
64
64
  }
65
65
  _createHelper(e) {
66
- return e.isRectAreaLight ? new At(e) : e.isPointLight ? new bt(e, .5) : e.isSpotLight ? new Tt(e) : e.isDirectionalLight ? new at(e, .5) : null;
66
+ return e.isRectAreaLight ? new Et(e) : e.isPointLight ? new gt(e, .5) : e.isSpotLight ? new xt(e) : e.isDirectionalLight ? new rt(e, .5) : null;
67
67
  }
68
- }, It = class extends n {
68
+ }, Mt = class extends t {
69
69
  constructor(e, t = {}) {
70
70
  super("Compositor", {
71
71
  ...t,
72
72
  executionMode: s.ALWAYS
73
- }), this.renderer = e, this._lightSources = [...t.displaySources ?? [], "pathtracer:color"], this.saturation = N(t.saturation ?? 1), this._transparentBackground = N(0, "int"), this._pathTracer = t.pathTracer ?? null, this._convergenceOverlay = !1, this._debugMaterial = null, this._debugQuad = null, this._debugTexNode = null, this._debugM2Attr = null, this._debugMaskAttr = null, this._debugExposureComp = N(1), this._sourceTexNode = new Be(), this._displayGain = null, this.compositorMaterial = new Le(), this.compositorMaterial.blending = mt, this._buildColorNode(), this.compositorQuad = new D(this.compositorMaterial);
73
+ }), this.renderer = e, this._lightSources = [...t.displaySources ?? [], "pathtracer:color"], this.saturation = N(t.saturation ?? 1), this._transparentBackground = N(0, "int"), this._pathTracer = t.pathTracer ?? null, this._convergenceOverlay = !1, this._debugMaterial = null, this._debugQuad = null, this._debugTexNode = null, this._debugM2Attr = null, this._debugMaskAttr = null, this._debugExposureComp = N(1), this._sourceTexNode = new Ve(), this._displayGain = null, this.compositorMaterial = new Le(), this.compositorMaterial.blending = dt, this._buildColorNode(), this.compositorQuad = new Re(this.compositorMaterial);
74
74
  }
75
75
  _buildColorNode() {
76
- let t = this._sourceTexNode.sample(P()), n = this._displayGain ? t.xyz.mul(this._displayGain(t.xyz, Je)) : t.xyz, r = j(F(Ge(n, e)), n, this.saturation), i = M(this._transparentBackground, t.w, 1);
77
- this.compositorMaterial.colorNode = Qe(r, i), this.compositorMaterial.needsUpdate = !0;
76
+ let t = this._sourceTexNode.sample(P()), n = this._displayGain ? t.xyz.mul(this._displayGain(t.xyz, qe)) : t.xyz, r = j(F(Ke(n, e)), n, this.saturation), i = M(this._transparentBackground, t.w, 1);
77
+ this.compositorMaterial.colorNode = Ze(r, i), this.compositorMaterial.needsUpdate = !0;
78
78
  }
79
79
  setDisplayGain(e) {
80
80
  e !== this._displayGain && (this._displayGain = e, this._buildColorNode());
@@ -96,17 +96,17 @@ var Ft = class {
96
96
  let t = this._pathTracer?.getConvergenceDebugSource?.();
97
97
  if (!t) return !1;
98
98
  if (this._debugMaterial && this._debugM2Attr === t.m2 && this._debugMaskAttr === t.frozenMask) return !0;
99
- this._debugMaterial?.dispose(), this._debugTexNode?.dispose(), this._debugM2Attr = t.m2, this._debugMaskAttr = t.frozenMask, this._debugTexNode = new Be();
100
- let n = He(() => {
101
- let n = Ge(this._debugTexNode.sample(P()).toVar().xyz, e).toVar(), r = t.renderWidth, i = t.renderHeight, a = A(P().x.mul(k(r))).min(r.sub(A(1))).max(A(0)), o = Ze(A(P().y.mul(k(i))).min(i.sub(A(1))).max(A(0)).mul(r).add(a)).toVar(), s = Ye(t.m2, "float").toReadOnly().element(o).toVar(), c = Ye(t.frozenMask, "uint").toReadOnly().element(o).toVar(), l = s.sub(n.mul(n)).max(k(0)).div(k(t.frame).add(1)).sqrt().toVar(), u = t.usePixelFreeze.greaterThan(A(0)), d = M(n.lessThan(k(1)), n.sqrt(), n).toVar(), f = M(u, l.div(n.add(k(1e-4))), l.div(d.add(k(1e-4)))).toVar(), p = M(u, t.pixelFreezeThreshold, t.noiseThreshold).toVar(), m = f.div(p.max(k(1e-6))).toVar(), h = F(n.div(n.add(k(1))).sqrt().mul(.55)).toVar(), g = h.toVar(), _ = k(t.frame).greaterThanEqual(k(t.adaptiveMinSamples));
102
- return Ue(m.greaterThanEqual(k(1)).or(_.not()), () => {
99
+ this._debugMaterial?.dispose(), this._debugTexNode?.dispose(), this._debugM2Attr = t.m2, this._debugMaskAttr = t.frozenMask, this._debugTexNode = new Ve();
100
+ let n = Ue(() => {
101
+ let n = Ke(this._debugTexNode.sample(P()).toVar().xyz, e).toVar(), r = t.renderWidth, i = t.renderHeight, a = A(P().x.mul(k(r))).min(r.sub(A(1))).max(A(0)), o = Xe(A(P().y.mul(k(i))).min(i.sub(A(1))).max(A(0)).mul(r).add(a)).toVar(), s = Je(t.m2, "float").toReadOnly().element(o).toVar(), c = Je(t.frozenMask, "uint").toReadOnly().element(o).toVar(), l = s.sub(n.mul(n)).max(k(0)).div(k(t.frame).add(1)).sqrt().toVar(), u = t.usePixelFreeze.greaterThan(A(0)), d = M(n.lessThan(k(1)), n.sqrt(), n).toVar(), f = M(u, l.div(n.add(k(1e-4))), l.div(d.add(k(1e-4)))).toVar(), p = M(u, t.pixelFreezeThreshold, t.noiseThreshold).toVar(), m = f.div(p.max(k(1e-6))).toVar(), h = F(n.div(n.add(k(1))).sqrt().mul(.55)).toVar(), g = h.toVar(), ee = k(t.frame).greaterThanEqual(k(t.adaptiveMinSamples));
102
+ return We(m.greaterThanEqual(k(1)).or(ee.not()), () => {
103
103
  let e = j(F(1, .8, .1), F(1, .1, .05), m.sub(1).div(3).clamp(0, 1));
104
104
  g.assign(j(h, e, .85));
105
- }), Ue(c.equal(Ze(1)).and(u), () => {
105
+ }), We(c.equal(Xe(1)).and(u), () => {
106
106
  g.assign(j(h, F(.1, .45, 1), .55));
107
107
  }), g;
108
108
  });
109
- return this._debugMaterial = new Le(), this._debugMaterial.colorNode = Qe(n().pow(2.2).mul(this._debugExposureComp), 1), this._debugMaterial.blending = mt, this._debugQuad = new D(this._debugMaterial), !0;
109
+ return this._debugMaterial = new Le(), this._debugMaterial.colorNode = Ze(n().pow(2.2).mul(this._debugExposureComp), 1), this._debugMaterial.blending = dt, this._debugQuad = new Re(this._debugMaterial), !0;
110
110
  }
111
111
  render(e) {
112
112
  if (!this.enabled) return;
@@ -114,7 +114,7 @@ var Ft = class {
114
114
  let t = e.getTexture("pathtracer:color");
115
115
  if (t) {
116
116
  this._debugTexNode.value = t;
117
- let e = this.renderer.toneMapping !== ht;
117
+ let e = this.renderer.toneMapping !== ft;
118
118
  this._debugExposureComp.value = e ? 1 / Math.max(this.renderer.toneMappingExposure, 1e-4) : 1, this.renderer.setRenderTarget(null), this._debugQuad.render(this.renderer);
119
119
  return;
120
120
  }
@@ -134,13 +134,12 @@ var Ft = class {
134
134
  dispose() {
135
135
  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;
136
136
  }
137
- }, Lt = class {
137
+ }, Nt = class {
138
138
  constructor() {
139
139
  this.textures = /* @__PURE__ */ new Map(), this.renderTargets = /* @__PURE__ */ new Map(), this.uniforms = /* @__PURE__ */ new Map(), this.state = {
140
140
  frame: 0,
141
141
  accumulatedFrames: 0,
142
142
  renderMode: 0,
143
- interactionMode: !1,
144
143
  isComplete: !1,
145
144
  tileInfo: null,
146
145
  currentTile: 0,
@@ -254,7 +253,7 @@ var Ft = class {
254
253
  dispose() {
255
254
  this.textures.clear(), this.renderTargets.clear(), this.uniforms.clear(), this._stateChangeCallbacks.clear(), this.state = {};
256
255
  }
257
- }, Rt = class extends I {
256
+ }, Pt = class extends L {
258
257
  constructor() {
259
258
  super(), this._onceCallbacks = /* @__PURE__ */ new Map();
260
259
  }
@@ -292,38 +291,38 @@ var Ft = class {
292
291
  eventNames() {
293
292
  return this._listeners ? Object.keys(this._listeners) : [];
294
293
  }
295
- }, zt = !1, U = [], Bt = /* @__PURE__ */ new WeakMap();
296
- function Vt(e) {
297
- zt = !!e;
294
+ }, Ft = !1, It = [], Lt = /* @__PURE__ */ new WeakMap();
295
+ function Rt(e) {
296
+ Ft = !!e;
298
297
  }
299
- function Ht() {
300
- return U.slice();
298
+ function zt() {
299
+ return It.slice();
301
300
  }
302
- function Ut() {
303
- U.length = 0;
301
+ function Bt() {
302
+ It.length = 0;
304
303
  }
305
- function Wt(e) {
304
+ function Vt(e) {
306
305
  let t = [];
307
306
  for (let n of Object.keys(e)) e[n]?.isTextureNode === !0 && t.push(n);
308
307
  return t;
309
308
  }
310
- var Gt = (e) => !e || !e.image || !(e.image.width > 0);
311
- function Kt(e, t, n) {
312
- if (!zt) {
309
+ var Ht = (e) => !e || !e.image || !(e.image.width > 0);
310
+ function Ut(e, t, n) {
311
+ if (!Ft) {
313
312
  n();
314
313
  return;
315
314
  }
316
- let r = Bt.get(e);
315
+ let r = Lt.get(e);
317
316
  if (r || (r = {
318
317
  phase: "pending",
319
318
  unboundAtCompile: []
320
- }, Bt.set(e, r)), r.phase !== "pending") {
321
- n(), r.phase === "watch" && qt(e, r);
319
+ }, Lt.set(e, r)), r.phase !== "pending") {
320
+ n(), r.phase === "watch" && Wt(e, r);
322
321
  return;
323
322
  }
324
323
  let i = Object.prototype.hasOwnProperty.call(t, "compute"), a = t.compute;
325
324
  t.compute = function(...t) {
326
- return r.phase === "pending" && (r.unboundAtCompile = Wt(e).filter((t) => Gt(e[t].value)), r.phase = r.unboundAtCompile.length < 2 ? "done" : "watch"), a.apply(this, t);
325
+ return r.phase === "pending" && (r.unboundAtCompile = Vt(e).filter((t) => Ht(e[t].value)), r.phase = r.unboundAtCompile.length < 2 ? "done" : "watch"), a.apply(this, t);
327
326
  };
328
327
  try {
329
328
  n();
@@ -331,14 +330,14 @@ function Kt(e, t, n) {
331
330
  i ? t.compute = a : delete t.compute;
332
331
  }
333
332
  }
334
- function qt(e, t) {
333
+ function Wt(e, t) {
335
334
  let n = [];
336
335
  for (let r of t.unboundAtCompile) {
337
336
  let t = e[r]?.value;
338
- if (Gt(t)) return;
337
+ if (Ht(t)) return;
339
338
  t.isStorageTexture !== !0 && n.push(r);
340
339
  }
341
- t.phase = "done", n.length !== 0 && U.push({
340
+ t.phase = "done", n.length !== 0 && It.push({
342
341
  stage: e.name,
343
342
  nodes: n,
344
343
  unboundAtCompile: t.unboundAtCompile.slice(),
@@ -347,18 +346,18 @@ function qt(e, t) {
347
346
  }
348
347
  //#endregion
349
348
  //#region src/Pipeline/RenderPipeline.js
350
- var Jt = class {
349
+ var Gt = class {
351
350
  _reportStageFailure(e, t, n) {
352
351
  console.error(`[Pipeline] Error in stage '${e}' (${t}):`, n);
353
352
  let r = `${e}:${t}`;
354
- this._reportedStageFailures.has(r) || (this._reportedStageFailures.add(r), this._issues?.record(S.STAGE_RENDER_FAILED, `stage "${e}" threw during ${t} — the frame is incomplete`, {
353
+ this._reportedStageFailures.has(r) || (this._reportedStageFailures.add(r), this._issues?.record(C.STAGE_RENDER_FAILED, `stage "${e}" threw during ${t} — the frame is incomplete`, {
355
354
  stage: e,
356
355
  phase: t,
357
356
  cause: String(n?.message ?? n)
358
357
  }));
359
358
  }
360
359
  constructor(e, t, n, { issues: r = null } = {}) {
361
- this.renderer = e, this._issues = r, this._reportedStageFailures = /* @__PURE__ */ new Set(), this.width = t, this.height = n, this.stages = [], this.context = new Lt(), this.eventBus = new Rt(), this.context.setState("width", t), this.context.setState("height", n), this.stats = {
360
+ 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 = {
362
361
  enabled: !1,
363
362
  logSkipped: !1,
364
363
  timings: /* @__PURE__ */ new Map(),
@@ -392,7 +391,7 @@ var Jt = class {
392
391
  }
393
392
  try {
394
393
  let n = this.stats.enabled ? performance.now() : 0;
395
- if (Kt(t, this.renderer, () => t.render(this.context, e)), this.stats.enabled) {
394
+ if (Ut(t, this.renderer, () => t.render(this.context, e)), this.stats.enabled) {
396
395
  let e = performance.now() - n;
397
396
  this.stats.timings.has(t.name) || this.stats.timings.set(t.name, []);
398
397
  let r = this.stats.timings.get(t.name);
@@ -490,7 +489,7 @@ var Jt = class {
490
489
  let e = this.getInfo();
491
490
  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();
492
491
  }
493
- }, Yt = me("engine"), Xt = class {
492
+ }, Kt = S("engine"), qt = class {
494
493
  constructor() {
495
494
  this.timeElapsed = 0, this.lastResetTime = performance.now(), this.renderCompleteDispatched = !1, this.budgetOverrun = !1, this._budgetHeldWarned = !1;
496
495
  }
@@ -498,7 +497,7 @@ var Jt = class {
498
497
  this.timeElapsed = (performance.now() - this.lastResetTime) / 1e3;
499
498
  }
500
499
  isTimeLimitReached(e, t, n) {
501
- return this.budgetOverrun = !1, t !== "time" && t !== "timeOnly" || !(n > 0) || this.timeElapsed < n ? !1 : e?.frameCount > 0 ? (this.budgetOverrun = !0, !0) : (this._budgetHeldWarned || (this._budgetHeldWarned = !0, Yt.warn(`render time limit (${n}s) expired before the first sample landed — holding the deadline open to avoid capturing an empty frame`)), !1);
500
+ return this.budgetOverrun = !1, t !== "time" && t !== "timeOnly" || !(n > 0) || this.timeElapsed < n ? !1 : e?.frameCount > 0 ? (this.budgetOverrun = !0, !0) : (this._budgetHeldWarned || (this._budgetHeldWarned = !0, Kt.warn(`render time limit (${n}s) expired before the first sample landed — holding the deadline open to avoid capturing an empty frame`)), !1);
502
501
  }
503
502
  isLimitReached(e, t, n) {
504
503
  return e ? this.isTimeLimitReached(e, t, n) ? !0 : this.stopCondition(e) !== null : !1;
@@ -515,47 +514,16 @@ var Jt = class {
515
514
  resumeFromPause() {
516
515
  this.renderCompleteDispatched = !1, this.lastResetTime = performance.now() - this.timeElapsed * 1e3;
517
516
  }
518
- }, Zt = class {
519
- constructor(e) {
520
- this.renderer = e, this.target = null, this.material = new Re(), this.material.name = "rayzee:texture-readback", this.quad = new D(this.material), this._node = null, this._source = null;
521
- }
522
- _ensureTarget(e, t) {
523
- this.target && this.target.width === e && this.target.height === t || (this.target?.dispose(), this.target = new Ct(e, t, {
524
- type: st,
525
- format: St,
526
- depthBuffer: !1,
527
- minFilter: pt,
528
- magFilter: pt
529
- }));
530
- }
531
- async read(e, t, n) {
532
- try {
533
- return await this.renderer.readRenderTargetPixelsAsync(this.draw(e, t, n), 0, 0, t, n);
534
- } finally {
535
- this.release();
536
- }
537
- }
538
- draw(e, t, n) {
539
- this._ensureTarget(t, n), this._source !== e && (this._node = Xe(e).load(Ke(qe.xy)), this.material.outputNode = this._node, this.material.needsUpdate = !0, this._source = e);
540
- let r = this.renderer.getRenderTarget();
541
- return this.renderer.setRenderTarget(this.target), this.quad.render(this.renderer), this.renderer.setRenderTarget(r), this.target;
542
- }
543
- release() {
544
- this.target?.dispose(), this.target = null;
545
- }
546
- dispose() {
547
- this.target?.dispose(), this.material.dispose(), this.target = null, this._source = null, this._node = null;
548
- }
549
- }, Qt = 864e5, W = Object.freeze({
517
+ }, Jt = 864e5, W = Object.freeze({
550
518
  IMMUTABLE: "immutable",
551
519
  REVALIDATE: "revalidate",
552
520
  NETWORK: "network"
553
- }), G = (e, t) => ({
521
+ }), Yt = (e, t) => ({
554
522
  loaded: e,
555
523
  total: t,
556
524
  lengthComputable: t > 0 && e <= t
557
- }), K = (e, t) => e.headers?.get?.(t) ?? null, $t = (e) => e.reason ?? new DOMException("aborted", "AbortError");
558
- function q(e) {
525
+ }), G = (e, t) => e.headers?.get?.(t) ?? null, Xt = (e) => e.reason ?? new DOMException("aborted", "AbortError");
526
+ function K(e) {
559
527
  try {
560
528
  let t = new URL(e, globalThis.location?.href ?? "http://localhost/").pathname;
561
529
  return decodeURIComponent(t.split("/").pop()) || "download";
@@ -563,36 +531,36 @@ function q(e) {
563
531
  return "download";
564
532
  }
565
533
  }
566
- async function en(e, { onProgress: t, signal: n }) {
567
- let r = Number(K(e, "content-length")) || 0, i = K(e, "content-type") ?? "";
534
+ async function Zt(e, { onProgress: t, signal: n }) {
535
+ let r = Number(G(e, "content-length")) || 0, i = G(e, "content-type") ?? "";
568
536
  if (!e.body) return new Blob([await e.arrayBuffer()], { type: i });
569
537
  let a = e.body.getReader(), o = [], s = 0;
570
538
  for (;;) {
571
- if (n?.aborted) throw a.cancel().catch(() => {}), $t(n);
539
+ if (n?.aborted) throw a.cancel().catch(() => {}), Xt(n);
572
540
  let { done: e, value: i } = await a.read();
573
541
  if (e) break;
574
- o.push(i), s += i.length, t?.(G(s, r));
542
+ o.push(i), s += i.length, t?.(Yt(s, r));
575
543
  }
576
544
  return new Blob(o, { type: i });
577
545
  }
578
- var tn = (e, t, n) => new File([e], t, {
546
+ var Qt = (e, t, n) => new File([e], t, {
579
547
  type: n || e.type,
580
548
  lastModified: e.lastModified ?? Date.now()
581
- }), nn = () => {}, J = class {
549
+ }), $t = () => {}, q = class {
582
550
  constructor(e) {
583
551
  this._storage = e, this._revalidating = /* @__PURE__ */ new Set();
584
552
  }
585
553
  get _area() {
586
- return this._storage?.area(be.DOWNLOADS) ?? null;
554
+ return this._storage?.area(xe.DOWNLOADS) ?? null;
587
555
  }
588
- async fetch(e, { key: t = e, name: n = q(e), policy: r = W.REVALIDATE, maxAgeMs: i = Qt, onProgress: a = null, signal: o = null, fetchOptions: s = {} } = {}) {
556
+ async fetch(e, { key: t = e, name: n = K(e), policy: r = W.REVALIDATE, maxAgeMs: i = Jt, onProgress: a = null, signal: o = null, fetchOptions: s = {} } = {}) {
589
557
  let c = this._area;
590
558
  if (c && r !== W.NETWORK) {
591
559
  let o = await c.open(t);
592
560
  if (o) {
593
561
  let c = await o.file("data");
594
- if (c) return r === W.REVALIDATE && Date.now() - (o.extra.checkedAt ?? 0) >= i && this._revalidate(e, t, n, o.extra, s), a?.(G(c.size, c.size)), {
595
- file: tn(c, n, o.extra.contentType),
562
+ if (c) return r === W.REVALIDATE && Date.now() - (o.extra.checkedAt ?? 0) >= i && this._revalidate(e, t, n, o.extra, s), a?.(Yt(c.size, c.size)), {
563
+ file: Qt(c, n, o.extra.contentType),
596
564
  release: () => o.release(),
597
565
  fromCache: !0
598
566
  };
@@ -610,16 +578,16 @@ var tn = (e, t, n) => new File([e], t, {
610
578
  return await this._area?.has(e) === !0;
611
579
  }
612
580
  async _download(e, t, n, { onProgress: r, signal: i, fetchOptions: a, cache: o }) {
613
- if (i?.aborted) throw $t(i);
581
+ if (i?.aborted) throw Xt(i);
614
582
  let s = await fetch(e, {
615
583
  ...a,
616
584
  signal: i
617
585
  });
618
586
  if (!s.ok) throw Error(`HTTP ${s.status} fetching ${e}`);
619
- let c = Number(K(s, "content-length")) || 0, l = {
587
+ let c = Number(G(s, "content-length")) || 0, l = {
620
588
  url: e,
621
- contentType: K(s, "content-type") ?? "",
622
- lastModified: K(s, "last-modified"),
589
+ contentType: G(s, "content-type") ?? "",
590
+ lastModified: G(s, "last-modified"),
623
591
  contentLength: c || null,
624
592
  checkedAt: Date.now()
625
593
  }, u = o && s.body ? await this._area.create(t, {
@@ -627,17 +595,17 @@ var tn = (e, t, n) => new File([e], t, {
627
595
  expectedBytes: c
628
596
  }) : null;
629
597
  if (!u) return {
630
- file: tn(await en(s, {
598
+ file: Qt(await Zt(s, {
631
599
  onProgress: r,
632
600
  signal: i
633
601
  }), n, l.contentType),
634
- release: nn,
602
+ release: $t,
635
603
  fromCache: !1
636
604
  };
637
605
  try {
638
606
  await u.writeStream("data", s.body, {
639
607
  signal: i,
640
- onProgress: (e) => r?.(G(e, c))
608
+ onProgress: (e) => r?.(Yt(e, c))
641
609
  }), await u.commit(l);
642
610
  } catch (o) {
643
611
  if (await u.abort(), o?.name !== "QuotaExceededError") throw o;
@@ -651,7 +619,7 @@ var tn = (e, t, n) => new File([e], t, {
651
619
  let d = await this._area.open(t, { wait: !0 }), f = d && await d.file("data");
652
620
  if (!f) throw d?.release(), Error(`storage: ${n} vanished right after it was saved`);
653
621
  return {
654
- file: tn(f, n, l.contentType),
622
+ file: Qt(f, n, l.contentType),
655
623
  release: () => d.release(),
656
624
  fromCache: !1
657
625
  };
@@ -668,7 +636,7 @@ var tn = (e, t, n) => new File([e], t, {
668
636
  headers: t
669
637
  });
670
638
  if (n.body?.cancel().catch(() => {}), n.ok) {
671
- 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;
639
+ 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;
672
640
  a = !!(e && r.lastModified && e !== r.lastModified || t && r.contentLength && t !== r.contentLength);
673
641
  }
674
642
  } catch {}
@@ -688,16 +656,16 @@ var tn = (e, t, n) => new File([e], t, {
688
656
  }
689
657
  }
690
658
  };
691
- function rn(e, t, n) {
692
- return new J(t).fetch(e, n);
659
+ function en(e, t, n) {
660
+ return new q(t).fetch(e, n);
693
661
  }
694
- function an() {
695
- return new J(ye(w().cacheNamespace));
662
+ function tn() {
663
+ return new q(be(E().cacheNamespace));
696
664
  }
697
- async function on(e, { downloads: t = an(), ...n } = {}) {
665
+ async function nn(e, { downloads: t = tn(), ...n } = {}) {
698
666
  if (!t._storage || !/^https?:/i.test(e)) return {
699
667
  url: e,
700
- release: nn,
668
+ release: $t,
701
669
  cached: !1
702
670
  };
703
671
  let { file: r, release: i } = await t.fetch(e, n), a = URL.createObjectURL(r);
@@ -711,7 +679,7 @@ async function on(e, { downloads: t = an(), ...n } = {}) {
711
679
  }
712
680
  //#endregion
713
681
  //#region src/RenderSettings.js
714
- var sn = {
682
+ var rn = {
715
683
  maxBounces: {
716
684
  uniform: "maxBounces",
717
685
  reset: !0
@@ -932,14 +900,14 @@ var sn = {
932
900
  },
933
901
  maxTextureSize: { reset: !1 },
934
902
  areaLightIntensityScale: { reset: !1 }
935
- }, Y = Object.freeze({
903
+ }, J = Object.freeze({
936
904
  DEFAULT: "default",
937
905
  HOST: "host",
938
906
  SCENE_METADATA: "scene-metadata",
939
907
  MODE_PRESET: "mode-preset"
940
- }), cn = class extends I {
908
+ }), an = class extends L {
941
909
  constructor(e = _, { issues: t = null } = {}) {
942
- super(), this._issues = t, this._defaults = e, this._routes = new Map(Object.entries(sn)), this._values = /* @__PURE__ */ new Map(), this._sources = /* @__PURE__ */ new Map(), this._pathTracer = null, this._resetCallback = null, this._handlers = {}, this._initDefaults(e);
910
+ 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);
943
911
  }
944
912
  bind(e) {
945
913
  this._pathTracer = e.stages.pathTracer, this._resetCallback = e.resetCallback, this._handlers = this._buildHandlers(e);
@@ -951,15 +919,15 @@ var sn = {
951
919
  reset: r
952
920
  });
953
921
  let i = t === void 0 ? this._defaults[e] : t;
954
- !this._values.has(e) && i !== void 0 && (this._values.set(e, i), this._sources.set(e, Y.DEFAULT));
922
+ !this._values.has(e) && i !== void 0 && (this._values.set(e, i), this._sources.set(e, J.DEFAULT));
955
923
  }
956
924
  _buildHandlers({ stages: e, resetCallback: t, reconcileCompletion: n, applyExposure: r, onCameraProjection: i }) {
957
- let a = new Ot(), o = (t, n) => {
958
- a.set(n?.[0] ?? 0, n?.[1] ?? 0).multiplyScalar(R.DEG2RAD), e.pathTracer?.setUniform(t, a);
925
+ let a = new wt(), o = (t, n) => {
926
+ a.set(n?.[0] ?? 0, n?.[1] ?? 0).multiplyScalar(z.DEG2RAD), e.pathTracer?.setUniform(t, a);
959
927
  };
960
928
  return {
961
929
  handleCameraProjection: (t) => {
962
- e.pathTracer?.setUniform("cameraProjection", re[t] ?? re.perspective), i?.(t);
930
+ e.pathTracer?.setUniform("cameraProjection", ie[t] ?? ie.perspective), i?.(t);
963
931
  },
964
932
  handleDofMode: (t) => e.pathTracer?.setUniform("dofMode", +(t === "look")),
965
933
  handlePanoramaLonRange: (e) => o("panoLonRange", e),
@@ -968,7 +936,7 @@ var sn = {
968
936
  e.pathTracer?.setUniform("transparentBackground", t), e.compositor?.setTransparentBackground(t);
969
937
  },
970
938
  handleBackgroundColor: (t) => {
971
- let n = t?.isColor ? t : new nt(t);
939
+ let n = t?.isColor ? t : new I(t);
972
940
  e.pathTracer?.setUniform("backgroundColor", n);
973
941
  },
974
942
  handleExposure: (e) => {
@@ -1009,21 +977,21 @@ var sn = {
1009
977
  }
1010
978
  };
1011
979
  }
1012
- set(e, t, { reset: n, silent: r, source: i = Y.HOST } = {}) {
980
+ set(e, t, { reset: n, silent: r, source: i = J.HOST } = {}) {
1013
981
  let a = this._applyOne(e, t, i);
1014
982
  a?.route && ((n === void 0 ? a.route.reset ?? !0 : n) && this._resetCallback?.(), r || this.dispatchEvent({
1015
- type: m.SETTING_CHANGED,
983
+ type: g.SETTING_CHANGED,
1016
984
  key: e,
1017
985
  value: t,
1018
986
  prev: a.prev
1019
987
  }));
1020
988
  }
1021
- setMany(e, { silent: t, reset: n, source: r = Y.HOST } = {}) {
989
+ setMany(e, { silent: t, reset: n, source: r = J.HOST } = {}) {
1022
990
  let i = !1;
1023
991
  for (let [n, a] of Object.entries(e)) {
1024
992
  let e = this._applyOne(n, a, r);
1025
993
  e?.route && ((e.route.reset ?? !0) && (i = !0), t || this.dispatchEvent({
1026
- type: m.SETTING_CHANGED,
994
+ type: g.SETTING_CHANGED,
1027
995
  key: n,
1028
996
  value: a,
1029
997
  prev: e.prev
@@ -1045,7 +1013,7 @@ var sn = {
1045
1013
  });
1046
1014
  }
1047
1015
  _reportUnknownKey(e) {
1048
- this._issues?.record(S.SETTING_UNKNOWN_KEY, `unknown setting "${e}" — stored but never applied to any stage`, { key: e });
1016
+ this._issues?.record(C.SETTING_UNKNOWN_KEY, `unknown setting "${e}" — stored but never applied to any stage`, { key: e });
1049
1017
  }
1050
1018
  get(e) {
1051
1019
  return this._values.get(e);
@@ -1054,7 +1022,7 @@ var sn = {
1054
1022
  let e = {};
1055
1023
  for (let [t, n] of this._values) e[t] = {
1056
1024
  value: n,
1057
- source: this._sources.get(t) ?? Y.DEFAULT,
1025
+ source: this._sources.get(t) ?? J.DEFAULT,
1058
1026
  routed: this._routes.has(t)
1059
1027
  };
1060
1028
  return e;
@@ -1065,15 +1033,15 @@ var sn = {
1065
1033
  serialize() {
1066
1034
  let e = {};
1067
1035
  for (let [t, n] of this._values) {
1068
- if (this._sources.get(t) !== Y.HOST || !this._routes.has(t)) continue;
1069
- let r = i(n);
1036
+ if (this._sources.get(t) !== J.HOST || !this._routes.has(t)) continue;
1037
+ let r = m(n);
1070
1038
  r !== void 0 && (e[t] = r);
1071
1039
  }
1072
1040
  return e;
1073
1041
  }
1074
1042
  restore(e) {
1075
1043
  let t = {}, n = [];
1076
- for (let [r, i] of Object.entries(e ?? {})) this._routes.has(r) ? t[r] = o(i) : n.push(r);
1044
+ for (let [r, i] of Object.entries(e ?? {})) this._routes.has(r) ? t[r] = p(i) : n.push(r);
1077
1045
  return this.setMany(t), n;
1078
1046
  }
1079
1047
  applyAll() {
@@ -1086,9 +1054,9 @@ var sn = {
1086
1054
  e.uniform ? this._pathTracer?.setUniform(e.uniform, t) : e.handler ? this._handlers[e.handler]?.(t, n) : e.apply?.(t, n);
1087
1055
  }
1088
1056
  _initDefaults(e) {
1089
- for (let t of Object.keys(sn)) t in e && (this._values.set(t, e[t]), this._sources.set(t, Y.DEFAULT));
1057
+ for (let t of Object.keys(rn)) t in e && (this._values.set(t, e[t]), this._sources.set(t, J.DEFAULT));
1090
1058
  }
1091
- }, ln = class {
1059
+ }, on = class {
1092
1060
  constructor({ issues: e = null } = {}) {
1093
1061
  this._issues = e, this._renderer = null, this._offRegistry = Oe(() => {
1094
1062
  this._renderer && De(this._renderer);
@@ -1098,7 +1066,7 @@ var sn = {
1098
1066
  return !1;
1099
1067
  }
1100
1068
  get workingSpace() {
1101
- return C;
1069
+ return T;
1102
1070
  }
1103
1071
  get workingSpaceAdopted() {
1104
1072
  return !1;
@@ -1109,7 +1077,7 @@ var sn = {
1109
1077
  attachRenderer(e) {
1110
1078
  this._renderer = e;
1111
1079
  let t = De(e);
1112
- return e.outputColorSpace = B, t;
1080
+ return e.outputColorSpace = H, t;
1113
1081
  }
1114
1082
  listViews() {
1115
1083
  return Te();
@@ -1118,31 +1086,31 @@ var sn = {
1118
1086
  return null;
1119
1087
  }
1120
1088
  setActiveView(e) {
1121
- let t = T(e);
1089
+ let t = D(e);
1122
1090
  if (!t) throw Error(`no view transform with id ${e}`);
1123
1091
  if (t.outputEncoded) throw Error(`"${t.name}" returns display-encoded colour: it needs rayzee/addons/color`);
1124
1092
  return this._renderer && (this._renderer.toneMapping = e), t;
1125
1093
  }
1126
1094
  _publishWorkingMatrix() {
1127
- xe(null, C);
1095
+ Se(null, T);
1128
1096
  }
1129
1097
  loadConfig() {
1130
1098
  let e = "colour configs need the OCIO pipeline: renderer.setColorManagement( ColorManagement ), from rayzee/addons/color";
1131
- return this._issues?.record(S.CAPABILITY_MISSING, e, { capability: "color" }), Promise.reject(Error(e));
1099
+ return this._issues?.record(C.CAPABILITY_MISSING, e, { capability: "color" }), Promise.reject(Error(e));
1132
1100
  }
1133
1101
  unloadConfig() {}
1134
1102
  setWorkingSpace() {}
1135
1103
  exportPixels(e) {
1136
1104
  return {
1137
1105
  rgba: e,
1138
- colorSpace: C
1106
+ colorSpace: T
1139
1107
  };
1140
1108
  }
1141
1109
  status() {
1142
- let e = this._renderer ? T(this._renderer.toneMapping) : null;
1110
+ let e = this._renderer ? D(this._renderer.toneMapping) : null;
1143
1111
  return {
1144
1112
  config: null,
1145
- workingSpace: C,
1113
+ workingSpace: T,
1146
1114
  workingSpaceAdopted: !1,
1147
1115
  activeTransform: e ? {
1148
1116
  id: e.id,
@@ -1158,17 +1126,17 @@ var sn = {
1158
1126
  };
1159
1127
  }
1160
1128
  dispose() {
1161
- this._offRegistry?.(), this._renderer = null, this._issues = null, Ce() === this && (xe(null), Se(null));
1129
+ this._offRegistry?.(), this._renderer = null, this._issues = null, Ce() === this && (Se(null), w(null));
1162
1130
  }
1163
- }, un = [
1131
+ }, sn = [
1164
1132
  [/\.jpe?g(\?|#|$)/i, "image/jpeg"],
1165
1133
  [/\.webp(\?|#|$)/i, "image/webp"],
1166
1134
  [/\.avif(\?|#|$)/i, "image/avif"]
1167
1135
  ];
1168
- function dn(e) {
1169
- return e.mimeType ? e.mimeType : e.uri?.startsWith("data:") ? e.uri.slice(5, e.uri.indexOf(";")) : un.find(([t]) => t.test(e.uri ?? ""))?.[1] ?? "image/png";
1136
+ function cn(e) {
1137
+ 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";
1170
1138
  }
1171
- function fn(e) {
1139
+ function ln(e) {
1172
1140
  for (let t = 8; t + 12 <= e.length;) {
1173
1141
  let n = (e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3]) >>> 0, r = t + 12 + n;
1174
1142
  if (e[t + 4] === 73 && e[t + 5] === 69 && e[t + 6] === 78 && e[t + 7] === 68) return e.subarray(0, r);
@@ -1176,48 +1144,48 @@ function fn(e) {
1176
1144
  }
1177
1145
  return e;
1178
1146
  }
1179
- function pn({ data: e, width: t, height: n }, { shared: r = !1 } = {}) {
1147
+ function un({ data: e, width: t, height: n }, { shared: r = !1 } = {}) {
1180
1148
  let i = new Uint8Array(e.buffer, e.byteOffset, t * n * 4), a = i;
1181
1149
  r && typeof SharedArrayBuffer < "u" && !(i.buffer instanceof SharedArrayBuffer) && (a = new Uint8Array(new SharedArrayBuffer(i.byteLength)), a.set(i));
1182
- let o = new rt(a, t, n, St, Dt);
1150
+ let o = new tt(a, t, n, vt, Ct);
1183
1151
  return o.needsUpdate = !0, o;
1184
1152
  }
1185
- function mn(e, t) {
1186
- return b().decodeImage(t === "image/png" ? fn(e) : e, t);
1153
+ function dn(e, t) {
1154
+ return b().decodeImage(t === "image/png" ? ln(e) : e, t);
1187
1155
  }
1188
- async function hn(e) {
1156
+ async function fn(e) {
1189
1157
  let t = await fetch(e);
1190
1158
  if (!t.ok) throw Error(`HTTP ${t.status}`);
1191
1159
  return new Uint8Array(await t.arrayBuffer());
1192
1160
  }
1193
- function gn(e, t) {
1194
- return t.bufferView === void 0 ? hn(e.options.manager.resolveURL(L.resolveURL(t.uri, e.options.path))) : e.getDependency("bufferView", t.bufferView).then((e) => new Uint8Array(e));
1161
+ function pn(e, t) {
1162
+ return t.bufferView === void 0 ? fn(e.options.manager.resolveURL(R.resolveURL(t.uri, e.options.path))) : e.getDependency("bufferView", t.bufferView).then((e) => new Uint8Array(e));
1195
1163
  }
1196
- var _n = (e, t) => !!t && t !== e.textureLoader && typeof t.parse == "function";
1197
- function vn(e, t, n) {
1164
+ var mn = (e, t) => !!t && t !== e.textureLoader && typeof t.parse == "function";
1165
+ function hn(e, t, n) {
1198
1166
  if (e.sourceCache[t] !== void 0) return e.sourceCache[t].then((e) => e.clone());
1199
- let r = gn(e, e.json.images[t]).then((e) => new Promise((t, r) => {
1167
+ let r = pn(e, e.json.images[t]).then((e) => new Promise((t, r) => {
1200
1168
  n.parse(e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength), t, r);
1201
1169
  }));
1202
1170
  return e.sourceCache[t] = r, r;
1203
1171
  }
1204
- async function yn(e, t = dn({ uri: e })) {
1205
- let n = pn(await mn(await hn(e), t));
1172
+ async function gn(e, t = cn({ uri: e })) {
1173
+ let n = un(await dn(await fn(e), t));
1206
1174
  return n.flipY = !0, n;
1207
1175
  }
1208
- function bn(e, t = null) {
1176
+ function _n(e, t = null) {
1209
1177
  return e.loadImageSource = function(e, n) {
1210
- if (_n(this, n)) return vn(this, e, n);
1178
+ if (mn(this, n)) return hn(this, e, n);
1211
1179
  let r = this.json.images[e], i = /* @__PURE__ */ Error("no image decoder in this runtime: configurePlatform( nodePlatform( { decodeImage } ) ) — see \"Running in Node\"");
1212
1180
  return t?.(r.uri ?? `bufferView ${r.bufferView}`, i), Promise.reject(i);
1213
1181
  }, { name: "RAYZEE_missing_image_decoder" };
1214
1182
  }
1215
- function xn(e, t = null) {
1183
+ function vn(e, t = null) {
1216
1184
  return e.loadImageSource = function(e, n) {
1217
- if (_n(this, n)) return vn(this, e, n);
1185
+ if (mn(this, n)) return hn(this, e, n);
1218
1186
  if (this.sourceCache[e] !== void 0) return this.sourceCache[e].then((e) => e.clone());
1219
- let r = this.json.images[e], i = dn(r), a = r.uri ?? `bufferView ${r.bufferView}`, o = gn(this, r).then((e) => mn(e, i)).then((e) => {
1220
- let t = pn(e, { shared: !0 });
1187
+ 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) => {
1188
+ let t = un(e, { shared: !0 });
1221
1189
  return r.extras && typeof r.extras == "object" && Object.assign(t.userData, r.extras), t.userData.mimeType = i, t;
1222
1190
  }).catch((e) => {
1223
1191
  throw t?.(a, e), e;
@@ -1227,8 +1195,8 @@ function xn(e, t = null) {
1227
1195
  }
1228
1196
  //#endregion
1229
1197
  //#region src/Processor/GLTFDiffuseTransmission.js
1230
- var Sn = "KHR_materials_diffuse_transmission";
1231
- function Cn(e) {
1198
+ var yn = "KHR_materials_diffuse_transmission";
1199
+ function bn(e) {
1232
1200
  let t = (t, n, r, i) => {
1233
1201
  let a = {};
1234
1202
  return e.assignTexture(a, n, r, i).then(() => {
@@ -1236,7 +1204,7 @@ function Cn(e) {
1236
1204
  });
1237
1205
  };
1238
1206
  return {
1239
- name: Sn,
1207
+ name: yn,
1240
1208
  afterRoot(n) {
1241
1209
  let r = e.json.materials ?? [], i = /* @__PURE__ */ new Set(), a = [];
1242
1210
  for (let o of n.scenes ?? []) o.traverse((n) => {
@@ -1244,7 +1212,7 @@ function Cn(e) {
1244
1212
  for (let n of o) {
1245
1213
  if (i.has(n)) continue;
1246
1214
  i.add(n);
1247
- let o = e.associations.get(n)?.materials, s = o === void 0 ? null : r[o]?.extensions?.[Sn];
1215
+ let o = e.associations.get(n)?.materials, s = o === void 0 ? null : r[o]?.extensions?.[yn];
1248
1216
  if (!s) continue;
1249
1217
  n.diffuseTransmission = s.diffuseTransmissionFactor ?? 0;
1250
1218
  let [c, l, u] = s.diffuseTransmissionColorFactor ?? [
@@ -1252,7 +1220,7 @@ function Cn(e) {
1252
1220
  1,
1253
1221
  1
1254
1222
  ];
1255
- n.diffuseTransmissionColor = new nt().setRGB(c, l, u, lt), s.diffuseTransmissionTexture && a.push(t(n, "diffuseTransmissionMap", s.diffuseTransmissionTexture)), s.diffuseTransmissionColorTexture && a.push(t(n, "diffuseTransmissionColorMap", s.diffuseTransmissionColorTexture, B));
1223
+ n.diffuseTransmissionColor = new I().setRGB(c, l, u, st), s.diffuseTransmissionTexture && a.push(t(n, "diffuseTransmissionMap", s.diffuseTransmissionTexture)), s.diffuseTransmissionColorTexture && a.push(t(n, "diffuseTransmissionColorMap", s.diffuseTransmissionColorTexture, H));
1256
1224
  }
1257
1225
  });
1258
1226
  return Promise.all(a);
@@ -1261,20 +1229,20 @@ function Cn(e) {
1261
1229
  }
1262
1230
  //#endregion
1263
1231
  //#region src/Processor/GLTFDecoders.js
1264
- var wn = "KHR_draco_mesh_compression", Tn = "KHR_texture_basisu", En = ["EXT_meshopt_compression", "KHR_meshopt_compression"], Dn = new TextDecoder();
1265
- function On(e) {
1232
+ var xn = "KHR_draco_mesh_compression", Sn = "KHR_texture_basisu", Cn = ["EXT_meshopt_compression", "KHR_meshopt_compression"], wn = new TextDecoder();
1233
+ function Tn(e) {
1266
1234
  if (typeof e == "string") return e;
1267
1235
  if (!(e instanceof ArrayBuffer)) return JSON.stringify(e?.extensionsUsed ?? []);
1268
1236
  let t = new DataView(e);
1269
- if (!(e.byteLength >= 20 && t.getUint32(0, !0) === 1179937895)) return Dn.decode(e);
1237
+ if (!(e.byteLength >= 20 && t.getUint32(0, !0) === 1179937895)) return wn.decode(e);
1270
1238
  let n = Math.min(t.getUint32(12, !0), e.byteLength - 20);
1271
- return Dn.decode(new Uint8Array(e, 20, n));
1239
+ return wn.decode(new Uint8Array(e, 20, n));
1272
1240
  }
1273
- async function kn(e, t, n) {
1274
- let { dracoDecoderPath: r, ktx2TranscoderPath: i } = w(), [a, o, s] = await Promise.all([
1275
- t.includes(wn) && !e.dracoLoader ? import("three/addons/loaders/DRACOLoader.js") : null,
1276
- t.includes(Tn) && !e.ktx2Loader ? import("three/addons/loaders/KTX2Loader.js") : null,
1277
- En.some((e) => t.includes(e)) && !e.meshoptDecoder ? import("three/addons/libs/meshopt_decoder.module.js") : null
1241
+ async function En(e, t, n) {
1242
+ let { dracoDecoderPath: r, ktx2TranscoderPath: i } = E(), [a, o, s] = await Promise.all([
1243
+ t.includes(xn) && !e.dracoLoader ? import("three/addons/loaders/DRACOLoader.js") : null,
1244
+ t.includes(Sn) && !e.ktx2Loader ? import("three/addons/loaders/KTX2Loader.js") : null,
1245
+ Cn.some((e) => t.includes(e)) && !e.meshoptDecoder ? import("three/addons/libs/meshopt_decoder.module.js") : null
1278
1246
  ]);
1279
1247
  if (a) {
1280
1248
  let t = new a.DRACOLoader();
@@ -1293,15 +1261,15 @@ async function kn(e, t, n) {
1293
1261
  }
1294
1262
  s && e.setMeshoptDecoder(s.MeshoptDecoder);
1295
1263
  }
1296
- function An(e, t) {
1264
+ function Dn(e, t) {
1297
1265
  let n = e.parse.bind(e);
1298
1266
  return e.parse = (r, i, a, o) => {
1299
- kn(e, On(r), t).then(() => n(r, i, a, o), (e) => o?.(e));
1267
+ En(e, Tn(r), t).then(() => n(r, i, a, o), (e) => o?.(e));
1300
1268
  }, e;
1301
1269
  }
1302
1270
  //#endregion
1303
1271
  //#region src/Processor/AssetLoader.js
1304
- var jn = me("assets"), Mn = {
1272
+ var On = S("assets"), kn = {
1305
1273
  glb: {
1306
1274
  type: "model",
1307
1275
  name: "GLB (GLTF Binary)"
@@ -1330,46 +1298,46 @@ var jn = me("assets"), Mn = {
1330
1298
  type: "image",
1331
1299
  name: "WebP"
1332
1300
  }
1333
- }, X = {
1301
+ }, Y = {
1334
1302
  addOn: "rayzee/addons/archives",
1335
1303
  install: "assetLoader.setArchiveImporter()"
1336
- }, Z = {
1304
+ }, X = {
1337
1305
  addOn: "rayzee/addons/formats",
1338
1306
  install: "assetLoader.registerFormat()"
1339
- }, Nn = {
1340
- zip: X,
1341
- gz: X,
1342
- tgz: X,
1343
- tar: X,
1344
- fbx: Z,
1345
- obj: Z,
1346
- stl: Z,
1347
- ply: Z,
1348
- dae: Z,
1349
- "3mf": Z,
1350
- usd: Z,
1351
- usda: Z,
1352
- usdc: Z,
1353
- usdz: Z,
1354
- exr: Z
1307
+ }, An = {
1308
+ zip: Y,
1309
+ gz: Y,
1310
+ tgz: Y,
1311
+ tar: Y,
1312
+ fbx: X,
1313
+ obj: X,
1314
+ stl: X,
1315
+ ply: X,
1316
+ dae: X,
1317
+ "3mf": X,
1318
+ usd: X,
1319
+ usda: X,
1320
+ usdc: X,
1321
+ usdz: X,
1322
+ exr: X
1355
1323
  };
1356
- function Pn(e) {
1357
- let t = new et();
1324
+ function jn(e) {
1325
+ let t = new $e();
1358
1326
  for (let n in e.attributes) t.setAttribute(n, e.attributes[n]);
1359
1327
  e.index && t.setIndex(e.index);
1360
1328
  for (let n of e.groups) t.addGroup(n.start, n.count, n.materialIndex);
1361
1329
  return t;
1362
1330
  }
1363
- var Fn = 683;
1364
- function In(e, t, n, r) {
1331
+ var Mn = 683;
1332
+ function Nn(e, t, n, r) {
1365
1333
  if (!(r.normalize ?? !0)) return Math.PI;
1366
- let i = r.shape === "ellipse" || r.shape === "disk" ? Math.PI / 4 : 1, a = e.getWorldScale(new H()), o = Math.PI * i * Math.abs(t * a.x * n * a.y);
1334
+ 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);
1367
1335
  return Number.isFinite(o) ? o : Math.PI;
1368
1336
  }
1369
- var Ln = class e extends I {
1337
+ var Pn = class e extends L {
1370
1338
  constructor(e, t, n, { issues: r = null, areaLightIntensityScale: i = null } = {}) {
1371
- super(), this.scene = e, this.camera = t, this.controls = n, this.targetModel = null, this.floorPlane = null, this.sceneScale = 1, this.sceneSize = new H(1, 1, 1), this.loaderCache = {}, this.uploadedFileInfo = null, this.animations = [], this.renderer = null, this.sceneMetadata = null, this._loadingManager = new ut(), 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 ?? (() => _.areaLightIntensityScale), this._loadingManager.onError = (e) => {
1372
- this._loadCancelled || this._issues?.record(S.ASSET_UNREACHABLE, `asset "${e}" could not be fetched — anything depending on it renders without it`, { url: e });
1339
+ 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 ct(), 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 ?? (() => _.areaLightIntensityScale), this._loadingManager.onError = (e) => {
1340
+ this._loadCancelled || this._issues?.record(C.ASSET_UNREACHABLE, `asset "${e}" could not be fetched — anything depending on it renders without it`, { url: e });
1373
1341
  };
1374
1342
  }
1375
1343
  cancelActiveLoad() {
@@ -1384,11 +1352,11 @@ var Ln = class e extends I {
1384
1352
  let o = new AbortController();
1385
1353
  this._urlAbort = o;
1386
1354
  try {
1387
- return await on(t, {
1355
+ return await nn(t, {
1388
1356
  downloads: this.downloads,
1389
1357
  key: i,
1390
1358
  policy: a,
1391
- name: q(t),
1359
+ name: K(t),
1392
1360
  signal: o.signal,
1393
1361
  onProgress: this._downloadProgress(n, r)
1394
1362
  });
@@ -1405,7 +1373,7 @@ var Ln = class e extends I {
1405
1373
  return t ? `${e}::${t}` : null;
1406
1374
  }
1407
1375
  get downloads() {
1408
- return this._downloads?._storage !== this.storage && (this._downloads = new J(this.storage)), this._downloads;
1376
+ return this._downloads?._storage !== this.storage && (this._downloads = new q(this.storage)), this._downloads;
1409
1377
  }
1410
1378
  _isCancellation(e) {
1411
1379
  return this._loadCancelled || e?.name === "AbortError" || e?.code === "LOAD_CANCELLED";
@@ -1417,7 +1385,7 @@ var Ln = class e extends I {
1417
1385
  _downloadProgress(e, t) {
1418
1386
  return (n) => {
1419
1387
  let r = n?.loaded || 0, i = n?.lengthComputable && n.total || 0;
1420
- v({
1388
+ y({
1421
1389
  isLoading: !0,
1422
1390
  status: e,
1423
1391
  loadedBytes: r,
@@ -1428,7 +1396,7 @@ var Ln = class e extends I {
1428
1396
  };
1429
1397
  }
1430
1398
  _downloadComplete(e = "Processing Data...", t = 62) {
1431
- v({
1399
+ y({
1432
1400
  status: e,
1433
1401
  progress: t,
1434
1402
  canCancel: !1,
@@ -1442,7 +1410,7 @@ var Ln = class e extends I {
1442
1410
  _adoptExternalObject(e) {
1443
1411
  let t;
1444
1412
  try {
1445
- t = Pt(e);
1413
+ t = At(e);
1446
1414
  } catch (t) {
1447
1415
  throw Error(`Cannot render "${e.name || e.type}": its userData must be JSON-serializable.`, { cause: t });
1448
1416
  }
@@ -1476,10 +1444,10 @@ var Ln = class e extends I {
1476
1444
  }
1477
1445
  getFileFormat(e) {
1478
1446
  let t = e.split(".").pop().toLowerCase();
1479
- return Mn[t] || this._formats.get(t) || this._archiveFormats?.[t] || null;
1447
+ return kn[t] || this._formats.get(t) || this._archiveFormats?.[t] || null;
1480
1448
  }
1481
1449
  formatError(e) {
1482
- let t = Nn[e.split(".").pop().toLowerCase()];
1450
+ let t = An[e.split(".").pop().toLowerCase()];
1483
1451
  return /* @__PURE__ */ Error(t ? `${e}: this format is read by ${t.addOn} — install it with ${t.install}` : `Unsupported file format: ${e}`);
1484
1452
  }
1485
1453
  async inspectArchive(e) {
@@ -1499,7 +1467,7 @@ var Ln = class e extends I {
1499
1467
  async loadAssetFromFile(e, t = {}) {
1500
1468
  let n = e.name, r = this.getFileFormat(n);
1501
1469
  if (!r) throw this.formatError(n);
1502
- v({
1470
+ y({
1503
1471
  isLoading: !0,
1504
1472
  status: `Loading ${r.name}...`,
1505
1473
  progress: 2
@@ -1530,8 +1498,8 @@ var Ln = class e extends I {
1530
1498
  }
1531
1499
  async loadFolder(e, t = {}) {
1532
1500
  let n = await this._archiveImporter();
1533
- if (!n) throw Error(`${e.name}: folders are read by ${X.addOn} — install it with ${X.install}`);
1534
- v({
1501
+ if (!n) throw Error(`${e.name}: folders are read by ${Y.addOn} — install it with ${Y.install}`);
1502
+ y({
1535
1503
  isLoading: !0,
1536
1504
  status: `Loading ${e.name}...`,
1537
1505
  progress: 2
@@ -1547,11 +1515,11 @@ var Ln = class e extends I {
1547
1515
  }
1548
1516
  }
1549
1517
  async loadAssetFromUrl(t, n = {}) {
1550
- let { filename: r = q(t), cacheKey: i = t, cachePolicy: a, ...o } = n;
1518
+ let { filename: r = K(t), cacheKey: i = t, cachePolicy: a, ...o } = n;
1551
1519
  if (!this.getFileFormat(r)) throw this.formatError(r);
1552
1520
  this._loadCancelled = !1;
1553
1521
  let s = e._isNetworkUrl(t), c = `Downloading ${r}...`, l = new AbortController();
1554
- this._urlAbort = l, v({
1522
+ this._urlAbort = l, y({
1555
1523
  isLoading: !0,
1556
1524
  status: c,
1557
1525
  progress: 2,
@@ -1583,7 +1551,7 @@ var Ln = class e extends I {
1583
1551
  }
1584
1552
  }
1585
1553
  async loadModelFromFile(e, t) {
1586
- let n = this.storage ? this._keyed("file", E(await Ae(e))) : null, r = /\.(usd|usda|usdc)$/i.test(t) ? await this._archiveImporter() : null, i = r ? await r.loadUSDScene({ [t]: e }, t) : await this._loadModelFileByExtension(e, t);
1554
+ let n = this.storage ? this._keyed("file", O(await Ae(e))) : null, r = /\.(usd|usda|usdc)$/i.test(t) ? await this._archiveImporter() : null, i = r ? await r.loadUSDScene({ [t]: e }, t) : await this._loadModelFileByExtension(e, t);
1587
1555
  return this._sourceKey = n, i;
1588
1556
  }
1589
1557
  async _loadModelFileByExtension(e, t) {
@@ -1595,7 +1563,7 @@ var Ln = class e extends I {
1595
1563
  }
1596
1564
  async _loadModelWithFormat(e, t, n) {
1597
1565
  try {
1598
- v({
1566
+ y({
1599
1567
  isLoading: !0,
1600
1568
  status: `Processing ${e.label} Data...`,
1601
1569
  progress: 5
@@ -1604,7 +1572,7 @@ var Ln = class e extends I {
1604
1572
  filename: n,
1605
1573
  cache: this.loaderCache
1606
1574
  });
1607
- return this.releaseTargetModel(), this.targetModel = r, v({
1575
+ return this.releaseTargetModel(), this.targetModel = r, y({
1608
1576
  isLoading: !0,
1609
1577
  status: "Processing Data...",
1610
1578
  progress: 10
@@ -1630,7 +1598,7 @@ var Ln = class e extends I {
1630
1598
  };
1631
1599
  try {
1632
1600
  let r = await this.loadEnvironment(n);
1633
- return pe(r, E(await Ae(e))), this.dispatchEvent({
1601
+ return he(r, O(await Ae(e))), this.dispatchEvent({
1634
1602
  type: "load",
1635
1603
  texture: r,
1636
1604
  filename: t
@@ -1652,7 +1620,7 @@ var Ln = class e extends I {
1652
1620
  let e = t.split(/[?#]/)[0].split(".").pop().toLowerCase();
1653
1621
  n = await this.loadEnvironmentByExtension(t, e);
1654
1622
  }
1655
- return n.generateMipmaps = !0, e._isNetworkUrl(t) && pe(n, t), this.applyEnvironmentToScene(n), this.dispatchEvent({
1623
+ return n.generateMipmaps = !0, e._isNetworkUrl(t) && he(n, t), this.applyEnvironmentToScene(n), this.dispatchEvent({
1656
1624
  type: "load",
1657
1625
  texture: n,
1658
1626
  url: t,
@@ -1689,25 +1657,25 @@ var Ln = class e extends I {
1689
1657
  }
1690
1658
  async loadEnvironmentByExtension(t, n, { loader: r = null } = {}) {
1691
1659
  let i = this._formats.get(n);
1692
- if (!r && i?.type === "environment" && (r = this.loaderCache[n] ??= await i.createLoader(this._loadingManager)), !r && n === "hdr" && (r = this.loaderCache.hdr ??= new Mt(this._loadingManager).setDataType(st)), !r && Nn[n]) throw this.formatError(`environment.${n}`);
1660
+ 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(at)), !r && An[n]) throw this.formatError(`environment.${n}`);
1693
1661
  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;
1694
1662
  try {
1695
- r ? l = await r.loadAsync(s.url, c) : b().decodeImage ? (l = await yn(s.url, `image/${n === "jpg" ? "jpeg" : n}`), l.colorSpace = B) : (this.loaderCache.texture || (this.loaderCache.texture = new Et(this._loadingManager)), l = await this.loaderCache.texture.loadAsync(s.url, c), l.colorSpace = B);
1663
+ r ? l = await r.loadAsync(s.url, c) : b().decodeImage ? (l = await gn(s.url, `image/${n === "jpg" ? "jpeg" : n}`), l.colorSpace = H) : (this.loaderCache.texture || (this.loaderCache.texture = new St(this._loadingManager)), l = await this.loaderCache.texture.loadAsync(s.url, c), l.colorSpace = H);
1696
1664
  } finally {
1697
1665
  s.release();
1698
1666
  }
1699
- return this._downloadComplete("Processing Environment...", 62), this.maxEnvironmentWidth && Rn(l, this.maxEnvironmentWidth), l.mapping = ot, l.minFilter = ct, l.magFilter = ct, l;
1667
+ return this._downloadComplete("Processing Environment...", 62), this.maxEnvironmentWidth && Fn(l, this.maxEnvironmentWidth), l.mapping = it, l.minFilter = ot, l.magFilter = ot, l;
1700
1668
  }
1701
1669
  applyEnvironmentToScene(e) {
1702
1670
  this.scene.background = e, this.scene.environment = e;
1703
1671
  }
1704
1672
  async createGLTFLoader() {
1705
- let e = An(new jt(this._loadingManager), this.renderer), t = (e, t) => this._reportImageFailure(e, t);
1706
- return b().decodeImage ? e.register((e) => xn(e, t)) : g() || e.register((e) => bn(e, t)), e.register((e) => Cn(e)), e;
1673
+ let e = Dn(new Dt(this._loadingManager), this.renderer), t = (e, t) => this._reportImageFailure(e, t);
1674
+ return b().decodeImage ? e.register((e) => vn(e, t)) : te() || e.register((e) => _n(e, t)), e.register((e) => bn(e)), e;
1707
1675
  }
1708
1676
  _reportImageFailure(e, t) {
1709
1677
  try {
1710
- this._issues?.record(S.TEXTURE_BUILD_FAILED, `image ${e} could not be decoded (${t?.message ?? t}) — the surfaces using it render untextured`, {
1678
+ this._issues?.record(C.TEXTURE_BUILD_FAILED, `image ${e} could not be decoded (${t?.message ?? t}) — the surfaces using it render untextured`, {
1711
1679
  image: e,
1712
1680
  cause: String(t?.message ?? t)
1713
1681
  });
@@ -1731,15 +1699,15 @@ var Ln = class e extends I {
1731
1699
  this._loadCancelled = !1;
1732
1700
  let r = await this.createGLTFLoader(), i = e._isNetworkUrl(t), a = null;
1733
1701
  try {
1734
- v({
1702
+ y({
1735
1703
  isLoading: !0,
1736
1704
  status: "Downloading Model...",
1737
1705
  progress: 2,
1738
1706
  canCancel: i,
1739
1707
  loadedBytes: 0,
1740
1708
  totalBytes: 0
1741
- }), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(L.extractUrlBase(t));
1742
- let e = await ne(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
1709
+ }), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(R.extractUrlBase(t));
1710
+ let e = await v(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
1743
1711
  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 = Pe(e), await this.onModelLoad(this.targetModel), this.dispatchEvent({
1744
1712
  type: "load",
1745
1713
  model: e.scene,
@@ -1762,15 +1730,15 @@ var Ln = class e extends I {
1762
1730
  this._loadCancelled = !1;
1763
1731
  let r = await this.createGLTFLoader(), i = e._isNetworkUrl(t), a = null;
1764
1732
  try {
1765
- v({
1733
+ y({
1766
1734
  isLoading: !0,
1767
1735
  status: "Downloading Model...",
1768
1736
  progress: 2,
1769
1737
  canCancel: i,
1770
1738
  loadedBytes: 0,
1771
1739
  totalBytes: 0
1772
- }), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(L.extractUrlBase(t));
1773
- let e = await ne(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
1740
+ }), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(R.extractUrlBase(t));
1741
+ let e = await v(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
1774
1742
  return this._downloadComplete(), this._throwDeferred(), this._appended = !0, this._processAndParent(e.scene), {
1775
1743
  root: e.scene,
1776
1744
  animations: e.animations || []
@@ -1787,18 +1755,18 @@ var Ln = class e extends I {
1787
1755
  return n.name = e.name || t, this._processAndParent(n), { root: n };
1788
1756
  }
1789
1757
  removeModelRoot(e) {
1790
- e && (e.userData.__rayzeeExternal ? (te(e), e.parent?.remove(e)) : h(e));
1758
+ e && (e.userData.__rayzeeExternal ? (re(e), e.parent?.remove(e)) : ee(e));
1791
1759
  }
1792
1760
  async loadGLBFromArrayBuffer(e, t = "model.glb") {
1793
1761
  let n = await this.createGLTFLoader();
1794
1762
  try {
1795
- v({
1763
+ y({
1796
1764
  isLoading: !0,
1797
1765
  status: "Processing GLB Data...",
1798
1766
  progress: 5
1799
1767
  }), await new Promise((e) => setTimeout(e, 0));
1800
- let r = await ne(() => n.parseAsync(e, ""));
1801
- return this._throwDeferred(), this.releaseTargetModel(), this.targetModel = r.scene, this.animations = r.animations || [], this.sceneMetadata = Pe(r), v({
1768
+ let r = await v(() => n.parseAsync(e, ""));
1769
+ return this._throwDeferred(), this.releaseTargetModel(), this.targetModel = r.scene, this.animations = r.animations || [], this.sceneMetadata = Pe(r), y({
1802
1770
  isLoading: !0,
1803
1771
  status: "Processing Data...",
1804
1772
  progress: 10
@@ -1820,7 +1788,7 @@ var Ln = class e extends I {
1820
1788
  async loadObject3D(e, t = "object3d") {
1821
1789
  this.releaseTargetModel();
1822
1790
  let n = this._adoptExternalObject(e);
1823
- return n.name = e.name || t, this.targetModel = n, v({
1791
+ return n.name = e.name || t, this.targetModel = n, y({
1824
1792
  isLoading: !0,
1825
1793
  status: "Processing Data...",
1826
1794
  progress: 10
@@ -1831,14 +1799,14 @@ var Ln = class e extends I {
1831
1799
  }), n;
1832
1800
  }
1833
1801
  async onModelLoad(e) {
1834
- let t = new d("onModelLoad");
1802
+ let t = new l("onModelLoad");
1835
1803
  t.start("Camera extraction");
1836
1804
  let n = this.extractCamerasFromModel(e);
1837
1805
  t.end("Camera extraction"), t.start("Camera setup");
1838
- let r = new $e().setFromObject(e), i = r.getCenter(new H()), a = r.getSize(new H());
1806
+ let r = new Qe().setFromObject(e), i = r.getCenter(new U()), a = r.getSize(new U());
1839
1807
  this.controls?.target.copy(i);
1840
- 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 H(Math.cos(l) * c, c / Math.sqrt(2), Math.sin(l) * c);
1841
- 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) {
1808
+ 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), u = Math.PI / 6, d = new U(Math.cos(u) * c, c / Math.sqrt(2), Math.sin(u) * c);
1809
+ if (this.camera.position.copy(d.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) {
1842
1810
  let e = r.min.y;
1843
1811
  this.floorPlane.position.y = e, this.floorPlane.rotation.x = -Math.PI / 2, this.floorPlane.scale.setScalar(o * 5);
1844
1812
  }
@@ -1874,22 +1842,22 @@ var Ln = class e extends I {
1874
1842
  let t = [], n = [];
1875
1843
  e.traverse((e) => {
1876
1844
  let r = e.userData;
1877
- e.isRectAreaLight && !r.__radianceConverted && (e.intensity *= In(e, e.width, e.height, r), r.__radianceConverted = !0), (e.isPointLight || e.isSpotLight) && !r.__candelaConverted && (e.intensity *= 4 * Math.PI / Fn, r.__candelaConverted = !0), e.isDirectionalLight && !r.__luxConverted && (e.intensity /= Fn, r.__luxConverted = !0);
1845
+ e.isRectAreaLight && !r.__radianceConverted && (e.intensity *= Nn(e, e.width, e.height, r), r.__radianceConverted = !0), (e.isPointLight || e.isSpotLight) && !r.__candelaConverted && (e.intensity *= 4 * Math.PI / Mn, r.__candelaConverted = !0), e.isDirectionalLight && !r.__luxConverted && (e.intensity /= Mn, r.__luxConverted = !0);
1878
1846
  let i = e.name.startsWith("RectAreaLightPlaceholder");
1879
1847
  if (i && !(r.name && r.type === "RectAreaLight") && !e.parent?.name?.startsWith("RectAreaLightPlaceholder") && n.push(e.name), i && r.name && r.type === "RectAreaLight") {
1880
- let t = r.normalize ?? !0, n = r.shape ?? "rectangle", i = r.intensity * In(e, r.width, r.height, r), a = new z(new nt(...r.color), i * this._areaLightIntensityScale(), r.width, r.height);
1848
+ let t = r.normalize ?? !0, n = r.shape ?? "rectangle", i = r.intensity * Nn(e, r.width, r.height, r), a = new V(new I(...r.color), i * this._areaLightIntensityScale(), r.width, r.height);
1881
1849
  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);
1882
1850
  }
1883
1851
  e.isMesh && Array.isArray(e.material) && t.push(e);
1884
- }), 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`, {
1852
+ }), n.length && this._issues?.record(C.LIGHT_PLACEHOLDER_SKIPPED, `${n.length} area-light placeholder(s) lack userData.name or userData.type 'RectAreaLight' — no light was made for them`, {
1885
1853
  count: n.length,
1886
1854
  names: n.slice(0, 10)
1887
1855
  });
1888
1856
  let r = e.userData.__rayzeeExternal === !0;
1889
1857
  for (let e of t) {
1890
1858
  if (!e.parent) continue;
1891
- console.log("Found multi-material mesh:", e.name), r && (e.geometry = Pn(e.geometry));
1892
- let t = Nt(e);
1859
+ console.log("Found multi-material mesh:", e.name), r && (e.geometry = jn(e.geometry));
1860
+ let t = kt(e);
1893
1861
  for (let e of t.children) e.geometry.userData.__rayzeeOwned = !0;
1894
1862
  e.parent.add(t), e.parent.remove(e);
1895
1863
  }
@@ -1898,7 +1866,7 @@ var Ln = class e extends I {
1898
1866
  this.sceneScale = t;
1899
1867
  }
1900
1868
  createFloorPlane() {
1901
- this.floorPlane = new dt(new tt(), new ft({
1869
+ this.floorPlane = new lt(new et(), new ut({
1902
1870
  transparent: !1,
1903
1871
  color: 3158064,
1904
1872
  roughness: 1,
@@ -1921,7 +1889,7 @@ var Ln = class e extends I {
1921
1889
  }
1922
1890
  getSupportedFormats(e = null) {
1923
1891
  let t = {
1924
- ...Mn,
1892
+ ...kn,
1925
1893
  ...this._archiveFormats
1926
1894
  };
1927
1895
  for (let [e, { type: n, name: r }] of this._formats) t[e] = {
@@ -1946,7 +1914,7 @@ var Ln = class e extends I {
1946
1914
  this._listeners = void 0;
1947
1915
  }
1948
1916
  };
1949
- function Rn(e, t) {
1917
+ function Fn(e, t) {
1950
1918
  let { data: n, width: r, height: i } = e.image ?? {};
1951
1919
  if (!(n instanceof Float32Array) || r <= t || n.length !== r * i * 4) return;
1952
1920
  let a = Math.ceil(r / t), o = Math.ceil(r / a), s = Math.ceil(i / a);
@@ -1967,17 +1935,17 @@ function Rn(e, t) {
1967
1935
  data: n.byteOffset === 0 && n.byteLength === n.buffer.byteLength && n.buffer.transfer ? new Float32Array(n.buffer.transfer(c)) : n.slice(0, o * s * 4),
1968
1936
  width: o,
1969
1937
  height: s
1970
- }, e.needsUpdate = !0, jn.info(`environment ${r}×${i} shrunk to ${o}×${s} (memory spill)`);
1938
+ }, e.needsUpdate = !0, On.info(`environment ${r}×${i} shrunk to ${o}×${s} (memory spill)`);
1971
1939
  }
1972
1940
  //#endregion
1973
1941
  //#region src/HeadlessCanvas.js
1974
- var zn = {
1942
+ var In = {
1975
1943
  addEventListener() {},
1976
1944
  removeEventListener() {},
1977
1945
  dispatchEvent() {
1978
1946
  return !0;
1979
1947
  }
1980
- }, Bn = class {
1948
+ }, Ln = class {
1981
1949
  constructor(e) {
1982
1950
  this.canvas = e, this._configuration = null, this._texture = null;
1983
1951
  }
@@ -2005,12 +1973,12 @@ var zn = {
2005
1973
  return this._texture;
2006
1974
  }
2007
1975
  };
2008
- function Vn(e = 1, t = 1) {
1976
+ function Rn(e = 1, t = 1) {
2009
1977
  let n = {
2010
- ...zn,
1978
+ ...In,
2011
1979
  defaultView: null
2012
1980
  }, r = {
2013
- ...zn,
1981
+ ...In,
2014
1982
  isHeadlessCanvas: !0,
2015
1983
  width: e,
2016
1984
  height: t,
@@ -2037,12 +2005,12 @@ function Vn(e = 1, t = 1) {
2037
2005
  hasPointerCapture: () => !1,
2038
2006
  focus() {},
2039
2007
  getContext: (e) => e === "webgpu" ? i : null
2040
- }, i = new Bn(r);
2008
+ }, i = new Ln(r);
2041
2009
  return r;
2042
2010
  }
2043
2011
  //#endregion
2044
2012
  //#region src/managers/ViewCamera.js
2045
- var Hn = class extends vt {
2013
+ var zn = class extends mt {
2046
2014
  constructor(e, t, n, r) {
2047
2015
  super(e, t, n, r), this.orthographic = !1, this.orthoHalfHeight = 1;
2048
2016
  }
@@ -2066,17 +2034,17 @@ var Hn = class extends vt {
2066
2034
  return -this.orthoHalfHeight * this.aspect;
2067
2035
  }
2068
2036
  updateProjectionMatrix() {
2069
- this.orthographic ? _t.prototype.updateProjectionMatrix.call(this) : super.updateProjectionMatrix();
2037
+ this.orthographic ? pt.prototype.updateProjectionMatrix.call(this) : super.updateProjectionMatrix();
2070
2038
  }
2071
2039
  copy(e, t) {
2072
2040
  return super.copy(e, t), this.orthographic = e.orthographic === !0, this.orthoHalfHeight = e.orthoHalfHeight ?? this.orthoHalfHeight, this;
2073
2041
  }
2074
- }, Un = "__rayzeeUserLight", Wn = {
2075
- DirectionalLight: it,
2076
- PointLight: yt,
2077
- SpotLight: wt,
2078
- RectAreaLight: z
2079
- }, Gn = class extends I {
2042
+ }, Bn = "__rayzeeUserLight", Vn = {
2043
+ DirectionalLight: nt,
2044
+ PointLight: ht,
2045
+ SpotLight: bt,
2046
+ RectAreaLight: V
2047
+ }, Hn = class extends L {
2080
2048
  constructor(e, t, n, r = {}) {
2081
2049
  super(), this.scene = e, this.sceneHelpers = t, this.pathTracer = n, this._onReset = r.onReset || null, this._onLightRemoved = r.onLightRemoved || null;
2082
2050
  }
@@ -2124,14 +2092,14 @@ var Hn = class extends vt {
2124
2092
  }[e];
2125
2093
  if (!t) return null;
2126
2094
  let n;
2127
- if (e === "DirectionalLight") n = new it(t.color, t.intensity), n.position.fromArray(t.position);
2128
- else if (e === "PointLight") n = new yt(t.color, t.intensity), n.position.fromArray(t.position);
2095
+ if (e === "DirectionalLight") n = new nt(t.color, t.intensity), n.position.fromArray(t.position);
2096
+ else if (e === "PointLight") n = new ht(t.color, t.intensity), n.position.fromArray(t.position);
2129
2097
  else if (e === "SpotLight") {
2130
- n = new wt(t.color, t.intensity), n.position.fromArray(t.position), n.angle = R.degToRad(t.angle);
2131
- let e = new gt();
2098
+ n = new bt(t.color, t.intensity), n.position.fromArray(t.position), n.angle = z.degToRad(t.angle);
2099
+ let e = new B();
2132
2100
  this.scene.add(e), n.target = e;
2133
- } 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");
2134
- n.userData[Un] = !0, n.userData.temperature = 6500, n.userData.useTemperature = !1, n.userData.exposure = 0;
2101
+ } else e === "RectAreaLight" && (n = new V(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");
2102
+ n.userData[Bn] = !0, n.userData.temperature = 6500, n.userData.useTemperature = !1, n.userData.exposure = 0;
2135
2103
  let r = this.scene.getObjectsByProperty("isLight", !0).length;
2136
2104
  return n.name = `${e.replace("Light", "")} ${r + 1}`, this.scene.add(n), this.updateLights(), this._syncHelpers(), this._onReset?.(), this._buildDescriptor(n);
2137
2105
  }
@@ -2157,7 +2125,7 @@ var Hn = class extends vt {
2157
2125
  this.pathTracer?.updateLights(), this.sceneHelpers?.visible && this.sceneHelpers.update();
2158
2126
  }
2159
2127
  transferSceneLights(e, { keepUserLights: t = !1 } = {}) {
2160
- this._removeAllLights(t ? (e) => !e.userData?.[Un] : void 0);
2128
+ this._removeAllLights(t ? (e) => !e.userData?.[Bn] : void 0);
2161
2129
  let n = e.getObjectsByProperty("isLight", !0);
2162
2130
  if (!n || n.length === 0) {
2163
2131
  this.updateLights();
@@ -2166,7 +2134,7 @@ var Hn = class extends vt {
2166
2134
  for (let e of n) {
2167
2135
  let t = e.clone();
2168
2136
  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) {
2169
- let n = new gt();
2137
+ let n = new B();
2170
2138
  e.target.updateWorldMatrix(!0, !1), e.target.getWorldPosition(n.position), this.scene.add(n), t.target = n;
2171
2139
  }
2172
2140
  this.scene.add(t);
@@ -2191,7 +2159,7 @@ var Hn = class extends vt {
2191
2159
  position: e.position.toArray(),
2192
2160
  quaternion: e.quaternion.toArray(),
2193
2161
  scale: e.scale.toArray(),
2194
- userData: i(e.userData) ?? {}
2162
+ userData: m(e.userData) ?? {}
2195
2163
  };
2196
2164
  return e.isSpotLight && Object.assign(t, {
2197
2165
  angle: e.angle,
@@ -2211,14 +2179,14 @@ var Hn = class extends vt {
2211
2179
  this.sceneHelpers?.clear(), this._removeAllLights();
2212
2180
  let t = [];
2213
2181
  for (let n of e ?? []) {
2214
- let e = Wn[n.type];
2182
+ let e = Vn[n.type];
2215
2183
  if (!e) continue;
2216
2184
  let r = new e();
2217
2185
  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 ?? [
2218
2186
  1,
2219
2187
  1,
2220
2188
  1
2221
- ]), r.userData = o(n.userData) ?? {};
2189
+ ]), r.userData = p(n.userData) ?? {};
2222
2190
  for (let e of [
2223
2191
  "angle",
2224
2192
  "penumbra",
@@ -2228,7 +2196,7 @@ var Hn = class extends vt {
2228
2196
  "height"
2229
2197
  ]) typeof n[e] == "number" && (r[e] = n[e]);
2230
2198
  if (n.target) {
2231
- let e = new gt();
2199
+ let e = new B();
2232
2200
  e.position.fromArray(n.target), this.scene.add(e), r.target = e;
2233
2201
  }
2234
2202
  this.scene.add(r), t.push(r);
@@ -2268,7 +2236,7 @@ var Hn = class extends vt {
2268
2236
  }
2269
2237
  _buildDescriptor(e) {
2270
2238
  let t = 0;
2271
- e.type === "SpotLight" && e.angle !== void 0 ? t = R.radToDeg(e.angle) : e.type === "DirectionalLight" && (t = R.radToDeg(e.userData?.angle ?? 0));
2239
+ e.type === "SpotLight" && e.angle !== void 0 ? t = z.radToDeg(e.angle) : e.type === "DirectionalLight" && (t = z.radToDeg(e.userData?.angle ?? 0));
2272
2240
  let n = {
2273
2241
  uuid: e.uuid,
2274
2242
  name: e.name,
@@ -2287,7 +2255,7 @@ var Hn = class extends vt {
2287
2255
  exposure: e.userData?.exposure ?? 0
2288
2256
  };
2289
2257
  if (e.type === "RectAreaLight") {
2290
- n.width = e.width, n.height = e.height, n.normalize = e.userData?.normalize ?? !0, n.spread = R.radToDeg(e.userData?.spread ?? Math.PI);
2258
+ n.width = e.width, n.height = e.height, n.normalize = e.userData?.normalize ?? !0, n.spread = z.radToDeg(e.userData?.spread ?? Math.PI);
2291
2259
  let t = e.userData?.shape;
2292
2260
  n.shape = t === "square" || t === "rectangle" || t === "disk" || t === "ellipse" ? t : t === 1 ? "ellipse" : "rectangle";
2293
2261
  let r = e.getWorldDirection(e.position.clone());
@@ -2303,11 +2271,11 @@ var Hn = class extends vt {
2303
2271
  ], 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);
2304
2272
  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;
2305
2273
  }
2306
- }, Kn = ({ element: e, pbrtEntry: t } = {}) => ({
2274
+ }, Z = ({ element: e, pbrtEntry: t } = {}) => ({
2307
2275
  ...e === void 0 ? {} : { element: e },
2308
2276
  ...t === void 0 ? {} : { pbrtEntry: t }
2309
- }), Q = /* @__PURE__ */ new WeakMap(), qn = 3e4, Jn = new Set([...Object.values(m), ...Object.values(p)]), Yn = /* @__PURE__ */ new Set();
2310
- async function Xn(e, t) {
2277
+ }), Q = /* @__PURE__ */ new WeakMap(), Un = 3e4, Wn = new Set([...Object.values(g), ...Object.values(h)]), Gn = /* @__PURE__ */ new Set();
2278
+ async function Kn(e, t) {
2311
2279
  if (!t || typeof self < "u") return e.init();
2312
2280
  globalThis.self = {
2313
2281
  requestAnimationFrame: () => 0,
@@ -2319,43 +2287,43 @@ async function Xn(e, t) {
2319
2287
  delete globalThis.self;
2320
2288
  }
2321
2289
  }
2322
- var $ = me("engine");
2323
- function Zn() {
2290
+ var $ = S("engine");
2291
+ function qn() {
2324
2292
  let e = new Float32Array(16);
2325
- return new Uint32Array(e.buffer)[3] = ge.TRIANGLE_LEAF, e;
2293
+ return new Uint32Array(e.buffer)[3] = _e.TRIANGLE_LEAF, e;
2326
2294
  }
2327
- function Qn(e, t) {
2295
+ function Jn(e, t) {
2328
2296
  e.lost.then((e) => {
2329
2297
  t.app && t.app._handleDeviceLost(e);
2330
2298
  });
2331
2299
  }
2332
- var $n = /swiftshader|llvmpipe|lavapipe|basic render|microsoft basic|warp/i;
2333
- function er(e) {
2300
+ var Yn = /swiftshader|llvmpipe|lavapipe|basic render|microsoft basic|warp/i;
2301
+ function Xn(e) {
2334
2302
  let t = e.info ?? {}, n = `${t.vendor ?? ""} ${t.architecture ?? ""} ${t.device ?? ""} ${t.description ?? ""}`;
2335
2303
  return {
2336
2304
  vendor: t.vendor ?? "",
2337
2305
  architecture: t.architecture ?? "",
2338
2306
  device: t.device ?? "",
2339
2307
  description: t.description ?? "",
2340
- isSoftware: t.isFallbackAdapter === !0 || e.isFallbackAdapter === !0 || $n.test(n)
2308
+ isSoftware: t.isFallbackAdapter === !0 || e.isFallbackAdapter === !0 || Yn.test(n)
2341
2309
  };
2342
2310
  }
2343
- var tr = class extends I {
2311
+ var Zn = class extends L {
2344
2312
  constructor(e, t = {}) {
2345
- super(), this._headless = t.headless === !0 || !e, e ??= Vn();
2313
+ super(), this._headless = t.headless === !0 || !e, e ??= Rn();
2346
2314
  try {
2347
2315
  Q.get(e)?.dispose();
2348
2316
  } catch (e) {
2349
2317
  $.warn("prior canvas owner dispose failed", e);
2350
2318
  }
2351
2319
  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 || t.memorySpill === !1 ? t.memorySpill : "auto", this._spillPlan = null, 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`.");
2352
- this._issues = new _e({
2320
+ this._issues = new ve({
2353
2321
  strict: t.strict === !0,
2354
2322
  onIssue: (e) => this.dispatchEvent({
2355
- type: m.ISSUE,
2323
+ type: g.ISSUE,
2356
2324
  issue: e
2357
2325
  })
2358
- }), this.color = new ln({ issues: this._issues }), Se(this.color), this.settings = new cn(_, { 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 Xt(), 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;
2326
+ }), this.color = new on({ issues: this._issues }), w(this.color), this.settings = new an(_, { 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 qt(), 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;
2359
2327
  }
2360
2328
  _addTrackedListener(e, t, n) {
2361
2329
  e && (e.addEventListener(t, n), this._trackedListeners.push({
@@ -2374,33 +2342,33 @@ var tr = class extends I {
2374
2342
  }
2375
2343
  async init() {
2376
2344
  let e = this._initStorage();
2377
- 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(he.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(Zn()), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setupMaterial(), this.isInitialized = !0, $.debug("WebGPU path tracer app initialized"), this;
2345
+ 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(qn()), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setupMaterial(), this.isInitialized = !0, $.debug("WebGPU path tracer app initialized"), this;
2378
2346
  }
2379
2347
  async setStorageOpener(e) {
2380
2348
  this._storageOpener = e, !(!this.isInitialized || this.storage || this._disposed) && (await this._initStorage(), this._attachStorage());
2381
2349
  }
2382
2350
  async _initStorage() {
2383
- let e = this._storageOption ?? (this._issues.strict && !we("storage") ? !1 : w().storage);
2351
+ let e = this._storageOption ?? (this._issues.strict && !we("storage") ? !1 : E().storage);
2384
2352
  if (e !== !1) {
2385
2353
  if (e && typeof e == "object") this.storage = e;
2386
2354
  else {
2387
2355
  if (!this._storageOpener) {
2388
- (this._storageOption !== void 0 || we("storage")) && this._issues.warn(S.CAPABILITY_MISSING, "on-disk storage needs rayzee/addons/storage: setStorageOpener( acquireSharedStorage )");
2356
+ (this._storageOption !== void 0 || we("storage")) && this._issues.warn(C.CAPABILITY_MISSING, "on-disk storage needs rayzee/addons/storage: setStorageOpener( acquireSharedStorage )");
2389
2357
  return;
2390
2358
  }
2391
- let { storage: e, reason: t, release: n } = await this._storageOpener(w().cacheNamespace);
2359
+ let { storage: e, reason: t, release: n } = await this._storageOpener(E().cacheNamespace);
2392
2360
  if (this._disposed) {
2393
2361
  n();
2394
2362
  return;
2395
2363
  }
2396
2364
  if (!e) {
2397
- this._issues.warn(S.STORAGE_UNAVAILABLE, `on-disk storage is off: ${t}`, { reason: t });
2365
+ this._issues.warn(C.STORAGE_UNAVAILABLE, `on-disk storage is off: ${t}`, { reason: t });
2398
2366
  return;
2399
2367
  }
2400
2368
  this.storage = e, this._storageRelease = n;
2401
2369
  }
2402
2370
  this._addTrackedListener(this.storage, "change", (e) => this.dispatchEvent({
2403
- type: m.STORAGE_CHANGED,
2371
+ type: g.STORAGE_CHANGED,
2404
2372
  area: e.area
2405
2373
  })), this._addTrackedListener(this.storage, "issue", (e) => this._issues.warn(e.code, e.message, e.detail));
2406
2374
  }
@@ -2410,20 +2378,20 @@ var tr = class extends I {
2410
2378
  }
2411
2379
  dispatchEvent(e) {
2412
2380
  super.dispatchEvent(e);
2413
- let t = p[e.type];
2381
+ let t = h[e.type];
2414
2382
  t && super.dispatchEvent({
2415
2383
  ...e,
2416
2384
  type: t
2417
2385
  });
2418
2386
  }
2419
2387
  addEventListener(e, t) {
2420
- !Jn.has(e) && !Yn.has(e) && (Yn.add(e), $.warn(`no engine event is named "${e}", so this listener will never fire — see EngineEvents`)), super.addEventListener(e, t);
2388
+ !Wn.has(e) && !Gn.has(e) && (Gn.add(e), $.warn(`no engine event is named "${e}", so this listener will never fire — see EngineEvents`)), super.addEventListener(e, t);
2421
2389
  }
2422
2390
  animate() {
2423
2391
  if (this._headless) throw Error("a headless app has no render loop — drive it with renderFrames() or renderUntilComplete()");
2424
2392
  if (this._deviceLost) return;
2425
2393
  if (this.animationManagerId = requestAnimationFrame(() => this.animate()), this._loadingInProgress || this._sdf?.isProcessing) {
2426
- this.dispatchEvent({ type: m.FRAME });
2394
+ this.dispatchEvent({ type: g.FRAME });
2427
2395
  return;
2428
2396
  }
2429
2397
  this._beginFrame();
@@ -2436,29 +2404,29 @@ var tr = class extends I {
2436
2404
  if (this._beforeTrace(), this.stages.pathTracer?.isReady) {
2437
2405
  if (this.stages.pathTracer.isComplete && this.completion.renderCompleteDispatched) {
2438
2406
  if (this._needsDisplayRefresh && (this._needsDisplayRefresh = !1, this.stages.compositor.render(this.pipeline.context), this._renderHelperOverlay()), this._settling()) {
2439
- this.dispatchEvent({ type: m.FRAME });
2407
+ this.dispatchEvent({ type: g.FRAME });
2440
2408
  return;
2441
2409
  }
2442
2410
  this.stopAnimation();
2443
2411
  return;
2444
2412
  }
2445
2413
  if (this._holdTrace(e)) {
2446
- this._renderHelperOverlay(), this.dispatchEvent({ type: m.FRAME });
2414
+ this._renderHelperOverlay(), this.dispatchEvent({ type: g.FRAME });
2447
2415
  return;
2448
2416
  }
2449
2417
  if (this.stages.pathTracer.readbackWait()) {
2450
- this.dispatchEvent({ type: m.FRAME });
2418
+ this.dispatchEvent({ type: g.FRAME });
2451
2419
  return;
2452
2420
  }
2453
2421
  this._traceFrame({ liveDenoise: !0 }), this.stages.pathTracer.isComplete && this.completion.markComplete() && this._announceComplete();
2454
2422
  }
2455
- this._renderHelperOverlay(), this.dispatchEvent({ type: m.FRAME });
2423
+ this._renderHelperOverlay(), this.dispatchEvent({ type: g.FRAME });
2456
2424
  }
2457
2425
  }
2458
2426
  _announceComplete() {
2459
2427
  let e = this._completionInfo(), t = this.stages.pathTracer.resetCount, n = () => {
2460
2428
  !this.completion.renderCompleteDispatched || this.stages.pathTracer?.resetCount !== t || (this._renderCompleted(), this.dispatchEvent({
2461
- type: m.RENDER_COMPLETE,
2429
+ type: g.RENDER_COMPLETE,
2462
2430
  ...e
2463
2431
  }));
2464
2432
  }, r = this._finishImage();
@@ -2468,9 +2436,9 @@ var tr = class extends I {
2468
2436
  let t = this.stages.pathTracer;
2469
2437
  this.pipeline.render(), this._afterTrace(t, e), t.isComplete || this.completion.updateTime(), this._ensureVRAMWiring();
2470
2438
  let n = t.vramTracker, r = t.frameCount ?? 0;
2471
- n && (r <= 1 || r % 30 == 0) && n.measure(), ce({
2439
+ n && (r <= 1 || r % 30 == 0) && n.measure(), ue({
2472
2440
  timeElapsed: this.completion.timeElapsed,
2473
- samples: de(t),
2441
+ samples: pe(t),
2474
2442
  memoryUsed: n?.current ?? 0,
2475
2443
  memoryPeak: n?.peak ?? 0
2476
2444
  }), this.completion.isTimeLimitReached(t, this.settings.get("renderLimitMode"), this.settings.get("renderTimeLimit")) && (t.isComplete = !0);
@@ -2488,7 +2456,7 @@ var tr = class extends I {
2488
2456
  }
2489
2457
  _handleDeviceLost(e) {
2490
2458
  this._deviceLost || (this._deviceLost = !0, $.error(`WebGPU device lost (${e?.reason || "unknown"}): ${e?.message || ""}`), this.stopAnimation(), this.dispatchEvent({
2491
- type: m.DEVICE_LOST,
2459
+ type: g.DEVICE_LOST,
2492
2460
  reason: e?.reason,
2493
2461
  message: e?.message
2494
2462
  }));
@@ -2503,34 +2471,34 @@ var tr = class extends I {
2503
2471
  this._paused = !1, !this.animationManagerId && !this._headless && this.animate();
2504
2472
  }
2505
2473
  reset(e = !1, { motion: t = !1 } = {}) {
2506
- t && this.stages.pathTracer?.noteViewChanged(), this._beforeReset(e || t), this.pipeline && (this.pipeline.reset(), e || this.pipeline.eventBus.emit("pipeline:historyReset")), this._afterReset(), this.completion.reset(), this.wake(), this.dispatchEvent({ type: m.RENDER_RESET });
2474
+ t && this.stages.pathTracer?.noteViewChanged(), this._beforeReset(e || t), this.pipeline && (this.pipeline.reset(), e || this.pipeline.eventBus.emit("pipeline:historyReset")), this._afterReset(), this.completion.reset(), this.wake(), this.dispatchEvent({ type: g.RENDER_RESET });
2507
2475
  }
2508
2476
  dispose() {
2509
2477
  if (!this._disposed) {
2510
- if (this._disposed = !0, this.dispatchEvent({ type: m.DISPOSE }), this.stopAnimation(), clearTimeout(this._resizeDebounceTimer), this._resizeDebounceTimer = null, clearTimeout(this._respillTimer), this._respillTimer = null, this._removeTrackedListeners(), ue(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) {
2478
+ if (this._disposed = !0, this.dispatchEvent({ type: g.DISPOSE }), this.stopAnimation(), clearTimeout(this._resizeDebounceTimer), this._resizeDebounceTimer = null, clearTimeout(this._respillTimer), this._respillTimer = null, this._removeTrackedListeners(), fe(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) {
2511
2479
  this.meshScene.environment?.dispose(), this.meshScene.environment = null;
2512
- for (let e of [...this.meshScene.children]) h(e);
2480
+ for (let e of [...this.meshScene.children]) ee(e);
2513
2481
  this.meshScene.clear(), this.meshScene = null;
2514
2482
  }
2515
2483
  this._sceneHelpers?.clear(), this._sceneHelpers = null, this.scene?.clear(), this.scene = null;
2516
2484
  try {
2517
- let e = Xe().value, t = We().value;
2485
+ let e = Ye().value, t = Ge().value;
2518
2486
  e?._listeners?.dispose && (e._listeners.dispose.length = 0), t?._listeners?.dispose && (t._listeners.dispose.length = 0);
2519
2487
  } catch (e) {
2520
2488
  $.warn("failed to clear TSL texture singleton listeners", e);
2521
2489
  }
2522
- 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), ae(this.renderer), this.renderer = null, this.stages = {}, this.isInitialized = !1;
2490
+ 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;
2523
2491
  }
2524
2492
  }
2525
2493
  unloadScene() {
2526
2494
  if (this.isInitialized) {
2527
2495
  if (this._loadingInProgress) throw Error("PathTracerApp.unloadScene: cannot unload while a load is in progress");
2528
- this._disposed || (this._releaseSceneState(), this.assetLoader?.releaseTargetModel(), this._sceneSource = this._sceneSourceInput = null, this.lightManager?.clearLights?.(), this.stages.pathTracer && (this.stages.pathTracer.setTriangleData(new Uint32Array(he.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(Zn()), 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: m.SCENE_UNLOADED }));
2496
+ this._disposed || (this._releaseSceneState(), this.assetLoader?.releaseTargetModel(), this._sceneSource = this._sceneSourceInput = null, this.lightManager?.clearLights?.(), this.stages.pathTracer && (this.stages.pathTracer.setTriangleData(new Uint32Array(ge.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(qn()), 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 }));
2529
2497
  }
2530
2498
  }
2531
2499
  async loadModel(e, t = {}) {
2532
2500
  await this._loadWithSceneRebuild(() => this.assetLoader.loadModel(e, t), {
2533
- type: m.MODEL_LOADED,
2501
+ type: g.MODEL_LOADED,
2534
2502
  url: e
2535
2503
  }, {
2536
2504
  kind: "url",
@@ -2540,7 +2508,7 @@ var tr = class extends I {
2540
2508
  }
2541
2509
  async loadObject3D(e, t = "object3d") {
2542
2510
  await this._loadWithSceneRebuild(() => this.assetLoader.loadObject3D(e, t), {
2543
- type: m.OBJECT3D_LOADED,
2511
+ type: g.OBJECT3D_LOADED,
2544
2512
  name: t
2545
2513
  }, {
2546
2514
  kind: "object3d",
@@ -2558,7 +2526,7 @@ var tr = class extends I {
2558
2526
  await this.assetLoader.loadEnvironment(e);
2559
2527
  let t = this.meshScene.environment;
2560
2528
  t && this.stages.pathTracer && await this.stages.pathTracer.environment.setEnvironmentMap(t), this.pipeline?.eventBus.emit("pipeline:lightingChanged"), this.reset(), this.dispatchEvent({
2561
- type: m.ENVIRONMENT_LOADED,
2529
+ type: g.ENVIRONMENT_LOADED,
2562
2530
  url: e
2563
2531
  });
2564
2532
  } finally {
@@ -2570,21 +2538,21 @@ var tr = class extends I {
2570
2538
  }
2571
2539
  async loadFile(e, t = {}) {
2572
2540
  if (t = this._sceneBudgets(t), typeof e == "string") {
2573
- let n = t.filename ?? q(e), r = this.assetLoader?.getFileFormat(n);
2541
+ let n = t.filename ?? K(e), r = this.assetLoader?.getFileFormat(n);
2574
2542
  if (!r) throw this.assetLoader.formatError(n);
2575
2543
  if (r.type === "environment" || r.type === "image") return this.loadEnvironment(e);
2576
2544
  await this._loadWithSceneRebuild(() => this.assetLoader.loadAssetFromUrl(e, {
2577
2545
  ...t,
2578
2546
  filename: n
2579
2547
  }), {
2580
- type: m.MODEL_LOADED,
2548
+ type: g.MODEL_LOADED,
2581
2549
  filename: n
2582
2550
  }, {
2583
2551
  kind: "url",
2584
2552
  url: e,
2585
2553
  filename: n,
2586
2554
  cacheKey: t.cacheKey ?? null,
2587
- ...Kn(t)
2555
+ ...Z(t)
2588
2556
  });
2589
2557
  return;
2590
2558
  }
@@ -2592,16 +2560,16 @@ var tr = class extends I {
2592
2560
  let n = Me(e, { isModel: (e) => this.assetLoader?.getFileFormat(e)?.type === "model" });
2593
2561
  if (n.files.length === 0) throw Error(`${n.name} holds no files to load`);
2594
2562
  await this._loadWithSceneRebuild(() => this.assetLoader.loadFolder(n, t), {
2595
- type: m.MODEL_LOADED,
2563
+ type: g.MODEL_LOADED,
2596
2564
  filename: n.name
2597
2565
  }, async () => {
2598
2566
  let e = await je(n);
2599
2567
  return {
2600
2568
  kind: "local-folder",
2601
2569
  folder: e,
2602
- key: E(e),
2570
+ key: O(e),
2603
2571
  ...n.flat ? { flat: !0 } : {},
2604
- ...Kn(t)
2572
+ ...Z(t)
2605
2573
  };
2606
2574
  }), this._sceneSourceInput = n;
2607
2575
  return;
@@ -2616,15 +2584,15 @@ var tr = class extends I {
2616
2584
  sample: null
2617
2585
  }));
2618
2586
  await this._loadWithSceneRebuild(() => this.assetLoader.loadAssetFromFile(e, t), {
2619
- type: m.MODEL_LOADED,
2587
+ type: g.MODEL_LOADED,
2620
2588
  filename: e.name
2621
2589
  }, async () => {
2622
2590
  let e = await n;
2623
2591
  return {
2624
2592
  kind: "local-file",
2625
2593
  file: e,
2626
- key: e.sample ? E(e) : null,
2627
- ...Kn(t)
2594
+ key: e.sample ? O(e) : null,
2595
+ ...Z(t)
2628
2596
  };
2629
2597
  }), this._sceneSourceInput = e;
2630
2598
  return;
@@ -2635,7 +2603,7 @@ var tr = class extends I {
2635
2603
  await this.assetLoader.loadAssetFromFile(e);
2636
2604
  let t = this.meshScene.environment;
2637
2605
  t && this.stages.pathTracer && await this.stages.pathTracer.environment.applyHDRI(t), this.pipeline?.eventBus.emit("pipeline:lightingChanged"), this.reset(), this.dispatchEvent({
2638
- type: m.ENVIRONMENT_LOADED,
2606
+ type: g.ENVIRONMENT_LOADED,
2639
2607
  filename: e.name
2640
2608
  });
2641
2609
  } finally {
@@ -2644,7 +2612,7 @@ var tr = class extends I {
2644
2612
  }
2645
2613
  async loadExampleModels(e, t) {
2646
2614
  await this._loadWithSceneRebuild(() => this.assetLoader.loadExampleModels(e, t), {
2647
- type: m.MODEL_LOADED,
2615
+ type: g.MODEL_LOADED,
2648
2616
  index: e
2649
2617
  }, {
2650
2618
  kind: "url",
@@ -2661,7 +2629,7 @@ var tr = class extends I {
2661
2629
  this._loadingInProgress = !0;
2662
2630
  try {
2663
2631
  await this.loadSceneData(), this.reset(), this.dispatchEvent({
2664
- type: m.TEXTURES_REPROCESSED,
2632
+ type: g.TEXTURES_REPROCESSED,
2665
2633
  maxTextureSize: r
2666
2634
  });
2667
2635
  } finally {
@@ -2680,11 +2648,11 @@ var tr = class extends I {
2680
2648
  }
2681
2649
  async _loadWithSceneRebuild(e, t, n = null) {
2682
2650
  if (this._loadingInProgress) throw this._busyError("PathTracerApp");
2683
- this._loadingInProgress = !0, this.assetLoader && (this.assetLoader.maxEnvironmentWidth = this._memorySpill === !0 ? se : 0);
2651
+ this._loadingInProgress = !0, this.assetLoader && (this.assetLoader.maxEnvironmentWidth = this._memorySpill === !0 ? ce : 0);
2684
2652
  try {
2685
2653
  await e(), this._sceneSource = typeof n == "function" ? await n() : n, this._sceneSourceInput = null, this._emissiveSamplingUserSet = !1, this._clearAppendedModels(), this._modelReplaced(), this._planSpill(), await this.loadSceneData({ pendingEnvironment: this._beginSceneMetadataEnvironment() }), this._maybeSpill(), this.pipeline?.eventBus.emit("pipeline:lightingChanged"), this._dropDisplay(), this.reset(), this.dispatchEvent(t), this._modelAnnounced();
2686
2654
  } catch (e) {
2687
- throw (!e || e.code !== "LOAD_IN_PROGRESS") && this._discardFailedLoad(), e?.code === "ARCHIVE_NEEDS_ELEMENT" ? y() : e?.code !== "LOAD_IN_PROGRESS" && v({
2655
+ throw (!e || e.code !== "LOAD_IN_PROGRESS") && this._discardFailedLoad(), e?.code === "ARCHIVE_NEEDS_ELEMENT" ? le() : e?.code !== "LOAD_IN_PROGRESS" && y({
2688
2656
  status: `Error: ${e?.message ?? e}`,
2689
2657
  failed: !0,
2690
2658
  progress: 100
@@ -2707,7 +2675,7 @@ var tr = class extends I {
2707
2675
  _beginSceneMetadataEnvironment() {
2708
2676
  this._restoreUnlitSettings();
2709
2677
  let e = this.sceneMetadata?.environment;
2710
- 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`, {
2678
+ 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(C.ENVIRONMENT_LOAD_FAILED, `authored environment "${e.sourceFile}" failed to load — lighting falls back to the previous environment`, {
2711
2679
  sourceFile: e.sourceFile,
2712
2680
  cause: String(t?.message ?? t)
2713
2681
  }), null)).finally(() => {
@@ -2724,9 +2692,9 @@ var tr = class extends I {
2724
2692
  };
2725
2693
  n.intensity !== void 0 && (r.environmentIntensity = n.intensity, r.backgroundIntensity = n.intensity), n.rotation !== void 0 && (r.environmentRotation = n.rotation), this.settings.setMany(r, {
2726
2694
  reset: !1,
2727
- source: Y.SCENE_METADATA
2695
+ source: J.SCENE_METADATA
2728
2696
  }), this.scene && (this.scene.background = e), this.dispatchEvent({
2729
- type: m.SCENE_METADATA_APPLIED,
2697
+ type: g.SCENE_METADATA_APPLIED,
2730
2698
  metadata: t,
2731
2699
  environment: { ...n }
2732
2700
  });
@@ -2741,9 +2709,9 @@ var tr = class extends I {
2741
2709
  source: e[t].source
2742
2710
  }])), this.settings.setMany(t, {
2743
2711
  reset: !1,
2744
- source: Y.SCENE_METADATA
2712
+ source: J.SCENE_METADATA
2745
2713
  }), this.dispatchEvent({
2746
- type: m.SCENE_METADATA_APPLIED,
2714
+ type: g.SCENE_METADATA_APPLIED,
2747
2715
  metadata: this.sceneMetadata,
2748
2716
  environment: { enabled: !1 }
2749
2717
  });
@@ -2753,38 +2721,38 @@ var tr = class extends I {
2753
2721
  if (!e) return;
2754
2722
  this._unlitRestore = null;
2755
2723
  let t = this.settings.getEffective();
2756
- for (let [n, { value: r, source: i }] of Object.entries(e)) t[n]?.source === Y.SCENE_METADATA && this.settings.set(n, r, {
2724
+ for (let [n, { value: r, source: i }] of Object.entries(e)) t[n]?.source === J.SCENE_METADATA && this.settings.set(n, r, {
2757
2725
  reset: !1,
2758
2726
  source: i
2759
2727
  });
2760
2728
  this.dispatchEvent({
2761
- type: m.SCENE_METADATA_APPLIED,
2729
+ type: g.SCENE_METADATA_APPLIED,
2762
2730
  metadata: this.sceneMetadata,
2763
2731
  environment: { enabled: this.settings.get("enableEnvironment") }
2764
2732
  });
2765
2733
  }
2766
2734
  async loadSceneData({ pendingEnvironment: e = null, keepUserLights: t = !1 } = {}) {
2767
2735
  this._releaseSceneState({ keepSelection: !!this._preserveSelectionOnRebuild }), this._tagPrimarySceneObject();
2768
- let n = new d("", {
2736
+ let n = new l("", {
2769
2737
  namespace: "scene",
2770
2738
  level: "info"
2771
2739
  }), r = () => this.stages.pathTracer.environment.envParams.mode === "hdri" ? this.meshScene.environment : null, i = r(), a = null;
2772
2740
  if (e ? (n.start("Environment fetch + CDF (concurrent)"), a = e.then(async (e) => {
2773
2741
  e && (await this.stages.pathTracer.environment.applyHDRI(e), this._applySceneMetadataSettings(e));
2774
- }).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(() => {
2742
+ }).catch((e) => this._issues.record(C.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(() => {
2775
2743
  n.end("Environment CDF build (worker)"), this._applySceneMetadataEnabled && this._applySceneMetadataSettings(i);
2776
2744
  })), n.start("BVH build (SceneProcessor)"), this._sdf.setMaxTextureSize(this.settings.get("maxTextureSize")), await this._sdf.buildBVH(this.meshScene, {
2777
2745
  sceneKey: this.assetLoader?.sceneSourceKey ?? null,
2778
2746
  progressive: this._progressiveSpill()
2779
- }), this.assetLoader?.flushPendingGraph(this._sdf.performanceMetrics.totalProcessingTime), n.end("BVH build (SceneProcessor)"), v({
2747
+ }), this.assetLoader?.flushPendingGraph(this._sdf.performanceMetrics.totalProcessingTime), n.end("BVH build (SceneProcessor)"), y({
2780
2748
  status: "Transferring data to GPU...",
2781
2749
  progress: 86
2782
2750
  }), await new Promise((e) => setTimeout(e, 0)), n.start("GPU data transfer"), await this._sdf.uploadChunks(this._chunkUploader()), !this._sdf.uploadToPathTracer(this.stages.pathTracer, this.lightManager, this.meshScene, r(), { keepUserLights: t })) return !1;
2783
2751
  for (let e of [...this._sdf.srgbBucketTextures ?? [], ...this._sdf.linearBucketTextures ?? []]) e && (this.renderer.initTexture(e), await this.stages.pathTracer.drainUploads());
2784
- 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({
2752
+ 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"), y({
2785
2753
  status: "Compiling shaders...",
2786
2754
  progress: 90
2787
- }), 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({
2755
+ }), 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 && (y({
2788
2756
  status: "Finalizing environment map...",
2789
2757
  progress: 95
2790
2758
  }), await a, this.stages.pathTracer.environment.applyCDFResults());
@@ -2793,7 +2761,7 @@ var tr = class extends I {
2793
2761
  let e = (this._sdf?.emissiveTriangleBuilder?.emissiveTriangles?.length ?? this._sdf?.emissiveTriangleCount ?? 0) > 0;
2794
2762
  this.settings.set("enableEmissiveTriangleSampling", e, { reset: !1 });
2795
2763
  }
2796
- 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: m.SCENE_REBUILD }), !0;
2764
+ return n.start("Apply settings"), this.settings.applyAll(), this.stages.compositor.setTransparentBackground(this.settings.get("transparentBackground")), n.end("Apply settings"), n.print(this._sceneSummaryParts()), le(), this._sceneRebuilt(), this.dispatchEvent({ type: g.SCENE_REBUILD }), !0;
2797
2765
  }
2798
2766
  _sceneSummaryParts() {
2799
2767
  let e = this.stages.pathTracer, t = this._sdf?.instanceTable?.setCount ?? 0, n = this._sdf?.geometryExtractor?.maps?.length ?? 0;
@@ -2824,7 +2792,7 @@ var tr = class extends I {
2824
2792
  try {
2825
2793
  let { root: r } = await this.assetLoader.appendModel(e, { cacheKey: n });
2826
2794
  return r.userData.__rayzeeSceneObject = !0, r.userData.__rayzeeSourceUrl = e, n && (r.userData.__rayzeeCacheKey = n), t && (r.userData.__rayzeeName = t), await this._finishRebuildNoReframe({
2827
- type: m.MODEL_ADDED,
2795
+ type: g.MODEL_ADDED,
2828
2796
  url: e,
2829
2797
  id: r.uuid
2830
2798
  }), r.uuid;
@@ -2838,7 +2806,7 @@ var tr = class extends I {
2838
2806
  try {
2839
2807
  let { root: n } = this.assetLoader.appendObject3D(e, t || "object3d");
2840
2808
  return n.userData.__rayzeeSceneObject = !0, t && (n.userData.__rayzeeName = t), await this._finishRebuildNoReframe({
2841
- type: m.MODEL_ADDED,
2809
+ type: g.MODEL_ADDED,
2842
2810
  id: n.uuid
2843
2811
  }), n.uuid;
2844
2812
  } finally {
@@ -2855,7 +2823,7 @@ var tr = class extends I {
2855
2823
  this._loadingInProgress = !0;
2856
2824
  try {
2857
2825
  return this._releaseSceneState(), n === this.sceneModel ? this.assetLoader.releaseTargetModel() : this.assetLoader.removeModelRoot(n), await this._finishRebuildNoReframe({
2858
- type: m.SCENE_OBJECT_REMOVED,
2826
+ type: g.SCENE_OBJECT_REMOVED,
2859
2827
  id: e
2860
2828
  }), !0;
2861
2829
  } finally {
@@ -2879,16 +2847,16 @@ var tr = class extends I {
2879
2847
  }
2880
2848
  _sceneBudgets(e) {
2881
2849
  return this._memorySpill === !1 || !this.storage ? e : {
2882
- maxTriangles: ie,
2883
- maxPlacements: fe,
2850
+ maxTriangles: ae,
2851
+ maxPlacements: me,
2884
2852
  ...e
2885
2853
  };
2886
2854
  }
2887
2855
  _planSpill() {
2888
2856
  let e = this._memorySpill !== !1 && !!this.storage && (this.assetLoader?.animations?.length ?? 0) === 0 && (this._memorySpill === !0 || this._sdf.needsSpill(this.meshScene));
2889
- this.assetLoader && (this.assetLoader.maxEnvironmentWidth = e ? se : 0);
2857
+ this.assetLoader && (this.assetLoader.maxEnvironmentWidth = e ? ce : 0);
2890
2858
  let t = e ? this.meshScene?.environment : null, n = t?.image;
2891
- return n && Rn(t, se), t && t.image !== n && (t.dispose(), t.needsUpdate = !0), e && this._memorySpill === "auto" && $.info("scene is past the in-memory line: building it through disk"), this._spillPlan = e, e;
2859
+ return n && Fn(t, ce), t && t.image !== n && (t.dispose(), t.needsUpdate = !0), e && this._memorySpill === "auto" && $.info("scene is past the in-memory line: building it through disk"), this._spillPlan = e, e;
2892
2860
  }
2893
2861
  _progressiveSpill() {
2894
2862
  let e = this._spillPlan ?? this._planSpill();
@@ -2902,15 +2870,15 @@ var tr = class extends I {
2902
2870
  return (t, n, r) => n === "triangles" ? e.createTriangleChunkUploader(t, r) : e.createChunkUploader(t);
2903
2871
  }
2904
2872
  _maybeSpill() {
2905
- !this._sdf?.spilling || !this.storage || (this._sdf.spillAfterLoad().catch((e) => this._issues.warn(S.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`)), this._sdf.spillToDisk(this.storage).then((e) => e && this.dispatchEvent({
2906
- type: m.SCENE_SPILLED,
2873
+ !this._sdf?.spilling || !this.storage || (this._sdf.spillAfterLoad().catch((e) => this._issues.warn(C.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`)), this._sdf.spillToDisk(this.storage).then((e) => e && this.dispatchEvent({
2874
+ type: g.SCENE_SPILLED,
2907
2875
  ...e
2908
- })).catch((e) => this._issues.warn(S.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`)));
2876
+ })).catch((e) => this._issues.warn(C.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`)));
2909
2877
  }
2910
2878
  _scheduleRespill() {
2911
2879
  this._sdf?.spilling && (clearTimeout(this._respillTimer), this._respillTimer = setTimeout(() => {
2912
- this._respillTimer = null, this._sdf?.respill().catch((e) => this._issues.warn(S.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`));
2913
- }, qn), this._respillTimer.unref?.());
2880
+ this._respillTimer = null, this._sdf?.respill().catch((e) => this._issues.warn(C.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`));
2881
+ }, Un), this._respillTimer.unref?.());
2914
2882
  }
2915
2883
  async ensureSceneResident() {
2916
2884
  this._sdf?.spilled && await this._sdf.ensureResident(), await this._sdf?.ensureGeometryResident();
@@ -2939,40 +2907,40 @@ var tr = class extends I {
2939
2907
  }), r;
2940
2908
  }
2941
2909
  updateMeshTransforms(e) {
2942
- if (this._sdf?.needsPageInForMove(e)) return this._sdf.ensureMovable(e).then(() => this.updateMeshTransforms(e)).catch((e) => this._issues.warn(S.STORAGE_READ_FAILED, `reading instance matrices back failed: ${e.message}`)), null;
2910
+ if (this._sdf?.needsPageInForMove(e)) return this._sdf.ensureMovable(e).then(() => this.updateMeshTransforms(e)).catch((e) => this._issues.warn(C.STORAGE_READ_FAILED, `reading instance matrices back failed: ${e.message}`)), null;
2943
2911
  this._notePlacementsMoving(e);
2944
2912
  let t = this._sdf.updateMeshTransforms(e);
2945
2913
  return this.stages.pathTracer.updateBufferRanges([], this._sdf.takeMoveRanges()), this.reset(!1, { motion: !0 }), this._scheduleRespill(), t;
2946
2914
  }
2947
- setReservedRenderResolution(e, { allowLower: n = !1 } = {}) {
2948
- let i = n ? e : Math.max(e, r);
2915
+ setReservedRenderResolution(e, { allowLower: t = !1 } = {}) {
2916
+ let i = t ? e : Math.max(e, n);
2949
2917
  if (!this.renderer) return this._pendingReservedRenderSize = {
2950
2918
  requestedPx: e,
2951
- allowLower: n
2952
- }, Math.max(256, Math.min(f, Math.floor(i) || 256));
2953
- let a = this.renderer.backend?.device?.limits?.maxStorageBufferBindingSize || 128 * 1024 * 1024, o = oe(this._hostMemoryGB), s = o.gb >= 8 && a >= 1024 * 1024 * 1024 ? f : 2048, c = t(Math.min(i, s));
2954
- if (c < Math.floor(e) && this._issues.warn(S.RENDER_RESERVE_CAPPED, `reserved render size ${x.n(e)}px was capped to ${x.n(c)}px by this device's limits — renders above ${x.n(c)}px will be declined` + (o.assumed && o.gb < 8 ? " (host memory unknown, 4 GB assumed: pass hostMemoryGB)" : ""), {
2919
+ allowLower: t
2920
+ }, Math.max(256, Math.min(r, Math.floor(i) || 256));
2921
+ 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, l = c(Math.min(i, s));
2922
+ if (l < Math.floor(e) && this._issues.warn(C.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` + (o.assumed && o.gb < 8 ? " (host memory unknown, 4 GB assumed: pass hostMemoryGB)" : ""), {
2955
2923
  requested: e,
2956
- applied: c,
2924
+ applied: l,
2957
2925
  deviceMemoryGB: o.gb,
2958
2926
  assumed: o.assumed,
2959
2927
  maxStorageBufferBindingSize: a
2960
- }), (this.stages?.pathTracer?.storageTextures?.writeColor?.image?.width ?? c) !== c) {
2928
+ }), (this.stages?.pathTracer?.storageTextures?.writeColor?.image?.width ?? l) !== l) {
2961
2929
  let e = this.pauseRendering;
2962
2930
  this.pauseRendering = !0;
2963
2931
  try {
2964
2932
  let e = this.renderer.domElement;
2965
- (e.width > c || e.height > c) && this.renderer.setSize(Math.min(e.width, c), Math.min(e.height, c), !1);
2933
+ (e.width > l || e.height > l) && this.renderer.setSize(Math.min(e.width, l), Math.min(e.height, l), !1);
2966
2934
  for (let e of Object.values(this.stages)) e?.reallocateReservedStorage?.();
2967
2935
  } finally {
2968
2936
  this.pauseRendering = e;
2969
2937
  }
2970
2938
  this.reset(), this.dispatchEvent({
2971
- type: m.RESERVED_RENDER_SIZE_CHANGED,
2972
- size: c
2939
+ type: g.RESERVED_RENDER_SIZE_CHANGED,
2940
+ size: l
2973
2941
  });
2974
2942
  }
2975
- return c;
2943
+ return l;
2976
2944
  }
2977
2945
  _applyPendingReservedRenderSize() {
2978
2946
  let e = this._pendingReservedRenderSize;
@@ -2980,18 +2948,18 @@ var tr = class extends I {
2980
2948
  this._pendingReservedRenderSize = null;
2981
2949
  let t = this.setReservedRenderResolution(e.requestedPx, { allowLower: e.allowLower });
2982
2950
  this.dispatchEvent({
2983
- type: m.RESERVED_RENDER_SIZE_CHANGED,
2951
+ type: g.RESERVED_RENDER_SIZE_CHANGED,
2984
2952
  size: t
2985
2953
  });
2986
2954
  }
2987
2955
  getReservedRenderResolution() {
2988
- return r;
2956
+ return n;
2989
2957
  }
2990
2958
  _isRenderSizeSupported(e, t) {
2991
- return e > r || t > r ? (this._issues.record(S.RENDER_SIZE_DECLINED, `render resolution ${e}×${t} exceeds the ${r}px storage reserve — resize ignored, so output stays at the previous size. Raise it with setReservedRenderResolution( ${Math.max(e, t)} ) before init().`, {
2959
+ return e > n || t > n ? (this._issues.record(C.RENDER_SIZE_DECLINED, `render resolution ${e}×${t} exceeds the ${n}px storage reserve — resize ignored, so output stays at the previous size. Raise it with setReservedRenderResolution( ${Math.max(e, t)} ) before init().`, {
2992
2960
  width: e,
2993
2961
  height: t,
2994
- reserve: r
2962
+ reserve: n
2995
2963
  }), !1) : !0;
2996
2964
  }
2997
2965
  onResize() {
@@ -3002,7 +2970,7 @@ var tr = class extends I {
3002
2970
  }
3003
2971
  _applyRenderResize(e, t) {
3004
2972
  this._isRenderSizeSupported(e, t) && (this.pipeline?.setSize(this._scaled(e), this._scaled(t)), this._renderWidth = e, this._renderHeight = t, this._renderSizeChanged(e, t), this.needsReset = !0, this.dispatchEvent({
3005
- type: m.RESOLUTION_CHANGED,
2973
+ type: g.RESOLUTION_CHANGED,
3006
2974
  width: e,
3007
2975
  height: t
3008
2976
  }));
@@ -3122,7 +3090,7 @@ var tr = class extends I {
3122
3090
  }
3123
3091
  let l = this._completionInfo();
3124
3092
  await this._finishImage(), this.completion.markComplete() && this.dispatchEvent({
3125
- type: m.RENDER_COMPLETE,
3093
+ type: g.RENDER_COMPLETE,
3126
3094
  ...l
3127
3095
  });
3128
3096
  let u = t ? await this._finalDenoise() : !1, { reason: d, ...f } = l;
@@ -3141,9 +3109,9 @@ var tr = class extends I {
3141
3109
  }
3142
3110
  getProvenance() {
3143
3111
  let e = this.stages.pathTracer, t = this.color?.status();
3144
- return i({
3145
- engine: le,
3146
- three: xt,
3112
+ return m({
3113
+ engine: de,
3114
+ three: _t,
3147
3115
  adapter: this.adapterInfo ?? null,
3148
3116
  mode: {
3149
3117
  headless: this._headless,
@@ -3185,7 +3153,7 @@ var tr = class extends I {
3185
3153
  let t = await e.captureAccumulation();
3186
3154
  return {
3187
3155
  v: 1,
3188
- engine: le,
3156
+ engine: de,
3189
3157
  savedAt: Date.now(),
3190
3158
  samples: t.state.frameCount,
3191
3159
  ...t
@@ -3196,7 +3164,7 @@ var tr = class extends I {
3196
3164
  let t = this.stages.pathTracer;
3197
3165
  if (!t) throw Error("restoreRenderCheckpoint: app is not initialized");
3198
3166
  t.restoreAccumulation(e), this.needsReset = !1, this.dispatchEvent({
3199
- type: m.RENDER_RESET,
3167
+ type: g.RENDER_RESET,
3200
3168
  restored: e.samples
3201
3169
  });
3202
3170
  }
@@ -3204,7 +3172,7 @@ var tr = class extends I {
3204
3172
  if (e !== "linear" && e !== "srgb" && !this.color?.hasConfig) throw Error(`renderToBuffer: colorSpace must be 'linear' or 'srgb' without a colour config loaded, got "${e}"`);
3205
3173
  let r = this.stages?.pathTracer, i = r?.storageTextures?.readTarget;
3206
3174
  if (!i) throw Error("renderToBuffer: no render target — call init() and render at least one sample");
3207
- let { width: o, height: s } = r;
3175
+ let { width: a, height: s } = r;
3208
3176
  if (e === "srgb") {
3209
3177
  let r = n === "display" ? this._displaySource(i) : null, c = {
3210
3178
  exposure: this.renderer.toneMappingExposure,
@@ -3212,30 +3180,30 @@ var tr = class extends I {
3212
3180
  saturation: this.settings.get("saturation") ?? 1,
3213
3181
  preserveAlpha: t,
3214
3182
  gain: this._displayGain()
3215
- }, l = await this._toneMapOnGPU(r?.texture ?? null, i, o, s, c), u = !l && c.gain ? await c.gain.cpu() : null;
3183
+ }, l = await this._toneMapOnGPU(r?.texture ?? null, i, a, s, c), u = !l && c.gain ? await c.gain.cpu() : null;
3216
3184
  return {
3217
- data: l ?? a(r ? await this._readTexture(r.texture, o, s) : await this.renderer.readRenderTargetPixelsAsync(i, 0, 0, o, s, 0), {
3185
+ data: l ?? f(r ? await this._readTexture(r.texture, a, s) : await o(this.renderer, i, a, s), {
3218
3186
  ...c,
3219
3187
  pixelGain: u && {
3220
3188
  fn: u,
3221
- width: o,
3189
+ width: a,
3222
3190
  height: s
3223
3191
  }
3224
3192
  }),
3225
- width: o,
3193
+ width: a,
3226
3194
  height: s,
3227
3195
  colorSpace: e,
3228
3196
  source: r?.source ?? "accumulation",
3229
3197
  toneMappedOn: l ? "gpu" : "cpu"
3230
3198
  };
3231
3199
  }
3232
- let { data: c, source: l } = n === "display" ? await this._readDisplaySource(i, o, s) : {
3233
- data: await this.renderer.readRenderTargetPixelsAsync(i, 0, 0, o, s, 0),
3200
+ let { data: c, source: l } = n === "display" ? await this._readDisplaySource(i, a, s) : {
3201
+ data: await o(this.renderer, i, a, s),
3234
3202
  source: "accumulation"
3235
3203
  };
3236
3204
  if (e === "linear") return {
3237
3205
  data: c,
3238
- width: o,
3206
+ width: a,
3239
3207
  height: s,
3240
3208
  colorSpace: e,
3241
3209
  workingSpace: this.color?.workingSpace ?? null,
@@ -3244,7 +3212,7 @@ var tr = class extends I {
3244
3212
  let { rgba: u, colorSpace: d } = this.color.exportPixels(c, e);
3245
3213
  return {
3246
3214
  data: u,
3247
- width: o,
3215
+ width: a,
3248
3216
  height: s,
3249
3217
  colorSpace: d,
3250
3218
  source: l
@@ -3257,7 +3225,7 @@ var tr = class extends I {
3257
3225
  let o = e ? this._readbackPass().draw(e, n, r).texture : t.textures[0], s = a.get(o).texture;
3258
3226
  return s ? (this._readbackToneMapper ??= new Fe(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");
3259
3227
  } catch (e) {
3260
- if (e instanceof ve) throw e;
3228
+ if (e instanceof ye) throw e;
3261
3229
  return this._toneMapFallback("the GPU pass threw", e);
3262
3230
  } finally {
3263
3231
  this._readbackToneMapper?.release(), e && this._textureReadback?.release();
@@ -3265,7 +3233,7 @@ var tr = class extends I {
3265
3233
  }
3266
3234
  _toneMapFallback(e, t = null) {
3267
3235
  let n = t ? String(t?.message ?? t) : null, r = `renderToBuffer: tone mapped on the CPU — ${e}${n ? `: ${n}` : ""}`;
3268
- return $.warn(r), this._issues.warn(S.OUTPUT_TONEMAP_FALLBACK, r, {
3236
+ return $.warn(r), this._issues.warn(C.OUTPUT_TONEMAP_FALLBACK, r, {
3269
3237
  reason: e,
3270
3238
  cause: n
3271
3239
  }), null;
@@ -3380,7 +3348,7 @@ var tr = class extends I {
3380
3348
  ...this._canvasResources()
3381
3349
  ]);
3382
3350
  let t = () => e.measure();
3383
- this._addTrackedListener(this, m.SCENE_REBUILD, t), this._addTrackedListener(this, m.ENVIRONMENT_LOADED, t), this._addTrackedListener(this, m.RESOLUTION_CHANGED, t), this._vramWired = !0;
3351
+ this._addTrackedListener(this, g.SCENE_REBUILD, t), this._addTrackedListener(this, g.ENVIRONMENT_LOADED, t), this._addTrackedListener(this, g.RESOLUTION_CHANGED, t), this._vramWired = !0;
3384
3352
  }
3385
3353
  _collectStageTextures() {
3386
3354
  let e = [], t = this.stages || {}, n = t.pathTracer;
@@ -3395,7 +3363,7 @@ var tr = class extends I {
3395
3363
  }
3396
3364
  getSceneMinY() {
3397
3365
  if (!this.meshScene) return 0;
3398
- let e = new $e().setFromObject(this.meshScene);
3366
+ let e = new Qe().setFromObject(this.meshScene);
3399
3367
  return Number.isFinite(e.min.y) ? e.min.y : 0;
3400
3368
  }
3401
3369
  getMaterialProperty(e, t) {
@@ -3405,7 +3373,7 @@ var tr = class extends I {
3405
3373
  return this.stages.pathTracer?.materialData.getMaterialPropertySource(e, t);
3406
3374
  }
3407
3375
  setMaterialProperty(e, t, n) {
3408
- if (this._sdf?.spilled && c.has(t)) {
3376
+ if (this._sdf?.spilled && a.has(t)) {
3409
3377
  this.ensureSceneResident().then(() => this.setMaterialProperty(e, t, n));
3410
3378
  return;
3411
3379
  }
@@ -3438,7 +3406,7 @@ var tr = class extends I {
3438
3406
  e(), this._refreshEmissiveForVisibility(), this.reset(), this._scheduleRespill();
3439
3407
  }, n = this._sdf?.whenTLASEditable();
3440
3408
  if (!n) return t();
3441
- n.then(t).catch((e) => this._issues.warn(S.STORAGE_READ_FAILED, `reading the TLAS back failed: ${e.message}`));
3409
+ n.then(t).catch((e) => this._issues.warn(C.STORAGE_READ_FAILED, `reading the TLAS back failed: ${e.message}`));
3442
3410
  }
3443
3411
  getScene() {
3444
3412
  return this.meshScene || this.scene;
@@ -3457,7 +3425,7 @@ var tr = class extends I {
3457
3425
  return n && n.key !== "pathtracer:color" && n.texture !== e.texture ? {
3458
3426
  texture: n.texture,
3459
3427
  source: n.key.split(":")[0]
3460
- } : (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", {
3428
+ } : (this._denoiserInUse() && this._issues.record(C.OUTPUT_SOURCE_FALLBACK, "renderToBuffer: 'display' was asked for, but no denoiser has published a picture — returned the raw accumulation", {
3461
3429
  requested: "display",
3462
3430
  read: "accumulation"
3463
3431
  }), null);
@@ -3468,12 +3436,12 @@ var tr = class extends I {
3468
3436
  data: await this._readTexture(r.texture, t, n),
3469
3437
  source: r.source
3470
3438
  } : {
3471
- data: await this.renderer.readRenderTargetPixelsAsync(e, 0, 0, t, n, 0),
3439
+ data: await o(this.renderer, e, t, n),
3472
3440
  source: "accumulation"
3473
3441
  };
3474
3442
  }
3475
3443
  _readbackPass() {
3476
- return this._textureReadback ??= new Zt(this.renderer);
3444
+ return this._textureReadback ??= new d(this.renderer);
3477
3445
  }
3478
3446
  _readTexture(e, t, n) {
3479
3447
  return this._readbackPass().read(e, t, n);
@@ -3484,20 +3452,20 @@ var tr = class extends I {
3484
3452
  n.__rayzeeOriginalColorSpace === void 0 && (n.__rayzeeOriginalColorSpace = e.colorSpace);
3485
3453
  let r = n.__rayzeeOriginalColorSpace;
3486
3454
  if (delete n.ocioColorSpace, delete n.__rayzeeColorSpaceChoice, t == null) e.colorSpace = r, delete n.__rayzeeOriginalColorSpace;
3487
- else if (t === "srgb" || t === "linear") e.colorSpace = t === "srgb" ? O : Ie, n.__rayzeeColorSpaceChoice = t;
3455
+ else if (t === "srgb" || t === "linear") e.colorSpace = t === "srgb" ? Be : Ie, n.__rayzeeColorSpaceChoice = t;
3488
3456
  else {
3489
3457
  if (!this.color?.hasConfig) throw Error(`"${t}" needs a colour config loaded`);
3490
- n.ocioColorSpace = t, e.colorSpace = O;
3458
+ n.ocioColorSpace = t, e.colorSpace = Be;
3491
3459
  }
3492
3460
  e.needsUpdate = !0, this.stages.pathTracer?.sdfs && await this.rebuildMaterials();
3493
3461
  }
3494
3462
  setColorManagement(e) {
3495
- this.color?.dispose(), this.color = new e({ issues: this._issues }), Se(this.color), this.renderer && this.color.attachRenderer(this.renderer);
3463
+ this.color?.dispose(), this.color = new e({ issues: this._issues }), w(this.color), this.renderer && this.color.attachRenderer(this.renderer);
3496
3464
  }
3497
3465
  async loadColorConfig(e = {}) {
3498
3466
  await this._leaveColorWorkingSpace();
3499
- let t = T(this.renderer?.toneMapping), n = await this.color.loadConfig(e);
3500
- return this.color.workingSpaceAdopted && await this.applyColorWorkingSpace(), (!(t?.source === "ocio" && T(this.renderer?.toneMapping) === t) || this.color.workingSpaceAdopted) && this.reset(), n;
3467
+ let t = D(this.renderer?.toneMapping), n = await this.color.loadConfig(e);
3468
+ return this.color.workingSpaceAdopted && await this.applyColorWorkingSpace(), (!(t?.source === "ocio" && D(this.renderer?.toneMapping) === t) || this.color.workingSpaceAdopted) && this.reset(), n;
3501
3469
  }
3502
3470
  async unloadColorConfig() {
3503
3471
  await this._leaveColorWorkingSpace(), this.color.unloadConfig(), this.reset();
@@ -3517,13 +3485,13 @@ var tr = class extends I {
3517
3485
  async rebuildMaterials(e) {
3518
3486
  await this.ensureSceneResident();
3519
3487
  let t = this.stages.pathTracer;
3520
- await t?.rebuildMaterials(e || this.meshScene), t?.triangleStorageNode?.withoutUV && this._sdf?.triangles && ee(e || this.meshScene) && (this._sdf.textureCoordinates = !0, t.setTriangleData(this._sdf.triangles, this._sdf.triangleCount, { textureCoordinates: !0 }), t.setupMaterial()), this.reset();
3488
+ await t?.rebuildMaterials(e || this.meshScene), t?.triangleStorageNode?.withoutUV && this._sdf?.triangles && ne(e || this.meshScene) && (this._sdf.textureCoordinates = !0, t.setTriangleData(this._sdf.triangles, this._sdf.triangleCount, { textureCoordinates: !0 }), t.setupMaterial()), this.reset();
3521
3489
  }
3522
3490
  async _initRenderer() {
3523
- if (ue((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)");
3491
+ if (fe((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)");
3524
3492
  let e = await navigator.gpu.requestAdapter({ powerPreference: "high-performance" });
3525
3493
  if (!e) throw Error("Failed to get WebGPU adapter");
3526
- this.adapterInfo = er(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}`));
3494
+ this.adapterInfo = Xn(e), this.adapterInfo.isSoftware && (this._issues.warn(C.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}`));
3527
3495
  let t = e.limits, n = { maxColorAttachmentBytesPerSample: 128 };
3528
3496
  for (let e of [
3529
3497
  "maxBufferSize",
@@ -3541,23 +3509,23 @@ var tr = class extends I {
3541
3509
  let r = t[e];
3542
3510
  r !== void 0 && (n[e] = r);
3543
3511
  }
3544
- if (n.maxStorageBuffersPerShaderStage = Math.min(t.maxStorageBuffersPerShaderStage, 10), this.renderer = new Ve({
3512
+ if (n.maxStorageBuffersPerShaderStage = Math.min(t.maxStorageBuffersPerShaderStage, 10), this.renderer = new He({
3545
3513
  canvas: this.canvas,
3546
3514
  alpha: !0,
3547
3515
  powerPreference: "high-performance",
3548
3516
  requiredLimits: n
3549
- }), await Xn(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.");
3517
+ }), await Kn(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.");
3550
3518
  let r = this.renderer.backend?.device;
3551
- r?.lost && (this._gpuDevice = r, this._deviceLostHolder = { app: this }, Qn(r, this._deviceLostHolder), r.onuncapturederror = (e) => $.error("WebGPU uncaptured error:", e.error)), ze.setLTC(kt.init()), this.renderer.outputColorSpace = O, this.renderer.toneMapping = ke, this.renderer.toneMappingExposure = 1, this.renderer.setPixelRatio(1), this.color.attachRenderer(this.renderer);
3519
+ r?.lost && (this._gpuDevice = r, this._deviceLostHolder = { app: this }, Jn(r, this._deviceLostHolder), r.onuncapturederror = (e) => $.error("WebGPU uncaptured error:", e.error)), ze.setLTC(Tt.init()), this.renderer.outputColorSpace = Be, this.renderer.toneMapping = ke, this.renderer.toneMappingExposure = 1, this.renderer.setPixelRatio(1), this.color.attachRenderer(this.renderer);
3552
3520
  }
3553
3521
  _initScenes() {
3554
- this.scene = new V(), this.meshScene = new V(), this._sceneHelpers = new Ft();
3522
+ this.scene = new yt(), this.meshScene = new yt(), this._sceneHelpers = new jt();
3555
3523
  }
3556
3524
  _initAssetPipeline() {
3557
- this._sdf = new u({
3525
+ this._sdf = new i({
3558
3526
  issues: this._issues,
3559
3527
  ...this._maxSceneBytes === void 0 ? {} : { maxSceneBytes: this._maxSceneBytes }
3560
- }), this.assetLoader = new Ln(this.meshScene, this.camera, null, {
3528
+ }), this.assetLoader = new Pn(this.meshScene, this.camera, null, {
3561
3529
  issues: this._issues,
3562
3530
  areaLightIntensityScale: () => this.settings.get("areaLightIntensityScale")
3563
3531
  }), this.assetLoader.setRenderer(this.renderer), this.assetLoader.createFloorPlane();
@@ -3565,14 +3533,14 @@ var tr = class extends I {
3565
3533
  _initPipeline() {
3566
3534
  this._createStages();
3567
3535
  let { clientWidth: e, clientHeight: t } = this.canvas;
3568
- this.pipeline = new Jt(this.renderer, e || 1, t || 1, { issues: this._issues }), this.pipeline.addStage(this.stages.pathTracer);
3536
+ this.pipeline = new Gt(this.renderer, e || 1, t || 1, { issues: this._issues }), this.pipeline.addStage(this.stages.pathTracer);
3569
3537
  for (let e of this._extraStages) this.pipeline.addStage(e);
3570
3538
  this.pipeline.addStage(this.stages.compositor);
3571
3539
  let n = this.canvas.clientWidth || 1, r = this.canvas.clientHeight || 1;
3572
3540
  this._displayWidth = n, this._displayHeight = r, this._renderWidth = n, this._renderHeight = r, this.pipeline.setSize(n, r);
3573
3541
  }
3574
3542
  async _initManagers() {
3575
- this.lightManager = new Gn(this.scene, this._sceneHelpers, this.stages.pathTracer, {
3543
+ this.lightManager = new Hn(this.scene, this._sceneHelpers, this.stages.pathTracer, {
3576
3544
  onReset: () => this.reset(),
3577
3545
  onLightRemoved: (e) => this._lightRemoved(e)
3578
3546
  }), 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();
@@ -3583,20 +3551,20 @@ var tr = class extends I {
3583
3551
  if (e.model) this._clearAppendedModels(), await this.loadSceneData({ pendingEnvironment: this._beginSceneMetadataEnvironment() });
3584
3552
  else if (e.texture) {
3585
3553
  let e = this.meshScene.environment;
3586
- e && this.stages.pathTracer && await this.stages.pathTracer.environment.setEnvironmentMap(e), y();
3554
+ e && this.stages.pathTracer && await this.stages.pathTracer.environment.setEnvironmentMap(e), le();
3587
3555
  }
3588
3556
  this.pauseRendering = !1, this.reset();
3589
3557
  }
3590
3558
  }, this._addTrackedListener(this.assetLoader, "load", this._onAssetLoaded), this.pipeline.eventBus.on("pathtracer:compiling", ({ compiling: e }) => this.dispatchEvent({
3591
- type: m.SHADERS_COMPILING,
3559
+ type: g.SHADERS_COMPILING,
3592
3560
  compiling: e
3593
3561
  }));
3594
3562
  }
3595
3563
  _createStages() {
3596
- this.stages.pathTracer = new l(this.renderer, this.scene, this.camera, {
3564
+ this.stages.pathTracer = new u(this.renderer, this.scene, this.camera, {
3597
3565
  hostMemoryGB: this._hostMemoryGB,
3598
3566
  sortMaterials: this.settings.get("wavefrontSortMaterials")
3599
- }), this._extraStages = this._createExtraStages(), this.stages.compositor = new It(this.renderer, {
3567
+ }), this._extraStages = this._createExtraStages(), this.stages.compositor = new Mt(this.renderer, {
3600
3568
  saturation: this.settings.get("saturation") ?? _.saturation,
3601
3569
  pathTracer: this.stages.pathTracer,
3602
3570
  displaySources: this._displaySources()
@@ -3606,13 +3574,13 @@ var tr = class extends I {
3606
3574
  let e = this.stages.pathTracer;
3607
3575
  if (!e) return;
3608
3576
  let t = this.completion.isLimitReached(e, this.settings.get("renderLimitMode"), this.settings.get("renderTimeLimit"));
3609
- t && !e.isComplete ? e.isComplete = !0 : !t && e.isComplete && (e.isComplete = !1, this.completion.resumeFromPause(), this._completionReopened(), this.dispatchEvent({ type: m.RENDER_RESET }), this.wake());
3577
+ t && !e.isComplete ? e.isComplete = !0 : !t && e.isComplete && (e.isComplete = !1, this.completion.resumeFromPause(), this._completionReopened(), this.dispatchEvent({ type: g.RENDER_RESET }), this.wake());
3610
3578
  }
3611
3579
  _forwardEvents(e, t) {
3612
3580
  if (e) for (let n of t) this._addTrackedListener(e, n, (e) => this.dispatchEvent(e));
3613
3581
  }
3614
3582
  _createCamera() {
3615
- let e = new Hn(60, this.canvas.clientWidth / this.canvas.clientHeight || 1, .01, 1e3);
3583
+ let e = new zn(60, this.canvas.clientWidth / this.canvas.clientHeight || 1, .01, 1e3);
3616
3584
  return e.position.set(0, 0, 5), e;
3617
3585
  }
3618
3586
  _createExtraStages() {
@@ -3682,4 +3650,4 @@ var tr = class extends I {
3682
3650
  _disposeExtensions() {}
3683
3651
  };
3684
3652
  //#endregion
3685
- export { Lt as _, cn as a, J as c, q as d, an as f, Vt as g, Ht as h, Hn as i, on as l, Ut as m, er as n, Y as o, Jt as p, Gn as r, W as s, tr as t, rn as u };
3653
+ export { Nt as _, an as a, q as c, K as d, tn as f, Rt as g, zt as h, zn as i, nn as l, Bt as m, Xn as n, J as o, Gt as p, Hn as r, W as s, Zn as t, en as u };