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