rayzee 11.3.0 → 11.4.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 +33 -5
- package/dist/{ArchiveImporter-D735xX-4.js → ArchiveImporter-Cgyx5AF7.js} +2 -2
- package/dist/{BidirectionalIntegrator-M89c0AlP.js → BidirectionalIntegrator-BKF-cwH2.js} +2 -2
- package/dist/{NeuralRetouch-DiBH63kz.js → NeuralRetouch-C3Q2XqbF.js} +4 -3
- package/dist/{NeuralSuperRes-CZNQP13W.js → NeuralSuperRes-DV5TtURP.js} +11 -5
- package/dist/{PathTracer-BXCCVrPK.js → PathTracer-D3MvEaZK.js} +19 -12
- package/dist/{PhysicalSky-DqmaS0lb.js → PhysicalSky-CY4jiz6a.js} +1 -1
- package/dist/{RayzeeRenderer-DUSMFhmc.js → RayzeeRenderer-D23m6NqG.js} +313 -281
- package/dist/{ToneMapGPU-BOjpul7A.js → ToneMapGPU-CTDBvmmS.js} +31 -22
- 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 +3 -3
- package/dist/rayzee.es.js +1343 -858
- package/dist/rayzee.umd.js +124 -113
- package/dist/{sceneCachePolicy-BAib5fCp.js → sceneCachePolicy-AKOEu2lf.js} +1 -1
- package/package.json +1 -1
- package/src/EngineDefaults.js +2 -2
- package/src/Passes/AIUpscaler.js +2 -0
- package/src/PathTracerApp.js +122 -16
- package/src/Pipeline/CompletionTracker.js +7 -3
- package/src/Processor/ToneMapCPU.js +16 -4
- package/src/Processor/ToneMapGPU.js +30 -14
- package/src/RayzeeRenderer.js +54 -7
- package/src/RenderSettings.js +4 -2
- package/src/Stages/AutoExposure.js +484 -494
- package/src/Stages/Compositor.js +27 -6
- package/src/Stages/LocalExposure.js +546 -0
- package/src/Stages/PathTracer.js +6 -4
- package/src/Stages/PathTracerStage.js +9 -7
- package/src/index.js +1 -0
- package/src/managers/DenoisingManager.js +11 -15
- package/src/managers/VideoRenderManager.js +30 -4
- package/src/neural/NeuralRetouch.js +1 -0
- package/src/neural/NeuralSuperRes.js +6 -1
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { dt as e } from "./SolarLimb-bZE6y63S.js";
|
|
2
|
-
import { Dt as t, Ot as n, Tt as r, _t as i, ct as a, gt as o, kt as s, mt as c, n as l, ot as u, st as d, wt as f } from "./PathTracer-
|
|
2
|
+
import { Dt as t, Ot as n, Tt as r, _t as i, ct as a, gt as o, kt as s, mt as c, n as l, ot as u, st as d, wt as f } from "./PathTracer-D3MvEaZK.js";
|
|
3
3
|
import { n as p, t as m } from "./EngineEvents-Ci8dVWCP.js";
|
|
4
|
-
import { $ as h, C as g, G as _, M as ee, Q as te, T as ne, W as re, at as v, d as ie, et as ae, f as oe, l as se, nt as
|
|
5
|
-
import { i as
|
|
4
|
+
import { $ as h, C as g, G as _, M as ee, Q as te, T as ne, W as re, at as v, d as ie, et as ae, f as oe, l as se, nt as y, ot as ce, r as le, rt as ue, tt as de, u as fe, v as pe, x as b } from "./sceneCachePolicy-AKOEu2lf.js";
|
|
5
|
+
import { i as x, r as me } from "./Logger-dDDGj9Av.js";
|
|
6
6
|
import { f as he, r as ge } from "./BufferLayout-xPRH9jYD.js";
|
|
7
7
|
import { i as _e, n as S, t as ve } from "./EngineIssues-CIZnXHsF.js";
|
|
8
8
|
import { n as ye, r as be } from "./shared-BGBcSxBQ.js";
|
|
9
9
|
import { a as xe } from "./WorkingMatrix-C6y233hT.js";
|
|
10
|
-
import { i as
|
|
11
|
-
import { n as
|
|
12
|
-
import { d as
|
|
13
|
-
import { i as
|
|
14
|
-
import { a as
|
|
15
|
-
import { t as
|
|
16
|
-
import { LinearSRGBColorSpace as
|
|
17
|
-
import { Fn as He, If as Ue, cubeTexture as We, dot as Ge, float as k, int as A, ivec2 as Ke, mix as j, screenCoordinate as qe, select as M, storage 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
|
|
10
|
+
import { i as Se, r as Ce, t as C } from "./ActiveColor-YvuQq44O.js";
|
|
11
|
+
import { n as w, r as we } from "./AssetConfig-DSEntE65.js";
|
|
12
|
+
import { d as Te, l as Ee, m as De, p as Oe, t as ke, u as T } from "./ViewTransforms-CYN7bq2w.js";
|
|
13
|
+
import { i as E, n as Ae, r as je } from "./identity-C1cLD1C0.js";
|
|
14
|
+
import { a as Me, i as Ne, t as Pe } from "./SceneMetadata-D2Sh-0e-.js";
|
|
15
|
+
import { t as Fe } from "./ToneMapGPU-CTDBvmmS.js";
|
|
16
|
+
import { LinearSRGBColorSpace as Ie, MeshBasicNodeMaterial as Le, NodeMaterial as Re, QuadMesh as D, RectAreaLightNode as ze, SRGBColorSpace as O, TextureNode as Be, WebGPURenderer as Ve } from "three/webgpu";
|
|
17
|
+
import { Fn as He, If as Ue, cubeTexture as We, dot as Ge, float as k, int as A, ivec2 as Ke, mix as j, screenCoordinate as qe, screenUV as Je, select as M, storage as Ye, texture as Xe, uint as Ze, uniform as N, uv as P, vec3 as F, vec4 as Qe } from "three/tsl";
|
|
18
|
+
import { Box3 as $e, BufferGeometry as et, CircleGeometry as tt, Color as nt, DataTexture as rt, DirectionalLight as it, DirectionalLightHelper as at, EquirectangularReflectionMapping as ot, EventDispatcher as I, FloatType as st, LinearFilter as ct, LinearSRGBColorSpace as lt, LoaderUtils as L, LoadingManager as ut, MathUtils as R, Mesh as dt, MeshPhysicalMaterial as ft, NearestFilter as pt, NoBlending as mt, NoToneMapping as ht, Object3D as gt, OrthographicCamera as _t, PerspectiveCamera as vt, PointLight as yt, PointLightHelper as bt, REVISION as xt, RGBAFormat as St, RectAreaLight as z, RenderTarget as Ct, SRGBColorSpace as B, Scene as V, SpotLight as wt, SpotLightHelper as Tt, TextureLoader as Et, UnsignedByteType as Dt, Vector2 as Ot, Vector3 as H } from "three";
|
|
19
|
+
import { RectAreaLightTexturesLib as kt } from "three/addons/lights/RectAreaLightTexturesLib.js";
|
|
20
|
+
import { RectAreaLightHelper as At } from "three/addons/helpers/RectAreaLightHelper.js";
|
|
21
|
+
import { GLTFLoader as jt } from "three/addons/loaders/GLTFLoader.js";
|
|
22
|
+
import { HDRLoader as Mt } from "three/addons/loaders/HDRLoader.js";
|
|
23
|
+
import { createMeshesFromMultiMaterialMesh as Nt } from "three/addons/utils/SceneUtils.js";
|
|
24
|
+
import { clone as Pt } from "three/addons/utils/SkeletonUtils.js";
|
|
25
25
|
//#region src/SceneHelpers.js
|
|
26
|
-
var
|
|
26
|
+
var Ft = class {
|
|
27
27
|
constructor() {
|
|
28
|
-
this.scene = new
|
|
28
|
+
this.scene = new V(), this._helpers = /* @__PURE__ */ new Map(), this.visible = !1;
|
|
29
29
|
}
|
|
30
30
|
add(e) {
|
|
31
31
|
if (this._helpers.has(e.uuid)) return this._helpers.get(e.uuid);
|
|
@@ -63,16 +63,21 @@ var Nt = class {
|
|
|
63
63
|
this.clear();
|
|
64
64
|
}
|
|
65
65
|
_createHelper(e) {
|
|
66
|
-
return e.isRectAreaLight ? new
|
|
66
|
+
return e.isRectAreaLight ? new At(e) : e.isPointLight ? new bt(e, .5) : e.isSpotLight ? new Tt(e) : e.isDirectionalLight ? new at(e, .5) : null;
|
|
67
67
|
}
|
|
68
|
-
},
|
|
69
|
-
constructor(
|
|
68
|
+
}, It = class extends n {
|
|
69
|
+
constructor(e, t = {}) {
|
|
70
70
|
super("Compositor", {
|
|
71
|
-
...
|
|
71
|
+
...t,
|
|
72
72
|
executionMode: s.ALWAYS
|
|
73
|
-
}), this.renderer =
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
}), this.renderer = e, this._lightSources = [...t.displaySources ?? [], "pathtracer:color"], this.saturation = N(t.saturation ?? 1), this._transparentBackground = N(0, "int"), this._pathTracer = t.pathTracer ?? null, this._convergenceOverlay = !1, this._debugMaterial = null, this._debugQuad = null, this._debugTexNode = null, this._debugM2Attr = null, this._debugMaskAttr = null, this._debugExposureComp = N(1), this._sourceTexNode = new Be(), this._displayGain = null, this.compositorMaterial = new Le(), this.compositorMaterial.blending = mt, this._buildColorNode(), this.compositorQuad = new D(this.compositorMaterial);
|
|
74
|
+
}
|
|
75
|
+
_buildColorNode() {
|
|
76
|
+
let t = this._sourceTexNode.sample(P()), n = this._displayGain ? t.xyz.mul(this._displayGain(t.xyz, Je)) : t.xyz, r = j(F(Ge(n, e)), n, this.saturation), i = M(this._transparentBackground, t.w, 1);
|
|
77
|
+
this.compositorMaterial.colorNode = Qe(r, i), this.compositorMaterial.needsUpdate = !0;
|
|
78
|
+
}
|
|
79
|
+
setDisplayGain(e) {
|
|
80
|
+
e !== this._displayGain && (this._displayGain = e, this._buildColorNode());
|
|
76
81
|
}
|
|
77
82
|
resolveLightTexture(e) {
|
|
78
83
|
return this.resolveLightSource(e)?.texture ?? null;
|
|
@@ -93,15 +98,15 @@ var Nt = class {
|
|
|
93
98
|
if (this._debugMaterial && this._debugM2Attr === t.m2 && this._debugMaskAttr === t.frozenMask) return !0;
|
|
94
99
|
this._debugMaterial?.dispose(), this._debugTexNode?.dispose(), this._debugM2Attr = t.m2, this._debugMaskAttr = t.frozenMask, this._debugTexNode = new Be();
|
|
95
100
|
let n = He(() => {
|
|
96
|
-
let n = Ge(this._debugTexNode.sample(P()).toVar().xyz, e).toVar(), r = t.renderWidth, i = t.renderHeight, a = A(P().x.mul(k(r))).min(r.sub(A(1))).max(A(0)), o =
|
|
101
|
+
let n = Ge(this._debugTexNode.sample(P()).toVar().xyz, e).toVar(), r = t.renderWidth, i = t.renderHeight, a = A(P().x.mul(k(r))).min(r.sub(A(1))).max(A(0)), o = Ze(A(P().y.mul(k(i))).min(i.sub(A(1))).max(A(0)).mul(r).add(a)).toVar(), s = Ye(t.m2, "float").toReadOnly().element(o).toVar(), c = Ye(t.frozenMask, "uint").toReadOnly().element(o).toVar(), l = s.sub(n.mul(n)).max(k(0)).div(k(t.frame).add(1)).sqrt().toVar(), u = t.usePixelFreeze.greaterThan(A(0)), d = M(n.lessThan(k(1)), n.sqrt(), n).toVar(), f = M(u, l.div(n.add(k(1e-4))), l.div(d.add(k(1e-4)))).toVar(), p = M(u, t.pixelFreezeThreshold, t.noiseThreshold).toVar(), m = f.div(p.max(k(1e-6))).toVar(), h = F(n.div(n.add(k(1))).sqrt().mul(.55)).toVar(), g = h.toVar(), _ = k(t.frame).greaterThanEqual(k(t.adaptiveMinSamples));
|
|
97
102
|
return Ue(m.greaterThanEqual(k(1)).or(_.not()), () => {
|
|
98
103
|
let e = j(F(1, .8, .1), F(1, .1, .05), m.sub(1).div(3).clamp(0, 1));
|
|
99
104
|
g.assign(j(h, e, .85));
|
|
100
|
-
}), Ue(c.equal(
|
|
105
|
+
}), Ue(c.equal(Ze(1)).and(u), () => {
|
|
101
106
|
g.assign(j(h, F(.1, .45, 1), .55));
|
|
102
107
|
}), g;
|
|
103
108
|
});
|
|
104
|
-
return this._debugMaterial = new
|
|
109
|
+
return this._debugMaterial = new Le(), this._debugMaterial.colorNode = Qe(n().pow(2.2).mul(this._debugExposureComp), 1), this._debugMaterial.blending = mt, this._debugQuad = new D(this._debugMaterial), !0;
|
|
105
110
|
}
|
|
106
111
|
render(e) {
|
|
107
112
|
if (!this.enabled) return;
|
|
@@ -109,7 +114,7 @@ var Nt = class {
|
|
|
109
114
|
let t = e.getTexture("pathtracer:color");
|
|
110
115
|
if (t) {
|
|
111
116
|
this._debugTexNode.value = t;
|
|
112
|
-
let e = this.renderer.toneMapping !==
|
|
117
|
+
let e = this.renderer.toneMapping !== ht;
|
|
113
118
|
this._debugExposureComp.value = e ? 1 / Math.max(this.renderer.toneMappingExposure, 1e-4) : 1, this.renderer.setRenderTarget(null), this._debugQuad.render(this.renderer);
|
|
114
119
|
return;
|
|
115
120
|
}
|
|
@@ -129,7 +134,7 @@ var Nt = class {
|
|
|
129
134
|
dispose() {
|
|
130
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;
|
|
131
136
|
}
|
|
132
|
-
},
|
|
137
|
+
}, Lt = class {
|
|
133
138
|
constructor() {
|
|
134
139
|
this.textures = /* @__PURE__ */ new Map(), this.renderTargets = /* @__PURE__ */ new Map(), this.uniforms = /* @__PURE__ */ new Map(), this.state = {
|
|
135
140
|
frame: 0,
|
|
@@ -249,7 +254,7 @@ var Nt = class {
|
|
|
249
254
|
dispose() {
|
|
250
255
|
this.textures.clear(), this.renderTargets.clear(), this.uniforms.clear(), this._stateChangeCallbacks.clear(), this.state = {};
|
|
251
256
|
}
|
|
252
|
-
},
|
|
257
|
+
}, Rt = class extends I {
|
|
253
258
|
constructor() {
|
|
254
259
|
super(), this._onceCallbacks = /* @__PURE__ */ new Map();
|
|
255
260
|
}
|
|
@@ -287,38 +292,38 @@ var Nt = class {
|
|
|
287
292
|
eventNames() {
|
|
288
293
|
return this._listeners ? Object.keys(this._listeners) : [];
|
|
289
294
|
}
|
|
290
|
-
},
|
|
291
|
-
function
|
|
292
|
-
|
|
295
|
+
}, zt = !1, U = [], Bt = /* @__PURE__ */ new WeakMap();
|
|
296
|
+
function Vt(e) {
|
|
297
|
+
zt = !!e;
|
|
293
298
|
}
|
|
294
|
-
function
|
|
295
|
-
return
|
|
299
|
+
function Ht() {
|
|
300
|
+
return U.slice();
|
|
296
301
|
}
|
|
297
|
-
function
|
|
298
|
-
|
|
302
|
+
function Ut() {
|
|
303
|
+
U.length = 0;
|
|
299
304
|
}
|
|
300
|
-
function
|
|
305
|
+
function Wt(e) {
|
|
301
306
|
let t = [];
|
|
302
307
|
for (let n of Object.keys(e)) e[n]?.isTextureNode === !0 && t.push(n);
|
|
303
308
|
return t;
|
|
304
309
|
}
|
|
305
|
-
var
|
|
306
|
-
function
|
|
307
|
-
if (!
|
|
310
|
+
var Gt = (e) => !e || !e.image || !(e.image.width > 0);
|
|
311
|
+
function Kt(e, t, n) {
|
|
312
|
+
if (!zt) {
|
|
308
313
|
n();
|
|
309
314
|
return;
|
|
310
315
|
}
|
|
311
|
-
let r =
|
|
316
|
+
let r = Bt.get(e);
|
|
312
317
|
if (r || (r = {
|
|
313
318
|
phase: "pending",
|
|
314
319
|
unboundAtCompile: []
|
|
315
|
-
},
|
|
316
|
-
n(), r.phase === "watch" &&
|
|
320
|
+
}, Bt.set(e, r)), r.phase !== "pending") {
|
|
321
|
+
n(), r.phase === "watch" && qt(e, r);
|
|
317
322
|
return;
|
|
318
323
|
}
|
|
319
324
|
let i = Object.prototype.hasOwnProperty.call(t, "compute"), a = t.compute;
|
|
320
325
|
t.compute = function(...t) {
|
|
321
|
-
return r.phase === "pending" && (r.unboundAtCompile =
|
|
326
|
+
return r.phase === "pending" && (r.unboundAtCompile = Wt(e).filter((t) => Gt(e[t].value)), r.phase = r.unboundAtCompile.length < 2 ? "done" : "watch"), a.apply(this, t);
|
|
322
327
|
};
|
|
323
328
|
try {
|
|
324
329
|
n();
|
|
@@ -326,14 +331,14 @@ function Wt(e, t, n) {
|
|
|
326
331
|
i ? t.compute = a : delete t.compute;
|
|
327
332
|
}
|
|
328
333
|
}
|
|
329
|
-
function
|
|
334
|
+
function qt(e, t) {
|
|
330
335
|
let n = [];
|
|
331
336
|
for (let r of t.unboundAtCompile) {
|
|
332
337
|
let t = e[r]?.value;
|
|
333
|
-
if (
|
|
338
|
+
if (Gt(t)) return;
|
|
334
339
|
t.isStorageTexture !== !0 && n.push(r);
|
|
335
340
|
}
|
|
336
|
-
t.phase = "done", n.length !== 0 &&
|
|
341
|
+
t.phase = "done", n.length !== 0 && U.push({
|
|
337
342
|
stage: e.name,
|
|
338
343
|
nodes: n,
|
|
339
344
|
unboundAtCompile: t.unboundAtCompile.slice(),
|
|
@@ -342,7 +347,7 @@ function Gt(e, t) {
|
|
|
342
347
|
}
|
|
343
348
|
//#endregion
|
|
344
349
|
//#region src/Pipeline/RenderPipeline.js
|
|
345
|
-
var
|
|
350
|
+
var Jt = class {
|
|
346
351
|
_reportStageFailure(e, t, n) {
|
|
347
352
|
console.error(`[Pipeline] Error in stage '${e}' (${t}):`, n);
|
|
348
353
|
let r = `${e}:${t}`;
|
|
@@ -353,7 +358,7 @@ var Kt = class {
|
|
|
353
358
|
}));
|
|
354
359
|
}
|
|
355
360
|
constructor(e, t, n, { issues: r = null } = {}) {
|
|
356
|
-
this.renderer = e, this._issues = r, this._reportedStageFailures = /* @__PURE__ */ new Set(), this.width = t, this.height = n, this.stages = [], this.context = new
|
|
361
|
+
this.renderer = e, this._issues = r, this._reportedStageFailures = /* @__PURE__ */ new Set(), this.width = t, this.height = n, this.stages = [], this.context = new Lt(), this.eventBus = new Rt(), this.context.setState("width", t), this.context.setState("height", n), this.stats = {
|
|
357
362
|
enabled: !1,
|
|
358
363
|
logSkipped: !1,
|
|
359
364
|
timings: /* @__PURE__ */ new Map(),
|
|
@@ -387,7 +392,7 @@ var Kt = class {
|
|
|
387
392
|
}
|
|
388
393
|
try {
|
|
389
394
|
let n = this.stats.enabled ? performance.now() : 0;
|
|
390
|
-
if (
|
|
395
|
+
if (Kt(t, this.renderer, () => t.render(this.context, e)), this.stats.enabled) {
|
|
391
396
|
let e = performance.now() - n;
|
|
392
397
|
this.stats.timings.has(t.name) || this.stats.timings.set(t.name, []);
|
|
393
398
|
let r = this.stats.timings.get(t.name);
|
|
@@ -485,7 +490,7 @@ var Kt = class {
|
|
|
485
490
|
let e = this.getInfo();
|
|
486
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();
|
|
487
492
|
}
|
|
488
|
-
},
|
|
493
|
+
}, Yt = me("engine"), Xt = class {
|
|
489
494
|
constructor() {
|
|
490
495
|
this.timeElapsed = 0, this.lastResetTime = performance.now(), this.renderCompleteDispatched = !1, this.budgetOverrun = !1, this._budgetHeldWarned = !1;
|
|
491
496
|
}
|
|
@@ -493,7 +498,7 @@ var Kt = class {
|
|
|
493
498
|
this.timeElapsed = (performance.now() - this.lastResetTime) / 1e3;
|
|
494
499
|
}
|
|
495
500
|
isTimeLimitReached(e, t, n) {
|
|
496
|
-
return t !== "time" || !(n > 0) || this.timeElapsed < n ? !1 : e?.frameCount > 0 ? (this.budgetOverrun = !0, !0) : (this._budgetHeldWarned || (this._budgetHeldWarned = !0,
|
|
501
|
+
return this.budgetOverrun = !1, t !== "time" && t !== "timeOnly" || !(n > 0) || this.timeElapsed < n ? !1 : e?.frameCount > 0 ? (this.budgetOverrun = !0, !0) : (this._budgetHeldWarned || (this._budgetHeldWarned = !0, Yt.warn(`render time limit (${n}s) expired before the first sample landed — holding the deadline open to avoid capturing an empty frame`)), !1);
|
|
497
502
|
}
|
|
498
503
|
isLimitReached(e, t, n) {
|
|
499
504
|
return e ? this.isTimeLimitReached(e, t, n) ? !0 : this.stopCondition(e) !== null : !1;
|
|
@@ -510,17 +515,17 @@ var Kt = class {
|
|
|
510
515
|
resumeFromPause() {
|
|
511
516
|
this.renderCompleteDispatched = !1, this.lastResetTime = performance.now() - this.timeElapsed * 1e3;
|
|
512
517
|
}
|
|
513
|
-
},
|
|
518
|
+
}, Zt = class {
|
|
514
519
|
constructor(e) {
|
|
515
|
-
this.renderer = e, this.target = null, this.material = new
|
|
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;
|
|
516
521
|
}
|
|
517
522
|
_ensureTarget(e, t) {
|
|
518
|
-
this.target && this.target.width === e && this.target.height === t || (this.target?.dispose(), this.target = new
|
|
519
|
-
type:
|
|
520
|
-
format:
|
|
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,
|
|
521
526
|
depthBuffer: !1,
|
|
522
|
-
minFilter:
|
|
523
|
-
magFilter:
|
|
527
|
+
minFilter: pt,
|
|
528
|
+
magFilter: pt
|
|
524
529
|
}));
|
|
525
530
|
}
|
|
526
531
|
async read(e, t, n) {
|
|
@@ -531,7 +536,7 @@ var Kt = class {
|
|
|
531
536
|
}
|
|
532
537
|
}
|
|
533
538
|
draw(e, t, n) {
|
|
534
|
-
this._ensureTarget(t, n), this._source !== e && (this._node =
|
|
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);
|
|
535
540
|
let r = this.renderer.getRenderTarget();
|
|
536
541
|
return this.renderer.setRenderTarget(this.target), this.quad.render(this.renderer), this.renderer.setRenderTarget(r), this.target;
|
|
537
542
|
}
|
|
@@ -541,15 +546,15 @@ var Kt = class {
|
|
|
541
546
|
dispose() {
|
|
542
547
|
this.target?.dispose(), this.material.dispose(), this.target = null, this._source = null, this._node = null;
|
|
543
548
|
}
|
|
544
|
-
},
|
|
549
|
+
}, Qt = 864e5, W = Object.freeze({
|
|
545
550
|
IMMUTABLE: "immutable",
|
|
546
551
|
REVALIDATE: "revalidate",
|
|
547
552
|
NETWORK: "network"
|
|
548
|
-
}),
|
|
553
|
+
}), G = (e, t) => ({
|
|
549
554
|
loaded: e,
|
|
550
555
|
total: t,
|
|
551
556
|
lengthComputable: t > 0 && e <= t
|
|
552
|
-
}), K = (e, t) => e.headers?.get?.(t) ?? null,
|
|
557
|
+
}), K = (e, t) => e.headers?.get?.(t) ?? null, $t = (e) => e.reason ?? new DOMException("aborted", "AbortError");
|
|
553
558
|
function q(e) {
|
|
554
559
|
try {
|
|
555
560
|
let t = new URL(e, globalThis.location?.href ?? "http://localhost/").pathname;
|
|
@@ -558,36 +563,36 @@ function q(e) {
|
|
|
558
563
|
return "download";
|
|
559
564
|
}
|
|
560
565
|
}
|
|
561
|
-
async function
|
|
566
|
+
async function en(e, { onProgress: t, signal: n }) {
|
|
562
567
|
let r = Number(K(e, "content-length")) || 0, i = K(e, "content-type") ?? "";
|
|
563
568
|
if (!e.body) return new Blob([await e.arrayBuffer()], { type: i });
|
|
564
569
|
let a = e.body.getReader(), o = [], s = 0;
|
|
565
570
|
for (;;) {
|
|
566
|
-
if (n?.aborted) throw a.cancel().catch(() => {}),
|
|
571
|
+
if (n?.aborted) throw a.cancel().catch(() => {}), $t(n);
|
|
567
572
|
let { done: e, value: i } = await a.read();
|
|
568
573
|
if (e) break;
|
|
569
|
-
o.push(i), s += i.length, t?.(
|
|
574
|
+
o.push(i), s += i.length, t?.(G(s, r));
|
|
570
575
|
}
|
|
571
576
|
return new Blob(o, { type: i });
|
|
572
577
|
}
|
|
573
|
-
var
|
|
578
|
+
var tn = (e, t, n) => new File([e], t, {
|
|
574
579
|
type: n || e.type,
|
|
575
580
|
lastModified: e.lastModified ?? Date.now()
|
|
576
|
-
}),
|
|
581
|
+
}), nn = () => {}, J = class {
|
|
577
582
|
constructor(e) {
|
|
578
583
|
this._storage = e, this._revalidating = /* @__PURE__ */ new Set();
|
|
579
584
|
}
|
|
580
585
|
get _area() {
|
|
581
586
|
return this._storage?.area(be.DOWNLOADS) ?? null;
|
|
582
587
|
}
|
|
583
|
-
async fetch(e, { key: t = e, name: n = q(e), policy: r =
|
|
588
|
+
async fetch(e, { key: t = e, name: n = q(e), policy: r = W.REVALIDATE, maxAgeMs: i = Qt, onProgress: a = null, signal: o = null, fetchOptions: s = {} } = {}) {
|
|
584
589
|
let c = this._area;
|
|
585
|
-
if (c && r !==
|
|
590
|
+
if (c && r !== W.NETWORK) {
|
|
586
591
|
let o = await c.open(t);
|
|
587
592
|
if (o) {
|
|
588
593
|
let c = await o.file("data");
|
|
589
|
-
if (c) return r ===
|
|
590
|
-
file:
|
|
594
|
+
if (c) return r === W.REVALIDATE && Date.now() - (o.extra.checkedAt ?? 0) >= i && this._revalidate(e, t, n, o.extra, s), a?.(G(c.size, c.size)), {
|
|
595
|
+
file: tn(c, n, o.extra.contentType),
|
|
591
596
|
release: () => o.release(),
|
|
592
597
|
fromCache: !0
|
|
593
598
|
};
|
|
@@ -605,7 +610,7 @@ var en = (e, t, n) => new File([e], t, {
|
|
|
605
610
|
return await this._area?.has(e) === !0;
|
|
606
611
|
}
|
|
607
612
|
async _download(e, t, n, { onProgress: r, signal: i, fetchOptions: a, cache: o }) {
|
|
608
|
-
if (i?.aborted) throw
|
|
613
|
+
if (i?.aborted) throw $t(i);
|
|
609
614
|
let s = await fetch(e, {
|
|
610
615
|
...a,
|
|
611
616
|
signal: i
|
|
@@ -622,17 +627,17 @@ var en = (e, t, n) => new File([e], t, {
|
|
|
622
627
|
expectedBytes: c
|
|
623
628
|
}) : null;
|
|
624
629
|
if (!u) return {
|
|
625
|
-
file:
|
|
630
|
+
file: tn(await en(s, {
|
|
626
631
|
onProgress: r,
|
|
627
632
|
signal: i
|
|
628
633
|
}), n, l.contentType),
|
|
629
|
-
release:
|
|
634
|
+
release: nn,
|
|
630
635
|
fromCache: !1
|
|
631
636
|
};
|
|
632
637
|
try {
|
|
633
638
|
await u.writeStream("data", s.body, {
|
|
634
639
|
signal: i,
|
|
635
|
-
onProgress: (e) => r?.(
|
|
640
|
+
onProgress: (e) => r?.(G(e, c))
|
|
636
641
|
}), await u.commit(l);
|
|
637
642
|
} catch (o) {
|
|
638
643
|
if (await u.abort(), o?.name !== "QuotaExceededError") throw o;
|
|
@@ -646,7 +651,7 @@ var en = (e, t, n) => new File([e], t, {
|
|
|
646
651
|
let d = await this._area.open(t, { wait: !0 }), f = d && await d.file("data");
|
|
647
652
|
if (!f) throw d?.release(), Error(`storage: ${n} vanished right after it was saved`);
|
|
648
653
|
return {
|
|
649
|
-
file:
|
|
654
|
+
file: tn(f, n, l.contentType),
|
|
650
655
|
release: () => d.release(),
|
|
651
656
|
fromCache: !1
|
|
652
657
|
};
|
|
@@ -683,16 +688,16 @@ var en = (e, t, n) => new File([e], t, {
|
|
|
683
688
|
}
|
|
684
689
|
}
|
|
685
690
|
};
|
|
686
|
-
function
|
|
691
|
+
function rn(e, t, n) {
|
|
687
692
|
return new J(t).fetch(e, n);
|
|
688
693
|
}
|
|
689
|
-
function
|
|
690
|
-
return new J(ye(
|
|
694
|
+
function an() {
|
|
695
|
+
return new J(ye(w().cacheNamespace));
|
|
691
696
|
}
|
|
692
|
-
async function
|
|
697
|
+
async function on(e, { downloads: t = an(), ...n } = {}) {
|
|
693
698
|
if (!t._storage || !/^https?:/i.test(e)) return {
|
|
694
699
|
url: e,
|
|
695
|
-
release:
|
|
700
|
+
release: nn,
|
|
696
701
|
cached: !1
|
|
697
702
|
};
|
|
698
703
|
let { file: r, release: i } = await t.fetch(e, n), a = URL.createObjectURL(r);
|
|
@@ -706,7 +711,7 @@ async function an(e, { downloads: t = rn(), ...n } = {}) {
|
|
|
706
711
|
}
|
|
707
712
|
//#endregion
|
|
708
713
|
//#region src/RenderSettings.js
|
|
709
|
-
var
|
|
714
|
+
var sn = {
|
|
710
715
|
maxBounces: {
|
|
711
716
|
uniform: "maxBounces",
|
|
712
717
|
reset: !0
|
|
@@ -932,9 +937,9 @@ var on = {
|
|
|
932
937
|
HOST: "host",
|
|
933
938
|
SCENE_METADATA: "scene-metadata",
|
|
934
939
|
MODE_PRESET: "mode-preset"
|
|
935
|
-
}),
|
|
940
|
+
}), cn = class extends I {
|
|
936
941
|
constructor(e = _, { issues: t = null } = {}) {
|
|
937
|
-
super(), this._issues = t, this._defaults = e, this._routes = new Map(Object.entries(
|
|
942
|
+
super(), this._issues = t, this._defaults = e, this._routes = new Map(Object.entries(sn)), this._values = /* @__PURE__ */ new Map(), this._sources = /* @__PURE__ */ new Map(), this._pathTracer = null, this._resetCallback = null, this._handlers = {}, this._initDefaults(e);
|
|
938
943
|
}
|
|
939
944
|
bind(e) {
|
|
940
945
|
this._pathTracer = e.stages.pathTracer, this._resetCallback = e.resetCallback, this._handlers = this._buildHandlers(e);
|
|
@@ -949,7 +954,7 @@ var on = {
|
|
|
949
954
|
!this._values.has(e) && i !== void 0 && (this._values.set(e, i), this._sources.set(e, Y.DEFAULT));
|
|
950
955
|
}
|
|
951
956
|
_buildHandlers({ stages: e, resetCallback: t, reconcileCompletion: n, applyExposure: r, onCameraProjection: i }) {
|
|
952
|
-
let a = new
|
|
957
|
+
let a = new Ot(), o = (t, n) => {
|
|
953
958
|
a.set(n?.[0] ?? 0, n?.[1] ?? 0).multiplyScalar(R.DEG2RAD), e.pathTracer?.setUniform(t, a);
|
|
954
959
|
};
|
|
955
960
|
return {
|
|
@@ -963,7 +968,7 @@ var on = {
|
|
|
963
968
|
e.pathTracer?.setUniform("transparentBackground", t), e.compositor?.setTransparentBackground(t);
|
|
964
969
|
},
|
|
965
970
|
handleBackgroundColor: (t) => {
|
|
966
|
-
let n = t?.isColor ? t : new
|
|
971
|
+
let n = t?.isColor ? t : new nt(t);
|
|
967
972
|
e.pathTracer?.setUniform("backgroundColor", n);
|
|
968
973
|
},
|
|
969
974
|
handleExposure: (e) => {
|
|
@@ -976,13 +981,13 @@ var on = {
|
|
|
976
981
|
e.pathTracer?.setUniform("convergenceOverlay", n), e.compositor?.setConvergenceOverlay(n), n && !this.get("useAdaptiveSampling") && t?.();
|
|
977
982
|
},
|
|
978
983
|
handleRenderLimitMode: (t) => {
|
|
979
|
-
e.pathTracer?.setRenderLimitMode?.(t), n?.();
|
|
984
|
+
e.pathTracer?.setRenderLimitMode?.(t, this.get("renderTimeLimit")), n?.();
|
|
980
985
|
},
|
|
981
986
|
handleMaxSamples: (t) => {
|
|
982
987
|
e.pathTracer?.setUniform("maxSamples", t), e.pathTracer?.updateCompletionThreshold(), n?.();
|
|
983
988
|
},
|
|
984
|
-
handleRenderTimeLimit: () => {
|
|
985
|
-
n?.();
|
|
989
|
+
handleRenderTimeLimit: (t) => {
|
|
990
|
+
e.pathTracer?.setRenderLimitMode?.(this.get("renderLimitMode"), t), n?.();
|
|
986
991
|
},
|
|
987
992
|
handleRenderMode: (t) => {
|
|
988
993
|
e.pathTracer?.setUniform("renderMode", parseInt(t));
|
|
@@ -1081,19 +1086,19 @@ var on = {
|
|
|
1081
1086
|
e.uniform ? this._pathTracer?.setUniform(e.uniform, t) : e.handler ? this._handlers[e.handler]?.(t, n) : e.apply?.(t, n);
|
|
1082
1087
|
}
|
|
1083
1088
|
_initDefaults(e) {
|
|
1084
|
-
for (let t of Object.keys(
|
|
1089
|
+
for (let t of Object.keys(sn)) t in e && (this._values.set(t, e[t]), this._sources.set(t, Y.DEFAULT));
|
|
1085
1090
|
}
|
|
1086
|
-
},
|
|
1091
|
+
}, ln = class {
|
|
1087
1092
|
constructor({ issues: e = null } = {}) {
|
|
1088
|
-
this._issues = e, this._renderer = null, this._offRegistry =
|
|
1089
|
-
this._renderer &&
|
|
1093
|
+
this._issues = e, this._renderer = null, this._offRegistry = Oe(() => {
|
|
1094
|
+
this._renderer && De(this._renderer);
|
|
1090
1095
|
});
|
|
1091
1096
|
}
|
|
1092
1097
|
get hasConfig() {
|
|
1093
1098
|
return !1;
|
|
1094
1099
|
}
|
|
1095
1100
|
get workingSpace() {
|
|
1096
|
-
return
|
|
1101
|
+
return C;
|
|
1097
1102
|
}
|
|
1098
1103
|
get workingSpaceAdopted() {
|
|
1099
1104
|
return !1;
|
|
@@ -1103,23 +1108,23 @@ var on = {
|
|
|
1103
1108
|
}
|
|
1104
1109
|
attachRenderer(e) {
|
|
1105
1110
|
this._renderer = e;
|
|
1106
|
-
let t =
|
|
1107
|
-
return e.outputColorSpace =
|
|
1111
|
+
let t = De(e);
|
|
1112
|
+
return e.outputColorSpace = B, t;
|
|
1108
1113
|
}
|
|
1109
1114
|
listViews() {
|
|
1110
|
-
return
|
|
1115
|
+
return Te();
|
|
1111
1116
|
}
|
|
1112
1117
|
get activeView() {
|
|
1113
1118
|
return null;
|
|
1114
1119
|
}
|
|
1115
1120
|
setActiveView(e) {
|
|
1116
|
-
let t =
|
|
1121
|
+
let t = T(e);
|
|
1117
1122
|
if (!t) throw Error(`no view transform with id ${e}`);
|
|
1118
1123
|
if (t.outputEncoded) throw Error(`"${t.name}" returns display-encoded colour: it needs rayzee/addons/color`);
|
|
1119
1124
|
return this._renderer && (this._renderer.toneMapping = e), t;
|
|
1120
1125
|
}
|
|
1121
1126
|
_publishWorkingMatrix() {
|
|
1122
|
-
xe(null,
|
|
1127
|
+
xe(null, C);
|
|
1123
1128
|
}
|
|
1124
1129
|
loadConfig() {
|
|
1125
1130
|
let e = "colour configs need the OCIO pipeline: renderer.setColorManagement( ColorManagement ), from rayzee/addons/color";
|
|
@@ -1130,14 +1135,14 @@ var on = {
|
|
|
1130
1135
|
exportPixels(e) {
|
|
1131
1136
|
return {
|
|
1132
1137
|
rgba: e,
|
|
1133
|
-
colorSpace:
|
|
1138
|
+
colorSpace: C
|
|
1134
1139
|
};
|
|
1135
1140
|
}
|
|
1136
1141
|
status() {
|
|
1137
|
-
let e = this._renderer ?
|
|
1142
|
+
let e = this._renderer ? T(this._renderer.toneMapping) : null;
|
|
1138
1143
|
return {
|
|
1139
1144
|
config: null,
|
|
1140
|
-
workingSpace:
|
|
1145
|
+
workingSpace: C,
|
|
1141
1146
|
workingSpaceAdopted: !1,
|
|
1142
1147
|
activeTransform: e ? {
|
|
1143
1148
|
id: e.id,
|
|
@@ -1147,23 +1152,23 @@ var on = {
|
|
|
1147
1152
|
activeView: null,
|
|
1148
1153
|
context: null,
|
|
1149
1154
|
exportSpace: null,
|
|
1150
|
-
views:
|
|
1151
|
-
registryVersion:
|
|
1155
|
+
views: Te(),
|
|
1156
|
+
registryVersion: Ee(),
|
|
1152
1157
|
bakeError: e?.error ?? null
|
|
1153
1158
|
};
|
|
1154
1159
|
}
|
|
1155
1160
|
dispose() {
|
|
1156
|
-
this._offRegistry?.(), this._renderer = null, this._issues = null,
|
|
1161
|
+
this._offRegistry?.(), this._renderer = null, this._issues = null, Ce() === this && (xe(null), Se(null));
|
|
1157
1162
|
}
|
|
1158
|
-
},
|
|
1163
|
+
}, un = [
|
|
1159
1164
|
[/\.jpe?g(\?|#|$)/i, "image/jpeg"],
|
|
1160
1165
|
[/\.webp(\?|#|$)/i, "image/webp"],
|
|
1161
1166
|
[/\.avif(\?|#|$)/i, "image/avif"]
|
|
1162
1167
|
];
|
|
1163
|
-
function un(e) {
|
|
1164
|
-
return e.mimeType ? e.mimeType : e.uri?.startsWith("data:") ? e.uri.slice(5, e.uri.indexOf(";")) : ln.find(([t]) => t.test(e.uri ?? ""))?.[1] ?? "image/png";
|
|
1165
|
-
}
|
|
1166
1168
|
function dn(e) {
|
|
1169
|
+
return e.mimeType ? e.mimeType : e.uri?.startsWith("data:") ? e.uri.slice(5, e.uri.indexOf(";")) : un.find(([t]) => t.test(e.uri ?? ""))?.[1] ?? "image/png";
|
|
1170
|
+
}
|
|
1171
|
+
function fn(e) {
|
|
1167
1172
|
for (let t = 8; t + 12 <= e.length;) {
|
|
1168
1173
|
let n = (e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3]) >>> 0, r = t + 12 + n;
|
|
1169
1174
|
if (e[t + 4] === 73 && e[t + 5] === 69 && e[t + 6] === 78 && e[t + 7] === 68) return e.subarray(0, r);
|
|
@@ -1171,48 +1176,48 @@ function dn(e) {
|
|
|
1171
1176
|
}
|
|
1172
1177
|
return e;
|
|
1173
1178
|
}
|
|
1174
|
-
function
|
|
1179
|
+
function pn({ data: e, width: t, height: n }, { shared: r = !1 } = {}) {
|
|
1175
1180
|
let i = new Uint8Array(e.buffer, e.byteOffset, t * n * 4), a = i;
|
|
1176
1181
|
r && typeof SharedArrayBuffer < "u" && !(i.buffer instanceof SharedArrayBuffer) && (a = new Uint8Array(new SharedArrayBuffer(i.byteLength)), a.set(i));
|
|
1177
|
-
let o = new
|
|
1182
|
+
let o = new rt(a, t, n, St, Dt);
|
|
1178
1183
|
return o.needsUpdate = !0, o;
|
|
1179
1184
|
}
|
|
1180
|
-
function
|
|
1181
|
-
return
|
|
1185
|
+
function mn(e, t) {
|
|
1186
|
+
return b().decodeImage(t === "image/png" ? fn(e) : e, t);
|
|
1182
1187
|
}
|
|
1183
|
-
async function
|
|
1188
|
+
async function hn(e) {
|
|
1184
1189
|
let t = await fetch(e);
|
|
1185
1190
|
if (!t.ok) throw Error(`HTTP ${t.status}`);
|
|
1186
1191
|
return new Uint8Array(await t.arrayBuffer());
|
|
1187
1192
|
}
|
|
1188
|
-
function
|
|
1189
|
-
return t.bufferView === void 0 ?
|
|
1193
|
+
function gn(e, t) {
|
|
1194
|
+
return t.bufferView === void 0 ? hn(e.options.manager.resolveURL(L.resolveURL(t.uri, e.options.path))) : e.getDependency("bufferView", t.bufferView).then((e) => new Uint8Array(e));
|
|
1190
1195
|
}
|
|
1191
|
-
var
|
|
1192
|
-
function
|
|
1196
|
+
var _n = (e, t) => !!t && t !== e.textureLoader && typeof t.parse == "function";
|
|
1197
|
+
function vn(e, t, n) {
|
|
1193
1198
|
if (e.sourceCache[t] !== void 0) return e.sourceCache[t].then((e) => e.clone());
|
|
1194
|
-
let r =
|
|
1199
|
+
let r = gn(e, e.json.images[t]).then((e) => new Promise((t, r) => {
|
|
1195
1200
|
n.parse(e.buffer.slice(e.byteOffset, e.byteOffset + e.byteLength), t, r);
|
|
1196
1201
|
}));
|
|
1197
1202
|
return e.sourceCache[t] = r, r;
|
|
1198
1203
|
}
|
|
1199
|
-
async function
|
|
1200
|
-
let n =
|
|
1204
|
+
async function yn(e, t = dn({ uri: e })) {
|
|
1205
|
+
let n = pn(await mn(await hn(e), t));
|
|
1201
1206
|
return n.flipY = !0, n;
|
|
1202
1207
|
}
|
|
1203
|
-
function
|
|
1208
|
+
function bn(e, t = null) {
|
|
1204
1209
|
return e.loadImageSource = function(e, n) {
|
|
1205
|
-
if (
|
|
1210
|
+
if (_n(this, n)) return vn(this, e, n);
|
|
1206
1211
|
let r = this.json.images[e], i = /* @__PURE__ */ Error("no image decoder in this runtime: configurePlatform( nodePlatform( { decodeImage } ) ) — see \"Running in Node\"");
|
|
1207
1212
|
return t?.(r.uri ?? `bufferView ${r.bufferView}`, i), Promise.reject(i);
|
|
1208
1213
|
}, { name: "RAYZEE_missing_image_decoder" };
|
|
1209
1214
|
}
|
|
1210
|
-
function
|
|
1215
|
+
function xn(e, t = null) {
|
|
1211
1216
|
return e.loadImageSource = function(e, n) {
|
|
1212
|
-
if (
|
|
1217
|
+
if (_n(this, n)) return vn(this, e, n);
|
|
1213
1218
|
if (this.sourceCache[e] !== void 0) return this.sourceCache[e].then((e) => e.clone());
|
|
1214
|
-
let r = this.json.images[e], i =
|
|
1215
|
-
let t =
|
|
1219
|
+
let r = this.json.images[e], i = dn(r), a = r.uri ?? `bufferView ${r.bufferView}`, o = gn(this, r).then((e) => mn(e, i)).then((e) => {
|
|
1220
|
+
let t = pn(e, { shared: !0 });
|
|
1216
1221
|
return r.extras && typeof r.extras == "object" && Object.assign(t.userData, r.extras), t.userData.mimeType = i, t;
|
|
1217
1222
|
}).catch((e) => {
|
|
1218
1223
|
throw t?.(a, e), e;
|
|
@@ -1222,8 +1227,8 @@ function bn(e, t = null) {
|
|
|
1222
1227
|
}
|
|
1223
1228
|
//#endregion
|
|
1224
1229
|
//#region src/Processor/GLTFDiffuseTransmission.js
|
|
1225
|
-
var
|
|
1226
|
-
function
|
|
1230
|
+
var Sn = "KHR_materials_diffuse_transmission";
|
|
1231
|
+
function Cn(e) {
|
|
1227
1232
|
let t = (t, n, r, i) => {
|
|
1228
1233
|
let a = {};
|
|
1229
1234
|
return e.assignTexture(a, n, r, i).then(() => {
|
|
@@ -1231,7 +1236,7 @@ function Sn(e) {
|
|
|
1231
1236
|
});
|
|
1232
1237
|
};
|
|
1233
1238
|
return {
|
|
1234
|
-
name:
|
|
1239
|
+
name: Sn,
|
|
1235
1240
|
afterRoot(n) {
|
|
1236
1241
|
let r = e.json.materials ?? [], i = /* @__PURE__ */ new Set(), a = [];
|
|
1237
1242
|
for (let o of n.scenes ?? []) o.traverse((n) => {
|
|
@@ -1239,7 +1244,7 @@ function Sn(e) {
|
|
|
1239
1244
|
for (let n of o) {
|
|
1240
1245
|
if (i.has(n)) continue;
|
|
1241
1246
|
i.add(n);
|
|
1242
|
-
let o = e.associations.get(n)?.materials, s = o === void 0 ? null : r[o]?.extensions?.[
|
|
1247
|
+
let o = e.associations.get(n)?.materials, s = o === void 0 ? null : r[o]?.extensions?.[Sn];
|
|
1243
1248
|
if (!s) continue;
|
|
1244
1249
|
n.diffuseTransmission = s.diffuseTransmissionFactor ?? 0;
|
|
1245
1250
|
let [c, l, u] = s.diffuseTransmissionColorFactor ?? [
|
|
@@ -1247,7 +1252,7 @@ function Sn(e) {
|
|
|
1247
1252
|
1,
|
|
1248
1253
|
1
|
|
1249
1254
|
];
|
|
1250
|
-
n.diffuseTransmissionColor = new
|
|
1255
|
+
n.diffuseTransmissionColor = new nt().setRGB(c, l, u, lt), s.diffuseTransmissionTexture && a.push(t(n, "diffuseTransmissionMap", s.diffuseTransmissionTexture)), s.diffuseTransmissionColorTexture && a.push(t(n, "diffuseTransmissionColorMap", s.diffuseTransmissionColorTexture, B));
|
|
1251
1256
|
}
|
|
1252
1257
|
});
|
|
1253
1258
|
return Promise.all(a);
|
|
@@ -1256,20 +1261,20 @@ function Sn(e) {
|
|
|
1256
1261
|
}
|
|
1257
1262
|
//#endregion
|
|
1258
1263
|
//#region src/Processor/GLTFDecoders.js
|
|
1259
|
-
var
|
|
1260
|
-
function
|
|
1264
|
+
var wn = "KHR_draco_mesh_compression", Tn = "KHR_texture_basisu", En = ["EXT_meshopt_compression", "KHR_meshopt_compression"], Dn = new TextDecoder();
|
|
1265
|
+
function On(e) {
|
|
1261
1266
|
if (typeof e == "string") return e;
|
|
1262
1267
|
if (!(e instanceof ArrayBuffer)) return JSON.stringify(e?.extensionsUsed ?? []);
|
|
1263
1268
|
let t = new DataView(e);
|
|
1264
|
-
if (!(e.byteLength >= 20 && t.getUint32(0, !0) === 1179937895)) return
|
|
1269
|
+
if (!(e.byteLength >= 20 && t.getUint32(0, !0) === 1179937895)) return Dn.decode(e);
|
|
1265
1270
|
let n = Math.min(t.getUint32(12, !0), e.byteLength - 20);
|
|
1266
|
-
return
|
|
1271
|
+
return Dn.decode(new Uint8Array(e, 20, n));
|
|
1267
1272
|
}
|
|
1268
|
-
async function
|
|
1269
|
-
let { dracoDecoderPath: r, ktx2TranscoderPath: i } =
|
|
1270
|
-
t.includes(
|
|
1271
|
-
t.includes(
|
|
1272
|
-
|
|
1273
|
+
async function kn(e, t, n) {
|
|
1274
|
+
let { dracoDecoderPath: r, ktx2TranscoderPath: i } = w(), [a, o, s] = await Promise.all([
|
|
1275
|
+
t.includes(wn) && !e.dracoLoader ? import("three/addons/loaders/DRACOLoader.js") : null,
|
|
1276
|
+
t.includes(Tn) && !e.ktx2Loader ? import("three/addons/loaders/KTX2Loader.js") : null,
|
|
1277
|
+
En.some((e) => t.includes(e)) && !e.meshoptDecoder ? import("three/addons/libs/meshopt_decoder.module.js") : null
|
|
1273
1278
|
]);
|
|
1274
1279
|
if (a) {
|
|
1275
1280
|
let t = new a.DRACOLoader();
|
|
@@ -1288,15 +1293,15 @@ async function On(e, t, n) {
|
|
|
1288
1293
|
}
|
|
1289
1294
|
s && e.setMeshoptDecoder(s.MeshoptDecoder);
|
|
1290
1295
|
}
|
|
1291
|
-
function
|
|
1296
|
+
function An(e, t) {
|
|
1292
1297
|
let n = e.parse.bind(e);
|
|
1293
1298
|
return e.parse = (r, i, a, o) => {
|
|
1294
|
-
|
|
1299
|
+
kn(e, On(r), t).then(() => n(r, i, a, o), (e) => o?.(e));
|
|
1295
1300
|
}, e;
|
|
1296
1301
|
}
|
|
1297
1302
|
//#endregion
|
|
1298
1303
|
//#region src/Processor/AssetLoader.js
|
|
1299
|
-
var
|
|
1304
|
+
var jn = me("assets"), Mn = {
|
|
1300
1305
|
glb: {
|
|
1301
1306
|
type: "model",
|
|
1302
1307
|
name: "GLB (GLTF Binary)"
|
|
@@ -1331,7 +1336,7 @@ var An = x("assets"), jn = {
|
|
|
1331
1336
|
}, Z = {
|
|
1332
1337
|
addOn: "rayzee/addons/formats",
|
|
1333
1338
|
install: "assetLoader.registerFormat()"
|
|
1334
|
-
},
|
|
1339
|
+
}, Nn = {
|
|
1335
1340
|
zip: X,
|
|
1336
1341
|
gz: X,
|
|
1337
1342
|
tgz: X,
|
|
@@ -1348,22 +1353,22 @@ var An = x("assets"), jn = {
|
|
|
1348
1353
|
usdz: Z,
|
|
1349
1354
|
exr: Z
|
|
1350
1355
|
};
|
|
1351
|
-
function
|
|
1352
|
-
let t = new
|
|
1356
|
+
function Pn(e) {
|
|
1357
|
+
let t = new et();
|
|
1353
1358
|
for (let n in e.attributes) t.setAttribute(n, e.attributes[n]);
|
|
1354
1359
|
e.index && t.setIndex(e.index);
|
|
1355
1360
|
for (let n of e.groups) t.addGroup(n.start, n.count, n.materialIndex);
|
|
1356
1361
|
return t;
|
|
1357
1362
|
}
|
|
1358
|
-
var
|
|
1359
|
-
function
|
|
1363
|
+
var Fn = 683;
|
|
1364
|
+
function In(e, t, n, r) {
|
|
1360
1365
|
if (!(r.normalize ?? !0)) return Math.PI;
|
|
1361
|
-
let i = r.shape === "ellipse" || r.shape === "disk" ? Math.PI / 4 : 1, a = e.getWorldScale(new
|
|
1366
|
+
let i = r.shape === "ellipse" || r.shape === "disk" ? Math.PI / 4 : 1, a = e.getWorldScale(new H()), o = Math.PI * i * Math.abs(t * a.x * n * a.y);
|
|
1362
1367
|
return Number.isFinite(o) ? o : Math.PI;
|
|
1363
1368
|
}
|
|
1364
|
-
var
|
|
1369
|
+
var Ln = class e extends I {
|
|
1365
1370
|
constructor(e, t, n, { issues: r = null, areaLightIntensityScale: i = null } = {}) {
|
|
1366
|
-
super(), this.scene = e, this.camera = t, this.controls = n, this.targetModel = null, this.floorPlane = null, this.sceneScale = 1, this.sceneSize = new
|
|
1371
|
+
super(), this.scene = e, this.camera = t, this.controls = n, this.targetModel = null, this.floorPlane = null, this.sceneScale = 1, this.sceneSize = new H(1, 1, 1), this.loaderCache = {}, this.uploadedFileInfo = null, this.animations = [], this.renderer = null, this.sceneMetadata = null, this._loadingManager = new ut(), this._loadCancelled = !1, this._urlAbort = null, this.storage = null, this._downloads = null, this._sourceKey = null, this._appended = !1, this.archives = null, this._archiveLoader = null, this._formats = /* @__PURE__ */ new Map(), this._issues = r, this._areaLightIntensityScale = i ?? (() => _.areaLightIntensityScale), this._loadingManager.onError = (e) => {
|
|
1367
1372
|
this._loadCancelled || this._issues?.record(S.ASSET_UNREACHABLE, `asset "${e}" could not be fetched — anything depending on it renders without it`, { url: e });
|
|
1368
1373
|
};
|
|
1369
1374
|
}
|
|
@@ -1379,7 +1384,7 @@ var In = class e extends I {
|
|
|
1379
1384
|
let o = new AbortController();
|
|
1380
1385
|
this._urlAbort = o;
|
|
1381
1386
|
try {
|
|
1382
|
-
return await
|
|
1387
|
+
return await on(t, {
|
|
1383
1388
|
downloads: this.downloads,
|
|
1384
1389
|
key: i,
|
|
1385
1390
|
policy: a,
|
|
@@ -1437,7 +1442,7 @@ var In = class e extends I {
|
|
|
1437
1442
|
_adoptExternalObject(e) {
|
|
1438
1443
|
let t;
|
|
1439
1444
|
try {
|
|
1440
|
-
t =
|
|
1445
|
+
t = Pt(e);
|
|
1441
1446
|
} catch (t) {
|
|
1442
1447
|
throw Error(`Cannot render "${e.name || e.type}": its userData must be JSON-serializable.`, { cause: t });
|
|
1443
1448
|
}
|
|
@@ -1471,10 +1476,10 @@ var In = class e extends I {
|
|
|
1471
1476
|
}
|
|
1472
1477
|
getFileFormat(e) {
|
|
1473
1478
|
let t = e.split(".").pop().toLowerCase();
|
|
1474
|
-
return
|
|
1479
|
+
return Mn[t] || this._formats.get(t) || this._archiveFormats?.[t] || null;
|
|
1475
1480
|
}
|
|
1476
1481
|
formatError(e) {
|
|
1477
|
-
let t =
|
|
1482
|
+
let t = Nn[e.split(".").pop().toLowerCase()];
|
|
1478
1483
|
return /* @__PURE__ */ Error(t ? `${e}: this format is read by ${t.addOn} — install it with ${t.install}` : `Unsupported file format: ${e}`);
|
|
1479
1484
|
}
|
|
1480
1485
|
async inspectArchive(e) {
|
|
@@ -1578,7 +1583,7 @@ var In = class e extends I {
|
|
|
1578
1583
|
}
|
|
1579
1584
|
}
|
|
1580
1585
|
async loadModelFromFile(e, t) {
|
|
1581
|
-
let n = this.storage ? this._keyed("file",
|
|
1586
|
+
let n = this.storage ? this._keyed("file", E(await Ae(e))) : null, r = /\.(usd|usda|usdc)$/i.test(t) ? await this._archiveImporter() : null, i = r ? await r.loadUSDScene({ [t]: e }, t) : await this._loadModelFileByExtension(e, t);
|
|
1582
1587
|
return this._sourceKey = n, i;
|
|
1583
1588
|
}
|
|
1584
1589
|
async _loadModelFileByExtension(e, t) {
|
|
@@ -1625,7 +1630,7 @@ var In = class e extends I {
|
|
|
1625
1630
|
};
|
|
1626
1631
|
try {
|
|
1627
1632
|
let r = await this.loadEnvironment(n);
|
|
1628
|
-
return
|
|
1633
|
+
return pe(r, E(await Ae(e))), this.dispatchEvent({
|
|
1629
1634
|
type: "load",
|
|
1630
1635
|
texture: r,
|
|
1631
1636
|
filename: t
|
|
@@ -1647,7 +1652,7 @@ var In = class e extends I {
|
|
|
1647
1652
|
let e = t.split(/[?#]/)[0].split(".").pop().toLowerCase();
|
|
1648
1653
|
n = await this.loadEnvironmentByExtension(t, e);
|
|
1649
1654
|
}
|
|
1650
|
-
return n.generateMipmaps = !0, e._isNetworkUrl(t) &&
|
|
1655
|
+
return n.generateMipmaps = !0, e._isNetworkUrl(t) && pe(n, t), this.applyEnvironmentToScene(n), this.dispatchEvent({
|
|
1651
1656
|
type: "load",
|
|
1652
1657
|
texture: n,
|
|
1653
1658
|
url: t,
|
|
@@ -1684,21 +1689,21 @@ var In = class e extends I {
|
|
|
1684
1689
|
}
|
|
1685
1690
|
async loadEnvironmentByExtension(t, n, { loader: r = null } = {}) {
|
|
1686
1691
|
let i = this._formats.get(n);
|
|
1687
|
-
if (!r && i?.type === "environment" && (r = this.loaderCache[n] ??= await i.createLoader(this._loadingManager)), !r && n === "hdr" && (r = this.loaderCache.hdr ??= new
|
|
1692
|
+
if (!r && i?.type === "environment" && (r = this.loaderCache[n] ??= await i.createLoader(this._loadingManager)), !r && n === "hdr" && (r = this.loaderCache.hdr ??= new Mt(this._loadingManager).setDataType(st)), !r && Nn[n]) throw this.formatError(`environment.${n}`);
|
|
1688
1693
|
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;
|
|
1689
1694
|
try {
|
|
1690
|
-
r ? l = await r.loadAsync(s.url, c) :
|
|
1695
|
+
r ? l = await r.loadAsync(s.url, c) : b().decodeImage ? (l = await yn(s.url, `image/${n === "jpg" ? "jpeg" : n}`), l.colorSpace = B) : (this.loaderCache.texture || (this.loaderCache.texture = new Et(this._loadingManager)), l = await this.loaderCache.texture.loadAsync(s.url, c), l.colorSpace = B);
|
|
1691
1696
|
} finally {
|
|
1692
1697
|
s.release();
|
|
1693
1698
|
}
|
|
1694
|
-
return this._downloadComplete("Processing Environment...", 62), this.maxEnvironmentWidth &&
|
|
1699
|
+
return this._downloadComplete("Processing Environment...", 62), this.maxEnvironmentWidth && Rn(l, this.maxEnvironmentWidth), l.mapping = ot, l.minFilter = ct, l.magFilter = ct, l;
|
|
1695
1700
|
}
|
|
1696
1701
|
applyEnvironmentToScene(e) {
|
|
1697
1702
|
this.scene.background = e, this.scene.environment = e;
|
|
1698
1703
|
}
|
|
1699
1704
|
async createGLTFLoader() {
|
|
1700
|
-
let e =
|
|
1701
|
-
return
|
|
1705
|
+
let e = An(new jt(this._loadingManager), this.renderer), t = (e, t) => this._reportImageFailure(e, t);
|
|
1706
|
+
return b().decodeImage ? e.register((e) => xn(e, t)) : g() || e.register((e) => bn(e, t)), e.register((e) => Cn(e)), e;
|
|
1702
1707
|
}
|
|
1703
1708
|
_reportImageFailure(e, t) {
|
|
1704
1709
|
try {
|
|
@@ -1735,7 +1740,7 @@ var In = class e extends I {
|
|
|
1735
1740
|
totalBytes: 0
|
|
1736
1741
|
}), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(L.extractUrlBase(t));
|
|
1737
1742
|
let e = await ne(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
|
|
1738
|
-
return this._downloadComplete(), this._throwDeferred(), this.releaseTargetModel(), this._sourceKey = i ? this._keyed("url", n.cacheKey ?? t) : null, this.targetModel = e.scene, this.animations = e.animations || [], this.sceneMetadata =
|
|
1743
|
+
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({
|
|
1739
1744
|
type: "load",
|
|
1740
1745
|
model: e.scene,
|
|
1741
1746
|
filename: t.split("/").pop()
|
|
@@ -1793,7 +1798,7 @@ var In = class e extends I {
|
|
|
1793
1798
|
progress: 5
|
|
1794
1799
|
}), await new Promise((e) => setTimeout(e, 0));
|
|
1795
1800
|
let r = await ne(() => n.parseAsync(e, ""));
|
|
1796
|
-
return this._throwDeferred(), this.releaseTargetModel(), this.targetModel = r.scene, this.animations = r.animations || [], this.sceneMetadata =
|
|
1801
|
+
return this._throwDeferred(), this.releaseTargetModel(), this.targetModel = r.scene, this.animations = r.animations || [], this.sceneMetadata = Pe(r), v({
|
|
1797
1802
|
isLoading: !0,
|
|
1798
1803
|
status: "Processing Data...",
|
|
1799
1804
|
progress: 10
|
|
@@ -1830,9 +1835,9 @@ var In = class e extends I {
|
|
|
1830
1835
|
t.start("Camera extraction");
|
|
1831
1836
|
let n = this.extractCamerasFromModel(e);
|
|
1832
1837
|
t.end("Camera extraction"), t.start("Camera setup");
|
|
1833
|
-
let r = new
|
|
1838
|
+
let r = new $e().setFromObject(e), i = r.getCenter(new H()), a = r.getSize(new H());
|
|
1834
1839
|
this.controls?.target.copy(i);
|
|
1835
|
-
let o = Math.max(a.x, a.y, a.z), s = this.camera.fov * (Math.PI / 180), c = Math.abs(o / Math.sin(s / 2) / 2), l = Math.PI / 6, u = new
|
|
1840
|
+
let o = Math.max(a.x, a.y, a.z), s = this.camera.fov * (Math.PI / 180), c = Math.abs(o / Math.sin(s / 2) / 2), l = Math.PI / 6, u = new H(Math.cos(l) * c, c / Math.sqrt(2), Math.sin(l) * c);
|
|
1836
1841
|
if (this.camera.position.copy(u.add(i)), this.camera.lookAt(i), this.camera.near = o / 100, this.camera.far = o * 100, this.camera.updateProjectionMatrix(), this.controls && (this.controls.maxDistance = c * 10, this.controls.saveState(), this.controls.update()), t.end("Camera setup"), this.floorPlane) {
|
|
1837
1842
|
let e = r.min.y;
|
|
1838
1843
|
this.floorPlane.position.y = e, this.floorPlane.rotation.x = -Math.PI / 2, this.floorPlane.scale.setScalar(o * 5);
|
|
@@ -1869,10 +1874,10 @@ var In = class e extends I {
|
|
|
1869
1874
|
let t = [], n = [];
|
|
1870
1875
|
e.traverse((e) => {
|
|
1871
1876
|
let r = e.userData;
|
|
1872
|
-
e.isRectAreaLight && !r.__radianceConverted && (e.intensity *=
|
|
1877
|
+
e.isRectAreaLight && !r.__radianceConverted && (e.intensity *= In(e, e.width, e.height, r), r.__radianceConverted = !0), (e.isPointLight || e.isSpotLight) && !r.__candelaConverted && (e.intensity *= 4 * Math.PI / Fn, r.__candelaConverted = !0), e.isDirectionalLight && !r.__luxConverted && (e.intensity /= Fn, r.__luxConverted = !0);
|
|
1873
1878
|
let i = e.name.startsWith("RectAreaLightPlaceholder");
|
|
1874
1879
|
if (i && !(r.name && r.type === "RectAreaLight") && !e.parent?.name?.startsWith("RectAreaLightPlaceholder") && n.push(e.name), i && r.name && r.type === "RectAreaLight") {
|
|
1875
|
-
let t = r.normalize ?? !0, n = r.shape ?? "rectangle", i = r.intensity *
|
|
1880
|
+
let t = r.normalize ?? !0, n = r.shape ?? "rectangle", i = r.intensity * In(e, r.width, r.height, r), a = new z(new nt(...r.color), i * this._areaLightIntensityScale(), r.width, r.height);
|
|
1876
1881
|
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);
|
|
1877
1882
|
}
|
|
1878
1883
|
e.isMesh && Array.isArray(e.material) && t.push(e);
|
|
@@ -1883,8 +1888,8 @@ var In = class e extends I {
|
|
|
1883
1888
|
let r = e.userData.__rayzeeExternal === !0;
|
|
1884
1889
|
for (let e of t) {
|
|
1885
1890
|
if (!e.parent) continue;
|
|
1886
|
-
console.log("Found multi-material mesh:", e.name), r && (e.geometry =
|
|
1887
|
-
let t =
|
|
1891
|
+
console.log("Found multi-material mesh:", e.name), r && (e.geometry = Pn(e.geometry));
|
|
1892
|
+
let t = Nt(e);
|
|
1888
1893
|
for (let e of t.children) e.geometry.userData.__rayzeeOwned = !0;
|
|
1889
1894
|
e.parent.add(t), e.parent.remove(e);
|
|
1890
1895
|
}
|
|
@@ -1893,7 +1898,7 @@ var In = class e extends I {
|
|
|
1893
1898
|
this.sceneScale = t;
|
|
1894
1899
|
}
|
|
1895
1900
|
createFloorPlane() {
|
|
1896
|
-
this.floorPlane = new
|
|
1901
|
+
this.floorPlane = new dt(new tt(), new ft({
|
|
1897
1902
|
transparent: !1,
|
|
1898
1903
|
color: 3158064,
|
|
1899
1904
|
roughness: 1,
|
|
@@ -1916,7 +1921,7 @@ var In = class e extends I {
|
|
|
1916
1921
|
}
|
|
1917
1922
|
getSupportedFormats(e = null) {
|
|
1918
1923
|
let t = {
|
|
1919
|
-
...
|
|
1924
|
+
...Mn,
|
|
1920
1925
|
...this._archiveFormats
|
|
1921
1926
|
};
|
|
1922
1927
|
for (let [e, { type: n, name: r }] of this._formats) t[e] = {
|
|
@@ -1941,7 +1946,7 @@ var In = class e extends I {
|
|
|
1941
1946
|
this._listeners = void 0;
|
|
1942
1947
|
}
|
|
1943
1948
|
};
|
|
1944
|
-
function
|
|
1949
|
+
function Rn(e, t) {
|
|
1945
1950
|
let { data: n, width: r, height: i } = e.image ?? {};
|
|
1946
1951
|
if (!(n instanceof Float32Array) || r <= t || n.length !== r * i * 4) return;
|
|
1947
1952
|
let a = Math.ceil(r / t), o = Math.ceil(r / a), s = Math.ceil(i / a);
|
|
@@ -1962,17 +1967,17 @@ function Ln(e, t) {
|
|
|
1962
1967
|
data: n.byteOffset === 0 && n.byteLength === n.buffer.byteLength && n.buffer.transfer ? new Float32Array(n.buffer.transfer(c)) : n.slice(0, o * s * 4),
|
|
1963
1968
|
width: o,
|
|
1964
1969
|
height: s
|
|
1965
|
-
}, e.needsUpdate = !0,
|
|
1970
|
+
}, e.needsUpdate = !0, jn.info(`environment ${r}×${i} shrunk to ${o}×${s} (memory spill)`);
|
|
1966
1971
|
}
|
|
1967
1972
|
//#endregion
|
|
1968
1973
|
//#region src/HeadlessCanvas.js
|
|
1969
|
-
var
|
|
1974
|
+
var zn = {
|
|
1970
1975
|
addEventListener() {},
|
|
1971
1976
|
removeEventListener() {},
|
|
1972
1977
|
dispatchEvent() {
|
|
1973
1978
|
return !0;
|
|
1974
1979
|
}
|
|
1975
|
-
},
|
|
1980
|
+
}, Bn = class {
|
|
1976
1981
|
constructor(e) {
|
|
1977
1982
|
this.canvas = e, this._configuration = null, this._texture = null;
|
|
1978
1983
|
}
|
|
@@ -2000,12 +2005,12 @@ var Rn = {
|
|
|
2000
2005
|
return this._texture;
|
|
2001
2006
|
}
|
|
2002
2007
|
};
|
|
2003
|
-
function
|
|
2008
|
+
function Vn(e = 1, t = 1) {
|
|
2004
2009
|
let n = {
|
|
2005
|
-
...
|
|
2010
|
+
...zn,
|
|
2006
2011
|
defaultView: null
|
|
2007
2012
|
}, r = {
|
|
2008
|
-
...
|
|
2013
|
+
...zn,
|
|
2009
2014
|
isHeadlessCanvas: !0,
|
|
2010
2015
|
width: e,
|
|
2011
2016
|
height: t,
|
|
@@ -2032,12 +2037,12 @@ function Bn(e = 1, t = 1) {
|
|
|
2032
2037
|
hasPointerCapture: () => !1,
|
|
2033
2038
|
focus() {},
|
|
2034
2039
|
getContext: (e) => e === "webgpu" ? i : null
|
|
2035
|
-
}, i = new
|
|
2040
|
+
}, i = new Bn(r);
|
|
2036
2041
|
return r;
|
|
2037
2042
|
}
|
|
2038
2043
|
//#endregion
|
|
2039
2044
|
//#region src/managers/ViewCamera.js
|
|
2040
|
-
var
|
|
2045
|
+
var Hn = class extends vt {
|
|
2041
2046
|
constructor(e, t, n, r) {
|
|
2042
2047
|
super(e, t, n, r), this.orthographic = !1, this.orthoHalfHeight = 1;
|
|
2043
2048
|
}
|
|
@@ -2061,17 +2066,17 @@ var Vn = class extends gt {
|
|
|
2061
2066
|
return -this.orthoHalfHeight * this.aspect;
|
|
2062
2067
|
}
|
|
2063
2068
|
updateProjectionMatrix() {
|
|
2064
|
-
this.orthographic ?
|
|
2069
|
+
this.orthographic ? _t.prototype.updateProjectionMatrix.call(this) : super.updateProjectionMatrix();
|
|
2065
2070
|
}
|
|
2066
2071
|
copy(e, t) {
|
|
2067
2072
|
return super.copy(e, t), this.orthographic = e.orthographic === !0, this.orthoHalfHeight = e.orthoHalfHeight ?? this.orthoHalfHeight, this;
|
|
2068
2073
|
}
|
|
2069
|
-
},
|
|
2070
|
-
DirectionalLight:
|
|
2071
|
-
PointLight:
|
|
2072
|
-
SpotLight:
|
|
2073
|
-
RectAreaLight:
|
|
2074
|
-
},
|
|
2074
|
+
}, Un = "__rayzeeUserLight", Wn = {
|
|
2075
|
+
DirectionalLight: it,
|
|
2076
|
+
PointLight: yt,
|
|
2077
|
+
SpotLight: wt,
|
|
2078
|
+
RectAreaLight: z
|
|
2079
|
+
}, Gn = class extends I {
|
|
2075
2080
|
constructor(e, t, n, r = {}) {
|
|
2076
2081
|
super(), this.scene = e, this.sceneHelpers = t, this.pathTracer = n, this._onReset = r.onReset || null, this._onLightRemoved = r.onLightRemoved || null;
|
|
2077
2082
|
}
|
|
@@ -2119,14 +2124,14 @@ var Vn = class extends gt {
|
|
|
2119
2124
|
}[e];
|
|
2120
2125
|
if (!t) return null;
|
|
2121
2126
|
let n;
|
|
2122
|
-
if (e === "DirectionalLight") n = new
|
|
2123
|
-
else if (e === "PointLight") n = new
|
|
2127
|
+
if (e === "DirectionalLight") n = new it(t.color, t.intensity), n.position.fromArray(t.position);
|
|
2128
|
+
else if (e === "PointLight") n = new yt(t.color, t.intensity), n.position.fromArray(t.position);
|
|
2124
2129
|
else if (e === "SpotLight") {
|
|
2125
|
-
n = new
|
|
2126
|
-
let e = new
|
|
2130
|
+
n = new wt(t.color, t.intensity), n.position.fromArray(t.position), n.angle = R.degToRad(t.angle);
|
|
2131
|
+
let e = new gt();
|
|
2127
2132
|
this.scene.add(e), n.target = e;
|
|
2128
|
-
} else e === "RectAreaLight" && (n = new
|
|
2129
|
-
n.userData[
|
|
2133
|
+
} else e === "RectAreaLight" && (n = new z(t.color, t.intensity, t.width, t.height), n.position.fromArray(t.position), n.lookAt(0, 0, 0), n.userData.normalize = !0, n.userData.spread = Math.PI, n.userData.shape = "rectangle");
|
|
2134
|
+
n.userData[Un] = !0, n.userData.temperature = 6500, n.userData.useTemperature = !1, n.userData.exposure = 0;
|
|
2130
2135
|
let r = this.scene.getObjectsByProperty("isLight", !0).length;
|
|
2131
2136
|
return n.name = `${e.replace("Light", "")} ${r + 1}`, this.scene.add(n), this.updateLights(), this._syncHelpers(), this._onReset?.(), this._buildDescriptor(n);
|
|
2132
2137
|
}
|
|
@@ -2152,7 +2157,7 @@ var Vn = class extends gt {
|
|
|
2152
2157
|
this.pathTracer?.updateLights(), this.sceneHelpers?.visible && this.sceneHelpers.update();
|
|
2153
2158
|
}
|
|
2154
2159
|
transferSceneLights(e, { keepUserLights: t = !1 } = {}) {
|
|
2155
|
-
this._removeAllLights(t ? (e) => !e.userData?.[
|
|
2160
|
+
this._removeAllLights(t ? (e) => !e.userData?.[Un] : void 0);
|
|
2156
2161
|
let n = e.getObjectsByProperty("isLight", !0);
|
|
2157
2162
|
if (!n || n.length === 0) {
|
|
2158
2163
|
this.updateLights();
|
|
@@ -2161,7 +2166,7 @@ var Vn = class extends gt {
|
|
|
2161
2166
|
for (let e of n) {
|
|
2162
2167
|
let t = e.clone();
|
|
2163
2168
|
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) {
|
|
2164
|
-
let n = new
|
|
2169
|
+
let n = new gt();
|
|
2165
2170
|
e.target.updateWorldMatrix(!0, !1), e.target.getWorldPosition(n.position), this.scene.add(n), t.target = n;
|
|
2166
2171
|
}
|
|
2167
2172
|
this.scene.add(t);
|
|
@@ -2206,7 +2211,7 @@ var Vn = class extends gt {
|
|
|
2206
2211
|
this.sceneHelpers?.clear(), this._removeAllLights();
|
|
2207
2212
|
let t = [];
|
|
2208
2213
|
for (let n of e ?? []) {
|
|
2209
|
-
let e =
|
|
2214
|
+
let e = Wn[n.type];
|
|
2210
2215
|
if (!e) continue;
|
|
2211
2216
|
let r = new e();
|
|
2212
2217
|
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 ?? [
|
|
@@ -2223,7 +2228,7 @@ var Vn = class extends gt {
|
|
|
2223
2228
|
"height"
|
|
2224
2229
|
]) typeof n[e] == "number" && (r[e] = n[e]);
|
|
2225
2230
|
if (n.target) {
|
|
2226
|
-
let e = new
|
|
2231
|
+
let e = new gt();
|
|
2227
2232
|
e.position.fromArray(n.target), this.scene.add(e), r.target = e;
|
|
2228
2233
|
}
|
|
2229
2234
|
this.scene.add(r), t.push(r);
|
|
@@ -2298,11 +2303,11 @@ var Vn = class extends gt {
|
|
|
2298
2303
|
], 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);
|
|
2299
2304
|
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;
|
|
2300
2305
|
}
|
|
2301
|
-
},
|
|
2306
|
+
}, Kn = ({ element: e, pbrtEntry: t } = {}) => ({
|
|
2302
2307
|
...e === void 0 ? {} : { element: e },
|
|
2303
2308
|
...t === void 0 ? {} : { pbrtEntry: t }
|
|
2304
|
-
}), Q = /* @__PURE__ */ new WeakMap(),
|
|
2305
|
-
async function
|
|
2309
|
+
}), Q = /* @__PURE__ */ new WeakMap(), qn = 3e4, Jn = new Set([...Object.values(m), ...Object.values(p)]), Yn = /* @__PURE__ */ new Set();
|
|
2310
|
+
async function Xn(e, t) {
|
|
2306
2311
|
if (!t || typeof self < "u") return e.init();
|
|
2307
2312
|
globalThis.self = {
|
|
2308
2313
|
requestAnimationFrame: () => 0,
|
|
@@ -2314,30 +2319,30 @@ async function Yn(e, t) {
|
|
|
2314
2319
|
delete globalThis.self;
|
|
2315
2320
|
}
|
|
2316
2321
|
}
|
|
2317
|
-
var $ =
|
|
2318
|
-
function
|
|
2322
|
+
var $ = me("engine");
|
|
2323
|
+
function Zn() {
|
|
2319
2324
|
let e = new Float32Array(16);
|
|
2320
2325
|
return new Uint32Array(e.buffer)[3] = ge.TRIANGLE_LEAF, e;
|
|
2321
2326
|
}
|
|
2322
|
-
function
|
|
2327
|
+
function Qn(e, t) {
|
|
2323
2328
|
e.lost.then((e) => {
|
|
2324
2329
|
t.app && t.app._handleDeviceLost(e);
|
|
2325
2330
|
});
|
|
2326
2331
|
}
|
|
2327
|
-
var
|
|
2328
|
-
function
|
|
2332
|
+
var $n = /swiftshader|llvmpipe|lavapipe|basic render|microsoft basic|warp/i;
|
|
2333
|
+
function er(e) {
|
|
2329
2334
|
let t = e.info ?? {}, n = `${t.vendor ?? ""} ${t.architecture ?? ""} ${t.device ?? ""} ${t.description ?? ""}`;
|
|
2330
2335
|
return {
|
|
2331
2336
|
vendor: t.vendor ?? "",
|
|
2332
2337
|
architecture: t.architecture ?? "",
|
|
2333
2338
|
device: t.device ?? "",
|
|
2334
2339
|
description: t.description ?? "",
|
|
2335
|
-
isSoftware: t.isFallbackAdapter === !0 || e.isFallbackAdapter === !0 ||
|
|
2340
|
+
isSoftware: t.isFallbackAdapter === !0 || e.isFallbackAdapter === !0 || $n.test(n)
|
|
2336
2341
|
};
|
|
2337
2342
|
}
|
|
2338
|
-
var
|
|
2343
|
+
var tr = class extends I {
|
|
2339
2344
|
constructor(e, t = {}) {
|
|
2340
|
-
super(), this._headless = t.headless === !0 || !e, e ??=
|
|
2345
|
+
super(), this._headless = t.headless === !0 || !e, e ??= Vn();
|
|
2341
2346
|
try {
|
|
2342
2347
|
Q.get(e)?.dispose();
|
|
2343
2348
|
} catch (e) {
|
|
@@ -2350,7 +2355,7 @@ var er = class extends I {
|
|
|
2350
2355
|
type: m.ISSUE,
|
|
2351
2356
|
issue: e
|
|
2352
2357
|
})
|
|
2353
|
-
}), this.color = new
|
|
2358
|
+
}), this.color = new ln({ issues: this._issues }), Se(this.color), this.settings = new cn(_, { issues: this._issues }), this.renderer = null, this.scene = null, this.meshScene = null, this._sceneHelpers = null, this.assetLoader = null, this._sdf = null, this.pipeline = null, this._pendingReservedRenderSize = null, this.stages = {}, this.camera = null, this.lightManager = null, this.environmentManager = null, this.isInitialized = !1, this.pauseRendering = !1, this._pathTracerEnabled = !0, this._rasterPrecompile = null, this.animationManagerId = null, this.needsReset = !1, this._loadingInProgress = !1, this._needsDisplayRefresh = !1, this._paused = !1, this._emissiveSamplingUserSet = !1, this.completion = new Xt(), this._resizeDebounceTimer = null, this._displayWidth = 0, this._displayHeight = 0, this._renderScale = 1, this._renderWidth = 0, this._renderHeight = 0, this._trackedListeners = [], this._disposed = !1, this._deviceLost = !1, this._gpuDevice = null, this._deviceLostHolder = null, this._deterministic = !1, this._dispatchPinned = !1, this._deterministicRestore = null, this.adapterInfo = null;
|
|
2354
2359
|
}
|
|
2355
2360
|
_addTrackedListener(e, t, n) {
|
|
2356
2361
|
e && (e.addEventListener(t, n), this._trackedListeners.push({
|
|
@@ -2369,21 +2374,21 @@ var er = class extends I {
|
|
|
2369
2374
|
}
|
|
2370
2375
|
async init() {
|
|
2371
2376
|
let e = this._initStorage();
|
|
2372
|
-
return await this._initRenderer(), this._applyPendingReservedRenderSize(), this.camera = this._createCamera(), this._initScenes(), this._initAssetPipeline(), this._initPipeline(), await this._initManagers(), this._wireEvents(), await e, this._attachStorage(), this.stages.pathTracer.setTriangleData(new Uint32Array(he.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(
|
|
2377
|
+
return await this._initRenderer(), this._applyPendingReservedRenderSize(), this.camera = this._createCamera(), this._initScenes(), this._initAssetPipeline(), this._initPipeline(), await this._initManagers(), this._wireEvents(), await e, this._attachStorage(), this.stages.pathTracer.setTriangleData(new Uint32Array(he.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(Zn()), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setupMaterial(), this.isInitialized = !0, $.debug("WebGPU path tracer app initialized"), this;
|
|
2373
2378
|
}
|
|
2374
2379
|
async setStorageOpener(e) {
|
|
2375
2380
|
this._storageOpener = e, !(!this.isInitialized || this.storage || this._disposed) && (await this._initStorage(), this._attachStorage());
|
|
2376
2381
|
}
|
|
2377
2382
|
async _initStorage() {
|
|
2378
|
-
let e = this._storageOption ?? (this._issues.strict && !
|
|
2383
|
+
let e = this._storageOption ?? (this._issues.strict && !we("storage") ? !1 : w().storage);
|
|
2379
2384
|
if (e !== !1) {
|
|
2380
2385
|
if (e && typeof e == "object") this.storage = e;
|
|
2381
2386
|
else {
|
|
2382
2387
|
if (!this._storageOpener) {
|
|
2383
|
-
(this._storageOption !== void 0 ||
|
|
2388
|
+
(this._storageOption !== void 0 || we("storage")) && this._issues.warn(S.CAPABILITY_MISSING, "on-disk storage needs rayzee/addons/storage: setStorageOpener( acquireSharedStorage )");
|
|
2384
2389
|
return;
|
|
2385
2390
|
}
|
|
2386
|
-
let { storage: e, reason: t, release: n } = await this._storageOpener(
|
|
2391
|
+
let { storage: e, reason: t, release: n } = await this._storageOpener(w().cacheNamespace);
|
|
2387
2392
|
if (this._disposed) {
|
|
2388
2393
|
n();
|
|
2389
2394
|
return;
|
|
@@ -2412,7 +2417,7 @@ var er = class extends I {
|
|
|
2412
2417
|
});
|
|
2413
2418
|
}
|
|
2414
2419
|
addEventListener(e, t) {
|
|
2415
|
-
!
|
|
2420
|
+
!Jn.has(e) && !Yn.has(e) && (Yn.add(e), $.warn(`no engine event is named "${e}", so this listener will never fire — see EngineEvents`)), super.addEventListener(e, t);
|
|
2416
2421
|
}
|
|
2417
2422
|
animate() {
|
|
2418
2423
|
if (this._headless) throw Error("a headless app has no render loop — drive it with renderFrames() or renderUntilComplete()");
|
|
@@ -2430,7 +2435,11 @@ var er = class extends I {
|
|
|
2430
2435
|
if (!this.pauseRendering) {
|
|
2431
2436
|
if (this._beforeTrace(), this.stages.pathTracer?.isReady) {
|
|
2432
2437
|
if (this.stages.pathTracer.isComplete && this.completion.renderCompleteDispatched) {
|
|
2433
|
-
this._needsDisplayRefresh && (this._needsDisplayRefresh = !1, this.stages.compositor.render(this.pipeline.context), this._renderHelperOverlay()), this.
|
|
2438
|
+
if (this._needsDisplayRefresh && (this._needsDisplayRefresh = !1, this.stages.compositor.render(this.pipeline.context), this._renderHelperOverlay()), this._settling()) {
|
|
2439
|
+
this.dispatchEvent({ type: m.FRAME });
|
|
2440
|
+
return;
|
|
2441
|
+
}
|
|
2442
|
+
this.stopAnimation();
|
|
2434
2443
|
return;
|
|
2435
2444
|
}
|
|
2436
2445
|
if (this._holdTrace(e)) {
|
|
@@ -2441,21 +2450,27 @@ var er = class extends I {
|
|
|
2441
2450
|
this.dispatchEvent({ type: m.FRAME });
|
|
2442
2451
|
return;
|
|
2443
2452
|
}
|
|
2444
|
-
this._traceFrame({ liveDenoise: !0 }), this.stages.pathTracer.isComplete && this.completion.markComplete() &&
|
|
2445
|
-
type: m.RENDER_COMPLETE,
|
|
2446
|
-
...this._completionInfo()
|
|
2447
|
-
}));
|
|
2453
|
+
this._traceFrame({ liveDenoise: !0 }), this.stages.pathTracer.isComplete && this.completion.markComplete() && this._announceComplete();
|
|
2448
2454
|
}
|
|
2449
2455
|
this._renderHelperOverlay(), this.dispatchEvent({ type: m.FRAME });
|
|
2450
2456
|
}
|
|
2451
2457
|
}
|
|
2458
|
+
_announceComplete() {
|
|
2459
|
+
let e = this._completionInfo(), t = this.stages.pathTracer.resetCount, n = () => {
|
|
2460
|
+
!this.completion.renderCompleteDispatched || this.stages.pathTracer?.resetCount !== t || (this._renderCompleted(), this.dispatchEvent({
|
|
2461
|
+
type: m.RENDER_COMPLETE,
|
|
2462
|
+
...e
|
|
2463
|
+
}));
|
|
2464
|
+
}, r = this._finishImage();
|
|
2465
|
+
r ? r.then(n, n) : n();
|
|
2466
|
+
}
|
|
2452
2467
|
_traceFrame({ liveDenoise: e = !1 } = {}) {
|
|
2453
2468
|
let t = this.stages.pathTracer;
|
|
2454
2469
|
this.pipeline.render(), this._afterTrace(t, e), t.isComplete || this.completion.updateTime(), this._ensureVRAMWiring();
|
|
2455
2470
|
let n = t.vramTracker, r = t.frameCount ?? 0;
|
|
2456
|
-
n && (r <= 1 || r % 30 == 0) && n.measure(),
|
|
2471
|
+
n && (r <= 1 || r % 30 == 0) && n.measure(), ce({
|
|
2457
2472
|
timeElapsed: this.completion.timeElapsed,
|
|
2458
|
-
samples:
|
|
2473
|
+
samples: de(t),
|
|
2459
2474
|
memoryUsed: n?.current ?? 0,
|
|
2460
2475
|
memoryPeak: n?.peak ?? 0
|
|
2461
2476
|
}), this.completion.isTimeLimitReached(t, this.settings.get("renderLimitMode"), this.settings.get("renderTimeLimit")) && (t.isComplete = !0);
|
|
@@ -2492,14 +2507,14 @@ var er = class extends I {
|
|
|
2492
2507
|
}
|
|
2493
2508
|
dispose() {
|
|
2494
2509
|
if (!this._disposed) {
|
|
2495
|
-
if (this._disposed = !0, this.dispatchEvent({ type: m.DISPOSE }), this.stopAnimation(), clearTimeout(this._resizeDebounceTimer), this._resizeDebounceTimer = null, clearTimeout(this._respillTimer), this._respillTimer = null, this._removeTrackedListeners(),
|
|
2510
|
+
if (this._disposed = !0, this.dispatchEvent({ type: m.DISPOSE }), this.stopAnimation(), clearTimeout(this._resizeDebounceTimer), this._resizeDebounceTimer = null, clearTimeout(this._respillTimer), this._respillTimer = null, this._removeTrackedListeners(), ue(null), this._storageRelease?.(), this._storageRelease = null, this.storage = null, this._sceneSource = this._sceneSourceInput = null, this._issues.detach(), this.color?.dispose(), this.color = null, this._textureReadback?.dispose(), this._textureReadback = null, this._readbackToneMapper?.dispose(), this._readbackToneMapper = null, this._disposeExtensions(), this.lightManager?.dispose(), this.pipeline?.dispose(), this._sdf?.dispose(), this._sdf = null, this.assetLoader?.dispose(), this.assetLoader = null, this.meshScene) {
|
|
2496
2511
|
this.meshScene.environment?.dispose(), this.meshScene.environment = null;
|
|
2497
2512
|
for (let e of [...this.meshScene.children]) h(e);
|
|
2498
2513
|
this.meshScene.clear(), this.meshScene = null;
|
|
2499
2514
|
}
|
|
2500
2515
|
this._sceneHelpers?.clear(), this._sceneHelpers = null, this.scene?.clear(), this.scene = null;
|
|
2501
2516
|
try {
|
|
2502
|
-
let e =
|
|
2517
|
+
let e = Xe().value, t = We().value;
|
|
2503
2518
|
e?._listeners?.dispose && (e._listeners.dispose.length = 0), t?._listeners?.dispose && (t._listeners.dispose.length = 0);
|
|
2504
2519
|
} catch (e) {
|
|
2505
2520
|
$.warn("failed to clear TSL texture singleton listeners", e);
|
|
@@ -2510,7 +2525,7 @@ var er = class extends I {
|
|
|
2510
2525
|
unloadScene() {
|
|
2511
2526
|
if (this.isInitialized) {
|
|
2512
2527
|
if (this._loadingInProgress) throw Error("PathTracerApp.unloadScene: cannot unload while a load is in progress");
|
|
2513
|
-
this._disposed || (this._releaseSceneState(), this.assetLoader?.releaseTargetModel(), this._sceneSource = this._sceneSourceInput = null, this.lightManager?.clearLights?.(), this.stages.pathTracer && (this.stages.pathTracer.setTriangleData(new Uint32Array(he.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(
|
|
2528
|
+
this._disposed || (this._releaseSceneState(), this.assetLoader?.releaseTargetModel(), this._sceneSource = this._sceneSourceInput = null, this.lightManager?.clearLights?.(), this.stages.pathTracer && (this.stages.pathTracer.setTriangleData(new Uint32Array(he.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData(Zn()), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setEmissiveTriangleData?.(new Float32Array(), 0, 0), this.stages.pathTracer.setupMaterial()), this._dropDisplay(), this.reset(), this.dispatchEvent({ type: m.SCENE_UNLOADED }));
|
|
2514
2529
|
}
|
|
2515
2530
|
}
|
|
2516
2531
|
async loadModel(e, t = {}) {
|
|
@@ -2569,24 +2584,24 @@ var er = class extends I {
|
|
|
2569
2584
|
url: e,
|
|
2570
2585
|
filename: n,
|
|
2571
2586
|
cacheKey: t.cacheKey ?? null,
|
|
2572
|
-
...
|
|
2587
|
+
...Kn(t)
|
|
2573
2588
|
});
|
|
2574
2589
|
return;
|
|
2575
2590
|
}
|
|
2576
|
-
if (
|
|
2577
|
-
let n =
|
|
2591
|
+
if (Ne(e)) {
|
|
2592
|
+
let n = Me(e, { isModel: (e) => this.assetLoader?.getFileFormat(e)?.type === "model" });
|
|
2578
2593
|
if (n.files.length === 0) throw Error(`${n.name} holds no files to load`);
|
|
2579
2594
|
await this._loadWithSceneRebuild(() => this.assetLoader.loadFolder(n, t), {
|
|
2580
2595
|
type: m.MODEL_LOADED,
|
|
2581
2596
|
filename: n.name
|
|
2582
2597
|
}, async () => {
|
|
2583
|
-
let e = await
|
|
2598
|
+
let e = await je(n);
|
|
2584
2599
|
return {
|
|
2585
2600
|
kind: "local-folder",
|
|
2586
2601
|
folder: e,
|
|
2587
|
-
key:
|
|
2602
|
+
key: E(e),
|
|
2588
2603
|
...n.flat ? { flat: !0 } : {},
|
|
2589
|
-
...
|
|
2604
|
+
...Kn(t)
|
|
2590
2605
|
};
|
|
2591
2606
|
}), this._sceneSourceInput = n;
|
|
2592
2607
|
return;
|
|
@@ -2594,7 +2609,7 @@ var er = class extends I {
|
|
|
2594
2609
|
let n = this.assetLoader?.getFileFormat(e?.name || "");
|
|
2595
2610
|
if (!n) throw this.assetLoader.formatError(e?.name || "");
|
|
2596
2611
|
if (n.type !== "environment" && n.type !== "image") {
|
|
2597
|
-
let n =
|
|
2612
|
+
let n = Ae(e).catch(() => ({
|
|
2598
2613
|
name: e.name,
|
|
2599
2614
|
size: e.size,
|
|
2600
2615
|
lastModified: e.lastModified ?? 0,
|
|
@@ -2608,8 +2623,8 @@ var er = class extends I {
|
|
|
2608
2623
|
return {
|
|
2609
2624
|
kind: "local-file",
|
|
2610
2625
|
file: e,
|
|
2611
|
-
key: e.sample ?
|
|
2612
|
-
...
|
|
2626
|
+
key: e.sample ? E(e) : null,
|
|
2627
|
+
...Kn(t)
|
|
2613
2628
|
};
|
|
2614
2629
|
}), this._sceneSourceInput = e;
|
|
2615
2630
|
return;
|
|
@@ -2658,10 +2673,10 @@ var er = class extends I {
|
|
|
2658
2673
|
return this._sceneSource ?? null;
|
|
2659
2674
|
}
|
|
2660
2675
|
get sceneSourceFile() {
|
|
2661
|
-
return this._sceneSourceInput && !
|
|
2676
|
+
return this._sceneSourceInput && !Ne(this._sceneSourceInput) ? this._sceneSourceInput : null;
|
|
2662
2677
|
}
|
|
2663
2678
|
get sceneSourceFolder() {
|
|
2664
|
-
return
|
|
2679
|
+
return Ne(this._sceneSourceInput) ? this._sceneSourceInput : null;
|
|
2665
2680
|
}
|
|
2666
2681
|
async _loadWithSceneRebuild(e, t, n = null) {
|
|
2667
2682
|
if (this._loadingInProgress) throw this._busyError("PathTracerApp");
|
|
@@ -2669,7 +2684,7 @@ var er = class extends I {
|
|
|
2669
2684
|
try {
|
|
2670
2685
|
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();
|
|
2671
2686
|
} catch (e) {
|
|
2672
|
-
throw (!e || e.code !== "LOAD_IN_PROGRESS") && this._discardFailedLoad(), e?.code === "ARCHIVE_NEEDS_ELEMENT" ?
|
|
2687
|
+
throw (!e || e.code !== "LOAD_IN_PROGRESS") && this._discardFailedLoad(), e?.code === "ARCHIVE_NEEDS_ELEMENT" ? y() : e?.code !== "LOAD_IN_PROGRESS" && v({
|
|
2673
2688
|
status: `Error: ${e?.message ?? e}`,
|
|
2674
2689
|
failed: !0,
|
|
2675
2690
|
progress: 100
|
|
@@ -2778,16 +2793,16 @@ var er = class extends I {
|
|
|
2778
2793
|
let e = (this._sdf?.emissiveTriangleBuilder?.emissiveTriangles?.length ?? this._sdf?.emissiveTriangleCount ?? 0) > 0;
|
|
2779
2794
|
this.settings.set("enableEmissiveTriangleSampling", e, { reset: !1 });
|
|
2780
2795
|
}
|
|
2781
|
-
return n.start("Apply settings"), this.settings.applyAll(), this.stages.compositor.setTransparentBackground(this.settings.get("transparentBackground")), n.end("Apply settings"), n.print(this._sceneSummaryParts()),
|
|
2796
|
+
return n.start("Apply settings"), this.settings.applyAll(), this.stages.compositor.setTransparentBackground(this.settings.get("transparentBackground")), n.end("Apply settings"), n.print(this._sceneSummaryParts()), y(), this._sceneRebuilt(), this.dispatchEvent({ type: m.SCENE_REBUILD }), !0;
|
|
2782
2797
|
}
|
|
2783
2798
|
_sceneSummaryParts() {
|
|
2784
2799
|
let e = this.stages.pathTracer, t = this._sdf?.instanceTable?.setCount ?? 0, n = this._sdf?.geometryExtractor?.maps?.length ?? 0;
|
|
2785
2800
|
return [
|
|
2786
|
-
|
|
2787
|
-
t ?
|
|
2788
|
-
|
|
2789
|
-
n ?
|
|
2790
|
-
|
|
2801
|
+
x.count(e.triangleCount, "tri"),
|
|
2802
|
+
t ? x.count(t, "mesh", "meshes") : null,
|
|
2803
|
+
x.count(e.materialData.materialCount, "material"),
|
|
2804
|
+
n ? x.count(n, "map") : null,
|
|
2805
|
+
x.count(e.bvhNodeCount, "BVH node")
|
|
2791
2806
|
];
|
|
2792
2807
|
}
|
|
2793
2808
|
_tagPrimarySceneObject() {
|
|
@@ -2865,7 +2880,7 @@ var er = class extends I {
|
|
|
2865
2880
|
_sceneBudgets(e) {
|
|
2866
2881
|
return this._memorySpill === !1 || !this.storage ? e : {
|
|
2867
2882
|
maxTriangles: ie,
|
|
2868
|
-
maxPlacements:
|
|
2883
|
+
maxPlacements: fe,
|
|
2869
2884
|
...e
|
|
2870
2885
|
};
|
|
2871
2886
|
}
|
|
@@ -2873,7 +2888,7 @@ var er = class extends I {
|
|
|
2873
2888
|
let e = this._memorySpill !== !1 && !!this.storage && (this.assetLoader?.animations?.length ?? 0) === 0 && (this._memorySpill === !0 || this._sdf.needsSpill(this.meshScene));
|
|
2874
2889
|
this.assetLoader && (this.assetLoader.maxEnvironmentWidth = e ? se : 0);
|
|
2875
2890
|
let t = e ? this.meshScene?.environment : null, n = t?.image;
|
|
2876
|
-
return n &&
|
|
2891
|
+
return n && Rn(t, se), t && t.image !== n && (t.dispose(), t.needsUpdate = !0), e && this._memorySpill === "auto" && $.info("scene is past the in-memory line: building it through disk"), this._spillPlan = e, e;
|
|
2877
2892
|
}
|
|
2878
2893
|
_progressiveSpill() {
|
|
2879
2894
|
let e = this._spillPlan ?? this._planSpill();
|
|
@@ -2895,7 +2910,7 @@ var er = class extends I {
|
|
|
2895
2910
|
_scheduleRespill() {
|
|
2896
2911
|
this._sdf?.spilling && (clearTimeout(this._respillTimer), this._respillTimer = setTimeout(() => {
|
|
2897
2912
|
this._respillTimer = null, this._sdf?.respill().catch((e) => this._issues.warn(S.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`));
|
|
2898
|
-
},
|
|
2913
|
+
}, qn), this._respillTimer.unref?.());
|
|
2899
2914
|
}
|
|
2900
2915
|
async ensureSceneResident() {
|
|
2901
2916
|
this._sdf?.spilled && await this._sdf.ensureResident(), await this._sdf?.ensureGeometryResident();
|
|
@@ -2936,7 +2951,7 @@ var er = class extends I {
|
|
|
2936
2951
|
allowLower: n
|
|
2937
2952
|
}, Math.max(256, Math.min(f, Math.floor(i) || 256));
|
|
2938
2953
|
let a = this.renderer.backend?.device?.limits?.maxStorageBufferBindingSize || 128 * 1024 * 1024, o = oe(this._hostMemoryGB), s = o.gb >= 8 && a >= 1024 * 1024 * 1024 ? f : 2048, c = t(Math.min(i, s));
|
|
2939
|
-
if (c < Math.floor(e) && this._issues.warn(S.RENDER_RESERVE_CAPPED, `reserved render size ${
|
|
2954
|
+
if (c < Math.floor(e) && this._issues.warn(S.RENDER_RESERVE_CAPPED, `reserved render size ${x.n(e)}px was capped to ${x.n(c)}px by this device's limits — renders above ${x.n(c)}px will be declined` + (o.assumed && o.gb < 8 ? " (host memory unknown, 4 GB assumed: pass hostMemoryGB)" : ""), {
|
|
2940
2955
|
requested: e,
|
|
2941
2956
|
applied: c,
|
|
2942
2957
|
deviceMemoryGB: o.gb,
|
|
@@ -3074,7 +3089,7 @@ var er = class extends I {
|
|
|
3074
3089
|
let e = l ? "adaptive sampling retired the frame at the convergence threshold — pass `allowEarlyRetire: true`, or disable it with setDeterministicMode()" : "something retired the render (maxSamples, a stray reset, or a canvas resize)";
|
|
3075
3090
|
throw Error(`renderFrames: stopped at ${a.frameCount}/${o} samples after ${c} passes — ${e}`);
|
|
3076
3091
|
}
|
|
3077
|
-
return a.frameCount;
|
|
3092
|
+
return await this._finishImage(), a.frameCount;
|
|
3078
3093
|
}
|
|
3079
3094
|
async renderUntilComplete({ reset: e = !0, denoise: t = !0, signal: n, drainEvery: r = 4, onProgress: i } = {}) {
|
|
3080
3095
|
let a = this.stages.pathTracer;
|
|
@@ -3106,7 +3121,7 @@ var er = class extends I {
|
|
|
3106
3121
|
}
|
|
3107
3122
|
}
|
|
3108
3123
|
let l = this._completionInfo();
|
|
3109
|
-
this.completion.markComplete() && this.dispatchEvent({
|
|
3124
|
+
await this._finishImage(), this.completion.markComplete() && this.dispatchEvent({
|
|
3110
3125
|
type: m.RENDER_COMPLETE,
|
|
3111
3126
|
...l
|
|
3112
3127
|
});
|
|
@@ -3127,8 +3142,8 @@ var er = class extends I {
|
|
|
3127
3142
|
getProvenance() {
|
|
3128
3143
|
let e = this.stages.pathTracer, t = this.color?.status();
|
|
3129
3144
|
return i({
|
|
3130
|
-
engine:
|
|
3131
|
-
three:
|
|
3145
|
+
engine: le,
|
|
3146
|
+
three: xt,
|
|
3132
3147
|
adapter: this.adapterInfo ?? null,
|
|
3133
3148
|
mode: {
|
|
3134
3149
|
headless: this._headless,
|
|
@@ -3170,7 +3185,7 @@ var er = class extends I {
|
|
|
3170
3185
|
let t = await e.captureAccumulation();
|
|
3171
3186
|
return {
|
|
3172
3187
|
v: 1,
|
|
3173
|
-
engine:
|
|
3188
|
+
engine: le,
|
|
3174
3189
|
savedAt: Date.now(),
|
|
3175
3190
|
samples: t.state.frameCount,
|
|
3176
3191
|
...t
|
|
@@ -3195,10 +3210,18 @@ var er = class extends I {
|
|
|
3195
3210
|
exposure: this.renderer.toneMappingExposure,
|
|
3196
3211
|
toneMapping: this.renderer.toneMapping,
|
|
3197
3212
|
saturation: this.settings.get("saturation") ?? 1,
|
|
3198
|
-
preserveAlpha: t
|
|
3199
|
-
|
|
3213
|
+
preserveAlpha: t,
|
|
3214
|
+
gain: this._displayGain()
|
|
3215
|
+
}, l = await this._toneMapOnGPU(r?.texture ?? null, i, o, s, c), u = !l && c.gain ? await c.gain.cpu() : null;
|
|
3200
3216
|
return {
|
|
3201
|
-
data: l ?? a(r ? await this._readTexture(r.texture, o, s) : await this.renderer.readRenderTargetPixelsAsync(i, 0, 0, o, s, 0),
|
|
3217
|
+
data: l ?? a(r ? await this._readTexture(r.texture, o, s) : await this.renderer.readRenderTargetPixelsAsync(i, 0, 0, o, s, 0), {
|
|
3218
|
+
...c,
|
|
3219
|
+
pixelGain: u && {
|
|
3220
|
+
fn: u,
|
|
3221
|
+
width: o,
|
|
3222
|
+
height: s
|
|
3223
|
+
}
|
|
3224
|
+
}),
|
|
3202
3225
|
width: o,
|
|
3203
3226
|
height: s,
|
|
3204
3227
|
colorSpace: e,
|
|
@@ -3232,7 +3255,7 @@ var er = class extends I {
|
|
|
3232
3255
|
if (!a?.device) return this._toneMapFallback("the renderer has no WebGPU device");
|
|
3233
3256
|
try {
|
|
3234
3257
|
let o = e ? this._readbackPass().draw(e, n, r).texture : t.textures[0], s = a.get(o).texture;
|
|
3235
|
-
return s ? (this._readbackToneMapper ??= new
|
|
3258
|
+
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");
|
|
3236
3259
|
} catch (e) {
|
|
3237
3260
|
if (e instanceof ve) throw e;
|
|
3238
3261
|
return this._toneMapFallback("the GPU pass threw", e);
|
|
@@ -3372,7 +3395,7 @@ var er = class extends I {
|
|
|
3372
3395
|
}
|
|
3373
3396
|
getSceneMinY() {
|
|
3374
3397
|
if (!this.meshScene) return 0;
|
|
3375
|
-
let e = new
|
|
3398
|
+
let e = new $e().setFromObject(this.meshScene);
|
|
3376
3399
|
return Number.isFinite(e.min.y) ? e.min.y : 0;
|
|
3377
3400
|
}
|
|
3378
3401
|
getMaterialProperty(e, t) {
|
|
@@ -3450,7 +3473,7 @@ var er = class extends I {
|
|
|
3450
3473
|
};
|
|
3451
3474
|
}
|
|
3452
3475
|
_readbackPass() {
|
|
3453
|
-
return this._textureReadback ??= new
|
|
3476
|
+
return this._textureReadback ??= new Zt(this.renderer);
|
|
3454
3477
|
}
|
|
3455
3478
|
_readTexture(e, t, n) {
|
|
3456
3479
|
return this._readbackPass().read(e, t, n);
|
|
@@ -3461,7 +3484,7 @@ var er = class extends I {
|
|
|
3461
3484
|
n.__rayzeeOriginalColorSpace === void 0 && (n.__rayzeeOriginalColorSpace = e.colorSpace);
|
|
3462
3485
|
let r = n.__rayzeeOriginalColorSpace;
|
|
3463
3486
|
if (delete n.ocioColorSpace, delete n.__rayzeeColorSpaceChoice, t == null) e.colorSpace = r, delete n.__rayzeeOriginalColorSpace;
|
|
3464
|
-
else if (t === "srgb" || t === "linear") e.colorSpace = t === "srgb" ? O :
|
|
3487
|
+
else if (t === "srgb" || t === "linear") e.colorSpace = t === "srgb" ? O : Ie, n.__rayzeeColorSpaceChoice = t;
|
|
3465
3488
|
else {
|
|
3466
3489
|
if (!this.color?.hasConfig) throw Error(`"${t}" needs a colour config loaded`);
|
|
3467
3490
|
n.ocioColorSpace = t, e.colorSpace = O;
|
|
@@ -3469,12 +3492,12 @@ var er = class extends I {
|
|
|
3469
3492
|
e.needsUpdate = !0, this.stages.pathTracer?.sdfs && await this.rebuildMaterials();
|
|
3470
3493
|
}
|
|
3471
3494
|
setColorManagement(e) {
|
|
3472
|
-
this.color?.dispose(), this.color = new e({ issues: this._issues }),
|
|
3495
|
+
this.color?.dispose(), this.color = new e({ issues: this._issues }), Se(this.color), this.renderer && this.color.attachRenderer(this.renderer);
|
|
3473
3496
|
}
|
|
3474
3497
|
async loadColorConfig(e = {}) {
|
|
3475
3498
|
await this._leaveColorWorkingSpace();
|
|
3476
|
-
let t =
|
|
3477
|
-
return this.color.workingSpaceAdopted && await this.applyColorWorkingSpace(), (!(t?.source === "ocio" &&
|
|
3499
|
+
let t = T(this.renderer?.toneMapping), n = await this.color.loadConfig(e);
|
|
3500
|
+
return this.color.workingSpaceAdopted && await this.applyColorWorkingSpace(), (!(t?.source === "ocio" && T(this.renderer?.toneMapping) === t) || this.color.workingSpaceAdopted) && this.reset(), n;
|
|
3478
3501
|
}
|
|
3479
3502
|
async unloadColorConfig() {
|
|
3480
3503
|
await this._leaveColorWorkingSpace(), this.color.unloadConfig(), this.reset();
|
|
@@ -3497,10 +3520,10 @@ var er = class extends I {
|
|
|
3497
3520
|
await t?.rebuildMaterials(e || this.meshScene), t?.triangleStorageNode?.withoutUV && this._sdf?.triangles && ee(e || this.meshScene) && (this._sdf.textureCoordinates = !0, t.setTriangleData(this._sdf.triangles, this._sdf.triangleCount, { textureCoordinates: !0 }), t.setupMaterial()), this.reset();
|
|
3498
3521
|
}
|
|
3499
3522
|
async _initRenderer() {
|
|
3500
|
-
if (
|
|
3523
|
+
if (ue((e) => this.dispatchEvent(e)), typeof navigator > "u" || !navigator.gpu) throw Error("WebGPU is not available — outside a browser, install one as navigator.gpu (for Node, the `webgpu` package)");
|
|
3501
3524
|
let e = await navigator.gpu.requestAdapter({ powerPreference: "high-performance" });
|
|
3502
3525
|
if (!e) throw Error("Failed to get WebGPU adapter");
|
|
3503
|
-
this.adapterInfo =
|
|
3526
|
+
this.adapterInfo = er(e), this.adapterInfo.isSoftware && (this._issues.warn(S.ADAPTER_SOFTWARE, `software GPU adapter "${this.adapterInfo.description || this.adapterInfo.vendor}" — renders are correct but orders of magnitude slower than hardware`, { ...this.adapterInfo }), $.warn(`software GPU adapter — check app.adapterInfo.isSoftware. ${this.adapterInfo.description}`));
|
|
3504
3527
|
let t = e.limits, n = { maxColorAttachmentBytesPerSample: 128 };
|
|
3505
3528
|
for (let e of [
|
|
3506
3529
|
"maxBufferSize",
|
|
@@ -3523,18 +3546,18 @@ var er = class extends I {
|
|
|
3523
3546
|
alpha: !0,
|
|
3524
3547
|
powerPreference: "high-performance",
|
|
3525
3548
|
requiredLimits: n
|
|
3526
|
-
}), await
|
|
3549
|
+
}), await Xn(this.renderer, this._headless), !this.renderer.backend?.isWebGPUBackend) throw Error("WebGPU backend unavailable — three.js fell back to WebGL2, which cannot run the path tracer's compute kernels. Check GPU process flags and driver support.");
|
|
3527
3550
|
let r = this.renderer.backend?.device;
|
|
3528
|
-
r?.lost && (this._gpuDevice = r, this._deviceLostHolder = { app: this },
|
|
3551
|
+
r?.lost && (this._gpuDevice = r, this._deviceLostHolder = { app: this }, Qn(r, this._deviceLostHolder), r.onuncapturederror = (e) => $.error("WebGPU uncaptured error:", e.error)), ze.setLTC(kt.init()), this.renderer.outputColorSpace = O, this.renderer.toneMapping = ke, this.renderer.toneMappingExposure = 1, this.renderer.setPixelRatio(1), this.color.attachRenderer(this.renderer);
|
|
3529
3552
|
}
|
|
3530
3553
|
_initScenes() {
|
|
3531
|
-
this.scene = new
|
|
3554
|
+
this.scene = new V(), this.meshScene = new V(), this._sceneHelpers = new Ft();
|
|
3532
3555
|
}
|
|
3533
3556
|
_initAssetPipeline() {
|
|
3534
3557
|
this._sdf = new u({
|
|
3535
3558
|
issues: this._issues,
|
|
3536
3559
|
...this._maxSceneBytes === void 0 ? {} : { maxSceneBytes: this._maxSceneBytes }
|
|
3537
|
-
}), this.assetLoader = new
|
|
3560
|
+
}), this.assetLoader = new Ln(this.meshScene, this.camera, null, {
|
|
3538
3561
|
issues: this._issues,
|
|
3539
3562
|
areaLightIntensityScale: () => this.settings.get("areaLightIntensityScale")
|
|
3540
3563
|
}), this.assetLoader.setRenderer(this.renderer), this.assetLoader.createFloorPlane();
|
|
@@ -3542,14 +3565,14 @@ var er = class extends I {
|
|
|
3542
3565
|
_initPipeline() {
|
|
3543
3566
|
this._createStages();
|
|
3544
3567
|
let { clientWidth: e, clientHeight: t } = this.canvas;
|
|
3545
|
-
this.pipeline = new
|
|
3568
|
+
this.pipeline = new Jt(this.renderer, e || 1, t || 1, { issues: this._issues }), this.pipeline.addStage(this.stages.pathTracer);
|
|
3546
3569
|
for (let e of this._extraStages) this.pipeline.addStage(e);
|
|
3547
3570
|
this.pipeline.addStage(this.stages.compositor);
|
|
3548
3571
|
let n = this.canvas.clientWidth || 1, r = this.canvas.clientHeight || 1;
|
|
3549
3572
|
this._displayWidth = n, this._displayHeight = r, this._renderWidth = n, this._renderHeight = r, this.pipeline.setSize(n, r);
|
|
3550
3573
|
}
|
|
3551
3574
|
async _initManagers() {
|
|
3552
|
-
this.lightManager = new
|
|
3575
|
+
this.lightManager = new Gn(this.scene, this._sceneHelpers, this.stages.pathTracer, {
|
|
3553
3576
|
onReset: () => this.reset(),
|
|
3554
3577
|
onLightRemoved: (e) => this._lightRemoved(e)
|
|
3555
3578
|
}), 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();
|
|
@@ -3560,7 +3583,7 @@ var er = class extends I {
|
|
|
3560
3583
|
if (e.model) this._clearAppendedModels(), await this.loadSceneData({ pendingEnvironment: this._beginSceneMetadataEnvironment() });
|
|
3561
3584
|
else if (e.texture) {
|
|
3562
3585
|
let e = this.meshScene.environment;
|
|
3563
|
-
e && this.stages.pathTracer && await this.stages.pathTracer.environment.setEnvironmentMap(e),
|
|
3586
|
+
e && this.stages.pathTracer && await this.stages.pathTracer.environment.setEnvironmentMap(e), y();
|
|
3564
3587
|
}
|
|
3565
3588
|
this.pauseRendering = !1, this.reset();
|
|
3566
3589
|
}
|
|
@@ -3573,7 +3596,7 @@ var er = class extends I {
|
|
|
3573
3596
|
this.stages.pathTracer = new l(this.renderer, this.scene, this.camera, {
|
|
3574
3597
|
hostMemoryGB: this._hostMemoryGB,
|
|
3575
3598
|
sortMaterials: this.settings.get("wavefrontSortMaterials")
|
|
3576
|
-
}), this._extraStages = this._createExtraStages(), this.stages.compositor = new
|
|
3599
|
+
}), this._extraStages = this._createExtraStages(), this.stages.compositor = new It(this.renderer, {
|
|
3577
3600
|
saturation: this.settings.get("saturation") ?? _.saturation,
|
|
3578
3601
|
pathTracer: this.stages.pathTracer,
|
|
3579
3602
|
displaySources: this._displaySources()
|
|
@@ -3589,7 +3612,7 @@ var er = class extends I {
|
|
|
3589
3612
|
if (e) for (let n of t) this._addTrackedListener(e, n, (e) => this.dispatchEvent(e));
|
|
3590
3613
|
}
|
|
3591
3614
|
_createCamera() {
|
|
3592
|
-
let e = new
|
|
3615
|
+
let e = new Hn(60, this.canvas.clientWidth / this.canvas.clientHeight || 1, .01, 1e3);
|
|
3593
3616
|
return e.position.set(0, 0, 5), e;
|
|
3594
3617
|
}
|
|
3595
3618
|
_createExtraStages() {
|
|
@@ -3615,6 +3638,12 @@ var er = class extends I {
|
|
|
3615
3638
|
}
|
|
3616
3639
|
_afterTrace() {}
|
|
3617
3640
|
_renderCompleted() {}
|
|
3641
|
+
_settling() {
|
|
3642
|
+
return !1;
|
|
3643
|
+
}
|
|
3644
|
+
_finishImage() {
|
|
3645
|
+
return null;
|
|
3646
|
+
}
|
|
3618
3647
|
_renderHelperOverlay() {
|
|
3619
3648
|
this.scene.updateMatrixWorld();
|
|
3620
3649
|
}
|
|
@@ -3633,6 +3662,9 @@ var er = class extends I {
|
|
|
3633
3662
|
async _finalDenoise() {
|
|
3634
3663
|
return !1;
|
|
3635
3664
|
}
|
|
3665
|
+
_displayGain() {
|
|
3666
|
+
return null;
|
|
3667
|
+
}
|
|
3636
3668
|
_denoiserInUse() {
|
|
3637
3669
|
return !1;
|
|
3638
3670
|
}
|
|
@@ -3650,4 +3682,4 @@ var er = class extends I {
|
|
|
3650
3682
|
_disposeExtensions() {}
|
|
3651
3683
|
};
|
|
3652
3684
|
//#endregion
|
|
3653
|
-
export {
|
|
3685
|
+
export { Lt as _, cn as a, J as c, q as d, an as f, Vt as g, Ht as h, Hn as i, on as l, Ut as m, er as n, Y as o, Jt as p, Gn as r, W as s, tr as t, rn as u };
|