rayzee 11.12.0 → 11.13.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 (29) hide show
  1. package/dist/{ArchiveImporter-vUowipjh.js → ArchiveImporter-DQU55mit.js} +1322 -1290
  2. package/dist/{BidirectionalIntegrator-DPh6PSYb.js → BidirectionalIntegrator-CLmFjSN3.js} +2 -2
  3. package/dist/{NeuralRetouch-wwAwssFM.js → NeuralRetouch-CEkBhI1M.js} +1 -1
  4. package/dist/{NeuralSuperRes-DqV4v_gQ.js → NeuralSuperRes-Drjws9nE.js} +1 -1
  5. package/dist/{PathTracer-DW-ElMON.js → PathTracer-7a7L3cGF.js} +3448 -3404
  6. package/dist/{PhysicalSky-Ispr77Lf.js → PhysicalSky-DUIbTE93.js} +1 -1
  7. package/dist/{RayzeeRenderer-CPbY683A.js → RayzeeRenderer-CjjGT2e0.js} +340 -340
  8. package/dist/{SceneMetadata-BNA22-m3.js → SceneMetadata-CoAHTAmo.js} +1 -1
  9. package/dist/addons/archives.es.js +1 -1
  10. package/dist/addons/bidirectional.es.js +1 -1
  11. package/dist/addons/physical-sky.es.js +1 -1
  12. package/dist/rayzee-core.es.js +4 -4
  13. package/dist/rayzee.es.js +13 -13
  14. package/dist/rayzee.umd.js +110 -110
  15. package/dist/{sceneCachePolicy-BLvdjkVh.js → sceneCachePolicy-DavHt6Ii.js} +217 -185
  16. package/package.json +1 -1
  17. package/src/Processor/ArchiveImporter.js +25 -3
  18. package/src/Processor/AssetLoader.js +6 -4
  19. package/src/Processor/InstanceTable.js +36 -11
  20. package/src/Processor/PBRT/PBRTCurves.js +6 -3
  21. package/src/Processor/PBRT/PBRTSceneBuilder.js +26 -3
  22. package/src/Processor/PBRT/index.js +1 -0
  23. package/src/Processor/SceneProcessor.js +43 -5
  24. package/src/Processor/TLASBuilder.js +5 -4
  25. package/src/Processor/USD/USDScene.js +6 -1
  26. package/src/Processor/USD/index.js +2 -2
  27. package/src/Processor/utils.js +80 -1
  28. package/src/Stages/PathTracerStage.js +17 -6
  29. package/src/TSL/BVHTraversal.js +1 -1
@@ -1,21 +1,21 @@
1
1
  import { dt as e } from "./SolarLimb-ZYl-Pwl0.js";
2
- import { At as t, Dt as n, Mt as r, Ot as i, bt as a, dt as o, ft as s, i as c, jt as l, lt as u, n as d, r as f, ut as p, vt as ee, yt as m } from "./PathTracer-DW-ElMON.js";
3
- import { n as h, t as g } from "./EngineEvents-CLckhYbL.js";
4
- import { $ as te, C as ne, G as _, M as re, Q as ie, T as ae, W as oe, at as v, d as se, et as ce, f as le, l as ue, nt as de, ot as fe, r as pe, rt as me, tt as he, u as ge, v as _e, x as ve } from "./sceneCachePolicy-BLvdjkVh.js";
5
- import { i as y, r as b } from "./Logger-dDDGj9Av.js";
6
- import { f as ye, r as be } from "./BufferLayout-BROyMqO1.js";
7
- import { i as xe, n as x, t as Se } from "./EngineIssues-CfJiBaNj.js";
8
- import { n as Ce, r as we } from "./shared-BGBcSxBQ.js";
9
- import { a as Te } from "./WorkingMatrix-C6y233hT.js";
10
- import { i as Ee, r as De, t as S } from "./ActiveColor-YvuQq44O.js";
11
- import { n as C, r as Oe } from "./AssetConfig-DSEntE65.js";
12
- import { d as ke, l as Ae, m as je, p as Me, t as Ne, u as w } from "./ViewTransforms-CYN7bq2w.js";
13
- import { i as T, n as Pe, r as Fe } from "./identity-C1cLD1C0.js";
14
- import { c as Ie, i as Le, l as Re, o as ze, r as Be, t as Ve } from "./SceneMetadata-BNA22-m3.js";
15
- import { t as He } from "./ToneMapGPU-4GPwoG_c.js";
16
- import { LinearSRGBColorSpace as Ue, MeshBasicNodeMaterial as E, QuadMesh as D, RectAreaLightNode as We, SRGBColorSpace as O, TextureNode as Ge, WebGPURenderer as Ke } from "three/webgpu";
17
- import { Fn as qe, If as Je, cubeTexture as Ye, dot as Xe, float as k, int as A, mix as j, screenUV as Ze, select as M, storage as Qe, texture as $e, toneMappingExposure as et, uint as tt, uniform as N, uv as P, vec3 as F, vec4 as nt } from "three/tsl";
18
- import { Box3 as rt, BufferGeometry as it, CircleGeometry as at, Color as ot, ColorManagement as st, DirectionalLight as ct, DirectionalLightHelper as lt, EquirectangularReflectionMapping as ut, EventDispatcher as I, FloatType as dt, HalfFloatType as ft, LinearFilter as pt, LinearSRGBColorSpace as mt, LoaderUtils as ht, LoadingManager as gt, MathUtils as L, Mesh as _t, MeshPhysicalMaterial as vt, NoBlending as R, NoToneMapping as yt, Object3D as z, OrthographicCamera as bt, PerspectiveCamera as xt, PointLight as St, PointLightHelper as Ct, REVISION as wt, RectAreaLight as B, SRGBColorSpace as V, Scene as H, SpotLight as Tt, SpotLightHelper as Et, TextureLoader as Dt, Vector2 as Ot, Vector3 as U } from "three";
2
+ import { At as t, Dt as n, Mt as r, Ot as i, bt as a, dt as o, ft as s, i as c, jt as l, lt as u, n as d, r as f, ut as p, vt as m, yt as h } from "./PathTracer-7a7L3cGF.js";
3
+ import { n as g, t as _ } from "./EngineEvents-CLckhYbL.js";
4
+ import { $ as ee, C as te, G as v, M as ne, T as y, W as re, Z as ie, ct as ae, d as oe, et as se, f as ce, it as le, l as ue, nt as de, r as fe, rt as pe, st as b, tt as me, u as he, v as ge, x as _e } from "./sceneCachePolicy-DavHt6Ii.js";
5
+ import { i as x, r as S } from "./Logger-dDDGj9Av.js";
6
+ import { f as ve, r as ye } from "./BufferLayout-BROyMqO1.js";
7
+ import { i as be, n as C, t as xe } from "./EngineIssues-CfJiBaNj.js";
8
+ import { n as Se, r as Ce } from "./shared-BGBcSxBQ.js";
9
+ import { a as we } from "./WorkingMatrix-C6y233hT.js";
10
+ import { i as Te, r as Ee, t as w } from "./ActiveColor-YvuQq44O.js";
11
+ import { n as T, r as De } from "./AssetConfig-DSEntE65.js";
12
+ import { d as Oe, l as ke, m as Ae, p as je, t as Me, u as E } from "./ViewTransforms-CYN7bq2w.js";
13
+ import { i as D, n as O, r as Ne } from "./identity-C1cLD1C0.js";
14
+ import { c as k, i as Pe, l as Fe, o as Ie, r as Le, t as Re } from "./SceneMetadata-CoAHTAmo.js";
15
+ import { t as ze } from "./ToneMapGPU-4GPwoG_c.js";
16
+ import { LinearSRGBColorSpace as Be, MeshBasicNodeMaterial as A, QuadMesh as j, RectAreaLightNode as Ve, SRGBColorSpace as M, TextureNode as He, WebGPURenderer as Ue } from "three/webgpu";
17
+ import { Fn as We, If as Ge, cubeTexture as Ke, dot as qe, float as N, int as P, mix as F, screenUV as Je, select as I, storage as Ye, texture as Xe, toneMappingExposure as Ze, uint as Qe, uniform as L, uv as R, vec3 as z, vec4 as B } from "three/tsl";
18
+ import { Box3 as $e, BufferGeometry as et, CircleGeometry as tt, Color as nt, ColorManagement as rt, DirectionalLight as it, DirectionalLightHelper as at, EquirectangularReflectionMapping as ot, EventDispatcher as V, FloatType as st, HalfFloatType as ct, LinearFilter as lt, LinearSRGBColorSpace as ut, LoaderUtils as dt, LoadingManager as ft, MathUtils as H, Mesh as pt, MeshPhysicalMaterial as mt, NoBlending as ht, NoToneMapping as gt, Object3D as _t, OrthographicCamera as vt, PerspectiveCamera as yt, PointLight as bt, PointLightHelper as xt, REVISION as St, RectAreaLight as Ct, SRGBColorSpace as U, Scene as wt, SpotLight as Tt, SpotLightHelper as Et, TextureLoader as Dt, Vector2 as Ot, Vector3 as W } from "three";
19
19
  import { RectAreaLightTexturesLib as kt } from "three/addons/lights/RectAreaLightTexturesLib.js";
20
20
  import { RectAreaLightHelper as At } from "three/addons/helpers/RectAreaLightHelper.js";
21
21
  import { GLTFLoader as jt } from "three/addons/loaders/GLTFLoader.js";
@@ -25,7 +25,7 @@ import { clone as Pt } from "three/addons/utils/SkeletonUtils.js";
25
25
  //#region src/SceneHelpers.js
26
26
  var Ft = class {
27
27
  constructor() {
28
- this.scene = new H(), this._helpers = /* @__PURE__ */ new Map(), this.visible = !1;
28
+ this.scene = new wt(), 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,29 +63,29 @@ var Ft = class {
63
63
  this.clear();
64
64
  }
65
65
  _createHelper(e) {
66
- return e.isRectAreaLight ? new At(e) : e.isPointLight ? new Ct(e, .5) : e.isSpotLight ? new Et(e) : e.isDirectionalLight ? new lt(e, .5) : null;
66
+ return e.isRectAreaLight ? new At(e) : e.isPointLight ? new xt(e, .5) : e.isSpotLight ? new Et(e) : e.isDirectionalLight ? new at(e, .5) : null;
67
67
  }
68
68
  }, It = class extends l {
69
69
  constructor(e, t = {}) {
70
70
  super("Compositor", {
71
71
  ...t,
72
72
  executionMode: r.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 Ge(), this._displayGain = null, this._backdropExposure = null, this._holdBackdrop = N(0, "int"), this._backdropGain = N(1), this._canvasTransform = null, this._canvasMaterial = null, this._canvasQuad = null, this.compositorMaterial = new E(), this.compositorMaterial.blending = R, this._buildColorNode(), this.compositorQuad = new D(this.compositorMaterial), this.setCanvasTransform(t.canvasTransform ?? null);
73
+ }), this.renderer = e, this._lightSources = [...t.displaySources ?? [], "pathtracer:color"], this.saturation = L(t.saturation ?? 1), this._transparentBackground = L(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 = L(1), this._sourceTexNode = new He(), this._displayGain = null, this._backdropExposure = null, this._holdBackdrop = L(0, "int"), this._backdropGain = L(1), this._canvasTransform = null, this._canvasMaterial = null, this._canvasQuad = null, this.compositorMaterial = new A(), this.compositorMaterial.blending = ht, this._buildColorNode(), this.compositorQuad = new j(this.compositorMaterial), this.setCanvasTransform(t.canvasTransform ?? null);
74
74
  }
75
75
  _buildColorNode() {
76
- let t = this._sourceTexNode.sample(P()), n = this._displayGain ? this._displayGain(t.xyz, Ze) : null;
76
+ let t = this._sourceTexNode.sample(R()), n = this._displayGain ? this._displayGain(t.xyz, Je) : null;
77
77
  if (this._backdropExposure !== null) {
78
- let e = n ?? k(1), r = e.add(this._backdropGain.sub(e).mul(t.w.clamp(0, 1).oneMinus()));
79
- n = M(this._holdBackdrop.greaterThan(A(0)), r, e);
78
+ let e = n ?? N(1), r = e.add(this._backdropGain.sub(e).mul(t.w.clamp(0, 1).oneMinus()));
79
+ n = I(this._holdBackdrop.greaterThan(P(0)), r, e);
80
80
  }
81
- let r = n ? t.xyz.mul(n) : t.xyz, i = j(F(Xe(r, e)), r, this.saturation), a = M(this._transparentBackground, t.w, 1);
82
- this._graded = i, this._alpha = a, this.compositorMaterial.colorNode = nt(i, a), this.compositorMaterial.needsUpdate = !0, this._buildCanvasNode();
81
+ let r = n ? t.xyz.mul(n) : t.xyz, i = F(z(qe(r, e)), r, this.saturation), a = I(this._transparentBackground, t.w, 1);
82
+ this._graded = i, this._alpha = a, this.compositorMaterial.colorNode = B(i, a), this.compositorMaterial.needsUpdate = !0, this._buildCanvasNode();
83
83
  }
84
84
  _buildCanvasNode() {
85
- this._canvasMaterial && (this._canvasMaterial.colorNode = nt(this._canvasTransform(this._graded, et), this._alpha), this._canvasMaterial.needsUpdate = !0);
85
+ this._canvasMaterial && (this._canvasMaterial.colorNode = B(this._canvasTransform(this._graded, Ze), this._alpha), this._canvasMaterial.needsUpdate = !0);
86
86
  }
87
87
  setCanvasTransform(e) {
88
- e !== this._canvasTransform && (this._canvasTransform = e, this._canvasMaterial?.dispose(), this._canvasMaterial = null, this._canvasQuad = null, e && (this._canvasMaterial = new E(), this._canvasMaterial.blending = R, this._canvasQuad = new D(this._canvasMaterial), this._buildCanvasNode()));
88
+ e !== this._canvasTransform && (this._canvasTransform = e, this._canvasMaterial?.dispose(), this._canvasMaterial = null, this._canvasQuad = null, e && (this._canvasMaterial = new A(), this._canvasMaterial.blending = ht, this._canvasQuad = new j(this._canvasMaterial), this._buildCanvasNode()));
89
89
  }
90
90
  get showsCanvasTransform() {
91
91
  return this._canvasQuad !== null;
@@ -114,17 +114,17 @@ var Ft = class {
114
114
  let t = this._pathTracer?.getConvergenceDebugSource?.();
115
115
  if (!t) return !1;
116
116
  if (this._debugMaterial && this._debugM2Attr === t.m2 && this._debugMaskAttr === t.frozenMask) return !0;
117
- this._debugMaterial?.dispose(), this._debugTexNode?.dispose(), this._debugM2Attr = t.m2, this._debugMaskAttr = t.frozenMask, this._debugTexNode = new Ge();
118
- let n = qe(() => {
119
- let n = Xe(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 = tt(A(P().y.mul(k(i))).min(i.sub(A(1))).max(A(0)).mul(r).add(a)).toVar(), s = Qe(t.m2, "float").toReadOnly().element(o).toVar(), c = Qe(t.frozenMask, "uint").toReadOnly().element(o).toVar(), l = s.sub(n.mul(n)).max(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(), ee = f.div(p.max(k(1e-6))).toVar(), m = F(n.div(n.add(k(1))).sqrt().mul(.55)).toVar(), h = m.toVar(), g = k(t.frame).greaterThanEqual(k(t.adaptiveMinSamples));
120
- return Je(ee.greaterThanEqual(k(1)).or(g.not()), () => {
121
- let e = j(F(1, .8, .1), F(1, .1, .05), ee.sub(1).div(3).clamp(0, 1));
122
- h.assign(j(m, e, .85));
123
- }), Je(c.equal(tt(1)).and(u), () => {
124
- h.assign(j(m, F(.1, .45, 1), .55));
125
- }), h;
117
+ this._debugMaterial?.dispose(), this._debugTexNode?.dispose(), this._debugM2Attr = t.m2, this._debugMaskAttr = t.frozenMask, this._debugTexNode = new He();
118
+ let n = We(() => {
119
+ let n = qe(this._debugTexNode.sample(R()).toVar().xyz, e).toVar(), r = t.renderWidth, i = t.renderHeight, a = P(R().x.mul(N(r))).min(r.sub(P(1))).max(P(0)), o = Qe(P(R().y.mul(N(i))).min(i.sub(P(1))).max(P(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(N(0)).div(N(t.frame).add(1)).sqrt().toVar(), u = t.usePixelFreeze.greaterThan(P(0)), d = I(n.lessThan(N(1)), n.sqrt(), n).toVar(), f = I(u, l.div(n.add(N(1e-4))), l.div(d.add(N(1e-4)))).toVar(), p = I(u, t.pixelFreezeThreshold, t.noiseThreshold).toVar(), m = f.div(p.max(N(1e-6))).toVar(), h = z(n.div(n.add(N(1))).sqrt().mul(.55)).toVar(), g = h.toVar(), _ = N(t.frame).greaterThanEqual(N(t.adaptiveMinSamples));
120
+ return Ge(m.greaterThanEqual(N(1)).or(_.not()), () => {
121
+ let e = F(z(1, .8, .1), z(1, .1, .05), m.sub(1).div(3).clamp(0, 1));
122
+ g.assign(F(h, e, .85));
123
+ }), Ge(c.equal(Qe(1)).and(u), () => {
124
+ g.assign(F(h, z(.1, .45, 1), .55));
125
+ }), g;
126
126
  });
127
- return this._debugMaterial = new E(), this._debugMaterial.colorNode = nt(n().pow(2.2).mul(this._debugExposureComp), 1), this._debugMaterial.blending = R, this._debugQuad = new D(this._debugMaterial), !0;
127
+ return this._debugMaterial = new A(), this._debugMaterial.colorNode = B(n().pow(2.2).mul(this._debugExposureComp), 1), this._debugMaterial.blending = ht, this._debugQuad = new j(this._debugMaterial), !0;
128
128
  }
129
129
  render(e) {
130
130
  this._draw(e, !1);
@@ -138,7 +138,7 @@ var Ft = class {
138
138
  let t = e.getTexture("pathtracer:color");
139
139
  if (t) {
140
140
  this._debugTexNode.value = t;
141
- let e = this.renderer.toneMapping !== yt;
141
+ let e = this.renderer.toneMapping !== gt;
142
142
  this._debugExposureComp.value = e ? 1 / Math.max(this.renderer.toneMappingExposure, 1e-4) : 1, this.renderer.setRenderTarget(null), this._debugQuad.render(this.renderer);
143
143
  return;
144
144
  }
@@ -154,7 +154,7 @@ var Ft = class {
154
154
  return;
155
155
  }
156
156
  let { toneMapping: r, outputColorSpace: i } = this.renderer;
157
- this.renderer.toneMapping = yt, this.renderer.outputColorSpace = st.workingColorSpace;
157
+ this.renderer.toneMapping = gt, this.renderer.outputColorSpace = rt.workingColorSpace;
158
158
  try {
159
159
  this._canvasQuad.render(this.renderer);
160
160
  } finally {
@@ -292,7 +292,7 @@ var Ft = class {
292
292
  dispose() {
293
293
  this.textures.clear(), this.renderTargets.clear(), this.uniforms.clear(), this._stateChangeCallbacks.clear(), this.state = {};
294
294
  }
295
- }, Rt = class extends I {
295
+ }, Rt = class extends V {
296
296
  constructor() {
297
297
  super(), this._onceCallbacks = /* @__PURE__ */ new Map();
298
298
  }
@@ -330,38 +330,38 @@ var Ft = class {
330
330
  eventNames() {
331
331
  return this._listeners ? Object.keys(this._listeners) : [];
332
332
  }
333
- }, zt = !1, W = [], Bt = /* @__PURE__ */ new WeakMap();
334
- function Vt(e) {
333
+ }, zt = !1, Bt = [], Vt = /* @__PURE__ */ new WeakMap();
334
+ function Ht(e) {
335
335
  zt = !!e;
336
336
  }
337
- function Ht() {
338
- return W.slice();
339
- }
340
337
  function Ut() {
341
- W.length = 0;
338
+ return Bt.slice();
339
+ }
340
+ function Wt() {
341
+ Bt.length = 0;
342
342
  }
343
- function Wt(e) {
343
+ function Gt(e) {
344
344
  let t = [];
345
345
  for (let n of Object.keys(e)) e[n]?.isTextureNode === !0 && t.push(n);
346
346
  return t;
347
347
  }
348
- var Gt = (e) => !e || !e.image || !(e.image.width > 0);
349
- function Kt(e, t, n) {
348
+ var Kt = (e) => !e || !e.image || !(e.image.width > 0);
349
+ function qt(e, t, n) {
350
350
  if (!zt) {
351
351
  n();
352
352
  return;
353
353
  }
354
- let r = Bt.get(e);
354
+ let r = Vt.get(e);
355
355
  if (r || (r = {
356
356
  phase: "pending",
357
357
  unboundAtCompile: []
358
- }, Bt.set(e, r)), r.phase !== "pending") {
359
- n(), r.phase === "watch" && qt(e, r);
358
+ }, Vt.set(e, r)), r.phase !== "pending") {
359
+ n(), r.phase === "watch" && Jt(e, r);
360
360
  return;
361
361
  }
362
362
  let i = Object.prototype.hasOwnProperty.call(t, "compute"), a = t.compute;
363
363
  t.compute = function(...t) {
364
- 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);
364
+ return r.phase === "pending" && (r.unboundAtCompile = Gt(e).filter((t) => Kt(e[t].value)), r.phase = r.unboundAtCompile.length < 2 ? "done" : "watch"), a.apply(this, t);
365
365
  };
366
366
  try {
367
367
  n();
@@ -369,14 +369,14 @@ function Kt(e, t, n) {
369
369
  i ? t.compute = a : delete t.compute;
370
370
  }
371
371
  }
372
- function qt(e, t) {
372
+ function Jt(e, t) {
373
373
  let n = [];
374
374
  for (let r of t.unboundAtCompile) {
375
375
  let t = e[r]?.value;
376
- if (Gt(t)) return;
376
+ if (Kt(t)) return;
377
377
  t.isStorageTexture !== !0 && n.push(r);
378
378
  }
379
- t.phase = "done", n.length !== 0 && W.push({
379
+ t.phase = "done", n.length !== 0 && Bt.push({
380
380
  stage: e.name,
381
381
  nodes: n,
382
382
  unboundAtCompile: t.unboundAtCompile.slice(),
@@ -385,11 +385,11 @@ function qt(e, t) {
385
385
  }
386
386
  //#endregion
387
387
  //#region src/Pipeline/RenderPipeline.js
388
- var Jt = class {
388
+ var Yt = class {
389
389
  _reportStageFailure(e, t, n) {
390
390
  console.error(`[Pipeline] Error in stage '${e}' (${t}):`, n);
391
391
  let r = `${e}:${t}`;
392
- this._reportedStageFailures.has(r) || (this._reportedStageFailures.add(r), this._issues?.record(x.STAGE_RENDER_FAILED, `stage "${e}" threw during ${t} — the frame is incomplete`, {
392
+ this._reportedStageFailures.has(r) || (this._reportedStageFailures.add(r), this._issues?.record(C.STAGE_RENDER_FAILED, `stage "${e}" threw during ${t} — the frame is incomplete`, {
393
393
  stage: e,
394
394
  phase: t,
395
395
  cause: String(n?.message ?? n)
@@ -430,7 +430,7 @@ var Jt = class {
430
430
  }
431
431
  try {
432
432
  let n = this.stats.enabled ? performance.now() : 0;
433
- if (Kt(t, this.renderer, () => t.render(this.context, e)), this.stats.enabled) {
433
+ if (qt(t, this.renderer, () => t.render(this.context, e)), this.stats.enabled) {
434
434
  let e = performance.now() - n;
435
435
  this.stats.timings.has(t.name) || this.stats.timings.set(t.name, []);
436
436
  let r = this.stats.timings.get(t.name);
@@ -528,7 +528,7 @@ var Jt = class {
528
528
  let e = this.getInfo();
529
529
  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();
530
530
  }
531
- }, Yt = b("engine"), Xt = class {
531
+ }, Xt = S("engine"), Zt = class {
532
532
  constructor() {
533
533
  this.timeElapsed = 0, this.lastResetTime = performance.now(), this.renderCompleteDispatched = !1, this.budgetOverrun = !1, this._budgetHeldWarned = !1;
534
534
  }
@@ -536,7 +536,7 @@ var Jt = class {
536
536
  this.timeElapsed = (performance.now() - this.lastResetTime) / 1e3;
537
537
  }
538
538
  isTimeLimitReached(e, t, n) {
539
- 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);
539
+ 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, Xt.warn(`render time limit (${n}s) expired before the first sample landed — holding the deadline open to avoid capturing an empty frame`)), !1);
540
540
  }
541
541
  isLimitReached(e, t, n) {
542
542
  return e ? this.isTimeLimitReached(e, t, n) ? !0 : this.stopCondition(e) !== null : !1;
@@ -553,15 +553,15 @@ var Jt = class {
553
553
  resumeFromPause() {
554
554
  this.renderCompleteDispatched = !1, this.lastResetTime = performance.now() - this.timeElapsed * 1e3;
555
555
  }
556
- }, Zt = 864e5, G = Object.freeze({
556
+ }, Qt = 864e5, G = Object.freeze({
557
557
  IMMUTABLE: "immutable",
558
558
  REVALIDATE: "revalidate",
559
559
  NETWORK: "network"
560
- }), Qt = (e, t) => ({
560
+ }), $t = (e, t) => ({
561
561
  loaded: e,
562
562
  total: t,
563
563
  lengthComputable: t > 0 && e <= t
564
- }), K = (e, t) => e.headers?.get?.(t) ?? null, $t = (e) => e.reason ?? new DOMException("aborted", "AbortError");
564
+ }), K = (e, t) => e.headers?.get?.(t) ?? null, en = (e) => e.reason ?? new DOMException("aborted", "AbortError");
565
565
  function q(e) {
566
566
  try {
567
567
  let t = new URL(e, globalThis.location?.href ?? "http://localhost/").pathname;
@@ -570,36 +570,36 @@ function q(e) {
570
570
  return "download";
571
571
  }
572
572
  }
573
- async function en(e, { onProgress: t, signal: n }) {
573
+ async function tn(e, { onProgress: t, signal: n }) {
574
574
  let r = Number(K(e, "content-length")) || 0, i = K(e, "content-type") ?? "";
575
575
  if (!e.body) return new Blob([await e.arrayBuffer()], { type: i });
576
576
  let a = e.body.getReader(), o = [], s = 0;
577
577
  for (;;) {
578
- if (n?.aborted) throw a.cancel().catch(() => {}), $t(n);
578
+ if (n?.aborted) throw a.cancel().catch(() => {}), en(n);
579
579
  let { done: e, value: i } = await a.read();
580
580
  if (e) break;
581
- o.push(i), s += i.length, t?.(Qt(s, r));
581
+ o.push(i), s += i.length, t?.($t(s, r));
582
582
  }
583
583
  return new Blob(o, { type: i });
584
584
  }
585
- var tn = (e, t, n) => new File([e], t, {
585
+ var nn = (e, t, n) => new File([e], t, {
586
586
  type: n || e.type,
587
587
  lastModified: e.lastModified ?? Date.now()
588
- }), nn = () => {}, J = class {
588
+ }), rn = () => {}, J = class {
589
589
  constructor(e) {
590
590
  this._storage = e, this._revalidating = /* @__PURE__ */ new Set();
591
591
  }
592
592
  get _area() {
593
- return this._storage?.area(we.DOWNLOADS) ?? null;
593
+ return this._storage?.area(Ce.DOWNLOADS) ?? null;
594
594
  }
595
- async fetch(e, { key: t = e, name: n = q(e), policy: r = G.REVALIDATE, maxAgeMs: i = Zt, onProgress: a = null, signal: o = null, fetchOptions: s = {} } = {}) {
595
+ async fetch(e, { key: t = e, name: n = q(e), policy: r = G.REVALIDATE, maxAgeMs: i = Qt, onProgress: a = null, signal: o = null, fetchOptions: s = {} } = {}) {
596
596
  let c = this._area;
597
597
  if (c && r !== G.NETWORK) {
598
598
  let o = await c.open(t);
599
599
  if (o) {
600
600
  let c = await o.file("data");
601
- if (c) return r === G.REVALIDATE && Date.now() - (o.extra.checkedAt ?? 0) >= i && this._revalidate(e, t, n, o.extra, s), a?.(Qt(c.size, c.size)), {
602
- file: tn(c, n, o.extra.contentType),
601
+ if (c) return r === G.REVALIDATE && Date.now() - (o.extra.checkedAt ?? 0) >= i && this._revalidate(e, t, n, o.extra, s), a?.($t(c.size, c.size)), {
602
+ file: nn(c, n, o.extra.contentType),
603
603
  release: () => o.release(),
604
604
  fromCache: !0
605
605
  };
@@ -617,7 +617,7 @@ var tn = (e, t, n) => new File([e], t, {
617
617
  return await this._area?.has(e) === !0;
618
618
  }
619
619
  async _download(e, t, n, { onProgress: r, signal: i, fetchOptions: a, cache: o }) {
620
- if (i?.aborted) throw $t(i);
620
+ if (i?.aborted) throw en(i);
621
621
  let s = await fetch(e, {
622
622
  ...a,
623
623
  signal: i
@@ -634,17 +634,17 @@ var tn = (e, t, n) => new File([e], t, {
634
634
  expectedBytes: c
635
635
  }) : null;
636
636
  if (!u) return {
637
- file: tn(await en(s, {
637
+ file: nn(await tn(s, {
638
638
  onProgress: r,
639
639
  signal: i
640
640
  }), n, l.contentType),
641
- release: nn,
641
+ release: rn,
642
642
  fromCache: !1
643
643
  };
644
644
  try {
645
645
  await u.writeStream("data", s.body, {
646
646
  signal: i,
647
- onProgress: (e) => r?.(Qt(e, c))
647
+ onProgress: (e) => r?.($t(e, c))
648
648
  }), await u.commit(l);
649
649
  } catch (o) {
650
650
  if (await u.abort(), o?.name !== "QuotaExceededError") throw o;
@@ -658,7 +658,7 @@ var tn = (e, t, n) => new File([e], t, {
658
658
  let d = await this._area.open(t, { wait: !0 }), f = d && await d.file("data");
659
659
  if (!f) throw d?.release(), Error(`storage: ${n} vanished right after it was saved`);
660
660
  return {
661
- file: tn(f, n, l.contentType),
661
+ file: nn(f, n, l.contentType),
662
662
  release: () => d.release(),
663
663
  fromCache: !1
664
664
  };
@@ -695,16 +695,16 @@ var tn = (e, t, n) => new File([e], t, {
695
695
  }
696
696
  }
697
697
  };
698
- function rn(e, t, n) {
698
+ function an(e, t, n) {
699
699
  return new J(t).fetch(e, n);
700
700
  }
701
- function an() {
702
- return new J(Ce(C().cacheNamespace));
701
+ function on() {
702
+ return new J(Se(T().cacheNamespace));
703
703
  }
704
- async function on(e, { downloads: t = an(), ...n } = {}) {
704
+ async function sn(e, { downloads: t = on(), ...n } = {}) {
705
705
  if (!t._storage || !/^https?:/i.test(e)) return {
706
706
  url: e,
707
- release: nn,
707
+ release: rn,
708
708
  cached: !1
709
709
  };
710
710
  let { file: r, release: i } = await t.fetch(e, n), a = URL.createObjectURL(r);
@@ -718,7 +718,7 @@ async function on(e, { downloads: t = an(), ...n } = {}) {
718
718
  }
719
719
  //#endregion
720
720
  //#region src/RenderSettings.js
721
- var sn = {
721
+ var cn = {
722
722
  maxBounces: {
723
723
  uniform: "maxBounces",
724
724
  reset: !0
@@ -944,9 +944,9 @@ var sn = {
944
944
  HOST: "host",
945
945
  SCENE_METADATA: "scene-metadata",
946
946
  MODE_PRESET: "mode-preset"
947
- }), cn = class extends I {
948
- constructor(e = _, { issues: t = null } = {}) {
949
- 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);
947
+ }), ln = class extends V {
948
+ constructor(e = v, { issues: t = null } = {}) {
949
+ super(), this._issues = t, this._defaults = e, this._routes = new Map(Object.entries(cn)), this._values = /* @__PURE__ */ new Map(), this._sources = /* @__PURE__ */ new Map(), this._pathTracer = null, this._resetCallback = null, this._handlers = {}, this._initDefaults(e);
950
950
  }
951
951
  bind(e) {
952
952
  this._pathTracer = e.stages.pathTracer, this._resetCallback = e.resetCallback, this._handlers = this._buildHandlers(e);
@@ -962,11 +962,11 @@ var sn = {
962
962
  }
963
963
  _buildHandlers({ stages: e, resetCallback: t, reconcileCompletion: n, applyExposure: r, onCameraProjection: i }) {
964
964
  let a = new Ot(), o = (t, n) => {
965
- a.set(n?.[0] ?? 0, n?.[1] ?? 0).multiplyScalar(L.DEG2RAD), e.pathTracer?.setUniform(t, a);
965
+ a.set(n?.[0] ?? 0, n?.[1] ?? 0).multiplyScalar(H.DEG2RAD), e.pathTracer?.setUniform(t, a);
966
966
  };
967
967
  return {
968
968
  handleCameraProjection: (t) => {
969
- e.pathTracer?.setUniform("cameraProjection", oe[t] ?? oe.perspective), i?.(t);
969
+ e.pathTracer?.setUniform("cameraProjection", re[t] ?? re.perspective), i?.(t);
970
970
  },
971
971
  handleDofMode: (t) => e.pathTracer?.setUniform("dofMode", +(t === "look")),
972
972
  handlePanoramaLonRange: (e) => o("panoLonRange", e),
@@ -975,7 +975,7 @@ var sn = {
975
975
  e.pathTracer?.setUniform("transparentBackground", t), e.compositor?.setTransparentBackground(t);
976
976
  },
977
977
  handleBackgroundColor: (t) => {
978
- let n = t?.isColor ? t : new ot(t);
978
+ let n = t?.isColor ? t : new nt(t);
979
979
  e.pathTracer?.setUniform("backgroundColor", n);
980
980
  },
981
981
  handleExposure: (e) => {
@@ -1019,7 +1019,7 @@ var sn = {
1019
1019
  set(e, t, { reset: n, silent: r, source: i = Y.HOST } = {}) {
1020
1020
  let a = this._applyOne(e, t, i);
1021
1021
  a?.route && ((n === void 0 ? a.route.reset ?? !0 : n) && this._resetCallback?.(), r || this.dispatchEvent({
1022
- type: g.SETTING_CHANGED,
1022
+ type: _.SETTING_CHANGED,
1023
1023
  key: e,
1024
1024
  value: t,
1025
1025
  prev: a.prev
@@ -1030,7 +1030,7 @@ var sn = {
1030
1030
  for (let [n, a] of Object.entries(e)) {
1031
1031
  let e = this._applyOne(n, a, r);
1032
1032
  e?.route && ((e.route.reset ?? !0) && (i = !0), t || this.dispatchEvent({
1033
- type: g.SETTING_CHANGED,
1033
+ type: _.SETTING_CHANGED,
1034
1034
  key: n,
1035
1035
  value: a,
1036
1036
  prev: e.prev
@@ -1052,7 +1052,7 @@ var sn = {
1052
1052
  });
1053
1053
  }
1054
1054
  _reportUnknownKey(e) {
1055
- this._issues?.record(x.SETTING_UNKNOWN_KEY, `unknown setting "${e}" — stored but never applied to any stage`, { key: e });
1055
+ this._issues?.record(C.SETTING_UNKNOWN_KEY, `unknown setting "${e}" — stored but never applied to any stage`, { key: e });
1056
1056
  }
1057
1057
  get(e) {
1058
1058
  return this._values.get(e);
@@ -1080,7 +1080,7 @@ var sn = {
1080
1080
  }
1081
1081
  restore(e) {
1082
1082
  let t = {}, n = [];
1083
- for (let [r, i] of Object.entries(e ?? {})) this._routes.has(r) ? t[r] = m(i) : n.push(r);
1083
+ for (let [r, i] of Object.entries(e ?? {})) this._routes.has(r) ? t[r] = h(i) : n.push(r);
1084
1084
  return this.setMany(t), n;
1085
1085
  }
1086
1086
  applyAll() {
@@ -1093,19 +1093,19 @@ var sn = {
1093
1093
  e.uniform ? this._pathTracer?.setUniform(e.uniform, t) : e.handler ? this._handlers[e.handler]?.(t, n) : e.apply?.(t, n);
1094
1094
  }
1095
1095
  _initDefaults(e) {
1096
- for (let t of Object.keys(sn)) t in e && (this._values.set(t, e[t]), this._sources.set(t, Y.DEFAULT));
1096
+ for (let t of Object.keys(cn)) t in e && (this._values.set(t, e[t]), this._sources.set(t, Y.DEFAULT));
1097
1097
  }
1098
- }, ln = class {
1098
+ }, un = class {
1099
1099
  constructor({ issues: e = null } = {}) {
1100
- this._issues = e, this._renderer = null, this._offRegistry = Me(() => {
1101
- this._renderer && je(this._renderer);
1100
+ this._issues = e, this._renderer = null, this._offRegistry = je(() => {
1101
+ this._renderer && Ae(this._renderer);
1102
1102
  });
1103
1103
  }
1104
1104
  get hasConfig() {
1105
1105
  return !1;
1106
1106
  }
1107
1107
  get workingSpace() {
1108
- return S;
1108
+ return w;
1109
1109
  }
1110
1110
  get workingSpaceAdopted() {
1111
1111
  return !1;
@@ -1115,32 +1115,32 @@ var sn = {
1115
1115
  }
1116
1116
  attachRenderer(e) {
1117
1117
  this._renderer = e;
1118
- let t = je(e);
1119
- return e.outputColorSpace = V, t;
1118
+ let t = Ae(e);
1119
+ return e.outputColorSpace = U, t;
1120
1120
  }
1121
1121
  listViews() {
1122
- return ke();
1122
+ return Oe();
1123
1123
  }
1124
1124
  get activeView() {
1125
1125
  return null;
1126
1126
  }
1127
1127
  setActiveView(e) {
1128
- let t = w(e);
1128
+ let t = E(e);
1129
1129
  if (!t) throw Error(`no view transform with id ${e}`);
1130
1130
  if (t.outputEncoded) throw Error(`"${t.name}" returns display-encoded colour: it needs rayzee/addons/color`);
1131
1131
  return this._renderer && (this._renderer.toneMapping = e), t;
1132
1132
  }
1133
1133
  _publishWorkingMatrix() {
1134
- Te(null, S);
1134
+ we(null, w);
1135
1135
  }
1136
1136
  loadConfig() {
1137
1137
  let e = "colour configs need the OCIO pipeline: renderer.setColorManagement( ColorManagement ), from rayzee/addons/color";
1138
- return this._issues?.record(x.CAPABILITY_MISSING, e, { capability: "color" }), Promise.reject(Error(e));
1138
+ return this._issues?.record(C.CAPABILITY_MISSING, e, { capability: "color" }), Promise.reject(Error(e));
1139
1139
  }
1140
1140
  unloadConfig() {}
1141
1141
  setWorkingSpace() {}
1142
1142
  setHdrOutput(e) {
1143
- e && this._issues?.warn(x.CAPABILITY_MISSING, "HDR on screen needs rayzee/addons/color", { capability: "color" });
1143
+ e && this._issues?.warn(C.CAPABILITY_MISSING, "HDR on screen needs rayzee/addons/color", { capability: "color" });
1144
1144
  }
1145
1145
  get hdrOutput() {
1146
1146
  return !1;
@@ -1154,14 +1154,14 @@ var sn = {
1154
1154
  exportPixels(e) {
1155
1155
  return {
1156
1156
  rgba: e,
1157
- colorSpace: S
1157
+ colorSpace: w
1158
1158
  };
1159
1159
  }
1160
1160
  status() {
1161
- let e = this._renderer ? w(this._renderer.toneMapping) : null;
1161
+ let e = this._renderer ? E(this._renderer.toneMapping) : null;
1162
1162
  return {
1163
1163
  config: null,
1164
- workingSpace: S,
1164
+ workingSpace: w,
1165
1165
  workingSpaceAdopted: !1,
1166
1166
  activeTransform: e ? {
1167
1167
  id: e.id,
@@ -1171,8 +1171,8 @@ var sn = {
1171
1171
  activeView: null,
1172
1172
  context: null,
1173
1173
  exportSpace: null,
1174
- views: ke(),
1175
- registryVersion: Ae(),
1174
+ views: Oe(),
1175
+ registryVersion: ke(),
1176
1176
  bakeError: e?.error ?? null,
1177
1177
  canvasColorSpace: "srgb",
1178
1178
  hdr: {
@@ -1184,10 +1184,10 @@ var sn = {
1184
1184
  };
1185
1185
  }
1186
1186
  dispose() {
1187
- this._offRegistry?.(), this._renderer = null, this._issues = null, De() === this && (Te(null), Ee(null));
1187
+ this._offRegistry?.(), this._renderer = null, this._issues = null, Ee() === this && (we(null), Te(null));
1188
1188
  }
1189
- }, un = "KHR_materials_diffuse_transmission";
1190
- function dn(e) {
1189
+ }, dn = "KHR_materials_diffuse_transmission";
1190
+ function fn(e) {
1191
1191
  let t = (t, n, r, i) => {
1192
1192
  let a = {};
1193
1193
  return e.assignTexture(a, n, r, i).then(() => {
@@ -1195,7 +1195,7 @@ function dn(e) {
1195
1195
  });
1196
1196
  };
1197
1197
  return {
1198
- name: un,
1198
+ name: dn,
1199
1199
  afterRoot(n) {
1200
1200
  let r = e.json.materials ?? [], i = /* @__PURE__ */ new Set(), a = [];
1201
1201
  for (let o of n.scenes ?? []) o.traverse((n) => {
@@ -1203,7 +1203,7 @@ function dn(e) {
1203
1203
  for (let n of o) {
1204
1204
  if (i.has(n)) continue;
1205
1205
  i.add(n);
1206
- let o = e.associations.get(n)?.materials, s = o === void 0 ? null : r[o]?.extensions?.[un];
1206
+ let o = e.associations.get(n)?.materials, s = o === void 0 ? null : r[o]?.extensions?.[dn];
1207
1207
  if (!s) continue;
1208
1208
  n.diffuseTransmission = s.diffuseTransmissionFactor ?? 0;
1209
1209
  let [c, l, u] = s.diffuseTransmissionColorFactor ?? [
@@ -1211,7 +1211,7 @@ function dn(e) {
1211
1211
  1,
1212
1212
  1
1213
1213
  ];
1214
- n.diffuseTransmissionColor = new ot().setRGB(c, l, u, mt), s.diffuseTransmissionTexture && a.push(t(n, "diffuseTransmissionMap", s.diffuseTransmissionTexture)), s.diffuseTransmissionColorTexture && a.push(t(n, "diffuseTransmissionColorMap", s.diffuseTransmissionColorTexture, V));
1214
+ n.diffuseTransmissionColor = new nt().setRGB(c, l, u, ut), s.diffuseTransmissionTexture && a.push(t(n, "diffuseTransmissionMap", s.diffuseTransmissionTexture)), s.diffuseTransmissionColorTexture && a.push(t(n, "diffuseTransmissionColorMap", s.diffuseTransmissionColorTexture, U));
1215
1215
  }
1216
1216
  });
1217
1217
  return Promise.all(a);
@@ -1220,20 +1220,20 @@ function dn(e) {
1220
1220
  }
1221
1221
  //#endregion
1222
1222
  //#region src/Processor/GLTFDecoders.js
1223
- var fn = "KHR_draco_mesh_compression", pn = "KHR_texture_basisu", mn = ["EXT_meshopt_compression", "KHR_meshopt_compression"], hn = new TextDecoder();
1224
- function gn(e) {
1223
+ var pn = "KHR_draco_mesh_compression", mn = "KHR_texture_basisu", hn = ["EXT_meshopt_compression", "KHR_meshopt_compression"], gn = new TextDecoder();
1224
+ function _n(e) {
1225
1225
  if (typeof e == "string") return e;
1226
1226
  if (!(e instanceof ArrayBuffer)) return JSON.stringify(e?.extensionsUsed ?? []);
1227
1227
  let t = new DataView(e);
1228
- if (!(e.byteLength >= 20 && t.getUint32(0, !0) === 1179937895)) return hn.decode(e);
1228
+ if (!(e.byteLength >= 20 && t.getUint32(0, !0) === 1179937895)) return gn.decode(e);
1229
1229
  let n = Math.min(t.getUint32(12, !0), e.byteLength - 20);
1230
- return hn.decode(new Uint8Array(e, 20, n));
1230
+ return gn.decode(new Uint8Array(e, 20, n));
1231
1231
  }
1232
- async function _n(e, t, n) {
1233
- let { dracoDecoderPath: r, ktx2TranscoderPath: i } = C(), [a, o, s] = await Promise.all([
1234
- t.includes(fn) && !e.dracoLoader ? import("three/addons/loaders/DRACOLoader.js") : null,
1235
- t.includes(pn) && !e.ktx2Loader ? import("three/addons/loaders/KTX2Loader.js") : null,
1236
- mn.some((e) => t.includes(e)) && !e.meshoptDecoder ? import("three/addons/libs/meshopt_decoder.module.js") : null
1232
+ async function vn(e, t, n) {
1233
+ let { dracoDecoderPath: r, ktx2TranscoderPath: i } = T(), [a, o, s] = await Promise.all([
1234
+ t.includes(pn) && !e.dracoLoader ? import("three/addons/loaders/DRACOLoader.js") : null,
1235
+ t.includes(mn) && !e.ktx2Loader ? import("three/addons/loaders/KTX2Loader.js") : null,
1236
+ hn.some((e) => t.includes(e)) && !e.meshoptDecoder ? import("three/addons/libs/meshopt_decoder.module.js") : null
1237
1237
  ]);
1238
1238
  if (a) {
1239
1239
  let t = new a.DRACOLoader();
@@ -1252,15 +1252,15 @@ async function _n(e, t, n) {
1252
1252
  }
1253
1253
  s && e.setMeshoptDecoder(s.MeshoptDecoder);
1254
1254
  }
1255
- function vn(e, t) {
1255
+ function yn(e, t) {
1256
1256
  let n = e.parse.bind(e);
1257
1257
  return e.parse = (r, i, a, o) => {
1258
- _n(e, gn(r), t).then(() => n(r, i, a, o), (e) => o?.(e));
1258
+ vn(e, _n(r), t).then(() => n(r, i, a, o), (e) => o?.(e));
1259
1259
  }, e;
1260
1260
  }
1261
1261
  //#endregion
1262
1262
  //#region src/Processor/AssetLoader.js
1263
- var yn = b("assets"), bn = {
1263
+ var bn = S("assets"), xn = {
1264
1264
  glb: {
1265
1265
  type: "model",
1266
1266
  name: "GLB (GLTF Binary)"
@@ -1295,7 +1295,7 @@ var yn = b("assets"), bn = {
1295
1295
  }, Z = {
1296
1296
  addOn: "rayzee/addons/formats",
1297
1297
  install: "assetLoader.registerFormat()"
1298
- }, xn = {
1298
+ }, Sn = {
1299
1299
  zip: X,
1300
1300
  gz: X,
1301
1301
  tgz: X,
@@ -1312,30 +1312,30 @@ var yn = b("assets"), bn = {
1312
1312
  usdz: Z,
1313
1313
  exr: Z
1314
1314
  };
1315
- function Sn(e) {
1316
- let t = new it();
1315
+ function Cn(e) {
1316
+ let t = new et();
1317
1317
  for (let n in e.attributes) t.setAttribute(n, e.attributes[n]);
1318
1318
  e.index && t.setIndex(e.index);
1319
1319
  for (let n of e.groups) t.addGroup(n.start, n.count, n.materialIndex);
1320
1320
  return t;
1321
1321
  }
1322
- var Cn = {
1322
+ var wn = {
1323
1323
  name: "RAYZEE_camera_clip",
1324
1324
  afterRoot(e) {
1325
1325
  for (let t of e.scenes) t.traverse((e) => {
1326
1326
  e.isCamera && e.near > 0 && (e.userData.clipStart = e.near);
1327
1327
  });
1328
1328
  }
1329
- }, wn = 683;
1330
- function Tn(e, t, n, r) {
1329
+ }, Tn = 683;
1330
+ function En(e, t, n, r) {
1331
1331
  if (!(r.normalize ?? !0)) return Math.PI;
1332
- 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);
1332
+ let i = r.shape === "ellipse" || r.shape === "disk" ? Math.PI / 4 : 1, a = e.getWorldScale(new W()), o = Math.PI * i * Math.abs(t * a.x * n * a.y);
1333
1333
  return Number.isFinite(o) ? o : Math.PI;
1334
1334
  }
1335
- var En = class e extends I {
1335
+ var Dn = class e extends V {
1336
1336
  constructor(e, t, n, { issues: r = null, areaLightIntensityScale: i = null } = {}) {
1337
- 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 gt(), 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) => {
1338
- this._loadCancelled || this._issues?.record(x.ASSET_UNREACHABLE, `asset "${e}" could not be fetched — anything depending on it renders without it`, { url: e });
1337
+ super(), this.scene = e, this.camera = t, this.controls = n, this.targetModel = null, this.floorPlane = null, this.sceneScale = 1, this.sceneSize = new W(1, 1, 1), this.loaderCache = {}, this.uploadedFileInfo = null, this.animations = [], this.renderer = null, this.sceneMetadata = null, this._loadingManager = new ft(), 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 ?? (() => v.areaLightIntensityScale), this._loadingManager.onError = (e) => {
1338
+ this._loadCancelled || this._issues?.record(C.ASSET_UNREACHABLE, `asset "${e}" could not be fetched — anything depending on it renders without it`, { url: e });
1339
1339
  };
1340
1340
  }
1341
1341
  cancelActiveLoad() {
@@ -1350,7 +1350,7 @@ var En = class e extends I {
1350
1350
  let o = new AbortController();
1351
1351
  this._urlAbort = o;
1352
1352
  try {
1353
- return await on(t, {
1353
+ return await sn(t, {
1354
1354
  downloads: this.downloads,
1355
1355
  key: i,
1356
1356
  policy: a,
@@ -1383,7 +1383,7 @@ var En = class e extends I {
1383
1383
  _downloadProgress(e, t) {
1384
1384
  return (n) => {
1385
1385
  let r = n?.loaded || 0, i = n?.lengthComputable && n.total || 0;
1386
- v({
1386
+ b({
1387
1387
  isLoading: !0,
1388
1388
  status: e,
1389
1389
  loadedBytes: r,
@@ -1394,7 +1394,7 @@ var En = class e extends I {
1394
1394
  };
1395
1395
  }
1396
1396
  _downloadComplete(e = "Processing Data...", t = 62) {
1397
- v({
1397
+ b({
1398
1398
  status: e,
1399
1399
  progress: t,
1400
1400
  canCancel: !1,
@@ -1442,10 +1442,10 @@ var En = class e extends I {
1442
1442
  }
1443
1443
  getFileFormat(e) {
1444
1444
  let t = e.split(".").pop().toLowerCase();
1445
- return bn[t] || this._formats.get(t) || this._archiveFormats?.[t] || null;
1445
+ return xn[t] || this._formats.get(t) || this._archiveFormats?.[t] || null;
1446
1446
  }
1447
1447
  formatError(e) {
1448
- let t = xn[e.split(".").pop().toLowerCase()];
1448
+ let t = Sn[e.split(".").pop().toLowerCase()];
1449
1449
  return /* @__PURE__ */ Error(t ? `${e}: this format is read by ${t.addOn} — install it with ${t.install}` : `Unsupported file format: ${e}`);
1450
1450
  }
1451
1451
  async inspectArchive(e) {
@@ -1468,7 +1468,7 @@ var En = class e extends I {
1468
1468
  async loadAssetFromFile(e, t = {}) {
1469
1469
  let n = e.name, r = this.getFileFormat(n);
1470
1470
  if (!r) throw this.formatError(n);
1471
- v({
1471
+ b({
1472
1472
  isLoading: !0,
1473
1473
  status: `Loading ${r.name}...`,
1474
1474
  progress: 2
@@ -1500,7 +1500,7 @@ var En = class e extends I {
1500
1500
  async loadFolder(e, t = {}) {
1501
1501
  let n = await this._archiveImporter();
1502
1502
  if (!n) throw Error(`${e.name}: folders are read by ${X.addOn} — install it with ${X.install}`);
1503
- v({
1503
+ b({
1504
1504
  isLoading: !0,
1505
1505
  status: `Loading ${e.name}...`,
1506
1506
  progress: 2
@@ -1520,7 +1520,7 @@ var En = class e extends I {
1520
1520
  if (!this.getFileFormat(r)) throw this.formatError(r);
1521
1521
  this._loadCancelled = !1;
1522
1522
  let s = e._isNetworkUrl(t), c = `Downloading ${r}...`, l = new AbortController();
1523
- this._urlAbort = l, v({
1523
+ this._urlAbort = l, b({
1524
1524
  isLoading: !0,
1525
1525
  status: c,
1526
1526
  progress: 2,
@@ -1552,7 +1552,7 @@ var En = class e extends I {
1552
1552
  }
1553
1553
  }
1554
1554
  async loadModelFromFile(e, t) {
1555
- let n = this.storage ? this._keyed("file", T(await Pe(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);
1555
+ let n = this.storage ? this._keyed("file", D(await O(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);
1556
1556
  return this._sourceKey = n, i;
1557
1557
  }
1558
1558
  async _loadModelFileByExtension(e, t) {
@@ -1564,7 +1564,7 @@ var En = class e extends I {
1564
1564
  }
1565
1565
  async _loadModelWithFormat(e, t, n) {
1566
1566
  try {
1567
- v({
1567
+ b({
1568
1568
  isLoading: !0,
1569
1569
  status: `Processing ${e.label} Data...`,
1570
1570
  progress: 5
@@ -1573,7 +1573,7 @@ var En = class e extends I {
1573
1573
  filename: n,
1574
1574
  cache: this.loaderCache
1575
1575
  });
1576
- return this.releaseTargetModel(), this.targetModel = r, v({
1576
+ return this.releaseTargetModel(), this.targetModel = r, b({
1577
1577
  isLoading: !0,
1578
1578
  status: "Processing Data...",
1579
1579
  progress: 10
@@ -1599,7 +1599,7 @@ var En = class e extends I {
1599
1599
  };
1600
1600
  try {
1601
1601
  let r = await this.loadEnvironment(n);
1602
- return _e(r, T(await Pe(e))), this.dispatchEvent({
1602
+ return ge(r, D(await O(e))), this.dispatchEvent({
1603
1603
  type: "load",
1604
1604
  texture: r,
1605
1605
  filename: t
@@ -1621,7 +1621,7 @@ var En = class e extends I {
1621
1621
  let e = t.split(/[?#]/)[0].split(".").pop().toLowerCase();
1622
1622
  n = await this.loadEnvironmentByExtension(t, e);
1623
1623
  }
1624
- return n.generateMipmaps = !0, e._isNetworkUrl(t) && _e(n, t), this.applyEnvironmentToScene(n), this.dispatchEvent({
1624
+ return n.generateMipmaps = !0, e._isNetworkUrl(t) && ge(n, t), this.applyEnvironmentToScene(n), this.dispatchEvent({
1625
1625
  type: "load",
1626
1626
  texture: n,
1627
1627
  url: t,
@@ -1656,27 +1656,27 @@ var En = class e extends I {
1656
1656
  }
1657
1657
  return !n && this.uploadedFileInfo && (n = this.uploadedFileInfo.name.split(".").pop().toLowerCase()), n;
1658
1658
  }
1659
- async loadEnvironmentByExtension(t, n, { loader: r = null } = {}) {
1660
- let i = this._formats.get(n);
1661
- 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(dt)), !r && xn[n]) throw this.formatError(`environment.${n}`);
1662
- 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;
1659
+ async loadEnvironmentByExtension(t, n, { loader: r = null, quiet: i = !1 } = {}) {
1660
+ let a = this._formats.get(n);
1661
+ if (!r && a?.type === "environment" && (r = this.loaderCache[n] ??= await a.createLoader(this._loadingManager)), !r && n === "hdr" && (r = this.loaderCache.hdr ??= new Mt(this._loadingManager).setDataType(st)), !r && Sn[n]) throw this.formatError(`environment.${n}`);
1662
+ let o = e._isNetworkUrl(t), s = "Downloading Environment...", c = await this._viaCache(t, s, o), l = c.cached || i ? void 0 : this._downloadProgress(s, o), u;
1663
1663
  try {
1664
- r ? l = await r.loadAsync(s.url, c) : ve().decodeImage ? (l = await Be(s.url, `image/${n === "jpg" ? "jpeg" : n}`), l.colorSpace = V) : (this.loaderCache.texture || (this.loaderCache.texture = new Dt(this._loadingManager)), l = await this.loaderCache.texture.loadAsync(s.url, c), l.colorSpace = V);
1664
+ r ? u = await r.loadAsync(c.url, l) : _e().decodeImage ? (u = await Le(c.url, `image/${n === "jpg" ? "jpeg" : n}`), u.colorSpace = U) : (this.loaderCache.texture || (this.loaderCache.texture = new Dt(this._loadingManager)), u = await this.loaderCache.texture.loadAsync(c.url, l), u.colorSpace = U);
1665
1665
  } finally {
1666
- s.release();
1666
+ c.release();
1667
1667
  }
1668
- return this._downloadComplete("Processing Environment...", 62), this.maxEnvironmentWidth && Dn(l, this.maxEnvironmentWidth), l.mapping = ut, l.minFilter = pt, l.magFilter = pt, l;
1668
+ return i || this._downloadComplete("Processing Environment...", 62), this.maxEnvironmentWidth && On(u, this.maxEnvironmentWidth), u.mapping = ot, u.minFilter = lt, u.magFilter = lt, u;
1669
1669
  }
1670
1670
  applyEnvironmentToScene(e) {
1671
1671
  this.scene.background = e, this.scene.environment = e;
1672
1672
  }
1673
1673
  async createGLTFLoader() {
1674
- let e = vn(new jt(this._loadingManager), this.renderer), t = (e, t) => this._reportImageFailure(e, t);
1675
- return ve().decodeImage ? e.register((e) => ze(e, t)) : ne() || e.register((e) => Le(e, t)), e.register((e) => dn(e)), e.register(() => Cn), e;
1674
+ let e = yn(new jt(this._loadingManager), this.renderer), t = (e, t) => this._reportImageFailure(e, t);
1675
+ return _e().decodeImage ? e.register((e) => Ie(e, t)) : te() || e.register((e) => Pe(e, t)), e.register((e) => fn(e)), e.register(() => wn), e;
1676
1676
  }
1677
1677
  _reportImageFailure(e, t) {
1678
1678
  try {
1679
- this._issues?.record(x.TEXTURE_BUILD_FAILED, `image ${e} could not be decoded (${t?.message ?? t}) — the surfaces using it render untextured`, {
1679
+ this._issues?.record(C.TEXTURE_BUILD_FAILED, `image ${e} could not be decoded (${t?.message ?? t}) — the surfaces using it render untextured`, {
1680
1680
  image: e,
1681
1681
  cause: String(t?.message ?? t)
1682
1682
  });
@@ -1700,16 +1700,16 @@ var En = class e extends I {
1700
1700
  this._loadCancelled = !1;
1701
1701
  let r = await this.createGLTFLoader(), i = e._isNetworkUrl(t), a = null;
1702
1702
  try {
1703
- v({
1703
+ b({
1704
1704
  isLoading: !0,
1705
1705
  status: "Downloading Model...",
1706
1706
  progress: 2,
1707
1707
  canCancel: i,
1708
1708
  loadedBytes: 0,
1709
1709
  totalBytes: 0
1710
- }), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(ht.extractUrlBase(t));
1711
- let e = await ae(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
1712
- 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 = Ve(e), await this.onModelLoad(this.targetModel), this.dispatchEvent({
1710
+ }), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(dt.extractUrlBase(t));
1711
+ let e = await y(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
1712
+ 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 = Re(e), await this.onModelLoad(this.targetModel), this.dispatchEvent({
1713
1713
  type: "load",
1714
1714
  model: e.scene,
1715
1715
  filename: t.split("/").pop()
@@ -1731,15 +1731,15 @@ var En = class e extends I {
1731
1731
  this._loadCancelled = !1;
1732
1732
  let r = await this.createGLTFLoader(), i = e._isNetworkUrl(t), a = null;
1733
1733
  try {
1734
- v({
1734
+ b({
1735
1735
  isLoading: !0,
1736
1736
  status: "Downloading Model...",
1737
1737
  progress: 2,
1738
1738
  canCancel: i,
1739
1739
  loadedBytes: 0,
1740
1740
  totalBytes: 0
1741
- }), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(ht.extractUrlBase(t));
1742
- let e = await ae(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
1741
+ }), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(dt.extractUrlBase(t));
1742
+ let e = await y(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
1743
1743
  return this._downloadComplete(), this._throwDeferred(), this._appended = !0, this._processAndParent(e.scene), {
1744
1744
  root: e.scene,
1745
1745
  animations: e.animations || []
@@ -1756,18 +1756,18 @@ var En = class e extends I {
1756
1756
  return n.name = e.name || t, this._processAndParent(n), { root: n };
1757
1757
  }
1758
1758
  removeModelRoot(e) {
1759
- e && (e.userData.__rayzeeExternal ? (ie(e), e.parent?.remove(e)) : te(e));
1759
+ e && (e.userData.__rayzeeExternal ? (ee(e), e.parent?.remove(e)) : se(e));
1760
1760
  }
1761
1761
  async loadGLBFromArrayBuffer(e, t = "model.glb") {
1762
1762
  let n = await this.createGLTFLoader();
1763
1763
  try {
1764
- v({
1764
+ b({
1765
1765
  isLoading: !0,
1766
1766
  status: "Processing GLB Data...",
1767
1767
  progress: 5
1768
1768
  }), await new Promise((e) => setTimeout(e, 0));
1769
- let r = await ae(() => n.parseAsync(e, ""));
1770
- return this._throwDeferred(), this.releaseTargetModel(), this.targetModel = r.scene, this.animations = r.animations || [], this.sceneMetadata = Ve(r), v({
1769
+ let r = await y(() => n.parseAsync(e, ""));
1770
+ return this._throwDeferred(), this.releaseTargetModel(), this.targetModel = r.scene, this.animations = r.animations || [], this.sceneMetadata = Re(r), b({
1771
1771
  isLoading: !0,
1772
1772
  status: "Processing Data...",
1773
1773
  progress: 10
@@ -1789,7 +1789,7 @@ var En = class e extends I {
1789
1789
  async loadObject3D(e, t = "object3d") {
1790
1790
  this.releaseTargetModel();
1791
1791
  let n = this._adoptExternalObject(e);
1792
- return n.name = e.name || t, this.targetModel = n, v({
1792
+ return n.name = e.name || t, this.targetModel = n, b({
1793
1793
  isLoading: !0,
1794
1794
  status: "Processing Data...",
1795
1795
  progress: 10
@@ -1803,10 +1803,10 @@ var En = class e extends I {
1803
1803
  let t = new p("onModelLoad");
1804
1804
  t.start("Camera extraction");
1805
1805
  let n = this.extractCamerasFromModel(e);
1806
- t.end("Camera extraction"), t.start("Camera setup");
1807
- let r = new rt().setFromObject(e), i = r.getCenter(new U()), a = r.getSize(new U());
1806
+ t.end("Camera extraction"), t.start("Camera setup"), ie(e);
1807
+ let r = new $e().setFromObject(e), i = r.getCenter(new W()), a = r.getSize(new W());
1808
1808
  this.controls?.target.copy(i);
1809
- let o = Math.max(a.x, a.y, a.z), s = this.camera.fov * (Math.PI / 180), c = Math.abs(o / Math.sin(s / 2) / 2), l = Math.PI / 6, u = new U(Math.cos(l) * c, c / Math.sqrt(2), Math.sin(l) * c);
1809
+ 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 W(Math.cos(l) * c, c / Math.sqrt(2), Math.sin(l) * c);
1810
1810
  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) {
1811
1811
  let e = r.min.y;
1812
1812
  this.floorPlane.position.y = e, this.floorPlane.rotation.x = -Math.PI / 2, this.floorPlane.scale.setScalar(o * 5);
@@ -1843,21 +1843,21 @@ var En = class e extends I {
1843
1843
  let t = [], n = [];
1844
1844
  e.traverse((e) => {
1845
1845
  let r = e.userData;
1846
- e.isRectAreaLight && !r.__radianceConverted && (e.intensity *= Tn(e, e.width, e.height, r), r.__radianceConverted = !0), (e.isPointLight || e.isSpotLight) && !r.__candelaConverted && (e.intensity *= 4 * Math.PI / wn, r.__candelaConverted = !0), e.isDirectionalLight && !r.__luxConverted && (e.intensity /= wn, r.__luxConverted = !0);
1846
+ e.isRectAreaLight && !r.__radianceConverted && (e.intensity *= En(e, e.width, e.height, r), r.__radianceConverted = !0), (e.isPointLight || e.isSpotLight) && !r.__candelaConverted && (e.intensity *= 4 * Math.PI / Tn, r.__candelaConverted = !0), e.isDirectionalLight && !r.__luxConverted && (e.intensity /= Tn, r.__luxConverted = !0);
1847
1847
  let i = e.name.startsWith("RectAreaLightPlaceholder");
1848
1848
  if (i && !(r.name && r.type === "RectAreaLight") && !e.parent?.name?.startsWith("RectAreaLightPlaceholder") && n.push(e.name), i && r.name && r.type === "RectAreaLight") {
1849
- let t = r.normalize ?? !0, n = r.shape ?? "rectangle", i = r.intensity * Tn(e, r.width, r.height, r), a = new B(new ot(...r.color), i * this._areaLightIntensityScale(), r.width, r.height);
1849
+ let t = r.normalize ?? !0, n = r.shape ?? "rectangle", i = r.intensity * En(e, r.width, r.height, r), a = new Ct(new nt(...r.color), i * this._areaLightIntensityScale(), r.width, r.height);
1850
1850
  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);
1851
1851
  }
1852
1852
  e.isMesh && Array.isArray(e.material) && t.push(e);
1853
- }), n.length && this._issues?.record(x.LIGHT_PLACEHOLDER_SKIPPED, `${n.length} area-light placeholder(s) lack userData.name or userData.type 'RectAreaLight' — no light was made for them`, {
1853
+ }), 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`, {
1854
1854
  count: n.length,
1855
1855
  names: n.slice(0, 10)
1856
1856
  });
1857
1857
  let r = e.userData.__rayzeeExternal === !0;
1858
1858
  for (let e of t) {
1859
1859
  if (!e.parent) continue;
1860
- console.log("Found multi-material mesh:", e.name), r && (e.geometry = Sn(e.geometry));
1860
+ console.log("Found multi-material mesh:", e.name), r && (e.geometry = Cn(e.geometry));
1861
1861
  let t = Nt(e);
1862
1862
  for (let e of t.children) e.geometry.userData.__rayzeeOwned = !0;
1863
1863
  e.parent.add(t), e.parent.remove(e);
@@ -1867,7 +1867,7 @@ var En = class e extends I {
1867
1867
  this.sceneScale = t;
1868
1868
  }
1869
1869
  createFloorPlane() {
1870
- this.floorPlane = new _t(new at(), new vt({
1870
+ this.floorPlane = new pt(new tt(), new mt({
1871
1871
  transparent: !1,
1872
1872
  color: 3158064,
1873
1873
  roughness: 1,
@@ -1890,7 +1890,7 @@ var En = class e extends I {
1890
1890
  }
1891
1891
  getSupportedFormats(e = null) {
1892
1892
  let t = {
1893
- ...bn,
1893
+ ...xn,
1894
1894
  ...this._archiveFormats
1895
1895
  };
1896
1896
  for (let [e, { type: n, name: r }] of this._formats) t[e] = {
@@ -1915,7 +1915,7 @@ var En = class e extends I {
1915
1915
  this._listeners = void 0;
1916
1916
  }
1917
1917
  };
1918
- function Dn(e, t) {
1918
+ function On(e, t) {
1919
1919
  let { data: n, width: r, height: i } = e.image ?? {};
1920
1920
  if (!(n instanceof Float32Array) || r <= t || n.length !== r * i * 4) return;
1921
1921
  let a = Math.ceil(r / t), o = Math.ceil(r / a), s = Math.ceil(i / a);
@@ -1936,17 +1936,17 @@ function Dn(e, t) {
1936
1936
  data: n.byteOffset === 0 && n.byteLength === n.buffer.byteLength && n.buffer.transfer ? new Float32Array(n.buffer.transfer(c)) : n.slice(0, o * s * 4),
1937
1937
  width: o,
1938
1938
  height: s
1939
- }, e.needsUpdate = !0, yn.info(`environment ${r}×${i} shrunk to ${o}×${s} (memory spill)`);
1939
+ }, e.needsUpdate = !0, bn.info(`environment ${r}×${i} shrunk to ${o}×${s} (memory spill)`);
1940
1940
  }
1941
1941
  //#endregion
1942
1942
  //#region src/HeadlessCanvas.js
1943
- var On = {
1943
+ var kn = {
1944
1944
  addEventListener() {},
1945
1945
  removeEventListener() {},
1946
1946
  dispatchEvent() {
1947
1947
  return !0;
1948
1948
  }
1949
- }, kn = class {
1949
+ }, An = class {
1950
1950
  constructor(e) {
1951
1951
  this.canvas = e, this._configuration = null, this._texture = null;
1952
1952
  }
@@ -1974,12 +1974,12 @@ var On = {
1974
1974
  return this._texture;
1975
1975
  }
1976
1976
  };
1977
- function An(e = 1, t = 1) {
1977
+ function jn(e = 1, t = 1) {
1978
1978
  let n = {
1979
- ...On,
1979
+ ...kn,
1980
1980
  defaultView: null
1981
1981
  }, r = {
1982
- ...On,
1982
+ ...kn,
1983
1983
  isHeadlessCanvas: !0,
1984
1984
  width: e,
1985
1985
  height: t,
@@ -2006,12 +2006,12 @@ function An(e = 1, t = 1) {
2006
2006
  hasPointerCapture: () => !1,
2007
2007
  focus() {},
2008
2008
  getContext: (e) => e === "webgpu" ? i : null
2009
- }, i = new kn(r);
2009
+ }, i = new An(r);
2010
2010
  return r;
2011
2011
  }
2012
2012
  //#endregion
2013
2013
  //#region src/managers/ViewCamera.js
2014
- var jn = class extends xt {
2014
+ var Mn = class extends yt {
2015
2015
  constructor(e, t, n, r) {
2016
2016
  super(e, t, n, r), this.orthographic = !1, this.orthoHalfHeight = 1;
2017
2017
  }
@@ -2035,17 +2035,17 @@ var jn = class extends xt {
2035
2035
  return -this.orthoHalfHeight * this.aspect;
2036
2036
  }
2037
2037
  updateProjectionMatrix() {
2038
- this.orthographic ? bt.prototype.updateProjectionMatrix.call(this) : super.updateProjectionMatrix();
2038
+ this.orthographic ? vt.prototype.updateProjectionMatrix.call(this) : super.updateProjectionMatrix();
2039
2039
  }
2040
2040
  copy(e, t) {
2041
2041
  return super.copy(e, t), this.orthographic = e.orthographic === !0, this.orthoHalfHeight = e.orthoHalfHeight ?? this.orthoHalfHeight, this;
2042
2042
  }
2043
- }, Mn = "__rayzeeUserLight", Nn = {
2044
- DirectionalLight: ct,
2045
- PointLight: St,
2043
+ }, Nn = "__rayzeeUserLight", Pn = {
2044
+ DirectionalLight: it,
2045
+ PointLight: bt,
2046
2046
  SpotLight: Tt,
2047
- RectAreaLight: B
2048
- }, Pn = class extends I {
2047
+ RectAreaLight: Ct
2048
+ }, Fn = class extends V {
2049
2049
  constructor(e, t, n, r = {}) {
2050
2050
  super(), this.scene = e, this.sceneHelpers = t, this.pathTracer = n, this._onReset = r.onReset || null, this._onLightRemoved = r.onLightRemoved || null;
2051
2051
  }
@@ -2093,14 +2093,14 @@ var jn = class extends xt {
2093
2093
  }[e];
2094
2094
  if (!t) return null;
2095
2095
  let n;
2096
- if (e === "DirectionalLight") n = new ct(t.color, t.intensity), n.position.fromArray(t.position);
2097
- else if (e === "PointLight") n = new St(t.color, t.intensity), n.position.fromArray(t.position);
2096
+ if (e === "DirectionalLight") n = new it(t.color, t.intensity), n.position.fromArray(t.position);
2097
+ else if (e === "PointLight") n = new bt(t.color, t.intensity), n.position.fromArray(t.position);
2098
2098
  else if (e === "SpotLight") {
2099
- n = new Tt(t.color, t.intensity), n.position.fromArray(t.position), n.angle = L.degToRad(t.angle);
2100
- let e = new z();
2099
+ n = new Tt(t.color, t.intensity), n.position.fromArray(t.position), n.angle = H.degToRad(t.angle);
2100
+ let e = new _t();
2101
2101
  this.scene.add(e), n.target = e;
2102
- } else e === "RectAreaLight" && (n = new B(t.color, t.intensity, t.width, t.height), n.position.fromArray(t.position), n.lookAt(0, 0, 0), n.userData.normalize = !0, n.userData.spread = Math.PI, n.userData.shape = "rectangle");
2103
- n.userData[Mn] = !0, n.userData.temperature = 6500, n.userData.useTemperature = !1, n.userData.exposure = 0;
2102
+ } else e === "RectAreaLight" && (n = new Ct(t.color, t.intensity, t.width, t.height), n.position.fromArray(t.position), n.lookAt(0, 0, 0), n.userData.normalize = !0, n.userData.spread = Math.PI, n.userData.shape = "rectangle");
2103
+ n.userData[Nn] = !0, n.userData.temperature = 6500, n.userData.useTemperature = !1, n.userData.exposure = 0;
2104
2104
  let r = this.scene.getObjectsByProperty("isLight", !0).length;
2105
2105
  return n.name = `${e.replace("Light", "")} ${r + 1}`, this.scene.add(n), this.updateLights(), this._syncHelpers(), this._onReset?.(), this._buildDescriptor(n);
2106
2106
  }
@@ -2126,7 +2126,7 @@ var jn = class extends xt {
2126
2126
  this.pathTracer?.updateLights(), this.sceneHelpers?.visible && this.sceneHelpers.update();
2127
2127
  }
2128
2128
  transferSceneLights(e, { keepUserLights: t = !1 } = {}) {
2129
- this._removeAllLights(t ? (e) => !e.userData?.[Mn] : void 0);
2129
+ this._removeAllLights(t ? (e) => !e.userData?.[Nn] : void 0);
2130
2130
  let n = e.getObjectsByProperty("isLight", !0);
2131
2131
  if (!n || n.length === 0) {
2132
2132
  this.updateLights();
@@ -2135,7 +2135,7 @@ var jn = class extends xt {
2135
2135
  for (let e of n) {
2136
2136
  let t = e.clone();
2137
2137
  if (e.updateWorldMatrix(!0, !1), e.getWorldPosition(t.position), e.getWorldQuaternion(t.quaternion), e.getWorldScale(t.scale), t.isRectAreaLight && (t.width *= t.scale.x, t.height *= t.scale.y, t.scale.set(1, 1, 1)), (e.isSpotLight || e.isDirectionalLight) && e.target) {
2138
- let n = new z();
2138
+ let n = new _t();
2139
2139
  e.target.updateWorldMatrix(!0, !1), e.target.getWorldPosition(n.position), this.scene.add(n), t.target = n;
2140
2140
  }
2141
2141
  this.scene.add(t);
@@ -2180,14 +2180,14 @@ var jn = class extends xt {
2180
2180
  this.sceneHelpers?.clear(), this._removeAllLights();
2181
2181
  let t = [];
2182
2182
  for (let n of e ?? []) {
2183
- let e = Nn[n.type];
2183
+ let e = Pn[n.type];
2184
2184
  if (!e) continue;
2185
2185
  let r = new e();
2186
2186
  r.name = n.name ?? "", r.visible = n.visible !== !1, r.color.setRGB(...n.color), r.intensity = n.intensity, r.position.fromArray(n.position), r.quaternion.fromArray(n.quaternion), r.scale.fromArray(n.scale ?? [
2187
2187
  1,
2188
2188
  1,
2189
2189
  1
2190
- ]), r.userData = m(n.userData) ?? {};
2190
+ ]), r.userData = h(n.userData) ?? {};
2191
2191
  for (let e of [
2192
2192
  "angle",
2193
2193
  "penumbra",
@@ -2197,7 +2197,7 @@ var jn = class extends xt {
2197
2197
  "height"
2198
2198
  ]) typeof n[e] == "number" && (r[e] = n[e]);
2199
2199
  if (n.target) {
2200
- let e = new z();
2200
+ let e = new _t();
2201
2201
  e.position.fromArray(n.target), this.scene.add(e), r.target = e;
2202
2202
  }
2203
2203
  this.scene.add(r), t.push(r);
@@ -2237,7 +2237,7 @@ var jn = class extends xt {
2237
2237
  }
2238
2238
  _buildDescriptor(e) {
2239
2239
  let t = 0;
2240
- e.type === "SpotLight" && e.angle !== void 0 ? t = L.radToDeg(e.angle) : e.type === "DirectionalLight" && (t = L.radToDeg(e.userData?.angle ?? 0));
2240
+ e.type === "SpotLight" && e.angle !== void 0 ? t = H.radToDeg(e.angle) : e.type === "DirectionalLight" && (t = H.radToDeg(e.userData?.angle ?? 0));
2241
2241
  let n = {
2242
2242
  uuid: e.uuid,
2243
2243
  name: e.name,
@@ -2256,7 +2256,7 @@ var jn = class extends xt {
2256
2256
  exposure: e.userData?.exposure ?? 0
2257
2257
  };
2258
2258
  if (e.type === "RectAreaLight") {
2259
- n.width = e.width, n.height = e.height, n.normalize = e.userData?.normalize ?? !0, n.spread = L.radToDeg(e.userData?.spread ?? Math.PI);
2259
+ n.width = e.width, n.height = e.height, n.normalize = e.userData?.normalize ?? !0, n.spread = H.radToDeg(e.userData?.spread ?? Math.PI);
2260
2260
  let t = e.userData?.shape;
2261
2261
  n.shape = t === "square" || t === "rectangle" || t === "disk" || t === "ellipse" ? t : t === 1 ? "ellipse" : "rectangle";
2262
2262
  let r = e.getWorldDirection(e.position.clone());
@@ -2272,11 +2272,11 @@ var jn = class extends xt {
2272
2272
  ], n.distance = e.distance ?? 0, n.penumbra = e.penumbra ?? 0, n.decay = e.decay ?? 2) : e.type === "PointLight" && (n.distance = e.distance ?? 0, n.decay = e.decay ?? 2);
2273
2273
  return (e.type === "SpotLight" || e.type === "DirectionalLight") && e.userData?.gobo && (n.gobo = e.userData.gobo.name, n.goboIntensity = e.userData.gobo.intensity, n.goboInverted = !!e.userData.gobo.inverted, e.type === "DirectionalLight" && (n.goboScale = e.userData.gobo.scale ?? 5)), e.type === "SpotLight" && e.userData?.ies && (n.ies = e.userData.ies.name, n.iesIntensity = e.userData.ies.intensity ?? 1, n.fixtureLumens = e.userData.ies.fixtureLumens ?? null), n;
2274
2274
  }
2275
- }, Fn = ({ element: e, pbrtEntry: t } = {}) => ({
2275
+ }, In = ({ element: e, pbrtEntry: t } = {}) => ({
2276
2276
  ...e === void 0 ? {} : { element: e },
2277
2277
  ...t === void 0 ? {} : { pbrtEntry: t }
2278
- }), Q = /* @__PURE__ */ new WeakMap(), In = 3e4, Ln = new Set([...Object.values(g), ...Object.values(h)]), Rn = /* @__PURE__ */ new Set();
2279
- async function zn(e, t) {
2278
+ }), Q = /* @__PURE__ */ new WeakMap(), Ln = 3e4, Rn = new Set([...Object.values(_), ...Object.values(g)]), zn = /* @__PURE__ */ new Set();
2279
+ async function Bn(e, t) {
2280
2280
  if (!t || typeof self < "u") return e.init();
2281
2281
  globalThis.self = {
2282
2282
  requestAnimationFrame: () => 0,
@@ -2288,17 +2288,17 @@ async function zn(e, t) {
2288
2288
  delete globalThis.self;
2289
2289
  }
2290
2290
  }
2291
- var $ = b("engine");
2292
- function Bn() {
2291
+ var $ = S("engine");
2292
+ function Vn() {
2293
2293
  let e = new Float32Array(16);
2294
- return new Uint32Array(e.buffer)[3] = be.TRIANGLE_LEAF, e;
2294
+ return new Uint32Array(e.buffer)[3] = ye.TRIANGLE_LEAF, e;
2295
2295
  }
2296
- function Vn(e, t) {
2296
+ function Hn(e, t) {
2297
2297
  e.lost.then((e) => {
2298
2298
  t.app && t.app._handleDeviceLost(e);
2299
2299
  });
2300
2300
  }
2301
- var Hn = [
2301
+ var Un = [
2302
2302
  "core-features-and-limits",
2303
2303
  "depth-clip-control",
2304
2304
  "depth32float-stencil8",
@@ -2319,33 +2319,33 @@ var Hn = [
2319
2319
  "subgroups",
2320
2320
  "texture-formats-tier1",
2321
2321
  "texture-formats-tier2"
2322
- ], Un = /swiftshader|llvmpipe|lavapipe|basic render|microsoft basic|warp/i;
2323
- function Wn(e) {
2322
+ ], Wn = /swiftshader|llvmpipe|lavapipe|basic render|microsoft basic|warp/i;
2323
+ function Gn(e) {
2324
2324
  let t = e.info ?? {}, n = `${t.vendor ?? ""} ${t.architecture ?? ""} ${t.device ?? ""} ${t.description ?? ""}`;
2325
2325
  return {
2326
2326
  vendor: t.vendor ?? "",
2327
2327
  architecture: t.architecture ?? "",
2328
2328
  device: t.device ?? "",
2329
2329
  description: t.description ?? "",
2330
- isSoftware: t.isFallbackAdapter === !0 || e.isFallbackAdapter === !0 || Un.test(n)
2330
+ isSoftware: t.isFallbackAdapter === !0 || e.isFallbackAdapter === !0 || Wn.test(n)
2331
2331
  };
2332
2332
  }
2333
- var Gn = class extends I {
2333
+ var Kn = class extends V {
2334
2334
  constructor(e, t = {}) {
2335
- super(), this._headless = t.headless === !0 || !e, e ??= An();
2335
+ super(), this._headless = t.headless === !0 || !e, e ??= jn();
2336
2336
  try {
2337
2337
  Q.get(e)?.dispose();
2338
2338
  } catch (e) {
2339
2339
  $.warn("prior canvas owner dispose failed", e);
2340
2340
  }
2341
2341
  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`.");
2342
- this._issues = new xe({
2342
+ this._issues = new be({
2343
2343
  strict: t.strict === !0,
2344
2344
  onIssue: (e) => this.dispatchEvent({
2345
- type: g.ISSUE,
2345
+ type: _.ISSUE,
2346
2346
  issue: e
2347
2347
  })
2348
- }), this.color = new ln({ issues: this._issues }), Ee(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;
2348
+ }), this.color = new un({ issues: this._issues }), Te(this.color), this.settings = new ln(v, { 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 Zt(), 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;
2349
2349
  }
2350
2350
  _addTrackedListener(e, t, n) {
2351
2351
  e && (e.addEventListener(t, n), this._trackedListeners.push({
@@ -2364,33 +2364,33 @@ var Gn = class extends I {
2364
2364
  }
2365
2365
  async init() {
2366
2366
  let e = this._initStorage();
2367
- 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(ye.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(Bn()), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setupMaterial(), this.isInitialized = !0, $.debug("WebGPU path tracer app initialized"), this;
2367
+ 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(ve.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(Vn()), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setupMaterial(), this.isInitialized = !0, $.debug("WebGPU path tracer app initialized"), this;
2368
2368
  }
2369
2369
  async setStorageOpener(e) {
2370
2370
  this._storageOpener = e, !(!this.isInitialized || this.storage || this._disposed) && (await this._initStorage(), this._attachStorage());
2371
2371
  }
2372
2372
  async _initStorage() {
2373
- let e = this._storageOption ?? (this._issues.strict && !Oe("storage") ? !1 : C().storage);
2373
+ let e = this._storageOption ?? (this._issues.strict && !De("storage") ? !1 : T().storage);
2374
2374
  if (e !== !1) {
2375
2375
  if (e && typeof e == "object") this.storage = e;
2376
2376
  else {
2377
2377
  if (!this._storageOpener) {
2378
- (this._storageOption !== void 0 || Oe("storage")) && this._issues.warn(x.CAPABILITY_MISSING, "on-disk storage needs rayzee/addons/storage: setStorageOpener( acquireSharedStorage )");
2378
+ (this._storageOption !== void 0 || De("storage")) && this._issues.warn(C.CAPABILITY_MISSING, "on-disk storage needs rayzee/addons/storage: setStorageOpener( acquireSharedStorage )");
2379
2379
  return;
2380
2380
  }
2381
- let { storage: e, reason: t, release: n } = await this._storageOpener(C().cacheNamespace);
2381
+ let { storage: e, reason: t, release: n } = await this._storageOpener(T().cacheNamespace);
2382
2382
  if (this._disposed) {
2383
2383
  n();
2384
2384
  return;
2385
2385
  }
2386
2386
  if (!e) {
2387
- this._issues.warn(x.STORAGE_UNAVAILABLE, `on-disk storage is off: ${t}`, { reason: t });
2387
+ this._issues.warn(C.STORAGE_UNAVAILABLE, `on-disk storage is off: ${t}`, { reason: t });
2388
2388
  return;
2389
2389
  }
2390
2390
  this.storage = e, this._storageRelease = n;
2391
2391
  }
2392
2392
  this._addTrackedListener(this.storage, "change", (e) => this.dispatchEvent({
2393
- type: g.STORAGE_CHANGED,
2393
+ type: _.STORAGE_CHANGED,
2394
2394
  area: e.area
2395
2395
  })), this._addTrackedListener(this.storage, "issue", (e) => this._issues.warn(e.code, e.message, e.detail));
2396
2396
  }
@@ -2400,20 +2400,20 @@ var Gn = class extends I {
2400
2400
  }
2401
2401
  dispatchEvent(e) {
2402
2402
  super.dispatchEvent(e);
2403
- let t = h[e.type];
2403
+ let t = g[e.type];
2404
2404
  t && super.dispatchEvent({
2405
2405
  ...e,
2406
2406
  type: t
2407
2407
  });
2408
2408
  }
2409
2409
  addEventListener(e, t) {
2410
- !Ln.has(e) && !Rn.has(e) && (Rn.add(e), $.warn(`no engine event is named "${e}", so this listener will never fire — see EngineEvents`)), super.addEventListener(e, t);
2410
+ !Rn.has(e) && !zn.has(e) && (zn.add(e), $.warn(`no engine event is named "${e}", so this listener will never fire — see EngineEvents`)), super.addEventListener(e, t);
2411
2411
  }
2412
2412
  animate() {
2413
2413
  if (this._headless) throw Error("a headless app has no render loop — drive it with renderFrames() or renderUntilComplete()");
2414
2414
  if (this._deviceLost) return;
2415
2415
  if (this.animationManagerId = requestAnimationFrame(() => this.animate()), this._loadingInProgress || this._sdf?.isProcessing) {
2416
- this.dispatchEvent({ type: g.FRAME });
2416
+ this.dispatchEvent({ type: _.FRAME });
2417
2417
  return;
2418
2418
  }
2419
2419
  this._beginFrame();
@@ -2426,29 +2426,29 @@ var Gn = class extends I {
2426
2426
  if (this._beforeTrace(), this.stages.pathTracer?.isReady) {
2427
2427
  if (this.stages.pathTracer.isComplete && this.completion.renderCompleteDispatched) {
2428
2428
  if (this._needsDisplayRefresh && (this._needsDisplayRefresh = !1, this.stages.compositor.render(this.pipeline.context), this._renderHelperOverlay()), this._settling()) {
2429
- this.dispatchEvent({ type: g.FRAME });
2429
+ this.dispatchEvent({ type: _.FRAME });
2430
2430
  return;
2431
2431
  }
2432
2432
  this.stopAnimation();
2433
2433
  return;
2434
2434
  }
2435
2435
  if (this._holdTrace(e)) {
2436
- this._renderHelperOverlay(), this.dispatchEvent({ type: g.FRAME });
2436
+ this._renderHelperOverlay(), this.dispatchEvent({ type: _.FRAME });
2437
2437
  return;
2438
2438
  }
2439
2439
  if (this.stages.pathTracer.readbackWait()) {
2440
- this.dispatchEvent({ type: g.FRAME });
2440
+ this.dispatchEvent({ type: _.FRAME });
2441
2441
  return;
2442
2442
  }
2443
2443
  this._traceFrame({ liveDenoise: !0 }), this.stages.pathTracer.isComplete && this.completion.markComplete() && this._announceComplete();
2444
2444
  }
2445
- this._renderHelperOverlay(), this.dispatchEvent({ type: g.FRAME });
2445
+ this._renderHelperOverlay(), this.dispatchEvent({ type: _.FRAME });
2446
2446
  }
2447
2447
  }
2448
2448
  _announceComplete() {
2449
2449
  let e = this._completionInfo(), t = this.stages.pathTracer.resetCount, n = () => {
2450
2450
  !this.completion.renderCompleteDispatched || this.stages.pathTracer?.resetCount !== t || (this._renderCompleted(), this.dispatchEvent({
2451
- type: g.RENDER_COMPLETE,
2451
+ type: _.RENDER_COMPLETE,
2452
2452
  ...e
2453
2453
  }));
2454
2454
  }, r = this._finishImage();
@@ -2458,9 +2458,9 @@ var Gn = class extends I {
2458
2458
  let t = this.stages.pathTracer;
2459
2459
  this.pipeline.render(), this._afterTrace(t, e), t.isComplete || this.completion.updateTime(), this._ensureVRAMWiring();
2460
2460
  let n = t.vramTracker, r = t.frameCount ?? 0;
2461
- n && (r <= 1 || r % 30 == 0) && n.measure(), fe({
2461
+ n && (r <= 1 || r % 30 == 0) && n.measure(), ae({
2462
2462
  timeElapsed: this.completion.timeElapsed,
2463
- samples: he(t),
2463
+ samples: de(t),
2464
2464
  memoryUsed: n?.current ?? 0,
2465
2465
  memoryPeak: n?.peak ?? 0
2466
2466
  }), this.completion.isTimeLimitReached(t, this.settings.get("renderLimitMode"), this.settings.get("renderTimeLimit")) && (t.isComplete = !0);
@@ -2478,7 +2478,7 @@ var Gn = class extends I {
2478
2478
  }
2479
2479
  _handleDeviceLost(e) {
2480
2480
  this._deviceLost || (this._deviceLost = !0, $.error(`WebGPU device lost (${e?.reason || "unknown"}): ${e?.message || ""}`), this.stopAnimation(), this.dispatchEvent({
2481
- type: g.DEVICE_LOST,
2481
+ type: _.DEVICE_LOST,
2482
2482
  reason: e?.reason,
2483
2483
  message: e?.message
2484
2484
  }));
@@ -2493,35 +2493,35 @@ var Gn = class extends I {
2493
2493
  this._paused = !1, !this.animationManagerId && !this._headless && this.animate();
2494
2494
  }
2495
2495
  reset(e = !1, { motion: t = !1 } = {}) {
2496
- 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 });
2496
+ 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: _.RENDER_RESET });
2497
2497
  }
2498
2498
  dispose() {
2499
2499
  if (this._disposed) return;
2500
- 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(), me(null), this._storageRelease?.(), this._storageRelease = null, this.storage = null, this._sceneSource = this._sceneSourceInput = null, this._issues.detach(), this.color?.dispose(), this.color = null, this._pictureCopy = 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) {
2500
+ if (this._disposed = !0, this.dispatchEvent({ type: _.DISPOSE }), this.stopAnimation(), clearTimeout(this._resizeDebounceTimer), this._resizeDebounceTimer = null, clearTimeout(this._respillTimer), this._respillTimer = null, this._removeTrackedListeners(), le(null), this._storageRelease?.(), this._storageRelease = null, this.storage = null, this._sceneSource = this._sceneSourceInput = null, this._issues.detach(), this.color?.dispose(), this.color = null, this._pictureCopy = 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) {
2501
2501
  this.meshScene.environment?.dispose(), this.meshScene.environment = null;
2502
- for (let e of [...this.meshScene.children]) te(e);
2502
+ for (let e of [...this.meshScene.children]) se(e);
2503
2503
  this.meshScene.clear(), this.meshScene = null;
2504
2504
  }
2505
2505
  this._sceneHelpers?.clear(), this._sceneHelpers = null, this.scene?.clear(), this.scene = null;
2506
2506
  try {
2507
- let e = $e().value, t = Ye().value;
2507
+ let e = Xe().value, t = Ke().value;
2508
2508
  e?._listeners?.dispose && (e._listeners.dispose.length = 0), t?._listeners?.dispose && (t._listeners.dispose.length = 0);
2509
2509
  } catch (e) {
2510
2510
  $.warn("failed to clear TSL texture singleton listeners", e);
2511
2511
  }
2512
2512
  this.canvas && Q.get(this.canvas) === this && Q.delete(this.canvas);
2513
2513
  let e = this._gpuDevice;
2514
- e && (e.onuncapturederror = null, this._gpuDevice = null), this._deviceLostHolder &&= (this._deviceLostHolder.app = null, null), Promise.resolve(ce(this.renderer)).finally(() => e?.destroy()), this.renderer = null, this.stages = {}, this.isInitialized = !1;
2514
+ e && (e.onuncapturederror = null, this._gpuDevice = null), this._deviceLostHolder &&= (this._deviceLostHolder.app = null, null), Promise.resolve(me(this.renderer)).finally(() => e?.destroy()), this.renderer = null, this.stages = {}, this.isInitialized = !1;
2515
2515
  }
2516
2516
  unloadScene() {
2517
2517
  if (this.isInitialized) {
2518
2518
  if (this._loadingInProgress) throw Error("PathTracerApp.unloadScene: cannot unload while a load is in progress");
2519
- this._disposed || (this._releaseSceneState(), this.assetLoader?.releaseTargetModel(), this._sceneSource = this._sceneSourceInput = null, this.lightManager?.clearLights?.(), this.stages.pathTracer && (this.stages.pathTracer.setTriangleData(new Uint32Array(ye.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(Bn()), 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 }));
2519
+ this._disposed || (this._releaseSceneState(), this.assetLoader?.releaseTargetModel(), this._sceneSource = this._sceneSourceInput = null, this.lightManager?.clearLights?.(), this.stages.pathTracer && (this.stages.pathTracer.setTriangleData(new Uint32Array(ve.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(Vn()), 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: _.SCENE_UNLOADED }));
2520
2520
  }
2521
2521
  }
2522
2522
  async loadModel(e, t = {}) {
2523
2523
  await this._loadWithSceneRebuild(() => this.assetLoader.loadModel(e, t), {
2524
- type: g.MODEL_LOADED,
2524
+ type: _.MODEL_LOADED,
2525
2525
  url: e
2526
2526
  }, {
2527
2527
  kind: "url",
@@ -2531,7 +2531,7 @@ var Gn = class extends I {
2531
2531
  }
2532
2532
  async loadObject3D(e, t = "object3d") {
2533
2533
  await this._loadWithSceneRebuild(() => this.assetLoader.loadObject3D(e, t), {
2534
- type: g.OBJECT3D_LOADED,
2534
+ type: _.OBJECT3D_LOADED,
2535
2535
  name: t
2536
2536
  }, {
2537
2537
  kind: "object3d",
@@ -2549,7 +2549,7 @@ var Gn = class extends I {
2549
2549
  await this.assetLoader.loadEnvironment(e);
2550
2550
  let t = this.meshScene.environment;
2551
2551
  t && this.stages.pathTracer && await this.stages.pathTracer.environment.setEnvironmentMap(t), this.pipeline?.eventBus.emit("pipeline:lightingChanged"), this.reset(), this.dispatchEvent({
2552
- type: g.ENVIRONMENT_LOADED,
2552
+ type: _.ENVIRONMENT_LOADED,
2553
2553
  url: e
2554
2554
  });
2555
2555
  } finally {
@@ -2568,31 +2568,31 @@ var Gn = class extends I {
2568
2568
  ...t,
2569
2569
  filename: n
2570
2570
  }), {
2571
- type: g.MODEL_LOADED,
2571
+ type: _.MODEL_LOADED,
2572
2572
  filename: n
2573
2573
  }, {
2574
2574
  kind: "url",
2575
2575
  url: e,
2576
2576
  filename: n,
2577
2577
  cacheKey: t.cacheKey ?? null,
2578
- ...Fn(t)
2578
+ ...In(t)
2579
2579
  });
2580
2580
  return;
2581
2581
  }
2582
- if (Ie(e)) {
2583
- let n = Re(e, { isModel: (e) => this.assetLoader?.getFileFormat(e)?.type === "model" });
2582
+ if (k(e)) {
2583
+ let n = Fe(e, { isModel: (e) => this.assetLoader?.getFileFormat(e)?.type === "model" });
2584
2584
  if (n.files.length === 0) throw Error(`${n.name} holds no files to load`);
2585
2585
  await this._loadWithSceneRebuild(() => this.assetLoader.loadFolder(n, t), {
2586
- type: g.MODEL_LOADED,
2586
+ type: _.MODEL_LOADED,
2587
2587
  filename: n.name
2588
2588
  }, async () => {
2589
- let e = await Fe(n);
2589
+ let e = await Ne(n);
2590
2590
  return {
2591
2591
  kind: "local-folder",
2592
2592
  folder: e,
2593
- key: T(e),
2593
+ key: D(e),
2594
2594
  ...n.flat ? { flat: !0 } : {},
2595
- ...Fn(t)
2595
+ ...In(t)
2596
2596
  };
2597
2597
  }), this._sceneSourceInput = n;
2598
2598
  return;
@@ -2600,22 +2600,22 @@ var Gn = class extends I {
2600
2600
  let n = this.assetLoader?.getFileFormat(e?.name || "");
2601
2601
  if (!n) throw this.assetLoader.formatError(e?.name || "");
2602
2602
  if (n.type !== "environment" && n.type !== "image") {
2603
- let n = Pe(e).catch(() => ({
2603
+ let n = O(e).catch(() => ({
2604
2604
  name: e.name,
2605
2605
  size: e.size,
2606
2606
  lastModified: e.lastModified ?? 0,
2607
2607
  sample: null
2608
2608
  }));
2609
2609
  await this._loadWithSceneRebuild(() => this.assetLoader.loadAssetFromFile(e, t), {
2610
- type: g.MODEL_LOADED,
2610
+ type: _.MODEL_LOADED,
2611
2611
  filename: e.name
2612
2612
  }, async () => {
2613
2613
  let e = await n;
2614
2614
  return {
2615
2615
  kind: "local-file",
2616
2616
  file: e,
2617
- key: e.sample ? T(e) : null,
2618
- ...Fn(t)
2617
+ key: e.sample ? D(e) : null,
2618
+ ...In(t)
2619
2619
  };
2620
2620
  }), this._sceneSourceInput = e;
2621
2621
  return;
@@ -2626,7 +2626,7 @@ var Gn = class extends I {
2626
2626
  await this.assetLoader.loadAssetFromFile(e);
2627
2627
  let t = this.meshScene.environment;
2628
2628
  t && this.stages.pathTracer && await this.stages.pathTracer.environment.applyHDRI(t), this.pipeline?.eventBus.emit("pipeline:lightingChanged"), this.reset(), this.dispatchEvent({
2629
- type: g.ENVIRONMENT_LOADED,
2629
+ type: _.ENVIRONMENT_LOADED,
2630
2630
  filename: e.name
2631
2631
  });
2632
2632
  } finally {
@@ -2635,7 +2635,7 @@ var Gn = class extends I {
2635
2635
  }
2636
2636
  async loadExampleModels(e, t) {
2637
2637
  await this._loadWithSceneRebuild(() => this.assetLoader.loadExampleModels(e, t), {
2638
- type: g.MODEL_LOADED,
2638
+ type: _.MODEL_LOADED,
2639
2639
  index: e
2640
2640
  }, {
2641
2641
  kind: "url",
@@ -2652,7 +2652,7 @@ var Gn = class extends I {
2652
2652
  this._loadingInProgress = !0;
2653
2653
  try {
2654
2654
  await this.loadSceneData(), this.reset(), this.dispatchEvent({
2655
- type: g.TEXTURES_REPROCESSED,
2655
+ type: _.TEXTURES_REPROCESSED,
2656
2656
  maxTextureSize: r
2657
2657
  });
2658
2658
  } finally {
@@ -2664,10 +2664,10 @@ var Gn = class extends I {
2664
2664
  return this._sceneSource ?? null;
2665
2665
  }
2666
2666
  get sceneSourceFile() {
2667
- return this._sceneSourceInput && !Ie(this._sceneSourceInput) ? this._sceneSourceInput : null;
2667
+ return this._sceneSourceInput && !k(this._sceneSourceInput) ? this._sceneSourceInput : null;
2668
2668
  }
2669
2669
  get sceneSourceFolder() {
2670
- return Ie(this._sceneSourceInput) ? this._sceneSourceInput : null;
2670
+ return k(this._sceneSourceInput) ? this._sceneSourceInput : null;
2671
2671
  }
2672
2672
  async _loadWithSceneRebuild(e, t, n = null) {
2673
2673
  if (this._loadingInProgress) throw this._busyError("PathTracerApp");
@@ -2677,7 +2677,7 @@ var Gn = class extends I {
2677
2677
  let r = await this.loadSceneData({ pendingEnvironment: this._beginSceneMetadataEnvironment() });
2678
2678
  this._maybeSpill(), this.pipeline?.eventBus.emit("pipeline:lightingChanged"), this._dropDisplay(), this.reset(), this.dispatchEvent(t), this._modelAnnounced(), r && this.assetLoader?.commitPendingGraph(this.sceneModel);
2679
2679
  } catch (e) {
2680
- throw (!e || e.code !== "LOAD_IN_PROGRESS") && this._discardFailedLoad(), e?.code === "ARCHIVE_NEEDS_ELEMENT" ? de() : e?.code !== "LOAD_IN_PROGRESS" && v({
2680
+ throw (!e || e.code !== "LOAD_IN_PROGRESS") && this._discardFailedLoad(), e?.code === "ARCHIVE_NEEDS_ELEMENT" ? pe() : e?.code !== "LOAD_IN_PROGRESS" && b({
2681
2681
  status: `Error: ${e?.message ?? e}`,
2682
2682
  failed: !0,
2683
2683
  progress: 100
@@ -2700,7 +2700,7 @@ var Gn = class extends I {
2700
2700
  _beginSceneMetadataEnvironment() {
2701
2701
  this._restoreUnlitSettings();
2702
2702
  let e = this.sceneMetadata?.environment;
2703
- 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(x.ENVIRONMENT_LOAD_FAILED, `authored environment "${e.sourceFile}" failed to load — lighting falls back to the previous environment`, {
2703
+ 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`, {
2704
2704
  sourceFile: e.sourceFile,
2705
2705
  cause: String(t?.message ?? t)
2706
2706
  }), null)).finally(() => {
@@ -2719,7 +2719,7 @@ var Gn = class extends I {
2719
2719
  reset: !1,
2720
2720
  source: Y.SCENE_METADATA
2721
2721
  }), this.scene && (this.scene.background = e), this.dispatchEvent({
2722
- type: g.SCENE_METADATA_APPLIED,
2722
+ type: _.SCENE_METADATA_APPLIED,
2723
2723
  metadata: t,
2724
2724
  environment: { ...n }
2725
2725
  });
@@ -2736,7 +2736,7 @@ var Gn = class extends I {
2736
2736
  reset: !1,
2737
2737
  source: Y.SCENE_METADATA
2738
2738
  }), this.dispatchEvent({
2739
- type: g.SCENE_METADATA_APPLIED,
2739
+ type: _.SCENE_METADATA_APPLIED,
2740
2740
  metadata: this.sceneMetadata,
2741
2741
  environment: { enabled: !1 }
2742
2742
  });
@@ -2751,7 +2751,7 @@ var Gn = class extends I {
2751
2751
  source: i
2752
2752
  });
2753
2753
  this.dispatchEvent({
2754
- type: g.SCENE_METADATA_APPLIED,
2754
+ type: _.SCENE_METADATA_APPLIED,
2755
2755
  metadata: this.sceneMetadata,
2756
2756
  environment: { enabled: this.settings.get("enableEnvironment") }
2757
2757
  });
@@ -2764,20 +2764,20 @@ var Gn = class extends I {
2764
2764
  }), r = () => this.stages.pathTracer.environment.envParams.mode === "hdri" ? this.meshScene.environment : null, i = r(), a = null;
2765
2765
  if (e ? (n.start("Environment fetch + CDF (concurrent)"), a = e.then(async (e) => {
2766
2766
  e && (await this.stages.pathTracer.environment.applyHDRI(e), this._applySceneMetadataSettings(e));
2767
- }).catch((e) => this._issues.record(x.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(() => {
2767
+ }).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(() => {
2768
2768
  n.end("Environment CDF build (worker)"), this._applySceneMetadataEnabled && this._applySceneMetadataSettings(i);
2769
2769
  })), n.start("BVH build (SceneProcessor)"), this._sdf.setMaxTextureSize(this.settings.get("maxTextureSize")), await this._sdf.buildBVH(this.meshScene, {
2770
2770
  sceneKey: this.assetLoader?.sceneSourceKey ?? null,
2771
2771
  progressive: this._progressiveSpill()
2772
- }), this.assetLoader?.flushPendingGraph(this._sdf.performanceMetrics.totalProcessingTime), n.end("BVH build (SceneProcessor)"), v({
2772
+ }), this.assetLoader?.flushPendingGraph(this._sdf.performanceMetrics.totalProcessingTime), n.end("BVH build (SceneProcessor)"), b({
2773
2773
  status: "Transferring data to GPU...",
2774
2774
  progress: 86
2775
2775
  }), 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;
2776
2776
  for (let e of [...this._sdf.srgbBucketTextures ?? [], ...this._sdf.linearBucketTextures ?? []]) e && (this.renderer.initTexture(e), await this.stages.pathTracer.drainUploads());
2777
- 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({
2777
+ 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"), b({
2778
2778
  status: "Compiling shaders...",
2779
2779
  progress: 90
2780
- }), 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({
2780
+ }), 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 && (b({
2781
2781
  status: "Finalizing environment map...",
2782
2782
  progress: 95
2783
2783
  }), await a, this.stages.pathTracer.environment.applyCDFResults());
@@ -2786,16 +2786,16 @@ var Gn = class extends I {
2786
2786
  let e = (this._sdf?.emissiveTriangleBuilder?.emissiveTriangles?.length ?? this._sdf?.emissiveTriangleCount ?? 0) > 0;
2787
2787
  this.settings.set("enableEmissiveTriangleSampling", e, { reset: !1 });
2788
2788
  }
2789
- return n.start("Apply settings"), this.settings.applyAll(), this.stages.compositor.setTransparentBackground(this.settings.get("transparentBackground")), n.end("Apply settings"), n.print(this._sceneSummaryParts()), de(), this._sceneRebuilt(), this.dispatchEvent({ type: g.SCENE_REBUILD }), !0;
2789
+ return n.start("Apply settings"), this.settings.applyAll(), this.stages.compositor.setTransparentBackground(this.settings.get("transparentBackground")), n.end("Apply settings"), n.print(this._sceneSummaryParts()), pe(), this._sceneRebuilt(), this.dispatchEvent({ type: _.SCENE_REBUILD }), !0;
2790
2790
  }
2791
2791
  _sceneSummaryParts() {
2792
2792
  let e = this.stages.pathTracer, t = this._sdf?.instanceTable?.setCount ?? 0, n = this._sdf?.geometryExtractor?.maps?.length ?? 0;
2793
2793
  return [
2794
- y.count(e.triangleCount, "tri"),
2795
- t ? y.count(t, "mesh", "meshes") : null,
2796
- y.count(e.materialData.materialCount, "material"),
2797
- n ? y.count(n, "map") : null,
2798
- y.count(e.bvhNodeCount, "BVH node")
2794
+ x.count(e.triangleCount, "tri"),
2795
+ t ? x.count(t, "mesh", "meshes") : null,
2796
+ x.count(e.materialData.materialCount, "material"),
2797
+ n ? x.count(n, "map") : null,
2798
+ x.count(e.bvhNodeCount, "BVH node")
2799
2799
  ];
2800
2800
  }
2801
2801
  _tagPrimarySceneObject() {
@@ -2817,7 +2817,7 @@ var Gn = class extends I {
2817
2817
  try {
2818
2818
  let { root: r } = await this.assetLoader.appendModel(e, { cacheKey: n });
2819
2819
  return r.userData.__rayzeeSceneObject = !0, r.userData.__rayzeeSourceUrl = e, n && (r.userData.__rayzeeCacheKey = n), t && (r.userData.__rayzeeName = t), await this._finishRebuildNoReframe({
2820
- type: g.MODEL_ADDED,
2820
+ type: _.MODEL_ADDED,
2821
2821
  url: e,
2822
2822
  id: r.uuid
2823
2823
  }), r.uuid;
@@ -2831,7 +2831,7 @@ var Gn = class extends I {
2831
2831
  try {
2832
2832
  let { root: n } = this.assetLoader.appendObject3D(e, t || "object3d");
2833
2833
  return n.userData.__rayzeeSceneObject = !0, t && (n.userData.__rayzeeName = t), await this._finishRebuildNoReframe({
2834
- type: g.MODEL_ADDED,
2834
+ type: _.MODEL_ADDED,
2835
2835
  id: n.uuid
2836
2836
  }), n.uuid;
2837
2837
  } finally {
@@ -2848,7 +2848,7 @@ var Gn = class extends I {
2848
2848
  this._loadingInProgress = !0;
2849
2849
  try {
2850
2850
  return this._releaseSceneState(), n === this.sceneModel ? this.assetLoader.releaseTargetModel() : this.assetLoader.removeModelRoot(n), await this._finishRebuildNoReframe({
2851
- type: g.SCENE_OBJECT_REMOVED,
2851
+ type: _.SCENE_OBJECT_REMOVED,
2852
2852
  id: e
2853
2853
  }), !0;
2854
2854
  } finally {
@@ -2872,8 +2872,8 @@ var Gn = class extends I {
2872
2872
  }
2873
2873
  _sceneBudgets(e) {
2874
2874
  return this._memorySpill === !1 || !this.storage ? e : {
2875
- maxTriangles: se,
2876
- maxPlacements: ge,
2875
+ maxTriangles: oe,
2876
+ maxPlacements: he,
2877
2877
  ...e
2878
2878
  };
2879
2879
  }
@@ -2881,7 +2881,7 @@ var Gn = class extends I {
2881
2881
  let e = this._memorySpill !== !1 && !!this.storage && (this.assetLoader?.animations?.length ?? 0) === 0 && (this._memorySpill === !0 || this._sdf.needsSpill(this.meshScene));
2882
2882
  this.assetLoader && (this.assetLoader.maxEnvironmentWidth = e ? ue : 0);
2883
2883
  let t = e ? this.meshScene?.environment : null, n = t?.image;
2884
- return n && Dn(t, ue), 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;
2884
+ return n && On(t, ue), 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;
2885
2885
  }
2886
2886
  _progressiveSpill() {
2887
2887
  let e = this._spillPlan ?? this._planSpill();
@@ -2895,15 +2895,15 @@ var Gn = class extends I {
2895
2895
  return (t, n, r) => n === "triangles" ? e.createTriangleChunkUploader(t, r) : e.createChunkUploader(t);
2896
2896
  }
2897
2897
  _maybeSpill() {
2898
- !this._sdf?.spilling || !this.storage || (this._sdf.spillAfterLoad().catch((e) => this._issues.warn(x.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`)), this._sdf.spillToDisk(this.storage).then((e) => e && this.dispatchEvent({
2899
- type: g.SCENE_SPILLED,
2898
+ !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({
2899
+ type: _.SCENE_SPILLED,
2900
2900
  ...e
2901
- })).catch((e) => this._issues.warn(x.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`)));
2901
+ })).catch((e) => this._issues.warn(C.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`)));
2902
2902
  }
2903
2903
  _scheduleRespill() {
2904
2904
  this._sdf?.spilling && (clearTimeout(this._respillTimer), this._respillTimer = setTimeout(() => {
2905
- this._respillTimer = null, this._sdf?.respill().catch((e) => this._issues.warn(x.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`));
2906
- }, In), this._respillTimer.unref?.());
2905
+ this._respillTimer = null, this._sdf?.respill().catch((e) => this._issues.warn(C.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`));
2906
+ }, Ln), this._respillTimer.unref?.());
2907
2907
  }
2908
2908
  async ensureSceneResident() {
2909
2909
  this._sdf?.spilled && await this._sdf.ensureResident(), await this._sdf?.ensureGeometryResident();
@@ -2932,7 +2932,7 @@ var Gn = class extends I {
2932
2932
  }), r;
2933
2933
  }
2934
2934
  updateMeshTransforms(e) {
2935
- if (this._sdf?.needsPageInForMove(e)) return this._sdf.ensureMovable(e).then(() => this.updateMeshTransforms(e)).catch((e) => this._issues.warn(x.STORAGE_READ_FAILED, `reading instance matrices back failed: ${e.message}`)), null;
2935
+ 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;
2936
2936
  this._notePlacementsMoving(e);
2937
2937
  let t = this._sdf.updateMeshTransforms(e);
2938
2938
  return this.stages.pathTracer.updateBufferRanges([], this._sdf.takeMoveRanges()), this.reset(!1, { motion: !0 }), this._scheduleRespill(), t;
@@ -2943,8 +2943,8 @@ var Gn = class extends I {
2943
2943
  requestedPx: e,
2944
2944
  allowLower: r
2945
2945
  }, Math.max(256, Math.min(n, Math.floor(a) || 256));
2946
- let o = this.renderer.backend?.device?.limits?.maxStorageBufferBindingSize || 128 * 1024 * 1024, s = le(this._hostMemoryGB), c = s.gb >= 8 && o >= 1024 * 1024 * 1024 ? n : 2048, l = t(Math.min(a, c));
2947
- if (l < Math.floor(e) && this._issues.warn(x.RENDER_RESERVE_CAPPED, `reserved render size ${y.n(e)}px was capped to ${y.n(l)}px by this device's limits — renders above ${y.n(l)}px will be declined` + (s.assumed && s.gb < 8 ? " (host memory unknown, 4 GB assumed: pass hostMemoryGB)" : ""), {
2946
+ let o = this.renderer.backend?.device?.limits?.maxStorageBufferBindingSize || 128 * 1024 * 1024, s = ce(this._hostMemoryGB), c = s.gb >= 8 && o >= 1024 * 1024 * 1024 ? n : 2048, l = t(Math.min(a, c));
2947
+ 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` + (s.assumed && s.gb < 8 ? " (host memory unknown, 4 GB assumed: pass hostMemoryGB)" : ""), {
2948
2948
  requested: e,
2949
2949
  applied: l,
2950
2950
  deviceMemoryGB: s.gb,
@@ -2961,7 +2961,7 @@ var Gn = class extends I {
2961
2961
  this.pauseRendering = e;
2962
2962
  }
2963
2963
  this.reset(), this.dispatchEvent({
2964
- type: g.RESERVED_RENDER_SIZE_CHANGED,
2964
+ type: _.RESERVED_RENDER_SIZE_CHANGED,
2965
2965
  size: l
2966
2966
  });
2967
2967
  }
@@ -2973,7 +2973,7 @@ var Gn = class extends I {
2973
2973
  this._pendingReservedRenderSize = null;
2974
2974
  let t = this.setReservedRenderResolution(e.requestedPx, { allowLower: e.allowLower });
2975
2975
  this.dispatchEvent({
2976
- type: g.RESERVED_RENDER_SIZE_CHANGED,
2976
+ type: _.RESERVED_RENDER_SIZE_CHANGED,
2977
2977
  size: t
2978
2978
  });
2979
2979
  }
@@ -2981,7 +2981,7 @@ var Gn = class extends I {
2981
2981
  return i;
2982
2982
  }
2983
2983
  _isRenderSizeSupported(e, t) {
2984
- return e > i || t > i ? (this._issues.record(x.RENDER_SIZE_DECLINED, `render resolution ${e}×${t} exceeds the ${i}px storage reserve — resize ignored, so output stays at the previous size. Raise it with setReservedRenderResolution( ${Math.max(e, t)} ) before init().`, {
2984
+ return e > i || t > i ? (this._issues.record(C.RENDER_SIZE_DECLINED, `render resolution ${e}×${t} exceeds the ${i}px storage reserve — resize ignored, so output stays at the previous size. Raise it with setReservedRenderResolution( ${Math.max(e, t)} ) before init().`, {
2985
2985
  width: e,
2986
2986
  height: t,
2987
2987
  reserve: i
@@ -2995,7 +2995,7 @@ var Gn = class extends I {
2995
2995
  }
2996
2996
  _applyRenderResize(e, t) {
2997
2997
  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({
2998
- type: g.RESOLUTION_CHANGED,
2998
+ type: _.RESOLUTION_CHANGED,
2999
2999
  width: e,
3000
3000
  height: t
3001
3001
  }));
@@ -3115,7 +3115,7 @@ var Gn = class extends I {
3115
3115
  }
3116
3116
  let l = this._completionInfo();
3117
3117
  await this._finishImage(), this.completion.markComplete() && this.dispatchEvent({
3118
- type: g.RENDER_COMPLETE,
3118
+ type: _.RENDER_COMPLETE,
3119
3119
  ...l
3120
3120
  });
3121
3121
  let u = t ? await this._finalDenoise() : !1, { reason: d, ...f } = l;
@@ -3135,8 +3135,8 @@ var Gn = class extends I {
3135
3135
  getProvenance() {
3136
3136
  let e = this.stages.pathTracer, t = this.color?.status();
3137
3137
  return a({
3138
- engine: pe,
3139
- three: wt,
3138
+ engine: fe,
3139
+ three: St,
3140
3140
  adapter: this.adapterInfo ?? null,
3141
3141
  mode: {
3142
3142
  headless: this._headless,
@@ -3178,7 +3178,7 @@ var Gn = class extends I {
3178
3178
  let t = await e.captureAccumulation();
3179
3179
  return {
3180
3180
  v: 1,
3181
- engine: pe,
3181
+ engine: fe,
3182
3182
  savedAt: Date.now(),
3183
3183
  samples: t.state.frameCount,
3184
3184
  ...t
@@ -3189,7 +3189,7 @@ var Gn = class extends I {
3189
3189
  let t = this.stages.pathTracer;
3190
3190
  if (!t) throw Error("restoreRenderCheckpoint: app is not initialized");
3191
3191
  t.restoreAccumulation(e), this.needsReset = !1, this.dispatchEvent({
3192
- type: g.RENDER_RESET,
3192
+ type: _.RENDER_RESET,
3193
3193
  restored: e.samples
3194
3194
  });
3195
3195
  }
@@ -3254,9 +3254,9 @@ var Gn = class extends I {
3254
3254
  if (!a?.device) return this._toneMapFallback("the renderer has no WebGPU device");
3255
3255
  try {
3256
3256
  let o = e ? this._readbackPass().draw(e, n, r).texture : t.textures[0], s = a.get(o).texture;
3257
- return s ? (this._readbackToneMapper ??= new He(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");
3257
+ return s ? (this._readbackToneMapper ??= new ze(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");
3258
3258
  } catch (e) {
3259
- if (e instanceof Se) throw e;
3259
+ if (e instanceof xe) throw e;
3260
3260
  return this._toneMapFallback("the GPU pass threw", e);
3261
3261
  } finally {
3262
3262
  this._readbackToneMapper?.release(), e && this._textureReadback?.release();
@@ -3264,7 +3264,7 @@ var Gn = class extends I {
3264
3264
  }
3265
3265
  _toneMapFallback(e, t = null) {
3266
3266
  let n = t ? String(t?.message ?? t) : null, r = `renderToBuffer: tone mapped on the CPU — ${e}${n ? `: ${n}` : ""}`;
3267
- return $.warn(r), this._issues.warn(x.OUTPUT_TONEMAP_FALLBACK, r, {
3267
+ return $.warn(r), this._issues.warn(C.OUTPUT_TONEMAP_FALLBACK, r, {
3268
3268
  reason: e,
3269
3269
  cause: n
3270
3270
  }), null;
@@ -3322,7 +3322,7 @@ var Gn = class extends I {
3322
3322
  }
3323
3323
  _pictureCanvas() {
3324
3324
  let e = this.renderer.domElement, t = this.stages.compositor, n = this.pipeline?.context;
3325
- if (!t || !n || (t.renderPicture(n), !(this.renderer.backend?.parameters?.outputType === ft || t.showsCanvasTransform) || this._headless || typeof document > "u")) return e;
3325
+ if (!t || !n || (t.renderPicture(n), !(this.renderer.backend?.parameters?.outputType === ct || t.showsCanvasTransform) || this._headless || typeof document > "u")) return e;
3326
3326
  let r = e.getContext("webgpu")?.getConfiguration?.()?.colorSpace ?? "srgb", i = this._pictureCopy;
3327
3327
  (!i || i.colorSpace !== r) && (i = this._pictureCopy = {
3328
3328
  canvas: document.createElement("canvas"),
@@ -3390,7 +3390,7 @@ var Gn = class extends I {
3390
3390
  ...this._canvasResources()
3391
3391
  ]);
3392
3392
  let t = () => e.measure();
3393
- this._addTrackedListener(this, g.SCENE_REBUILD, t), this._addTrackedListener(this, g.ENVIRONMENT_LOADED, t), this._addTrackedListener(this, g.RESOLUTION_CHANGED, t), this._vramWired = !0;
3393
+ this._addTrackedListener(this, _.SCENE_REBUILD, t), this._addTrackedListener(this, _.ENVIRONMENT_LOADED, t), this._addTrackedListener(this, _.RESOLUTION_CHANGED, t), this._vramWired = !0;
3394
3394
  }
3395
3395
  _collectStageTextures() {
3396
3396
  let e = [], t = this.stages || {}, n = t.pathTracer;
@@ -3405,7 +3405,7 @@ var Gn = class extends I {
3405
3405
  }
3406
3406
  getSceneMinY() {
3407
3407
  if (!this.meshScene) return 0;
3408
- let e = new rt().setFromObject(this.meshScene);
3408
+ let e = new $e().setFromObject(this.meshScene);
3409
3409
  return Number.isFinite(e.min.y) ? e.min.y : 0;
3410
3410
  }
3411
3411
  getMaterialProperty(e, t) {
@@ -3415,7 +3415,7 @@ var Gn = class extends I {
3415
3415
  return this.stages.pathTracer?.materialData.getMaterialPropertySource(e, t);
3416
3416
  }
3417
3417
  setMaterialProperty(e, t, n) {
3418
- if (this._sdf?.spilled && ee.has(t)) {
3418
+ if (this._sdf?.spilled && m.has(t)) {
3419
3419
  this.ensureSceneResident().then(() => this.setMaterialProperty(e, t, n));
3420
3420
  return;
3421
3421
  }
@@ -3448,7 +3448,7 @@ var Gn = class extends I {
3448
3448
  e(), this._refreshEmissiveForVisibility(), this.reset(), this._scheduleRespill();
3449
3449
  }, n = this._sdf?.whenTLASEditable();
3450
3450
  if (!n) return t();
3451
- n.then(t).catch((e) => this._issues.warn(x.STORAGE_READ_FAILED, `reading the TLAS back failed: ${e.message}`));
3451
+ n.then(t).catch((e) => this._issues.warn(C.STORAGE_READ_FAILED, `reading the TLAS back failed: ${e.message}`));
3452
3452
  }
3453
3453
  getScene() {
3454
3454
  return this.meshScene || this.scene;
@@ -3467,7 +3467,7 @@ var Gn = class extends I {
3467
3467
  return n && n.key !== "pathtracer:color" && n.texture !== e.texture ? {
3468
3468
  texture: n.texture,
3469
3469
  source: n.key.split(":")[0]
3470
- } : (this._denoiserInUse() && this._issues.record(x.OUTPUT_SOURCE_FALLBACK, "renderToBuffer: 'display' was asked for, but no denoiser has published a picture — returned the raw accumulation", {
3470
+ } : (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", {
3471
3471
  requested: "display",
3472
3472
  read: "accumulation"
3473
3473
  }), null);
@@ -3494,15 +3494,15 @@ var Gn = class extends I {
3494
3494
  n.__rayzeeOriginalColorSpace === void 0 && (n.__rayzeeOriginalColorSpace = e.colorSpace);
3495
3495
  let r = n.__rayzeeOriginalColorSpace;
3496
3496
  if (delete n.ocioColorSpace, delete n.__rayzeeColorSpaceChoice, t == null) e.colorSpace = r, delete n.__rayzeeOriginalColorSpace;
3497
- else if (t === "srgb" || t === "linear") e.colorSpace = t === "srgb" ? O : Ue, n.__rayzeeColorSpaceChoice = t;
3497
+ else if (t === "srgb" || t === "linear") e.colorSpace = t === "srgb" ? M : Be, n.__rayzeeColorSpaceChoice = t;
3498
3498
  else {
3499
3499
  if (!this.color?.hasConfig) throw Error(`"${t}" needs a colour config loaded`);
3500
- n.ocioColorSpace = t, e.colorSpace = O;
3500
+ n.ocioColorSpace = t, e.colorSpace = M;
3501
3501
  }
3502
3502
  e.needsUpdate = !0, this.stages.pathTracer?.sdfs && await this.rebuildMaterials();
3503
3503
  }
3504
3504
  setColorManagement(e) {
3505
- this.color?.dispose(), this.color = new e({ issues: this._issues }), Ee(this.color), this.color.on?.("canvas", () => this._applyCanvasTransform()), this.renderer && this.color.attachRenderer(this.renderer);
3505
+ this.color?.dispose(), this.color = new e({ issues: this._issues }), Te(this.color), this.color.on?.("canvas", () => this._applyCanvasTransform()), this.renderer && this.color.attachRenderer(this.renderer);
3506
3506
  }
3507
3507
  _applyCanvasTransform() {
3508
3508
  let e = this.stages?.compositor;
@@ -3510,8 +3510,8 @@ var Gn = class extends I {
3510
3510
  }
3511
3511
  async loadColorConfig(e = {}) {
3512
3512
  await this._leaveColorWorkingSpace();
3513
- let t = w(this.renderer?.toneMapping), n = await this.color.loadConfig(e);
3514
- return this.color.workingSpaceAdopted && await this.applyColorWorkingSpace(), (!(t?.source === "ocio" && w(this.renderer?.toneMapping) === t) || this.color.workingSpaceAdopted) && this.reset(), n;
3513
+ let t = E(this.renderer?.toneMapping), n = await this.color.loadConfig(e);
3514
+ return this.color.workingSpaceAdopted && await this.applyColorWorkingSpace(), (!(t?.source === "ocio" && E(this.renderer?.toneMapping) === t) || this.color.workingSpaceAdopted) && this.reset(), n;
3515
3515
  }
3516
3516
  async unloadColorConfig() {
3517
3517
  await this._leaveColorWorkingSpace(), this.color.unloadConfig(), this.reset();
@@ -3531,17 +3531,17 @@ var Gn = class extends I {
3531
3531
  async rebuildMaterials(e) {
3532
3532
  await this.ensureSceneResident();
3533
3533
  let t = this.stages.pathTracer;
3534
- await t?.rebuildMaterials(e || this.meshScene), t?.triangleStorageNode?.withoutUV && this._sdf?.triangles && re(e || this.meshScene) && (this._sdf.textureCoordinates = !0, t.setTriangleData(this._sdf.triangles, this._sdf.triangleCount, { textureCoordinates: !0 }), t.setupMaterial()), this.reset();
3534
+ 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();
3535
3535
  }
3536
3536
  async _initRenderer() {
3537
- me((e) => this.dispatchEvent(e)), (typeof navigator > "u" || !navigator.gpu) && this._issues.fail(x.WEBGPU_UNAVAILABLE, "WebGPU is not available — outside a browser, install one as navigator.gpu (for Node, the `webgpu` package)");
3537
+ le((e) => this.dispatchEvent(e)), (typeof navigator > "u" || !navigator.gpu) && this._issues.fail(C.WEBGPU_UNAVAILABLE, "WebGPU is not available — outside a browser, install one as navigator.gpu (for Node, the `webgpu` package)");
3538
3538
  let e = null, t;
3539
3539
  try {
3540
3540
  e = await navigator.gpu.requestAdapter({ powerPreference: "high-performance" });
3541
3541
  } catch (e) {
3542
3542
  t = e;
3543
3543
  }
3544
- e || this._issues.fail(x.ADAPTER_UNAVAILABLE, `no WebGPU adapter${t ? ": " + t.message : ""}`, {}, t), this.adapterInfo = Wn(e), this.adapterInfo.isSoftware && (this._issues.warn(x.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}`));
3544
+ e || this._issues.fail(C.ADAPTER_UNAVAILABLE, `no WebGPU adapter${t ? ": " + t.message : ""}`, {}, t), this.adapterInfo = Gn(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}`));
3545
3545
  let n = e.limits, r = { maxColorAttachmentBytesPerSample: 128 };
3546
3546
  for (let e of [
3547
3547
  "maxBufferSize",
@@ -3563,32 +3563,32 @@ var Gn = class extends I {
3563
3563
  let i;
3564
3564
  try {
3565
3565
  i = await e.requestDevice({
3566
- requiredFeatures: Hn.filter((t) => e.features.has(t)),
3566
+ requiredFeatures: Un.filter((t) => e.features.has(t)),
3567
3567
  requiredLimits: r
3568
3568
  });
3569
3569
  } catch (e) {
3570
- this._issues.fail(x.DEVICE_UNAVAILABLE, `WebGPU device request failed: ${e.message}`, { adapter: { ...this.adapterInfo } }, e);
3570
+ this._issues.fail(C.DEVICE_UNAVAILABLE, `WebGPU device request failed: ${e.message}`, { adapter: { ...this.adapterInfo } }, e);
3571
3571
  }
3572
- this.renderer = new Ke({
3572
+ this.renderer = new Ue({
3573
3573
  canvas: this.canvas,
3574
3574
  alpha: !0,
3575
3575
  device: i
3576
3576
  });
3577
3577
  try {
3578
- await zn(this.renderer, this._headless);
3578
+ await Bn(this.renderer, this._headless);
3579
3579
  } catch (e) {
3580
3580
  throw i.destroy(), e;
3581
3581
  }
3582
- this.renderer.backend?.isWebGPUBackend || (i.destroy(), this._issues.fail(x.WEBGPU_UNAVAILABLE, "three.js fell back to WebGL2, which cannot run the path tracer's compute kernels. Check GPU process flags and driver support.")), this._gpuDevice = i, i.lost && (this._deviceLostHolder = { app: this }, Vn(i, this._deviceLostHolder), i.onuncapturederror = (e) => $.error("WebGPU uncaptured error:", e.error)), We.setLTC(kt.init()), this.renderer.outputColorSpace = O, this.renderer.toneMapping = Ne, this.renderer.toneMappingExposure = 1, this.renderer.setPixelRatio(1), this.color.attachRenderer(this.renderer);
3582
+ this.renderer.backend?.isWebGPUBackend || (i.destroy(), this._issues.fail(C.WEBGPU_UNAVAILABLE, "three.js fell back to WebGL2, which cannot run the path tracer's compute kernels. Check GPU process flags and driver support.")), this._gpuDevice = i, i.lost && (this._deviceLostHolder = { app: this }, Hn(i, this._deviceLostHolder), i.onuncapturederror = (e) => $.error("WebGPU uncaptured error:", e.error)), Ve.setLTC(kt.init()), this.renderer.outputColorSpace = M, this.renderer.toneMapping = Me, this.renderer.toneMappingExposure = 1, this.renderer.setPixelRatio(1), this.color.attachRenderer(this.renderer);
3583
3583
  }
3584
3584
  _initScenes() {
3585
- this.scene = new H(), this.meshScene = new H(), this._sceneHelpers = new Ft();
3585
+ this.scene = new wt(), this.meshScene = new wt(), this._sceneHelpers = new Ft();
3586
3586
  }
3587
3587
  _initAssetPipeline() {
3588
3588
  this._sdf = new u({
3589
3589
  issues: this._issues,
3590
3590
  ...this._maxSceneBytes === void 0 ? {} : { maxSceneBytes: this._maxSceneBytes }
3591
- }), this.assetLoader = new En(this.meshScene, this.camera, null, {
3591
+ }), this.assetLoader = new Dn(this.meshScene, this.camera, null, {
3592
3592
  issues: this._issues,
3593
3593
  areaLightIntensityScale: () => this.settings.get("areaLightIntensityScale")
3594
3594
  }), this.assetLoader.setRenderer(this.renderer), this.assetLoader.createFloorPlane();
@@ -3596,14 +3596,14 @@ var Gn = class extends I {
3596
3596
  _initPipeline() {
3597
3597
  this._createStages();
3598
3598
  let { clientWidth: e, clientHeight: t } = this.canvas;
3599
- this.pipeline = new Jt(this.renderer, e || 1, t || 1, { issues: this._issues }), this.pipeline.addStage(this.stages.pathTracer);
3599
+ this.pipeline = new Yt(this.renderer, e || 1, t || 1, { issues: this._issues }), this.pipeline.addStage(this.stages.pathTracer);
3600
3600
  for (let e of this._extraStages) this.pipeline.addStage(e);
3601
3601
  this.pipeline.addStage(this.stages.compositor);
3602
3602
  let n = this.canvas.clientWidth || 1, r = this.canvas.clientHeight || 1;
3603
3603
  this._displayWidth = n, this._displayHeight = r, this._renderWidth = n, this._renderHeight = r, this.pipeline.setSize(n, r);
3604
3604
  }
3605
3605
  async _initManagers() {
3606
- this.lightManager = new Pn(this.scene, this._sceneHelpers, this.stages.pathTracer, {
3606
+ this.lightManager = new Fn(this.scene, this._sceneHelpers, this.stages.pathTracer, {
3607
3607
  onReset: () => this.reset(),
3608
3608
  onLightRemoved: (e) => this._lightRemoved(e)
3609
3609
  }), 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();
@@ -3614,12 +3614,12 @@ var Gn = class extends I {
3614
3614
  if (e.model) this._clearAppendedModels(), await this.loadSceneData({ pendingEnvironment: this._beginSceneMetadataEnvironment() }) && this.assetLoader?.commitPendingGraph(e.model);
3615
3615
  else if (e.texture) {
3616
3616
  let e = this.meshScene.environment;
3617
- e && this.stages.pathTracer && await this.stages.pathTracer.environment.setEnvironmentMap(e), de();
3617
+ e && this.stages.pathTracer && await this.stages.pathTracer.environment.setEnvironmentMap(e), pe();
3618
3618
  }
3619
3619
  this.pauseRendering = !1, this.reset();
3620
3620
  }
3621
3621
  }, this._addTrackedListener(this.assetLoader, "load", this._onAssetLoaded), this.pipeline.eventBus.on("pathtracer:compiling", ({ compiling: e }) => this.dispatchEvent({
3622
- type: g.SHADERS_COMPILING,
3622
+ type: _.SHADERS_COMPILING,
3623
3623
  compiling: e
3624
3624
  }));
3625
3625
  }
@@ -3628,7 +3628,7 @@ var Gn = class extends I {
3628
3628
  hostMemoryGB: this._hostMemoryGB,
3629
3629
  sortMaterials: this.settings.get("wavefrontSortMaterials")
3630
3630
  }), this._extraStages = this._createExtraStages(), this.stages.compositor = new It(this.renderer, {
3631
- saturation: this.settings.get("saturation") ?? _.saturation,
3631
+ saturation: this.settings.get("saturation") ?? v.saturation,
3632
3632
  pathTracer: this.stages.pathTracer,
3633
3633
  displaySources: this._displaySources(),
3634
3634
  canvasTransform: this.color?.canvasTransform ?? null
@@ -3638,13 +3638,13 @@ var Gn = class extends I {
3638
3638
  let e = this.stages.pathTracer;
3639
3639
  if (!e) return;
3640
3640
  let t = this.completion.isLimitReached(e, this.settings.get("renderLimitMode"), this.settings.get("renderTimeLimit"));
3641
- 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());
3641
+ t && !e.isComplete ? e.isComplete = !0 : !t && e.isComplete && (e.isComplete = !1, this.completion.resumeFromPause(), this._completionReopened(), this.dispatchEvent({ type: _.RENDER_RESET }), this.wake());
3642
3642
  }
3643
3643
  _forwardEvents(e, t) {
3644
3644
  if (e) for (let n of t) this._addTrackedListener(e, n, (e) => this.dispatchEvent(e));
3645
3645
  }
3646
3646
  _createCamera() {
3647
- let e = new jn(60, this.canvas.clientWidth / this.canvas.clientHeight || 1, .01, 1e3);
3647
+ let e = new Mn(60, this.canvas.clientWidth / this.canvas.clientHeight || 1, .01, 1e3);
3648
3648
  return e.position.set(0, 0, 5), e;
3649
3649
  }
3650
3650
  _createExtraStages() {
@@ -3714,4 +3714,4 @@ var Gn = class extends I {
3714
3714
  _disposeExtensions() {}
3715
3715
  };
3716
3716
  //#endregion
3717
- export { Lt as _, cn as a, J as c, q as d, an as f, Vt as g, Ht as h, jn as i, on as l, Ut as m, Wn as n, Y as o, Jt as p, Pn as r, G as s, Gn as t, rn as u };
3717
+ export { Lt as _, ln as a, J as c, q as d, on as f, Ht as g, Ut as h, Mn as i, sn as l, Wt as m, Gn as n, Y as o, Yt as p, Fn as r, G as s, Kn as t, an as u };