rayzee 11.13.0 → 11.14.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 +59 -4
- package/dist/{ArchiveImporter-DQU55mit.js → ArchiveImporter-DBMmDG98.js} +97 -92
- package/dist/{BidirectionalIntegrator-CLmFjSN3.js → BidirectionalIntegrator-D6rcU7N1.js} +199 -198
- package/dist/{ColorManagement-3xw0xXRg.js → ColorManagement-D9eYhssc.js} +1083 -547
- package/dist/DepthPass-D4Zh108s.js +68 -0
- package/dist/{EngineIssues-CfJiBaNj.js → EngineIssues-B14FGIHX.js} +1 -0
- package/dist/{NeuralRetouch-CEkBhI1M.js → NeuralRetouch-Cyh0AwUT.js} +3 -3
- package/dist/{NeuralSuperRes-Drjws9nE.js → NeuralSuperRes-BPp05Ipu.js} +3 -3
- package/dist/{SolarLimb-ZYl-Pwl0.js → PackedRayBuffer-BtJJxs43.js} +3 -7
- package/dist/{PathTracer-7a7L3cGF.js → PathTracer-BLV2bVqi.js} +3372 -4160
- package/dist/{PhysicalSky-DUIbTE93.js → PhysicalSky-VonV_lAD.js} +46 -45
- package/dist/{RayzeeRenderer-CjjGT2e0.js → RayzeeRenderer-D1NeGoVA.js} +787 -453
- package/dist/{SceneMetadata-CoAHTAmo.js → SceneMetadata-BBx6k2EY.js} +1 -1
- package/dist/SolarLimb-DSig_M0f.js +8 -0
- package/dist/TextureBuckets-CcSAhgVc.js +308 -0
- package/dist/TextureSampling-C4Sg4Yw_.js +901 -0
- package/dist/{ToneMapGPU-4GPwoG_c.js → ToneMapGPU-l_79riZd.js} +21 -11
- package/dist/addons/archives.es.js +2 -2
- package/dist/addons/bidirectional.es.js +1 -1
- package/dist/addons/color.es.js +3 -3
- package/dist/addons/formats.es.js +1 -1
- package/dist/addons/physical-sky.es.js +1 -1
- package/dist/addons/storage.es.js +2 -2
- package/dist/encoders.es.js +942 -0
- package/dist/{openStorage-CdyVjmps.js → openStorage-D6DBv9_I.js} +3 -3
- package/dist/rayzee-core.es.js +12 -11
- package/dist/rayzee.es.js +179 -176
- package/dist/rayzee.umd.js +149 -107
- package/dist/{sceneCachePolicy-DavHt6Ii.js → sceneCachePolicy-DcEWCTKO.js} +179 -485
- package/package.json +4 -1
- package/src/Color/BakedViews.js +5 -1
- package/src/Color/BasicColor.js +7 -0
- package/src/Color/ColorManagement.js +64 -42
- package/src/Color/Displays.js +35 -0
- package/src/Color/LutBake.js +163 -9
- package/src/Color/OcioViews.js +508 -55
- package/src/EngineIssues.js +1 -0
- package/src/Processor/ImageEncoders.js +1306 -0
- package/src/Processor/SceneProcessor.js +1 -1
- package/src/Processor/TextureCreator.js +154 -48
- package/src/Processor/ToneMapCPU.js +35 -9
- package/src/Processor/ToneMapGPU.js +52 -6
- package/src/Processor/Workers/TexturesWorker.js +10 -13
- package/src/RayzeeRenderer.js +303 -36
- package/src/Stages/Compositor.js +112 -18
- package/src/Stages/PathTracer.js +22 -0
- package/src/Stages/PathTracerStage.js +63 -1
- package/src/Storage/SceneGraphCodec.js +17 -2
- package/src/TSL/DepthPass.js +146 -0
- package/src/managers/VideoRenderManager.js +6 -2
- /package/dist/{ActiveColor-YvuQq44O.js → ActiveColor-7CZdmrsz.js} +0 -0
- /package/dist/{AssetConfig-DSEntE65.js → AssetConfig-BY4jDfTH.js} +0 -0
- /package/dist/{BufferLayout-BROyMqO1.js → BufferLayout-SvkefbAs.js} +0 -0
- /package/dist/{FileFormats-sPGJeCRc.js → FileFormats-B_VqIVDq.js} +0 -0
- /package/dist/{ViewTransforms-CYN7bq2w.js → ViewTransforms-Crdom11t.js} +0 -0
- /package/dist/{WorkingMatrix-C6y233hT.js → WorkingMatrix-DWJV2JM2.js} +0 -0
- /package/dist/{ZipReader-gDSWr0I5.js → ZipReader-Bva4oiva.js} +0 -0
- /package/dist/{identity-C1cLD1C0.js → identity-CtOwEU7N.js} +0 -0
- /package/dist/{shared-BGBcSxBQ.js → shared-ubP8eJlr.js} +0 -0
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
5
|
-
import { i as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
1
|
+
import { ut as e } from "./PackedRayBuffer-BtJJxs43.js";
|
|
2
|
+
import { G as t, J as n, K as r, U as i, W as a, Y as o, at as s, ct as c, i as l, lt as u, n as d, nt as f, ot as p, q as m, r as h, rt as g, tt as _, ut as v } from "./PathTracer-BLV2bVqi.js";
|
|
3
|
+
import { n as y, t as b } from "./EngineEvents-CLckhYbL.js";
|
|
4
|
+
import { B as ee, C as te, G as ne, H as re, K as ie, M as ae, T as oe, U as se, W as ce, X as x, Z as le, d as ue, f as de, l as fe, q as pe, r as me, u as he, v as ge, x as _e } from "./sceneCachePolicy-DcEWCTKO.js";
|
|
5
|
+
import { i as S, r as ve } from "./Logger-dDDGj9Av.js";
|
|
6
|
+
import { o as ye, s as C } from "./TextureBuckets-CcSAhgVc.js";
|
|
7
|
+
import { f as be, r as xe } from "./BufferLayout-SvkefbAs.js";
|
|
8
|
+
import { i as Se, n as w, t as Ce } from "./EngineIssues-B14FGIHX.js";
|
|
9
|
+
import { n as we, r as Te } from "./shared-ubP8eJlr.js";
|
|
10
|
+
import { a as Ee } from "./WorkingMatrix-DWJV2JM2.js";
|
|
11
|
+
import { i as De, r as Oe, t as T } from "./ActiveColor-7CZdmrsz.js";
|
|
12
|
+
import { n as E, r as ke } from "./AssetConfig-BY4jDfTH.js";
|
|
13
|
+
import { d as Ae, l as je, m as Me, p as Ne, t as Pe, u as D } from "./ViewTransforms-Crdom11t.js";
|
|
14
|
+
import { i as O, n as Fe, r as Ie } from "./identity-CtOwEU7N.js";
|
|
15
|
+
import { c as Le, i as Re, l as ze, o as Be, r as Ve, t as He } from "./SceneMetadata-BBx6k2EY.js";
|
|
16
|
+
import { t as Ue } from "./ToneMapGPU-l_79riZd.js";
|
|
17
|
+
import { LinearSRGBColorSpace as We, MeshBasicNodeMaterial as k, QuadMesh as A, RectAreaLightNode as Ge, SRGBColorSpace as Ke, TextureNode as qe, WebGPURenderer as Je } from "three/webgpu";
|
|
18
|
+
import { Fn as Ye, If as Xe, cubeTexture as Ze, dot as Qe, float as j, int as M, mix as N, screenUV as $e, select as P, sign as et, step as tt, storage as nt, texture as rt, toneMappingExposure as it, uint as at, uniform as F, uv as I, vec3 as L, vec4 as R } from "three/tsl";
|
|
19
|
+
import { Box3 as ot, BufferGeometry as st, CircleGeometry as ct, Color as lt, ColorManagement as ut, DataUtils as dt, DirectionalLight as ft, DirectionalLightHelper as pt, EquirectangularReflectionMapping as mt, EventDispatcher as z, FloatType as ht, HalfFloatType as gt, LinearFilter as _t, LinearSRGBColorSpace as vt, LoaderUtils as yt, LoadingManager as bt, MathUtils as B, Mesh as xt, MeshPhysicalMaterial as St, NearestFilter as Ct, NoBlending as V, NoToneMapping as H, Object3D as wt, OrthographicCamera as Tt, PerspectiveCamera as Et, PointLight as Dt, PointLightHelper as Ot, REVISION as kt, RGBAFormat as At, RectAreaLight as jt, RenderTarget as Mt, SRGBColorSpace as U, Scene as Nt, SpotLight as Pt, SpotLightHelper as Ft, TextureLoader as It, Vector2 as Lt, Vector3 as W } from "three";
|
|
20
|
+
import { RectAreaLightTexturesLib as Rt } from "three/addons/lights/RectAreaLightTexturesLib.js";
|
|
21
|
+
import { RectAreaLightHelper as zt } from "three/addons/helpers/RectAreaLightHelper.js";
|
|
22
|
+
import { GLTFLoader as Bt } from "three/addons/loaders/GLTFLoader.js";
|
|
23
|
+
import { HDRLoader as Vt } from "three/addons/loaders/HDRLoader.js";
|
|
24
|
+
import { createMeshesFromMultiMaterialMesh as Ht } from "three/addons/utils/SceneUtils.js";
|
|
25
|
+
import { clone as Ut } from "three/addons/utils/SkeletonUtils.js";
|
|
25
26
|
//#region src/SceneHelpers.js
|
|
26
|
-
var
|
|
27
|
+
var Wt = class {
|
|
27
28
|
constructor() {
|
|
28
|
-
this.scene = new
|
|
29
|
+
this.scene = new Nt(), this._helpers = /* @__PURE__ */ new Map(), this.visible = !1;
|
|
29
30
|
}
|
|
30
31
|
add(e) {
|
|
31
32
|
if (this._helpers.has(e.uuid)) return this._helpers.get(e.uuid);
|
|
@@ -63,29 +64,39 @@ var Ft = class {
|
|
|
63
64
|
this.clear();
|
|
64
65
|
}
|
|
65
66
|
_createHelper(e) {
|
|
66
|
-
return e.isRectAreaLight ? new
|
|
67
|
+
return e.isRectAreaLight ? new zt(e) : e.isPointLight ? new Ot(e, .5) : e.isSpotLight ? new Ft(e) : e.isDirectionalLight ? new pt(e, .5) : null;
|
|
67
68
|
}
|
|
68
|
-
},
|
|
69
|
+
}, Gt = (e) => {
|
|
70
|
+
let t = e.abs();
|
|
71
|
+
return N(t.add(.055).div(1.055).pow(L(2.4)), t.div(12.92), tt(t, L(.04045))).mul(et(e));
|
|
72
|
+
}, Kt = class extends u {
|
|
69
73
|
constructor(e, t = {}) {
|
|
70
74
|
super("Compositor", {
|
|
71
75
|
...t,
|
|
72
|
-
executionMode:
|
|
73
|
-
}), this.renderer = e, this._lightSources = [...t.displaySources ?? [], "pathtracer:color"], this.saturation =
|
|
76
|
+
executionMode: v.ALWAYS
|
|
77
|
+
}), this.renderer = e, this._lightSources = [...t.displaySources ?? [], "pathtracer:color"], this.saturation = F(t.saturation ?? 1), this._transparentBackground = F(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 = F(1), this._sourceTexNode = new qe(), this._displayGain = null, this._backdropExposure = null, this._holdBackdrop = F(0, "int"), this._backdropGain = F(1), this._canvasTransform = null, this._canvasMaterial = null, this._canvasQuad = null, this._viewTsl = null, this._viewMaterial = null, this._viewQuad = null, this.compositorMaterial = new k(), this.compositorMaterial.blending = V, this._buildColorNode(), this.compositorQuad = new A(this.compositorMaterial), this.setCanvasTransform(t.canvasTransform ?? null);
|
|
74
78
|
}
|
|
75
79
|
_buildColorNode() {
|
|
76
|
-
let t = this._sourceTexNode.sample(
|
|
80
|
+
let t = this._sourceTexNode.sample(I()), n = this._displayGain ? this._displayGain(t.xyz, $e) : null;
|
|
77
81
|
if (this._backdropExposure !== null) {
|
|
78
|
-
let e = n ??
|
|
79
|
-
n =
|
|
82
|
+
let e = n ?? j(1), r = e.add(this._backdropGain.sub(e).mul(t.w.clamp(0, 1).oneMinus()));
|
|
83
|
+
n = P(this._holdBackdrop.greaterThan(M(0)), r, e);
|
|
80
84
|
}
|
|
81
|
-
let r = n ? t.xyz.mul(n) : t.xyz, i =
|
|
82
|
-
this._graded = i, this._alpha = a, this.compositorMaterial.colorNode =
|
|
85
|
+
let r = n ? t.xyz.mul(n) : t.xyz, i = N(L(Qe(r, e)), r, this.saturation), a = P(this._transparentBackground, t.w, 1);
|
|
86
|
+
this._graded = i, this._alpha = a, this.compositorMaterial.colorNode = R(i, a), this.compositorMaterial.needsUpdate = !0, this._buildCanvasNode(), this._dropViewQuad();
|
|
83
87
|
}
|
|
84
88
|
_buildCanvasNode() {
|
|
85
|
-
this._canvasMaterial && (this._canvasMaterial.
|
|
89
|
+
this._canvasMaterial && (this._canvasMaterial.outputNode = R(this._canvasTransform(this._graded, it), this._alpha), this._canvasMaterial.needsUpdate = !0);
|
|
86
90
|
}
|
|
87
91
|
setCanvasTransform(e) {
|
|
88
|
-
e !== this._canvasTransform && (this._canvasTransform = e, this._canvasMaterial?.dispose(), this._canvasMaterial = null, this._canvasQuad = null, e && (this._canvasMaterial = new
|
|
92
|
+
e !== this._canvasTransform && (this._canvasTransform = e, this._canvasMaterial?.dispose(), this._canvasMaterial = null, this._canvasQuad = null, e && (this._canvasMaterial = new k(), this._canvasMaterial.blending = V, this._canvasQuad = new A(this._canvasMaterial), this._buildCanvasNode()));
|
|
93
|
+
}
|
|
94
|
+
_viewQuadFor() {
|
|
95
|
+
let e = D(this.renderer.toneMapping), t = e?.source === "ocio" ? e.tsl ?? null : null;
|
|
96
|
+
return t === this._viewTsl && (!t || this._viewQuad) ? this._viewQuad : (this._dropViewQuad(), this._viewTsl = t, t && (this._viewMaterial = new k(), this._viewMaterial.blending = V, this._viewMaterial.outputNode = R(t(this._graded, it), this._alpha), this._viewQuad = new A(this._viewMaterial)), this._viewQuad);
|
|
97
|
+
}
|
|
98
|
+
_dropViewQuad() {
|
|
99
|
+
this._viewMaterial?.dispose(), this._viewMaterial = null, this._viewQuad = null, this._viewTsl = null;
|
|
89
100
|
}
|
|
90
101
|
get showsCanvasTransform() {
|
|
91
102
|
return this._canvasQuad !== null;
|
|
@@ -114,17 +125,17 @@ var Ft = class {
|
|
|
114
125
|
let t = this._pathTracer?.getConvergenceDebugSource?.();
|
|
115
126
|
if (!t) return !1;
|
|
116
127
|
if (this._debugMaterial && this._debugM2Attr === t.m2 && this._debugMaskAttr === t.frozenMask) return !0;
|
|
117
|
-
this._debugMaterial?.dispose(), this._debugTexNode?.dispose(), this._debugM2Attr = t.m2, this._debugMaskAttr = t.frozenMask, this._debugTexNode = new
|
|
118
|
-
let n =
|
|
119
|
-
let n =
|
|
120
|
-
return
|
|
121
|
-
let e =
|
|
122
|
-
g.assign(
|
|
123
|
-
}),
|
|
124
|
-
g.assign(
|
|
128
|
+
this._debugMaterial?.dispose(), this._debugTexNode?.dispose(), this._debugM2Attr = t.m2, this._debugMaskAttr = t.frozenMask, this._debugTexNode = new qe();
|
|
129
|
+
let n = Ye(() => {
|
|
130
|
+
let n = Qe(this._debugTexNode.sample(I()).toVar().xyz, e).toVar(), r = t.renderWidth, i = t.renderHeight, a = M(I().x.mul(j(r))).min(r.sub(M(1))).max(M(0)), o = at(M(I().y.mul(j(i))).min(i.sub(M(1))).max(M(0)).mul(r).add(a)).toVar(), s = nt(t.m2, "float").toReadOnly().element(o).toVar(), c = nt(t.frozenMask, "uint").toReadOnly().element(o).toVar(), l = s.sub(n.mul(n)).max(j(0)).div(j(t.frame).add(1)).sqrt().toVar(), u = t.usePixelFreeze.greaterThan(M(0)), d = P(n.lessThan(j(1)), n.sqrt(), n).toVar(), f = P(u, l.div(n.add(j(1e-4))), l.div(d.add(j(1e-4)))).toVar(), p = P(u, t.pixelFreezeThreshold, t.noiseThreshold).toVar(), m = f.div(p.max(j(1e-6))).toVar(), h = L(n.div(n.add(j(1))).sqrt().mul(.55)).toVar(), g = h.toVar(), _ = j(t.frame).greaterThanEqual(j(t.adaptiveMinSamples));
|
|
131
|
+
return Xe(m.greaterThanEqual(j(1)).or(_.not()), () => {
|
|
132
|
+
let e = N(L(1, .8, .1), L(1, .1, .05), m.sub(1).div(3).clamp(0, 1));
|
|
133
|
+
g.assign(N(h, e, .85));
|
|
134
|
+
}), Xe(c.equal(at(1)).and(u), () => {
|
|
135
|
+
g.assign(N(h, L(.1, .45, 1), .55));
|
|
125
136
|
}), g;
|
|
126
137
|
});
|
|
127
|
-
return this._debugMaterial = new
|
|
138
|
+
return this._debugMaterial = new k(), this._debugMaterial.colorNode = R(n().pow(2.2).mul(this._debugExposureComp), 1), this._debugMaterial.blending = V, this._debugQuad = new A(this._debugMaterial), !0;
|
|
128
139
|
}
|
|
129
140
|
render(e) {
|
|
130
141
|
this._draw(e, !1);
|
|
@@ -132,31 +143,50 @@ var Ft = class {
|
|
|
132
143
|
renderPicture(e) {
|
|
133
144
|
this._draw(e, !0);
|
|
134
145
|
}
|
|
146
|
+
renderShown(e, t) {
|
|
147
|
+
if (!this._canvasTransform || !this._prepare(e)) return !1;
|
|
148
|
+
let n = new k();
|
|
149
|
+
n.blending = V, n.outputNode = R(Gt(this._canvasTransform(this._graded, it)), this._alpha);
|
|
150
|
+
let { toneMapping: r, outputColorSpace: i } = this.renderer, a = this.renderer.getRenderTarget();
|
|
151
|
+
this.renderer.toneMapping = H, this.renderer.outputColorSpace = ut.workingColorSpace;
|
|
152
|
+
try {
|
|
153
|
+
this.renderer.setRenderTarget(t), new A(n).render(this.renderer);
|
|
154
|
+
} finally {
|
|
155
|
+
this.renderer.setRenderTarget(a), this.renderer.toneMapping = r, this.renderer.outputColorSpace = i, n.dispose();
|
|
156
|
+
}
|
|
157
|
+
return !0;
|
|
158
|
+
}
|
|
159
|
+
_prepare(e) {
|
|
160
|
+
let t = this.resolveLightTexture(e);
|
|
161
|
+
if (!t) return !1;
|
|
162
|
+
if (this._backdropExposure !== null) {
|
|
163
|
+
let t = e.getState("pathtracer:backdrop") === "color";
|
|
164
|
+
this._holdBackdrop.value = +!!t, t && (this._backdropGain.value = r(this._backdropExposure, this.renderer.toneMappingExposure, this.renderer.toneMapping));
|
|
165
|
+
}
|
|
166
|
+
return this._sourceTexNode.value = t, !0;
|
|
167
|
+
}
|
|
135
168
|
_draw(e, t) {
|
|
136
169
|
if (!this.enabled) return;
|
|
137
170
|
if (this._convergenceOverlay && this._ensureDebugMaterial()) {
|
|
138
171
|
let t = e.getTexture("pathtracer:color");
|
|
139
172
|
if (t) {
|
|
140
173
|
this._debugTexNode.value = t;
|
|
141
|
-
let e = this.renderer.toneMapping !==
|
|
174
|
+
let e = this.renderer.toneMapping !== H;
|
|
142
175
|
this._debugExposureComp.value = e ? 1 / Math.max(this.renderer.toneMappingExposure, 1e-4) : 1, this.renderer.setRenderTarget(null), this._debugQuad.render(this.renderer);
|
|
143
176
|
return;
|
|
144
177
|
}
|
|
145
178
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
this._holdBackdrop.value = +!!t, t && (this._backdropGain.value = o(this._backdropExposure, this.renderer.toneMappingExposure, this.renderer.toneMapping));
|
|
151
|
-
}
|
|
152
|
-
if (this._sourceTexNode.value = n, this.renderer.setRenderTarget(null), t || !this._canvasQuad) {
|
|
179
|
+
if (!this._prepare(e)) return;
|
|
180
|
+
this.renderer.setRenderTarget(null);
|
|
181
|
+
let n = t || !this._canvasQuad ? this._viewQuadFor() : this._canvasQuad;
|
|
182
|
+
if (!n) {
|
|
153
183
|
this.compositorQuad.render(this.renderer);
|
|
154
184
|
return;
|
|
155
185
|
}
|
|
156
186
|
let { toneMapping: r, outputColorSpace: i } = this.renderer;
|
|
157
|
-
this.renderer.toneMapping =
|
|
187
|
+
this.renderer.toneMapping = H, this.renderer.outputColorSpace = ut.workingColorSpace;
|
|
158
188
|
try {
|
|
159
|
-
|
|
189
|
+
n.render(this.renderer);
|
|
160
190
|
} finally {
|
|
161
191
|
this.renderer.toneMapping = r, this.renderer.outputColorSpace = i;
|
|
162
192
|
}
|
|
@@ -171,9 +201,9 @@ var Ft = class {
|
|
|
171
201
|
this._transparentBackground.value = +!!e;
|
|
172
202
|
}
|
|
173
203
|
dispose() {
|
|
174
|
-
this._sourceTexNode?.dispose(), this.compositorMaterial?.dispose(), this._canvasMaterial?.dispose(), this._canvasMaterial = null, this._canvasQuad = null, this._canvasTransform = null, this._debugTexNode?.dispose(), this._debugMaterial?.dispose(), this.compositorQuad = null, this._debugQuad = null, this._debugMaterial = null, this._debugTexNode = null, this._pathTracer = null;
|
|
204
|
+
this._sourceTexNode?.dispose(), this.compositorMaterial?.dispose(), this._canvasMaterial?.dispose(), this._canvasMaterial = null, this._canvasQuad = null, this._canvasTransform = null, this._dropViewQuad(), this._debugTexNode?.dispose(), this._debugMaterial?.dispose(), this.compositorQuad = null, this._debugQuad = null, this._debugMaterial = null, this._debugTexNode = null, this._pathTracer = null;
|
|
175
205
|
}
|
|
176
|
-
},
|
|
206
|
+
}, qt = class {
|
|
177
207
|
constructor() {
|
|
178
208
|
this.textures = /* @__PURE__ */ new Map(), this.renderTargets = /* @__PURE__ */ new Map(), this.uniforms = /* @__PURE__ */ new Map(), this.state = {
|
|
179
209
|
frame: 0,
|
|
@@ -292,7 +322,7 @@ var Ft = class {
|
|
|
292
322
|
dispose() {
|
|
293
323
|
this.textures.clear(), this.renderTargets.clear(), this.uniforms.clear(), this._stateChangeCallbacks.clear(), this.state = {};
|
|
294
324
|
}
|
|
295
|
-
},
|
|
325
|
+
}, Jt = class extends z {
|
|
296
326
|
constructor() {
|
|
297
327
|
super(), this._onceCallbacks = /* @__PURE__ */ new Map();
|
|
298
328
|
}
|
|
@@ -330,38 +360,38 @@ var Ft = class {
|
|
|
330
360
|
eventNames() {
|
|
331
361
|
return this._listeners ? Object.keys(this._listeners) : [];
|
|
332
362
|
}
|
|
333
|
-
},
|
|
334
|
-
function
|
|
335
|
-
|
|
363
|
+
}, Yt = !1, Xt = [], Zt = /* @__PURE__ */ new WeakMap();
|
|
364
|
+
function Qt(e) {
|
|
365
|
+
Yt = !!e;
|
|
336
366
|
}
|
|
337
|
-
function
|
|
338
|
-
return
|
|
367
|
+
function $t() {
|
|
368
|
+
return Xt.slice();
|
|
339
369
|
}
|
|
340
|
-
function
|
|
341
|
-
|
|
370
|
+
function en() {
|
|
371
|
+
Xt.length = 0;
|
|
342
372
|
}
|
|
343
|
-
function
|
|
373
|
+
function tn(e) {
|
|
344
374
|
let t = [];
|
|
345
375
|
for (let n of Object.keys(e)) e[n]?.isTextureNode === !0 && t.push(n);
|
|
346
376
|
return t;
|
|
347
377
|
}
|
|
348
|
-
var
|
|
349
|
-
function
|
|
350
|
-
if (!
|
|
378
|
+
var nn = (e) => !e || !e.image || !(e.image.width > 0);
|
|
379
|
+
function rn(e, t, n) {
|
|
380
|
+
if (!Yt) {
|
|
351
381
|
n();
|
|
352
382
|
return;
|
|
353
383
|
}
|
|
354
|
-
let r =
|
|
384
|
+
let r = Zt.get(e);
|
|
355
385
|
if (r || (r = {
|
|
356
386
|
phase: "pending",
|
|
357
387
|
unboundAtCompile: []
|
|
358
|
-
},
|
|
359
|
-
n(), r.phase === "watch" &&
|
|
388
|
+
}, Zt.set(e, r)), r.phase !== "pending") {
|
|
389
|
+
n(), r.phase === "watch" && an(e, r);
|
|
360
390
|
return;
|
|
361
391
|
}
|
|
362
392
|
let i = Object.prototype.hasOwnProperty.call(t, "compute"), a = t.compute;
|
|
363
393
|
t.compute = function(...t) {
|
|
364
|
-
return r.phase === "pending" && (r.unboundAtCompile =
|
|
394
|
+
return r.phase === "pending" && (r.unboundAtCompile = tn(e).filter((t) => nn(e[t].value)), r.phase = r.unboundAtCompile.length < 2 ? "done" : "watch"), a.apply(this, t);
|
|
365
395
|
};
|
|
366
396
|
try {
|
|
367
397
|
n();
|
|
@@ -369,14 +399,14 @@ function qt(e, t, n) {
|
|
|
369
399
|
i ? t.compute = a : delete t.compute;
|
|
370
400
|
}
|
|
371
401
|
}
|
|
372
|
-
function
|
|
402
|
+
function an(e, t) {
|
|
373
403
|
let n = [];
|
|
374
404
|
for (let r of t.unboundAtCompile) {
|
|
375
405
|
let t = e[r]?.value;
|
|
376
|
-
if (
|
|
406
|
+
if (nn(t)) return;
|
|
377
407
|
t.isStorageTexture !== !0 && n.push(r);
|
|
378
408
|
}
|
|
379
|
-
t.phase = "done", n.length !== 0 &&
|
|
409
|
+
t.phase = "done", n.length !== 0 && Xt.push({
|
|
380
410
|
stage: e.name,
|
|
381
411
|
nodes: n,
|
|
382
412
|
unboundAtCompile: t.unboundAtCompile.slice(),
|
|
@@ -385,18 +415,18 @@ function Jt(e, t) {
|
|
|
385
415
|
}
|
|
386
416
|
//#endregion
|
|
387
417
|
//#region src/Pipeline/RenderPipeline.js
|
|
388
|
-
var
|
|
418
|
+
var on = class {
|
|
389
419
|
_reportStageFailure(e, t, n) {
|
|
390
420
|
console.error(`[Pipeline] Error in stage '${e}' (${t}):`, n);
|
|
391
421
|
let r = `${e}:${t}`;
|
|
392
|
-
this._reportedStageFailures.has(r) || (this._reportedStageFailures.add(r), this._issues?.record(
|
|
422
|
+
this._reportedStageFailures.has(r) || (this._reportedStageFailures.add(r), this._issues?.record(w.STAGE_RENDER_FAILED, `stage "${e}" threw during ${t} — the frame is incomplete`, {
|
|
393
423
|
stage: e,
|
|
394
424
|
phase: t,
|
|
395
425
|
cause: String(n?.message ?? n)
|
|
396
426
|
}));
|
|
397
427
|
}
|
|
398
428
|
constructor(e, t, n, { issues: r = null } = {}) {
|
|
399
|
-
this.renderer = e, this._issues = r, this._reportedStageFailures = /* @__PURE__ */ new Set(), this.width = t, this.height = n, this.stages = [], this.context = new
|
|
429
|
+
this.renderer = e, this._issues = r, this._reportedStageFailures = /* @__PURE__ */ new Set(), this.width = t, this.height = n, this.stages = [], this.context = new qt(), this.eventBus = new Jt(), this.context.setState("width", t), this.context.setState("height", n), this.stats = {
|
|
400
430
|
enabled: !1,
|
|
401
431
|
logSkipped: !1,
|
|
402
432
|
timings: /* @__PURE__ */ new Map(),
|
|
@@ -430,7 +460,7 @@ var Yt = class {
|
|
|
430
460
|
}
|
|
431
461
|
try {
|
|
432
462
|
let n = this.stats.enabled ? performance.now() : 0;
|
|
433
|
-
if (
|
|
463
|
+
if (rn(t, this.renderer, () => t.render(this.context, e)), this.stats.enabled) {
|
|
434
464
|
let e = performance.now() - n;
|
|
435
465
|
this.stats.timings.has(t.name) || this.stats.timings.set(t.name, []);
|
|
436
466
|
let r = this.stats.timings.get(t.name);
|
|
@@ -528,7 +558,7 @@ var Yt = class {
|
|
|
528
558
|
let e = this.getInfo();
|
|
529
559
|
console.group("[Pipeline] Info"), console.log("Stages:", e.stages), console.log("Context Textures:", e.textures), console.log("Context Render Targets:", e.renderTargets), console.log("Context Uniforms:", e.uniforms), console.log("Event Types:", e.events), console.log("State:", e.contextState), console.groupEnd();
|
|
530
560
|
}
|
|
531
|
-
},
|
|
561
|
+
}, sn = ve("engine"), cn = class {
|
|
532
562
|
constructor() {
|
|
533
563
|
this.timeElapsed = 0, this.lastResetTime = performance.now(), this.renderCompleteDispatched = !1, this.budgetOverrun = !1, this._budgetHeldWarned = !1;
|
|
534
564
|
}
|
|
@@ -536,7 +566,7 @@ var Yt = class {
|
|
|
536
566
|
this.timeElapsed = (performance.now() - this.lastResetTime) / 1e3;
|
|
537
567
|
}
|
|
538
568
|
isTimeLimitReached(e, t, n) {
|
|
539
|
-
return this.budgetOverrun = !1, t !== "time" && t !== "timeOnly" || !(n > 0) || this.timeElapsed < n ? !1 : e?.frameCount > 0 ? (this.budgetOverrun = !0, !0) : (this._budgetHeldWarned || (this._budgetHeldWarned = !0,
|
|
569
|
+
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, sn.warn(`render time limit (${n}s) expired before the first sample landed — holding the deadline open to avoid capturing an empty frame`)), !1);
|
|
540
570
|
}
|
|
541
571
|
isLimitReached(e, t, n) {
|
|
542
572
|
return e ? this.isTimeLimitReached(e, t, n) ? !0 : this.stopCondition(e) !== null : !1;
|
|
@@ -553,15 +583,15 @@ var Yt = class {
|
|
|
553
583
|
resumeFromPause() {
|
|
554
584
|
this.renderCompleteDispatched = !1, this.lastResetTime = performance.now() - this.timeElapsed * 1e3;
|
|
555
585
|
}
|
|
556
|
-
},
|
|
586
|
+
}, ln = 864e5, G = Object.freeze({
|
|
557
587
|
IMMUTABLE: "immutable",
|
|
558
588
|
REVALIDATE: "revalidate",
|
|
559
589
|
NETWORK: "network"
|
|
560
|
-
}),
|
|
590
|
+
}), un = (e, t) => ({
|
|
561
591
|
loaded: e,
|
|
562
592
|
total: t,
|
|
563
593
|
lengthComputable: t > 0 && e <= t
|
|
564
|
-
}), K = (e, t) => e.headers?.get?.(t) ?? null,
|
|
594
|
+
}), K = (e, t) => e.headers?.get?.(t) ?? null, dn = (e) => e.reason ?? new DOMException("aborted", "AbortError");
|
|
565
595
|
function q(e) {
|
|
566
596
|
try {
|
|
567
597
|
let t = new URL(e, globalThis.location?.href ?? "http://localhost/").pathname;
|
|
@@ -570,36 +600,36 @@ function q(e) {
|
|
|
570
600
|
return "download";
|
|
571
601
|
}
|
|
572
602
|
}
|
|
573
|
-
async function
|
|
603
|
+
async function fn(e, { onProgress: t, signal: n }) {
|
|
574
604
|
let r = Number(K(e, "content-length")) || 0, i = K(e, "content-type") ?? "";
|
|
575
605
|
if (!e.body) return new Blob([await e.arrayBuffer()], { type: i });
|
|
576
606
|
let a = e.body.getReader(), o = [], s = 0;
|
|
577
607
|
for (;;) {
|
|
578
|
-
if (n?.aborted) throw a.cancel().catch(() => {}),
|
|
608
|
+
if (n?.aborted) throw a.cancel().catch(() => {}), dn(n);
|
|
579
609
|
let { done: e, value: i } = await a.read();
|
|
580
610
|
if (e) break;
|
|
581
|
-
o.push(i), s += i.length, t?.(
|
|
611
|
+
o.push(i), s += i.length, t?.(un(s, r));
|
|
582
612
|
}
|
|
583
613
|
return new Blob(o, { type: i });
|
|
584
614
|
}
|
|
585
|
-
var
|
|
615
|
+
var pn = (e, t, n) => new File([e], t, {
|
|
586
616
|
type: n || e.type,
|
|
587
617
|
lastModified: e.lastModified ?? Date.now()
|
|
588
|
-
}),
|
|
618
|
+
}), mn = () => {}, J = class {
|
|
589
619
|
constructor(e) {
|
|
590
620
|
this._storage = e, this._revalidating = /* @__PURE__ */ new Set();
|
|
591
621
|
}
|
|
592
622
|
get _area() {
|
|
593
|
-
return this._storage?.area(
|
|
623
|
+
return this._storage?.area(Te.DOWNLOADS) ?? null;
|
|
594
624
|
}
|
|
595
|
-
async fetch(e, { key: t = e, name: n = q(e), policy: r = G.REVALIDATE, maxAgeMs: i =
|
|
625
|
+
async fetch(e, { key: t = e, name: n = q(e), policy: r = G.REVALIDATE, maxAgeMs: i = ln, onProgress: a = null, signal: o = null, fetchOptions: s = {} } = {}) {
|
|
596
626
|
let c = this._area;
|
|
597
627
|
if (c && r !== G.NETWORK) {
|
|
598
628
|
let o = await c.open(t);
|
|
599
629
|
if (o) {
|
|
600
630
|
let c = await o.file("data");
|
|
601
|
-
if (c) return r === G.REVALIDATE && Date.now() - (o.extra.checkedAt ?? 0) >= i && this._revalidate(e, t, n, o.extra, s), a?.(
|
|
602
|
-
file:
|
|
631
|
+
if (c) return r === G.REVALIDATE && Date.now() - (o.extra.checkedAt ?? 0) >= i && this._revalidate(e, t, n, o.extra, s), a?.(un(c.size, c.size)), {
|
|
632
|
+
file: pn(c, n, o.extra.contentType),
|
|
603
633
|
release: () => o.release(),
|
|
604
634
|
fromCache: !0
|
|
605
635
|
};
|
|
@@ -617,7 +647,7 @@ var nn = (e, t, n) => new File([e], t, {
|
|
|
617
647
|
return await this._area?.has(e) === !0;
|
|
618
648
|
}
|
|
619
649
|
async _download(e, t, n, { onProgress: r, signal: i, fetchOptions: a, cache: o }) {
|
|
620
|
-
if (i?.aborted) throw
|
|
650
|
+
if (i?.aborted) throw dn(i);
|
|
621
651
|
let s = await fetch(e, {
|
|
622
652
|
...a,
|
|
623
653
|
signal: i
|
|
@@ -634,17 +664,17 @@ var nn = (e, t, n) => new File([e], t, {
|
|
|
634
664
|
expectedBytes: c
|
|
635
665
|
}) : null;
|
|
636
666
|
if (!u) return {
|
|
637
|
-
file:
|
|
667
|
+
file: pn(await fn(s, {
|
|
638
668
|
onProgress: r,
|
|
639
669
|
signal: i
|
|
640
670
|
}), n, l.contentType),
|
|
641
|
-
release:
|
|
671
|
+
release: mn,
|
|
642
672
|
fromCache: !1
|
|
643
673
|
};
|
|
644
674
|
try {
|
|
645
675
|
await u.writeStream("data", s.body, {
|
|
646
676
|
signal: i,
|
|
647
|
-
onProgress: (e) => r?.(
|
|
677
|
+
onProgress: (e) => r?.(un(e, c))
|
|
648
678
|
}), await u.commit(l);
|
|
649
679
|
} catch (o) {
|
|
650
680
|
if (await u.abort(), o?.name !== "QuotaExceededError") throw o;
|
|
@@ -658,7 +688,7 @@ var nn = (e, t, n) => new File([e], t, {
|
|
|
658
688
|
let d = await this._area.open(t, { wait: !0 }), f = d && await d.file("data");
|
|
659
689
|
if (!f) throw d?.release(), Error(`storage: ${n} vanished right after it was saved`);
|
|
660
690
|
return {
|
|
661
|
-
file:
|
|
691
|
+
file: pn(f, n, l.contentType),
|
|
662
692
|
release: () => d.release(),
|
|
663
693
|
fromCache: !1
|
|
664
694
|
};
|
|
@@ -695,16 +725,16 @@ var nn = (e, t, n) => new File([e], t, {
|
|
|
695
725
|
}
|
|
696
726
|
}
|
|
697
727
|
};
|
|
698
|
-
function
|
|
728
|
+
function hn(e, t, n) {
|
|
699
729
|
return new J(t).fetch(e, n);
|
|
700
730
|
}
|
|
701
|
-
function
|
|
702
|
-
return new J(
|
|
731
|
+
function gn() {
|
|
732
|
+
return new J(we(E().cacheNamespace));
|
|
703
733
|
}
|
|
704
|
-
async function
|
|
734
|
+
async function _n(e, { downloads: t = gn(), ...n } = {}) {
|
|
705
735
|
if (!t._storage || !/^https?:/i.test(e)) return {
|
|
706
736
|
url: e,
|
|
707
|
-
release:
|
|
737
|
+
release: mn,
|
|
708
738
|
cached: !1
|
|
709
739
|
};
|
|
710
740
|
let { file: r, release: i } = await t.fetch(e, n), a = URL.createObjectURL(r);
|
|
@@ -718,7 +748,7 @@ async function sn(e, { downloads: t = on(), ...n } = {}) {
|
|
|
718
748
|
}
|
|
719
749
|
//#endregion
|
|
720
750
|
//#region src/RenderSettings.js
|
|
721
|
-
var
|
|
751
|
+
var vn = {
|
|
722
752
|
maxBounces: {
|
|
723
753
|
uniform: "maxBounces",
|
|
724
754
|
reset: !0
|
|
@@ -944,9 +974,9 @@ var cn = {
|
|
|
944
974
|
HOST: "host",
|
|
945
975
|
SCENE_METADATA: "scene-metadata",
|
|
946
976
|
MODE_PRESET: "mode-preset"
|
|
947
|
-
}),
|
|
948
|
-
constructor(e =
|
|
949
|
-
super(), this._issues = t, this._defaults = e, this._routes = new Map(Object.entries(
|
|
977
|
+
}), yn = class extends z {
|
|
978
|
+
constructor(e = C, { issues: t = null } = {}) {
|
|
979
|
+
super(), this._issues = t, this._defaults = e, this._routes = new Map(Object.entries(vn)), this._values = /* @__PURE__ */ new Map(), this._sources = /* @__PURE__ */ new Map(), this._pathTracer = null, this._resetCallback = null, this._handlers = {}, this._initDefaults(e);
|
|
950
980
|
}
|
|
951
981
|
bind(e) {
|
|
952
982
|
this._pathTracer = e.stages.pathTracer, this._resetCallback = e.resetCallback, this._handlers = this._buildHandlers(e);
|
|
@@ -961,12 +991,12 @@ var cn = {
|
|
|
961
991
|
!this._values.has(e) && i !== void 0 && (this._values.set(e, i), this._sources.set(e, Y.DEFAULT));
|
|
962
992
|
}
|
|
963
993
|
_buildHandlers({ stages: e, resetCallback: t, reconcileCompletion: n, applyExposure: r, onCameraProjection: i }) {
|
|
964
|
-
let a = new
|
|
965
|
-
a.set(n?.[0] ?? 0, n?.[1] ?? 0).multiplyScalar(
|
|
994
|
+
let a = new Lt(), o = (t, n) => {
|
|
995
|
+
a.set(n?.[0] ?? 0, n?.[1] ?? 0).multiplyScalar(B.DEG2RAD), e.pathTracer?.setUniform(t, a);
|
|
966
996
|
};
|
|
967
997
|
return {
|
|
968
998
|
handleCameraProjection: (t) => {
|
|
969
|
-
e.pathTracer?.setUniform("cameraProjection",
|
|
999
|
+
e.pathTracer?.setUniform("cameraProjection", ye[t] ?? ye.perspective), i?.(t);
|
|
970
1000
|
},
|
|
971
1001
|
handleDofMode: (t) => e.pathTracer?.setUniform("dofMode", +(t === "look")),
|
|
972
1002
|
handlePanoramaLonRange: (e) => o("panoLonRange", e),
|
|
@@ -975,7 +1005,7 @@ var cn = {
|
|
|
975
1005
|
e.pathTracer?.setUniform("transparentBackground", t), e.compositor?.setTransparentBackground(t);
|
|
976
1006
|
},
|
|
977
1007
|
handleBackgroundColor: (t) => {
|
|
978
|
-
let n = t?.isColor ? t : new
|
|
1008
|
+
let n = t?.isColor ? t : new lt(t);
|
|
979
1009
|
e.pathTracer?.setUniform("backgroundColor", n);
|
|
980
1010
|
},
|
|
981
1011
|
handleExposure: (e) => {
|
|
@@ -1019,7 +1049,7 @@ var cn = {
|
|
|
1019
1049
|
set(e, t, { reset: n, silent: r, source: i = Y.HOST } = {}) {
|
|
1020
1050
|
let a = this._applyOne(e, t, i);
|
|
1021
1051
|
a?.route && ((n === void 0 ? a.route.reset ?? !0 : n) && this._resetCallback?.(), r || this.dispatchEvent({
|
|
1022
|
-
type:
|
|
1052
|
+
type: b.SETTING_CHANGED,
|
|
1023
1053
|
key: e,
|
|
1024
1054
|
value: t,
|
|
1025
1055
|
prev: a.prev
|
|
@@ -1030,7 +1060,7 @@ var cn = {
|
|
|
1030
1060
|
for (let [n, a] of Object.entries(e)) {
|
|
1031
1061
|
let e = this._applyOne(n, a, r);
|
|
1032
1062
|
e?.route && ((e.route.reset ?? !0) && (i = !0), t || this.dispatchEvent({
|
|
1033
|
-
type:
|
|
1063
|
+
type: b.SETTING_CHANGED,
|
|
1034
1064
|
key: n,
|
|
1035
1065
|
value: a,
|
|
1036
1066
|
prev: e.prev
|
|
@@ -1052,7 +1082,7 @@ var cn = {
|
|
|
1052
1082
|
});
|
|
1053
1083
|
}
|
|
1054
1084
|
_reportUnknownKey(e) {
|
|
1055
|
-
this._issues?.record(
|
|
1085
|
+
this._issues?.record(w.SETTING_UNKNOWN_KEY, `unknown setting "${e}" — stored but never applied to any stage`, { key: e });
|
|
1056
1086
|
}
|
|
1057
1087
|
get(e) {
|
|
1058
1088
|
return this._values.get(e);
|
|
@@ -1073,14 +1103,14 @@ var cn = {
|
|
|
1073
1103
|
let e = {};
|
|
1074
1104
|
for (let [t, n] of this._values) {
|
|
1075
1105
|
if (this._sources.get(t) !== Y.HOST || !this._routes.has(t)) continue;
|
|
1076
|
-
let r =
|
|
1106
|
+
let r = g(n);
|
|
1077
1107
|
r !== void 0 && (e[t] = r);
|
|
1078
1108
|
}
|
|
1079
1109
|
return e;
|
|
1080
1110
|
}
|
|
1081
1111
|
restore(e) {
|
|
1082
1112
|
let t = {}, n = [];
|
|
1083
|
-
for (let [r, i] of Object.entries(e ?? {})) this._routes.has(r) ? t[r] =
|
|
1113
|
+
for (let [r, i] of Object.entries(e ?? {})) this._routes.has(r) ? t[r] = f(i) : n.push(r);
|
|
1084
1114
|
return this.setMany(t), n;
|
|
1085
1115
|
}
|
|
1086
1116
|
applyAll() {
|
|
@@ -1093,19 +1123,19 @@ var cn = {
|
|
|
1093
1123
|
e.uniform ? this._pathTracer?.setUniform(e.uniform, t) : e.handler ? this._handlers[e.handler]?.(t, n) : e.apply?.(t, n);
|
|
1094
1124
|
}
|
|
1095
1125
|
_initDefaults(e) {
|
|
1096
|
-
for (let t of Object.keys(
|
|
1126
|
+
for (let t of Object.keys(vn)) t in e && (this._values.set(t, e[t]), this._sources.set(t, Y.DEFAULT));
|
|
1097
1127
|
}
|
|
1098
|
-
},
|
|
1128
|
+
}, bn = class {
|
|
1099
1129
|
constructor({ issues: e = null } = {}) {
|
|
1100
|
-
this._issues = e, this._renderer = null, this._offRegistry =
|
|
1101
|
-
this._renderer &&
|
|
1130
|
+
this._issues = e, this._renderer = null, this._offRegistry = Ne(() => {
|
|
1131
|
+
this._renderer && Me(this._renderer);
|
|
1102
1132
|
});
|
|
1103
1133
|
}
|
|
1104
1134
|
get hasConfig() {
|
|
1105
1135
|
return !1;
|
|
1106
1136
|
}
|
|
1107
1137
|
get workingSpace() {
|
|
1108
|
-
return
|
|
1138
|
+
return T;
|
|
1109
1139
|
}
|
|
1110
1140
|
get workingSpaceAdopted() {
|
|
1111
1141
|
return !1;
|
|
@@ -1115,32 +1145,32 @@ var cn = {
|
|
|
1115
1145
|
}
|
|
1116
1146
|
attachRenderer(e) {
|
|
1117
1147
|
this._renderer = e;
|
|
1118
|
-
let t =
|
|
1148
|
+
let t = Me(e);
|
|
1119
1149
|
return e.outputColorSpace = U, t;
|
|
1120
1150
|
}
|
|
1121
1151
|
listViews() {
|
|
1122
|
-
return
|
|
1152
|
+
return Ae();
|
|
1123
1153
|
}
|
|
1124
1154
|
get activeView() {
|
|
1125
1155
|
return null;
|
|
1126
1156
|
}
|
|
1127
1157
|
setActiveView(e) {
|
|
1128
|
-
let t =
|
|
1158
|
+
let t = D(e);
|
|
1129
1159
|
if (!t) throw Error(`no view transform with id ${e}`);
|
|
1130
1160
|
if (t.outputEncoded) throw Error(`"${t.name}" returns display-encoded colour: it needs rayzee/addons/color`);
|
|
1131
1161
|
return this._renderer && (this._renderer.toneMapping = e), t;
|
|
1132
1162
|
}
|
|
1133
1163
|
_publishWorkingMatrix() {
|
|
1134
|
-
|
|
1164
|
+
Ee(null, T);
|
|
1135
1165
|
}
|
|
1136
1166
|
loadConfig() {
|
|
1137
1167
|
let e = "colour configs need the OCIO pipeline: renderer.setColorManagement( ColorManagement ), from rayzee/addons/color";
|
|
1138
|
-
return this._issues?.record(
|
|
1168
|
+
return this._issues?.record(w.CAPABILITY_MISSING, e, { capability: "color" }), Promise.reject(Error(e));
|
|
1139
1169
|
}
|
|
1140
1170
|
unloadConfig() {}
|
|
1141
1171
|
setWorkingSpace() {}
|
|
1142
1172
|
setHdrOutput(e) {
|
|
1143
|
-
e && this._issues?.warn(
|
|
1173
|
+
e && this._issues?.warn(w.CAPABILITY_MISSING, "HDR on screen needs rayzee/addons/color", { capability: "color" });
|
|
1144
1174
|
}
|
|
1145
1175
|
get hdrOutput() {
|
|
1146
1176
|
return !1;
|
|
@@ -1154,14 +1184,26 @@ var cn = {
|
|
|
1154
1184
|
exportPixels(e) {
|
|
1155
1185
|
return {
|
|
1156
1186
|
rgba: e,
|
|
1157
|
-
colorSpace:
|
|
1187
|
+
colorSpace: T
|
|
1158
1188
|
};
|
|
1159
1189
|
}
|
|
1190
|
+
chromaticities() {
|
|
1191
|
+
return [
|
|
1192
|
+
.64,
|
|
1193
|
+
.33,
|
|
1194
|
+
.3,
|
|
1195
|
+
.6,
|
|
1196
|
+
.15,
|
|
1197
|
+
.06,
|
|
1198
|
+
.3127,
|
|
1199
|
+
.329
|
|
1200
|
+
];
|
|
1201
|
+
}
|
|
1160
1202
|
status() {
|
|
1161
|
-
let e = this._renderer ?
|
|
1203
|
+
let e = this._renderer ? D(this._renderer.toneMapping) : null;
|
|
1162
1204
|
return {
|
|
1163
1205
|
config: null,
|
|
1164
|
-
workingSpace:
|
|
1206
|
+
workingSpace: T,
|
|
1165
1207
|
workingSpaceAdopted: !1,
|
|
1166
1208
|
activeTransform: e ? {
|
|
1167
1209
|
id: e.id,
|
|
@@ -1171,8 +1213,8 @@ var cn = {
|
|
|
1171
1213
|
activeView: null,
|
|
1172
1214
|
context: null,
|
|
1173
1215
|
exportSpace: null,
|
|
1174
|
-
views:
|
|
1175
|
-
registryVersion:
|
|
1216
|
+
views: Ae(),
|
|
1217
|
+
registryVersion: je(),
|
|
1176
1218
|
bakeError: e?.error ?? null,
|
|
1177
1219
|
canvasColorSpace: "srgb",
|
|
1178
1220
|
hdr: {
|
|
@@ -1184,10 +1226,10 @@ var cn = {
|
|
|
1184
1226
|
};
|
|
1185
1227
|
}
|
|
1186
1228
|
dispose() {
|
|
1187
|
-
this._offRegistry?.(), this._renderer = null, this._issues = null,
|
|
1229
|
+
this._offRegistry?.(), this._renderer = null, this._issues = null, Oe() === this && (Ee(null), De(null));
|
|
1188
1230
|
}
|
|
1189
|
-
},
|
|
1190
|
-
function
|
|
1231
|
+
}, xn = "KHR_materials_diffuse_transmission";
|
|
1232
|
+
function Sn(e) {
|
|
1191
1233
|
let t = (t, n, r, i) => {
|
|
1192
1234
|
let a = {};
|
|
1193
1235
|
return e.assignTexture(a, n, r, i).then(() => {
|
|
@@ -1195,7 +1237,7 @@ function fn(e) {
|
|
|
1195
1237
|
});
|
|
1196
1238
|
};
|
|
1197
1239
|
return {
|
|
1198
|
-
name:
|
|
1240
|
+
name: xn,
|
|
1199
1241
|
afterRoot(n) {
|
|
1200
1242
|
let r = e.json.materials ?? [], i = /* @__PURE__ */ new Set(), a = [];
|
|
1201
1243
|
for (let o of n.scenes ?? []) o.traverse((n) => {
|
|
@@ -1203,7 +1245,7 @@ function fn(e) {
|
|
|
1203
1245
|
for (let n of o) {
|
|
1204
1246
|
if (i.has(n)) continue;
|
|
1205
1247
|
i.add(n);
|
|
1206
|
-
let o = e.associations.get(n)?.materials, s = o === void 0 ? null : r[o]?.extensions?.[
|
|
1248
|
+
let o = e.associations.get(n)?.materials, s = o === void 0 ? null : r[o]?.extensions?.[xn];
|
|
1207
1249
|
if (!s) continue;
|
|
1208
1250
|
n.diffuseTransmission = s.diffuseTransmissionFactor ?? 0;
|
|
1209
1251
|
let [c, l, u] = s.diffuseTransmissionColorFactor ?? [
|
|
@@ -1211,7 +1253,7 @@ function fn(e) {
|
|
|
1211
1253
|
1,
|
|
1212
1254
|
1
|
|
1213
1255
|
];
|
|
1214
|
-
n.diffuseTransmissionColor = new
|
|
1256
|
+
n.diffuseTransmissionColor = new lt().setRGB(c, l, u, vt), s.diffuseTransmissionTexture && a.push(t(n, "diffuseTransmissionMap", s.diffuseTransmissionTexture)), s.diffuseTransmissionColorTexture && a.push(t(n, "diffuseTransmissionColorMap", s.diffuseTransmissionColorTexture, U));
|
|
1215
1257
|
}
|
|
1216
1258
|
});
|
|
1217
1259
|
return Promise.all(a);
|
|
@@ -1220,20 +1262,20 @@ function fn(e) {
|
|
|
1220
1262
|
}
|
|
1221
1263
|
//#endregion
|
|
1222
1264
|
//#region src/Processor/GLTFDecoders.js
|
|
1223
|
-
var
|
|
1224
|
-
function
|
|
1265
|
+
var Cn = "KHR_draco_mesh_compression", wn = "KHR_texture_basisu", Tn = ["EXT_meshopt_compression", "KHR_meshopt_compression"], En = new TextDecoder();
|
|
1266
|
+
function Dn(e) {
|
|
1225
1267
|
if (typeof e == "string") return e;
|
|
1226
1268
|
if (!(e instanceof ArrayBuffer)) return JSON.stringify(e?.extensionsUsed ?? []);
|
|
1227
1269
|
let t = new DataView(e);
|
|
1228
|
-
if (!(e.byteLength >= 20 && t.getUint32(0, !0) === 1179937895)) return
|
|
1270
|
+
if (!(e.byteLength >= 20 && t.getUint32(0, !0) === 1179937895)) return En.decode(e);
|
|
1229
1271
|
let n = Math.min(t.getUint32(12, !0), e.byteLength - 20);
|
|
1230
|
-
return
|
|
1272
|
+
return En.decode(new Uint8Array(e, 20, n));
|
|
1231
1273
|
}
|
|
1232
|
-
async function
|
|
1233
|
-
let { dracoDecoderPath: r, ktx2TranscoderPath: i } =
|
|
1234
|
-
t.includes(
|
|
1235
|
-
t.includes(
|
|
1236
|
-
|
|
1274
|
+
async function On(e, t, n) {
|
|
1275
|
+
let { dracoDecoderPath: r, ktx2TranscoderPath: i } = E(), [a, o, s] = await Promise.all([
|
|
1276
|
+
t.includes(Cn) && !e.dracoLoader ? import("three/addons/loaders/DRACOLoader.js") : null,
|
|
1277
|
+
t.includes(wn) && !e.ktx2Loader ? import("three/addons/loaders/KTX2Loader.js") : null,
|
|
1278
|
+
Tn.some((e) => t.includes(e)) && !e.meshoptDecoder ? import("three/addons/libs/meshopt_decoder.module.js") : null
|
|
1237
1279
|
]);
|
|
1238
1280
|
if (a) {
|
|
1239
1281
|
let t = new a.DRACOLoader();
|
|
@@ -1252,15 +1294,15 @@ async function vn(e, t, n) {
|
|
|
1252
1294
|
}
|
|
1253
1295
|
s && e.setMeshoptDecoder(s.MeshoptDecoder);
|
|
1254
1296
|
}
|
|
1255
|
-
function
|
|
1297
|
+
function kn(e, t) {
|
|
1256
1298
|
let n = e.parse.bind(e);
|
|
1257
1299
|
return e.parse = (r, i, a, o) => {
|
|
1258
|
-
|
|
1300
|
+
On(e, Dn(r), t).then(() => n(r, i, a, o), (e) => o?.(e));
|
|
1259
1301
|
}, e;
|
|
1260
1302
|
}
|
|
1261
1303
|
//#endregion
|
|
1262
1304
|
//#region src/Processor/AssetLoader.js
|
|
1263
|
-
var
|
|
1305
|
+
var An = ve("assets"), jn = {
|
|
1264
1306
|
glb: {
|
|
1265
1307
|
type: "model",
|
|
1266
1308
|
name: "GLB (GLTF Binary)"
|
|
@@ -1295,7 +1337,7 @@ var bn = S("assets"), xn = {
|
|
|
1295
1337
|
}, Z = {
|
|
1296
1338
|
addOn: "rayzee/addons/formats",
|
|
1297
1339
|
install: "assetLoader.registerFormat()"
|
|
1298
|
-
},
|
|
1340
|
+
}, Mn = {
|
|
1299
1341
|
zip: X,
|
|
1300
1342
|
gz: X,
|
|
1301
1343
|
tgz: X,
|
|
@@ -1312,30 +1354,30 @@ var bn = S("assets"), xn = {
|
|
|
1312
1354
|
usdz: Z,
|
|
1313
1355
|
exr: Z
|
|
1314
1356
|
};
|
|
1315
|
-
function
|
|
1316
|
-
let t = new
|
|
1357
|
+
function Nn(e) {
|
|
1358
|
+
let t = new st();
|
|
1317
1359
|
for (let n in e.attributes) t.setAttribute(n, e.attributes[n]);
|
|
1318
1360
|
e.index && t.setIndex(e.index);
|
|
1319
1361
|
for (let n of e.groups) t.addGroup(n.start, n.count, n.materialIndex);
|
|
1320
1362
|
return t;
|
|
1321
1363
|
}
|
|
1322
|
-
var
|
|
1364
|
+
var Pn = {
|
|
1323
1365
|
name: "RAYZEE_camera_clip",
|
|
1324
1366
|
afterRoot(e) {
|
|
1325
1367
|
for (let t of e.scenes) t.traverse((e) => {
|
|
1326
1368
|
e.isCamera && e.near > 0 && (e.userData.clipStart = e.near);
|
|
1327
1369
|
});
|
|
1328
1370
|
}
|
|
1329
|
-
},
|
|
1330
|
-
function
|
|
1371
|
+
}, Fn = 683;
|
|
1372
|
+
function In(e, t, n, r) {
|
|
1331
1373
|
if (!(r.normalize ?? !0)) return Math.PI;
|
|
1332
1374
|
let i = r.shape === "ellipse" || r.shape === "disk" ? Math.PI / 4 : 1, a = e.getWorldScale(new W()), o = Math.PI * i * Math.abs(t * a.x * n * a.y);
|
|
1333
1375
|
return Number.isFinite(o) ? o : Math.PI;
|
|
1334
1376
|
}
|
|
1335
|
-
var
|
|
1377
|
+
var Ln = class e extends z {
|
|
1336
1378
|
constructor(e, t, n, { issues: r = null, areaLightIntensityScale: i = null } = {}) {
|
|
1337
|
-
super(), this.scene = e, this.camera = t, this.controls = n, this.targetModel = null, this.floorPlane = null, this.sceneScale = 1, this.sceneSize = new W(1, 1, 1), this.loaderCache = {}, this.uploadedFileInfo = null, this.animations = [], this.renderer = null, this.sceneMetadata = null, this._loadingManager = new
|
|
1338
|
-
this._loadCancelled || this._issues?.record(
|
|
1379
|
+
super(), this.scene = e, this.camera = t, this.controls = n, this.targetModel = null, this.floorPlane = null, this.sceneScale = 1, this.sceneSize = new W(1, 1, 1), this.loaderCache = {}, this.uploadedFileInfo = null, this.animations = [], this.renderer = null, this.sceneMetadata = null, this._loadingManager = new bt(), 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 ?? (() => C.areaLightIntensityScale), this._loadingManager.onError = (e) => {
|
|
1380
|
+
this._loadCancelled || this._issues?.record(w.ASSET_UNREACHABLE, `asset "${e}" could not be fetched — anything depending on it renders without it`, { url: e });
|
|
1339
1381
|
};
|
|
1340
1382
|
}
|
|
1341
1383
|
cancelActiveLoad() {
|
|
@@ -1350,7 +1392,7 @@ var Dn = class e extends V {
|
|
|
1350
1392
|
let o = new AbortController();
|
|
1351
1393
|
this._urlAbort = o;
|
|
1352
1394
|
try {
|
|
1353
|
-
return await
|
|
1395
|
+
return await _n(t, {
|
|
1354
1396
|
downloads: this.downloads,
|
|
1355
1397
|
key: i,
|
|
1356
1398
|
policy: a,
|
|
@@ -1383,7 +1425,7 @@ var Dn = class e extends V {
|
|
|
1383
1425
|
_downloadProgress(e, t) {
|
|
1384
1426
|
return (n) => {
|
|
1385
1427
|
let r = n?.loaded || 0, i = n?.lengthComputable && n.total || 0;
|
|
1386
|
-
|
|
1428
|
+
x({
|
|
1387
1429
|
isLoading: !0,
|
|
1388
1430
|
status: e,
|
|
1389
1431
|
loadedBytes: r,
|
|
@@ -1394,7 +1436,7 @@ var Dn = class e extends V {
|
|
|
1394
1436
|
};
|
|
1395
1437
|
}
|
|
1396
1438
|
_downloadComplete(e = "Processing Data...", t = 62) {
|
|
1397
|
-
|
|
1439
|
+
x({
|
|
1398
1440
|
status: e,
|
|
1399
1441
|
progress: t,
|
|
1400
1442
|
canCancel: !1,
|
|
@@ -1408,7 +1450,7 @@ var Dn = class e extends V {
|
|
|
1408
1450
|
_adoptExternalObject(e) {
|
|
1409
1451
|
let t;
|
|
1410
1452
|
try {
|
|
1411
|
-
t =
|
|
1453
|
+
t = Ut(e);
|
|
1412
1454
|
} catch (t) {
|
|
1413
1455
|
throw Error(`Cannot render "${e.name || e.type}": its userData must be JSON-serializable.`, { cause: t });
|
|
1414
1456
|
}
|
|
@@ -1442,10 +1484,10 @@ var Dn = class e extends V {
|
|
|
1442
1484
|
}
|
|
1443
1485
|
getFileFormat(e) {
|
|
1444
1486
|
let t = e.split(".").pop().toLowerCase();
|
|
1445
|
-
return
|
|
1487
|
+
return jn[t] || this._formats.get(t) || this._archiveFormats?.[t] || null;
|
|
1446
1488
|
}
|
|
1447
1489
|
formatError(e) {
|
|
1448
|
-
let t =
|
|
1490
|
+
let t = Mn[e.split(".").pop().toLowerCase()];
|
|
1449
1491
|
return /* @__PURE__ */ Error(t ? `${e}: this format is read by ${t.addOn} — install it with ${t.install}` : `Unsupported file format: ${e}`);
|
|
1450
1492
|
}
|
|
1451
1493
|
async inspectArchive(e) {
|
|
@@ -1468,7 +1510,7 @@ var Dn = class e extends V {
|
|
|
1468
1510
|
async loadAssetFromFile(e, t = {}) {
|
|
1469
1511
|
let n = e.name, r = this.getFileFormat(n);
|
|
1470
1512
|
if (!r) throw this.formatError(n);
|
|
1471
|
-
|
|
1513
|
+
x({
|
|
1472
1514
|
isLoading: !0,
|
|
1473
1515
|
status: `Loading ${r.name}...`,
|
|
1474
1516
|
progress: 2
|
|
@@ -1500,7 +1542,7 @@ var Dn = class e extends V {
|
|
|
1500
1542
|
async loadFolder(e, t = {}) {
|
|
1501
1543
|
let n = await this._archiveImporter();
|
|
1502
1544
|
if (!n) throw Error(`${e.name}: folders are read by ${X.addOn} — install it with ${X.install}`);
|
|
1503
|
-
|
|
1545
|
+
x({
|
|
1504
1546
|
isLoading: !0,
|
|
1505
1547
|
status: `Loading ${e.name}...`,
|
|
1506
1548
|
progress: 2
|
|
@@ -1520,7 +1562,7 @@ var Dn = class e extends V {
|
|
|
1520
1562
|
if (!this.getFileFormat(r)) throw this.formatError(r);
|
|
1521
1563
|
this._loadCancelled = !1;
|
|
1522
1564
|
let s = e._isNetworkUrl(t), c = `Downloading ${r}...`, l = new AbortController();
|
|
1523
|
-
this._urlAbort = l,
|
|
1565
|
+
this._urlAbort = l, x({
|
|
1524
1566
|
isLoading: !0,
|
|
1525
1567
|
status: c,
|
|
1526
1568
|
progress: 2,
|
|
@@ -1552,7 +1594,7 @@ var Dn = class e extends V {
|
|
|
1552
1594
|
}
|
|
1553
1595
|
}
|
|
1554
1596
|
async loadModelFromFile(e, t) {
|
|
1555
|
-
let n = this.storage ? this._keyed("file",
|
|
1597
|
+
let n = this.storage ? this._keyed("file", O(await Fe(e))) : null, r = /\.(usd|usda|usdc)$/i.test(t) ? await this._archiveImporter() : null, i = r ? await r.loadUSDScene({ [t]: e }, t) : await this._loadModelFileByExtension(e, t);
|
|
1556
1598
|
return this._sourceKey = n, i;
|
|
1557
1599
|
}
|
|
1558
1600
|
async _loadModelFileByExtension(e, t) {
|
|
@@ -1564,7 +1606,7 @@ var Dn = class e extends V {
|
|
|
1564
1606
|
}
|
|
1565
1607
|
async _loadModelWithFormat(e, t, n) {
|
|
1566
1608
|
try {
|
|
1567
|
-
|
|
1609
|
+
x({
|
|
1568
1610
|
isLoading: !0,
|
|
1569
1611
|
status: `Processing ${e.label} Data...`,
|
|
1570
1612
|
progress: 5
|
|
@@ -1573,7 +1615,7 @@ var Dn = class e extends V {
|
|
|
1573
1615
|
filename: n,
|
|
1574
1616
|
cache: this.loaderCache
|
|
1575
1617
|
});
|
|
1576
|
-
return this.releaseTargetModel(), this.targetModel = r,
|
|
1618
|
+
return this.releaseTargetModel(), this.targetModel = r, x({
|
|
1577
1619
|
isLoading: !0,
|
|
1578
1620
|
status: "Processing Data...",
|
|
1579
1621
|
progress: 10
|
|
@@ -1599,7 +1641,7 @@ var Dn = class e extends V {
|
|
|
1599
1641
|
};
|
|
1600
1642
|
try {
|
|
1601
1643
|
let r = await this.loadEnvironment(n);
|
|
1602
|
-
return ge(r,
|
|
1644
|
+
return ge(r, O(await Fe(e))), this.dispatchEvent({
|
|
1603
1645
|
type: "load",
|
|
1604
1646
|
texture: r,
|
|
1605
1647
|
filename: t
|
|
@@ -1658,25 +1700,25 @@ var Dn = class e extends V {
|
|
|
1658
1700
|
}
|
|
1659
1701
|
async loadEnvironmentByExtension(t, n, { loader: r = null, quiet: i = !1 } = {}) {
|
|
1660
1702
|
let a = this._formats.get(n);
|
|
1661
|
-
if (!r && a?.type === "environment" && (r = this.loaderCache[n] ??= await a.createLoader(this._loadingManager)), !r && n === "hdr" && (r = this.loaderCache.hdr ??= new
|
|
1703
|
+
if (!r && a?.type === "environment" && (r = this.loaderCache[n] ??= await a.createLoader(this._loadingManager)), !r && n === "hdr" && (r = this.loaderCache.hdr ??= new Vt(this._loadingManager).setDataType(ht)), !r && Mn[n]) throw this.formatError(`environment.${n}`);
|
|
1662
1704
|
let o = e._isNetworkUrl(t), s = "Downloading Environment...", c = await this._viaCache(t, s, o), l = c.cached || i ? void 0 : this._downloadProgress(s, o), u;
|
|
1663
1705
|
try {
|
|
1664
|
-
r ? u = await r.loadAsync(c.url, l) : _e().decodeImage ? (u = await
|
|
1706
|
+
r ? u = await r.loadAsync(c.url, l) : _e().decodeImage ? (u = await Ve(c.url, `image/${n === "jpg" ? "jpeg" : n}`), u.colorSpace = U) : (this.loaderCache.texture || (this.loaderCache.texture = new It(this._loadingManager)), u = await this.loaderCache.texture.loadAsync(c.url, l), u.colorSpace = U);
|
|
1665
1707
|
} finally {
|
|
1666
1708
|
c.release();
|
|
1667
1709
|
}
|
|
1668
|
-
return i || this._downloadComplete("Processing Environment...", 62), this.maxEnvironmentWidth &&
|
|
1710
|
+
return i || this._downloadComplete("Processing Environment...", 62), this.maxEnvironmentWidth && Rn(u, this.maxEnvironmentWidth), u.mapping = mt, u.minFilter = _t, u.magFilter = _t, u;
|
|
1669
1711
|
}
|
|
1670
1712
|
applyEnvironmentToScene(e) {
|
|
1671
1713
|
this.scene.background = e, this.scene.environment = e;
|
|
1672
1714
|
}
|
|
1673
1715
|
async createGLTFLoader() {
|
|
1674
|
-
let e =
|
|
1675
|
-
return _e().decodeImage ? e.register((e) =>
|
|
1716
|
+
let e = kn(new Bt(this._loadingManager), this.renderer), t = (e, t) => this._reportImageFailure(e, t);
|
|
1717
|
+
return _e().decodeImage ? e.register((e) => Be(e, t)) : te() || e.register((e) => Re(e, t)), e.register((e) => Sn(e)), e.register(() => Pn), e;
|
|
1676
1718
|
}
|
|
1677
1719
|
_reportImageFailure(e, t) {
|
|
1678
1720
|
try {
|
|
1679
|
-
this._issues?.record(
|
|
1721
|
+
this._issues?.record(w.TEXTURE_BUILD_FAILED, `image ${e} could not be decoded (${t?.message ?? t}) — the surfaces using it render untextured`, {
|
|
1680
1722
|
image: e,
|
|
1681
1723
|
cause: String(t?.message ?? t)
|
|
1682
1724
|
});
|
|
@@ -1700,16 +1742,16 @@ var Dn = class e extends V {
|
|
|
1700
1742
|
this._loadCancelled = !1;
|
|
1701
1743
|
let r = await this.createGLTFLoader(), i = e._isNetworkUrl(t), a = null;
|
|
1702
1744
|
try {
|
|
1703
|
-
|
|
1745
|
+
x({
|
|
1704
1746
|
isLoading: !0,
|
|
1705
1747
|
status: "Downloading Model...",
|
|
1706
1748
|
progress: 2,
|
|
1707
1749
|
canCancel: i,
|
|
1708
1750
|
loadedBytes: 0,
|
|
1709
1751
|
totalBytes: 0
|
|
1710
|
-
}), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(
|
|
1711
|
-
let e = await
|
|
1712
|
-
return this._downloadComplete(), this._throwDeferred(), this.releaseTargetModel(), this._sourceKey = i ? this._keyed("url", n.cacheKey ?? t) : null, this.targetModel = e.scene, this.animations = e.animations || [], this.sceneMetadata =
|
|
1752
|
+
}), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(yt.extractUrlBase(t));
|
|
1753
|
+
let e = await oe(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
|
|
1754
|
+
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 = He(e), await this.onModelLoad(this.targetModel), this.dispatchEvent({
|
|
1713
1755
|
type: "load",
|
|
1714
1756
|
model: e.scene,
|
|
1715
1757
|
filename: t.split("/").pop()
|
|
@@ -1731,15 +1773,15 @@ var Dn = class e extends V {
|
|
|
1731
1773
|
this._loadCancelled = !1;
|
|
1732
1774
|
let r = await this.createGLTFLoader(), i = e._isNetworkUrl(t), a = null;
|
|
1733
1775
|
try {
|
|
1734
|
-
|
|
1776
|
+
x({
|
|
1735
1777
|
isLoading: !0,
|
|
1736
1778
|
status: "Downloading Model...",
|
|
1737
1779
|
progress: 2,
|
|
1738
1780
|
canCancel: i,
|
|
1739
1781
|
loadedBytes: 0,
|
|
1740
1782
|
totalBytes: 0
|
|
1741
|
-
}), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(
|
|
1742
|
-
let e = await
|
|
1783
|
+
}), a = await this._viaCache(t, "Downloading Model...", i, n), a.cached && r.setResourcePath(yt.extractUrlBase(t));
|
|
1784
|
+
let e = await oe(() => r.loadAsync(a.url, a.cached ? void 0 : this._downloadProgress("Downloading Model...", i)));
|
|
1743
1785
|
return this._downloadComplete(), this._throwDeferred(), this._appended = !0, this._processAndParent(e.scene), {
|
|
1744
1786
|
root: e.scene,
|
|
1745
1787
|
animations: e.animations || []
|
|
@@ -1756,18 +1798,18 @@ var Dn = class e extends V {
|
|
|
1756
1798
|
return n.name = e.name || t, this._processAndParent(n), { root: n };
|
|
1757
1799
|
}
|
|
1758
1800
|
removeModelRoot(e) {
|
|
1759
|
-
e && (e.userData.__rayzeeExternal ? (
|
|
1801
|
+
e && (e.userData.__rayzeeExternal ? (re(e), e.parent?.remove(e)) : se(e));
|
|
1760
1802
|
}
|
|
1761
1803
|
async loadGLBFromArrayBuffer(e, t = "model.glb") {
|
|
1762
1804
|
let n = await this.createGLTFLoader();
|
|
1763
1805
|
try {
|
|
1764
|
-
|
|
1806
|
+
x({
|
|
1765
1807
|
isLoading: !0,
|
|
1766
1808
|
status: "Processing GLB Data...",
|
|
1767
1809
|
progress: 5
|
|
1768
1810
|
}), await new Promise((e) => setTimeout(e, 0));
|
|
1769
|
-
let r = await
|
|
1770
|
-
return this._throwDeferred(), this.releaseTargetModel(), this.targetModel = r.scene, this.animations = r.animations || [], this.sceneMetadata =
|
|
1811
|
+
let r = await oe(() => n.parseAsync(e, ""));
|
|
1812
|
+
return this._throwDeferred(), this.releaseTargetModel(), this.targetModel = r.scene, this.animations = r.animations || [], this.sceneMetadata = He(r), x({
|
|
1771
1813
|
isLoading: !0,
|
|
1772
1814
|
status: "Processing Data...",
|
|
1773
1815
|
progress: 10
|
|
@@ -1789,7 +1831,7 @@ var Dn = class e extends V {
|
|
|
1789
1831
|
async loadObject3D(e, t = "object3d") {
|
|
1790
1832
|
this.releaseTargetModel();
|
|
1791
1833
|
let n = this._adoptExternalObject(e);
|
|
1792
|
-
return n.name = e.name || t, this.targetModel = n,
|
|
1834
|
+
return n.name = e.name || t, this.targetModel = n, x({
|
|
1793
1835
|
isLoading: !0,
|
|
1794
1836
|
status: "Processing Data...",
|
|
1795
1837
|
progress: 10
|
|
@@ -1800,34 +1842,34 @@ var Dn = class e extends V {
|
|
|
1800
1842
|
}), n;
|
|
1801
1843
|
}
|
|
1802
1844
|
async onModelLoad(e) {
|
|
1803
|
-
let
|
|
1804
|
-
|
|
1805
|
-
let
|
|
1806
|
-
|
|
1807
|
-
let
|
|
1808
|
-
this.controls?.target.copy(
|
|
1809
|
-
let
|
|
1810
|
-
if (this.camera.position.copy(
|
|
1811
|
-
let e =
|
|
1812
|
-
this.floorPlane.position.y = e, this.floorPlane.rotation.x = -Math.PI / 2, this.floorPlane.scale.setScalar(
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
let
|
|
1816
|
-
return this.sceneSize.copy(
|
|
1845
|
+
let n = new t("onModelLoad");
|
|
1846
|
+
n.start("Camera extraction");
|
|
1847
|
+
let r = this.extractCamerasFromModel(e);
|
|
1848
|
+
n.end("Camera extraction"), n.start("Camera setup"), ee(e);
|
|
1849
|
+
let i = new ot().setFromObject(e), a = i.getCenter(new W()), o = i.getSize(new W());
|
|
1850
|
+
this.controls?.target.copy(a);
|
|
1851
|
+
let s = Math.max(o.x, o.y, o.z), c = this.camera.fov * (Math.PI / 180), l = Math.abs(s / Math.sin(c / 2) / 2), u = Math.PI / 6, d = new W(Math.cos(u) * l, l / Math.sqrt(2), Math.sin(u) * l);
|
|
1852
|
+
if (this.camera.position.copy(d.add(a)), this.camera.lookAt(a), this.camera.near = s / 100, this.camera.far = s * 100, this.camera.updateProjectionMatrix(), this.controls && (this.controls.maxDistance = l * 10, this.controls.saveState(), this.controls.update()), n.end("Camera setup"), this.floorPlane) {
|
|
1853
|
+
let e = i.min.y;
|
|
1854
|
+
this.floorPlane.position.y = e, this.floorPlane.rotation.x = -Math.PI / 2, this.floorPlane.scale.setScalar(s * 5);
|
|
1855
|
+
}
|
|
1856
|
+
n.start("Process model objects"), this.processModelObjects(e), n.end("Process model objects"), n.start("Scene add"), this.scene.add(e), n.end("Scene add");
|
|
1857
|
+
let f = s;
|
|
1858
|
+
return this.sceneSize.copy(o), n.start("setupPathTracing"), await this.setupPathTracing(e, f), n.end("setupPathTracing"), n.print(), this.dispatchEvent({
|
|
1817
1859
|
type: "modelProcessed",
|
|
1818
1860
|
model: e,
|
|
1819
|
-
cameras:
|
|
1861
|
+
cameras: r,
|
|
1820
1862
|
sceneData: {
|
|
1821
|
-
center:
|
|
1822
|
-
size:
|
|
1823
|
-
maxDim:
|
|
1824
|
-
sceneScale:
|
|
1863
|
+
center: a,
|
|
1864
|
+
size: o,
|
|
1865
|
+
maxDim: s,
|
|
1866
|
+
sceneScale: f
|
|
1825
1867
|
}
|
|
1826
1868
|
}), this.dispatchEvent({ type: "SceneRebuild" }), {
|
|
1827
|
-
center:
|
|
1828
|
-
size:
|
|
1829
|
-
maxDim:
|
|
1830
|
-
sceneScale:
|
|
1869
|
+
center: a,
|
|
1870
|
+
size: o,
|
|
1871
|
+
maxDim: s,
|
|
1872
|
+
sceneScale: f
|
|
1831
1873
|
};
|
|
1832
1874
|
}
|
|
1833
1875
|
extractCamerasFromModel(e) {
|
|
@@ -1843,22 +1885,22 @@ var Dn = class e extends V {
|
|
|
1843
1885
|
let t = [], n = [];
|
|
1844
1886
|
e.traverse((e) => {
|
|
1845
1887
|
let r = e.userData;
|
|
1846
|
-
e.isRectAreaLight && !r.__radianceConverted && (e.intensity *=
|
|
1888
|
+
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);
|
|
1847
1889
|
let i = e.name.startsWith("RectAreaLightPlaceholder");
|
|
1848
1890
|
if (i && !(r.name && r.type === "RectAreaLight") && !e.parent?.name?.startsWith("RectAreaLightPlaceholder") && n.push(e.name), i && r.name && r.type === "RectAreaLight") {
|
|
1849
|
-
let t = r.normalize ?? !0, n = r.shape ?? "rectangle", i = r.intensity *
|
|
1891
|
+
let t = r.normalize ?? !0, n = r.shape ?? "rectangle", i = r.intensity * In(e, r.width, r.height, r), a = new jt(new lt(...r.color), i * this._areaLightIntensityScale(), r.width, r.height);
|
|
1850
1892
|
a.userData.normalize = t, a.userData.spread = Number.isFinite(r.spread) ? r.spread : Math.PI, a.userData.shape = n, a.userData.__radianceConverted = !0, a.name = r.name, e.add(a);
|
|
1851
1893
|
}
|
|
1852
1894
|
e.isMesh && Array.isArray(e.material) && t.push(e);
|
|
1853
|
-
}), n.length && this._issues?.record(
|
|
1895
|
+
}), n.length && this._issues?.record(w.LIGHT_PLACEHOLDER_SKIPPED, `${n.length} area-light placeholder(s) lack userData.name or userData.type 'RectAreaLight' — no light was made for them`, {
|
|
1854
1896
|
count: n.length,
|
|
1855
1897
|
names: n.slice(0, 10)
|
|
1856
1898
|
});
|
|
1857
1899
|
let r = e.userData.__rayzeeExternal === !0;
|
|
1858
1900
|
for (let e of t) {
|
|
1859
1901
|
if (!e.parent) continue;
|
|
1860
|
-
console.log("Found multi-material mesh:", e.name), r && (e.geometry =
|
|
1861
|
-
let t =
|
|
1902
|
+
console.log("Found multi-material mesh:", e.name), r && (e.geometry = Nn(e.geometry));
|
|
1903
|
+
let t = Ht(e);
|
|
1862
1904
|
for (let e of t.children) e.geometry.userData.__rayzeeOwned = !0;
|
|
1863
1905
|
e.parent.add(t), e.parent.remove(e);
|
|
1864
1906
|
}
|
|
@@ -1867,7 +1909,7 @@ var Dn = class e extends V {
|
|
|
1867
1909
|
this.sceneScale = t;
|
|
1868
1910
|
}
|
|
1869
1911
|
createFloorPlane() {
|
|
1870
|
-
this.floorPlane = new
|
|
1912
|
+
this.floorPlane = new xt(new ct(), new St({
|
|
1871
1913
|
transparent: !1,
|
|
1872
1914
|
color: 3158064,
|
|
1873
1915
|
roughness: 1,
|
|
@@ -1890,7 +1932,7 @@ var Dn = class e extends V {
|
|
|
1890
1932
|
}
|
|
1891
1933
|
getSupportedFormats(e = null) {
|
|
1892
1934
|
let t = {
|
|
1893
|
-
...
|
|
1935
|
+
...jn,
|
|
1894
1936
|
...this._archiveFormats
|
|
1895
1937
|
};
|
|
1896
1938
|
for (let [e, { type: n, name: r }] of this._formats) t[e] = {
|
|
@@ -1915,7 +1957,7 @@ var Dn = class e extends V {
|
|
|
1915
1957
|
this._listeners = void 0;
|
|
1916
1958
|
}
|
|
1917
1959
|
};
|
|
1918
|
-
function
|
|
1960
|
+
function Rn(e, t) {
|
|
1919
1961
|
let { data: n, width: r, height: i } = e.image ?? {};
|
|
1920
1962
|
if (!(n instanceof Float32Array) || r <= t || n.length !== r * i * 4) return;
|
|
1921
1963
|
let a = Math.ceil(r / t), o = Math.ceil(r / a), s = Math.ceil(i / a);
|
|
@@ -1936,17 +1978,17 @@ function On(e, t) {
|
|
|
1936
1978
|
data: n.byteOffset === 0 && n.byteLength === n.buffer.byteLength && n.buffer.transfer ? new Float32Array(n.buffer.transfer(c)) : n.slice(0, o * s * 4),
|
|
1937
1979
|
width: o,
|
|
1938
1980
|
height: s
|
|
1939
|
-
}, e.needsUpdate = !0,
|
|
1981
|
+
}, e.needsUpdate = !0, An.info(`environment ${r}×${i} shrunk to ${o}×${s} (memory spill)`);
|
|
1940
1982
|
}
|
|
1941
1983
|
//#endregion
|
|
1942
1984
|
//#region src/HeadlessCanvas.js
|
|
1943
|
-
var
|
|
1985
|
+
var zn = {
|
|
1944
1986
|
addEventListener() {},
|
|
1945
1987
|
removeEventListener() {},
|
|
1946
1988
|
dispatchEvent() {
|
|
1947
1989
|
return !0;
|
|
1948
1990
|
}
|
|
1949
|
-
},
|
|
1991
|
+
}, Bn = class {
|
|
1950
1992
|
constructor(e) {
|
|
1951
1993
|
this.canvas = e, this._configuration = null, this._texture = null;
|
|
1952
1994
|
}
|
|
@@ -1974,12 +2016,12 @@ var kn = {
|
|
|
1974
2016
|
return this._texture;
|
|
1975
2017
|
}
|
|
1976
2018
|
};
|
|
1977
|
-
function
|
|
2019
|
+
function Vn(e = 1, t = 1) {
|
|
1978
2020
|
let n = {
|
|
1979
|
-
...
|
|
2021
|
+
...zn,
|
|
1980
2022
|
defaultView: null
|
|
1981
2023
|
}, r = {
|
|
1982
|
-
...
|
|
2024
|
+
...zn,
|
|
1983
2025
|
isHeadlessCanvas: !0,
|
|
1984
2026
|
width: e,
|
|
1985
2027
|
height: t,
|
|
@@ -2006,12 +2048,12 @@ function jn(e = 1, t = 1) {
|
|
|
2006
2048
|
hasPointerCapture: () => !1,
|
|
2007
2049
|
focus() {},
|
|
2008
2050
|
getContext: (e) => e === "webgpu" ? i : null
|
|
2009
|
-
}, i = new
|
|
2051
|
+
}, i = new Bn(r);
|
|
2010
2052
|
return r;
|
|
2011
2053
|
}
|
|
2012
2054
|
//#endregion
|
|
2013
2055
|
//#region src/managers/ViewCamera.js
|
|
2014
|
-
var
|
|
2056
|
+
var Hn = class extends Et {
|
|
2015
2057
|
constructor(e, t, n, r) {
|
|
2016
2058
|
super(e, t, n, r), this.orthographic = !1, this.orthoHalfHeight = 1;
|
|
2017
2059
|
}
|
|
@@ -2035,17 +2077,17 @@ var Mn = class extends yt {
|
|
|
2035
2077
|
return -this.orthoHalfHeight * this.aspect;
|
|
2036
2078
|
}
|
|
2037
2079
|
updateProjectionMatrix() {
|
|
2038
|
-
this.orthographic ?
|
|
2080
|
+
this.orthographic ? Tt.prototype.updateProjectionMatrix.call(this) : super.updateProjectionMatrix();
|
|
2039
2081
|
}
|
|
2040
2082
|
copy(e, t) {
|
|
2041
2083
|
return super.copy(e, t), this.orthographic = e.orthographic === !0, this.orthoHalfHeight = e.orthoHalfHeight ?? this.orthoHalfHeight, this;
|
|
2042
2084
|
}
|
|
2043
|
-
},
|
|
2044
|
-
DirectionalLight:
|
|
2045
|
-
PointLight:
|
|
2046
|
-
SpotLight:
|
|
2047
|
-
RectAreaLight:
|
|
2048
|
-
},
|
|
2085
|
+
}, Un = "__rayzeeUserLight", Wn = {
|
|
2086
|
+
DirectionalLight: ft,
|
|
2087
|
+
PointLight: Dt,
|
|
2088
|
+
SpotLight: Pt,
|
|
2089
|
+
RectAreaLight: jt
|
|
2090
|
+
}, Gn = class extends z {
|
|
2049
2091
|
constructor(e, t, n, r = {}) {
|
|
2050
2092
|
super(), this.scene = e, this.sceneHelpers = t, this.pathTracer = n, this._onReset = r.onReset || null, this._onLightRemoved = r.onLightRemoved || null;
|
|
2051
2093
|
}
|
|
@@ -2093,14 +2135,14 @@ var Mn = class extends yt {
|
|
|
2093
2135
|
}[e];
|
|
2094
2136
|
if (!t) return null;
|
|
2095
2137
|
let n;
|
|
2096
|
-
if (e === "DirectionalLight") n = new
|
|
2097
|
-
else if (e === "PointLight") n = new
|
|
2138
|
+
if (e === "DirectionalLight") n = new ft(t.color, t.intensity), n.position.fromArray(t.position);
|
|
2139
|
+
else if (e === "PointLight") n = new Dt(t.color, t.intensity), n.position.fromArray(t.position);
|
|
2098
2140
|
else if (e === "SpotLight") {
|
|
2099
|
-
n = new
|
|
2100
|
-
let e = new
|
|
2141
|
+
n = new Pt(t.color, t.intensity), n.position.fromArray(t.position), n.angle = B.degToRad(t.angle);
|
|
2142
|
+
let e = new wt();
|
|
2101
2143
|
this.scene.add(e), n.target = e;
|
|
2102
|
-
} else e === "RectAreaLight" && (n = new
|
|
2103
|
-
n.userData[
|
|
2144
|
+
} else e === "RectAreaLight" && (n = new jt(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");
|
|
2145
|
+
n.userData[Un] = !0, n.userData.temperature = 6500, n.userData.useTemperature = !1, n.userData.exposure = 0;
|
|
2104
2146
|
let r = this.scene.getObjectsByProperty("isLight", !0).length;
|
|
2105
2147
|
return n.name = `${e.replace("Light", "")} ${r + 1}`, this.scene.add(n), this.updateLights(), this._syncHelpers(), this._onReset?.(), this._buildDescriptor(n);
|
|
2106
2148
|
}
|
|
@@ -2126,7 +2168,7 @@ var Mn = class extends yt {
|
|
|
2126
2168
|
this.pathTracer?.updateLights(), this.sceneHelpers?.visible && this.sceneHelpers.update();
|
|
2127
2169
|
}
|
|
2128
2170
|
transferSceneLights(e, { keepUserLights: t = !1 } = {}) {
|
|
2129
|
-
this._removeAllLights(t ? (e) => !e.userData?.[
|
|
2171
|
+
this._removeAllLights(t ? (e) => !e.userData?.[Un] : void 0);
|
|
2130
2172
|
let n = e.getObjectsByProperty("isLight", !0);
|
|
2131
2173
|
if (!n || n.length === 0) {
|
|
2132
2174
|
this.updateLights();
|
|
@@ -2135,7 +2177,7 @@ var Mn = class extends yt {
|
|
|
2135
2177
|
for (let e of n) {
|
|
2136
2178
|
let t = e.clone();
|
|
2137
2179
|
if (e.updateWorldMatrix(!0, !1), e.getWorldPosition(t.position), e.getWorldQuaternion(t.quaternion), e.getWorldScale(t.scale), t.isRectAreaLight && (t.width *= t.scale.x, t.height *= t.scale.y, t.scale.set(1, 1, 1)), (e.isSpotLight || e.isDirectionalLight) && e.target) {
|
|
2138
|
-
let n = new
|
|
2180
|
+
let n = new wt();
|
|
2139
2181
|
e.target.updateWorldMatrix(!0, !1), e.target.getWorldPosition(n.position), this.scene.add(n), t.target = n;
|
|
2140
2182
|
}
|
|
2141
2183
|
this.scene.add(t);
|
|
@@ -2160,7 +2202,7 @@ var Mn = class extends yt {
|
|
|
2160
2202
|
position: e.position.toArray(),
|
|
2161
2203
|
quaternion: e.quaternion.toArray(),
|
|
2162
2204
|
scale: e.scale.toArray(),
|
|
2163
|
-
userData:
|
|
2205
|
+
userData: g(e.userData) ?? {}
|
|
2164
2206
|
};
|
|
2165
2207
|
return e.isSpotLight && Object.assign(t, {
|
|
2166
2208
|
angle: e.angle,
|
|
@@ -2180,14 +2222,14 @@ var Mn = class extends yt {
|
|
|
2180
2222
|
this.sceneHelpers?.clear(), this._removeAllLights();
|
|
2181
2223
|
let t = [];
|
|
2182
2224
|
for (let n of e ?? []) {
|
|
2183
|
-
let e =
|
|
2225
|
+
let e = Wn[n.type];
|
|
2184
2226
|
if (!e) continue;
|
|
2185
2227
|
let r = new e();
|
|
2186
2228
|
r.name = n.name ?? "", r.visible = n.visible !== !1, r.color.setRGB(...n.color), r.intensity = n.intensity, r.position.fromArray(n.position), r.quaternion.fromArray(n.quaternion), r.scale.fromArray(n.scale ?? [
|
|
2187
2229
|
1,
|
|
2188
2230
|
1,
|
|
2189
2231
|
1
|
|
2190
|
-
]), r.userData =
|
|
2232
|
+
]), r.userData = f(n.userData) ?? {};
|
|
2191
2233
|
for (let e of [
|
|
2192
2234
|
"angle",
|
|
2193
2235
|
"penumbra",
|
|
@@ -2197,7 +2239,7 @@ var Mn = class extends yt {
|
|
|
2197
2239
|
"height"
|
|
2198
2240
|
]) typeof n[e] == "number" && (r[e] = n[e]);
|
|
2199
2241
|
if (n.target) {
|
|
2200
|
-
let e = new
|
|
2242
|
+
let e = new wt();
|
|
2201
2243
|
e.position.fromArray(n.target), this.scene.add(e), r.target = e;
|
|
2202
2244
|
}
|
|
2203
2245
|
this.scene.add(r), t.push(r);
|
|
@@ -2237,7 +2279,7 @@ var Mn = class extends yt {
|
|
|
2237
2279
|
}
|
|
2238
2280
|
_buildDescriptor(e) {
|
|
2239
2281
|
let t = 0;
|
|
2240
|
-
e.type === "SpotLight" && e.angle !== void 0 ? t =
|
|
2282
|
+
e.type === "SpotLight" && e.angle !== void 0 ? t = B.radToDeg(e.angle) : e.type === "DirectionalLight" && (t = B.radToDeg(e.userData?.angle ?? 0));
|
|
2241
2283
|
let n = {
|
|
2242
2284
|
uuid: e.uuid,
|
|
2243
2285
|
name: e.name,
|
|
@@ -2256,7 +2298,7 @@ var Mn = class extends yt {
|
|
|
2256
2298
|
exposure: e.userData?.exposure ?? 0
|
|
2257
2299
|
};
|
|
2258
2300
|
if (e.type === "RectAreaLight") {
|
|
2259
|
-
n.width = e.width, n.height = e.height, n.normalize = e.userData?.normalize ?? !0, n.spread =
|
|
2301
|
+
n.width = e.width, n.height = e.height, n.normalize = e.userData?.normalize ?? !0, n.spread = B.radToDeg(e.userData?.spread ?? Math.PI);
|
|
2260
2302
|
let t = e.userData?.shape;
|
|
2261
2303
|
n.shape = t === "square" || t === "rectangle" || t === "disk" || t === "ellipse" ? t : t === 1 ? "ellipse" : "rectangle";
|
|
2262
2304
|
let r = e.getWorldDirection(e.position.clone());
|
|
@@ -2272,11 +2314,28 @@ var Mn = class extends yt {
|
|
|
2272
2314
|
], n.distance = e.distance ?? 0, n.penumbra = e.penumbra ?? 0, n.decay = e.decay ?? 2) : e.type === "PointLight" && (n.distance = e.distance ?? 0, n.decay = e.decay ?? 2);
|
|
2273
2315
|
return (e.type === "SpotLight" || e.type === "DirectionalLight") && e.userData?.gobo && (n.gobo = e.userData.gobo.name, n.goboIntensity = e.userData.gobo.intensity, n.goboInverted = !!e.userData.gobo.inverted, e.type === "DirectionalLight" && (n.goboScale = e.userData.gobo.scale ?? 5)), e.type === "SpotLight" && e.userData?.ies && (n.ies = e.userData.ies.name, n.iesIntensity = e.userData.ies.intensity ?? 1, n.fixtureLumens = e.userData.ies.fixtureLumens ?? null), n;
|
|
2274
2316
|
}
|
|
2275
|
-
}
|
|
2317
|
+
};
|
|
2318
|
+
function Kn(e) {
|
|
2319
|
+
if (e instanceof Float32Array) return e;
|
|
2320
|
+
let t = new Float32Array(e.length);
|
|
2321
|
+
for (let n = 0; n < e.length; n++) t[n] = dt.fromHalfFloat(e[n]);
|
|
2322
|
+
return t;
|
|
2323
|
+
}
|
|
2324
|
+
function qn(e) {
|
|
2325
|
+
let t = e.getContext("2d"), n = t.getContextAttributes?.()?.colorSpace ?? "srgb", r = t.getImageData(0, 0, e.width, e.height, { colorSpace: n });
|
|
2326
|
+
return {
|
|
2327
|
+
data: r.data,
|
|
2328
|
+
width: e.width,
|
|
2329
|
+
height: e.height,
|
|
2330
|
+
displayColorSpace: r.colorSpace ?? n,
|
|
2331
|
+
source: "upscaled"
|
|
2332
|
+
};
|
|
2333
|
+
}
|
|
2334
|
+
var Jn = ({ element: e, pbrtEntry: t } = {}) => ({
|
|
2276
2335
|
...e === void 0 ? {} : { element: e },
|
|
2277
2336
|
...t === void 0 ? {} : { pbrtEntry: t }
|
|
2278
|
-
}), Q = /* @__PURE__ */ new WeakMap(),
|
|
2279
|
-
async function
|
|
2337
|
+
}), Q = /* @__PURE__ */ new WeakMap(), Yn = 3e4, Xn = new Set([...Object.values(b), ...Object.values(y)]), Zn = /* @__PURE__ */ new Set();
|
|
2338
|
+
async function Qn(e, t) {
|
|
2280
2339
|
if (!t || typeof self < "u") return e.init();
|
|
2281
2340
|
globalThis.self = {
|
|
2282
2341
|
requestAnimationFrame: () => 0,
|
|
@@ -2288,17 +2347,17 @@ async function Bn(e, t) {
|
|
|
2288
2347
|
delete globalThis.self;
|
|
2289
2348
|
}
|
|
2290
2349
|
}
|
|
2291
|
-
var $ =
|
|
2292
|
-
function
|
|
2350
|
+
var $ = ve("engine");
|
|
2351
|
+
function $n() {
|
|
2293
2352
|
let e = new Float32Array(16);
|
|
2294
|
-
return new Uint32Array(e.buffer)[3] =
|
|
2353
|
+
return new Uint32Array(e.buffer)[3] = xe.TRIANGLE_LEAF, e;
|
|
2295
2354
|
}
|
|
2296
|
-
function
|
|
2355
|
+
function er(e, t) {
|
|
2297
2356
|
e.lost.then((e) => {
|
|
2298
2357
|
t.app && t.app._handleDeviceLost(e);
|
|
2299
2358
|
});
|
|
2300
2359
|
}
|
|
2301
|
-
var
|
|
2360
|
+
var tr = [
|
|
2302
2361
|
"core-features-and-limits",
|
|
2303
2362
|
"depth-clip-control",
|
|
2304
2363
|
"depth32float-stencil8",
|
|
@@ -2319,33 +2378,33 @@ var Un = [
|
|
|
2319
2378
|
"subgroups",
|
|
2320
2379
|
"texture-formats-tier1",
|
|
2321
2380
|
"texture-formats-tier2"
|
|
2322
|
-
],
|
|
2323
|
-
function
|
|
2381
|
+
], nr = /swiftshader|llvmpipe|lavapipe|basic render|microsoft basic|warp/i;
|
|
2382
|
+
function rr(e) {
|
|
2324
2383
|
let t = e.info ?? {}, n = `${t.vendor ?? ""} ${t.architecture ?? ""} ${t.device ?? ""} ${t.description ?? ""}`;
|
|
2325
2384
|
return {
|
|
2326
2385
|
vendor: t.vendor ?? "",
|
|
2327
2386
|
architecture: t.architecture ?? "",
|
|
2328
2387
|
device: t.device ?? "",
|
|
2329
2388
|
description: t.description ?? "",
|
|
2330
|
-
isSoftware: t.isFallbackAdapter === !0 || e.isFallbackAdapter === !0 ||
|
|
2389
|
+
isSoftware: t.isFallbackAdapter === !0 || e.isFallbackAdapter === !0 || nr.test(n)
|
|
2331
2390
|
};
|
|
2332
2391
|
}
|
|
2333
|
-
var
|
|
2392
|
+
var ir = class extends z {
|
|
2334
2393
|
constructor(e, t = {}) {
|
|
2335
|
-
super(), this._headless = t.headless === !0 || !e, e ??=
|
|
2394
|
+
super(), this._headless = t.headless === !0 || !e, e ??= Vn();
|
|
2336
2395
|
try {
|
|
2337
2396
|
Q.get(e)?.dispose();
|
|
2338
2397
|
} catch (e) {
|
|
2339
2398
|
$.warn("prior canvas owner dispose failed", e);
|
|
2340
2399
|
}
|
|
2341
2400
|
if (Q.set(e, this), this.canvas = e, this._autoResize = !this._headless && t.autoResize !== !1, this._maxSceneBytes = t.maxSceneBytes, this._hostMemoryGB = t.hostMemoryGB, this._storageOption = t.storage, this._storageOpener = null, this._memorySpill = t.memorySpill === !0 || t.memorySpill === !1 ? t.memorySpill : "auto", this._spillPlan = null, this.storage = null, this._storageRelease = null, this._applySceneMetadataEnabled = t.applySceneMetadata !== !1, this._unlitRestore = null, this._applyingSceneMetadata = !1, t.profile !== void 0) throw Error("the `profile` option was removed: the engine has one set of defaults. For the old 'physical' profile set `areaLightIntensityScale: 1` and `dofMode: 'physical'` through `settings`.");
|
|
2342
|
-
this._issues = new
|
|
2401
|
+
this._issues = new Se({
|
|
2343
2402
|
strict: t.strict === !0,
|
|
2344
2403
|
onIssue: (e) => this.dispatchEvent({
|
|
2345
|
-
type:
|
|
2404
|
+
type: b.ISSUE,
|
|
2346
2405
|
issue: e
|
|
2347
2406
|
})
|
|
2348
|
-
}), this.color = new
|
|
2407
|
+
}), this.color = new bn({ issues: this._issues }), De(this.color), this.settings = new yn(C, { 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 cn(), this._resizeDebounceTimer = null, this._displayWidth = 0, this._displayHeight = 0, this._renderScale = 1, this._renderWidth = 0, this._renderHeight = 0, this._trackedListeners = [], this._disposed = !1, this._deviceLost = !1, this._gpuDevice = null, this._deviceLostHolder = null, this._deterministic = !1, this._dispatchPinned = !1, this._deterministicRestore = null, this.adapterInfo = null;
|
|
2349
2408
|
}
|
|
2350
2409
|
_addTrackedListener(e, t, n) {
|
|
2351
2410
|
e && (e.addEventListener(t, n), this._trackedListeners.push({
|
|
@@ -2364,33 +2423,33 @@ var Kn = class extends V {
|
|
|
2364
2423
|
}
|
|
2365
2424
|
async init() {
|
|
2366
2425
|
let e = this._initStorage();
|
|
2367
|
-
return await this._initRenderer(), this._applyPendingReservedRenderSize(), this.camera = this._createCamera(), this._initScenes(), this._initAssetPipeline(), this._initPipeline(), await this._initManagers(), this._wireEvents(), await e, this._attachStorage(), this.stages.pathTracer.setTriangleData(new Uint32Array(
|
|
2426
|
+
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(be.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData($n()), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setupMaterial(), this.isInitialized = !0, $.debug("WebGPU path tracer app initialized"), this;
|
|
2368
2427
|
}
|
|
2369
2428
|
async setStorageOpener(e) {
|
|
2370
2429
|
this._storageOpener = e, !(!this.isInitialized || this.storage || this._disposed) && (await this._initStorage(), this._attachStorage());
|
|
2371
2430
|
}
|
|
2372
2431
|
async _initStorage() {
|
|
2373
|
-
let e = this._storageOption ?? (this._issues.strict && !
|
|
2432
|
+
let e = this._storageOption ?? (this._issues.strict && !ke("storage") ? !1 : E().storage);
|
|
2374
2433
|
if (e !== !1) {
|
|
2375
2434
|
if (e && typeof e == "object") this.storage = e;
|
|
2376
2435
|
else {
|
|
2377
2436
|
if (!this._storageOpener) {
|
|
2378
|
-
(this._storageOption !== void 0 ||
|
|
2437
|
+
(this._storageOption !== void 0 || ke("storage")) && this._issues.warn(w.CAPABILITY_MISSING, "on-disk storage needs rayzee/addons/storage: setStorageOpener( acquireSharedStorage )");
|
|
2379
2438
|
return;
|
|
2380
2439
|
}
|
|
2381
|
-
let { storage: e, reason: t, release: n } = await this._storageOpener(
|
|
2440
|
+
let { storage: e, reason: t, release: n } = await this._storageOpener(E().cacheNamespace);
|
|
2382
2441
|
if (this._disposed) {
|
|
2383
2442
|
n();
|
|
2384
2443
|
return;
|
|
2385
2444
|
}
|
|
2386
2445
|
if (!e) {
|
|
2387
|
-
this._issues.warn(
|
|
2446
|
+
this._issues.warn(w.STORAGE_UNAVAILABLE, `on-disk storage is off: ${t}`, { reason: t });
|
|
2388
2447
|
return;
|
|
2389
2448
|
}
|
|
2390
2449
|
this.storage = e, this._storageRelease = n;
|
|
2391
2450
|
}
|
|
2392
2451
|
this._addTrackedListener(this.storage, "change", (e) => this.dispatchEvent({
|
|
2393
|
-
type:
|
|
2452
|
+
type: b.STORAGE_CHANGED,
|
|
2394
2453
|
area: e.area
|
|
2395
2454
|
})), this._addTrackedListener(this.storage, "issue", (e) => this._issues.warn(e.code, e.message, e.detail));
|
|
2396
2455
|
}
|
|
@@ -2400,20 +2459,20 @@ var Kn = class extends V {
|
|
|
2400
2459
|
}
|
|
2401
2460
|
dispatchEvent(e) {
|
|
2402
2461
|
super.dispatchEvent(e);
|
|
2403
|
-
let t =
|
|
2462
|
+
let t = y[e.type];
|
|
2404
2463
|
t && super.dispatchEvent({
|
|
2405
2464
|
...e,
|
|
2406
2465
|
type: t
|
|
2407
2466
|
});
|
|
2408
2467
|
}
|
|
2409
2468
|
addEventListener(e, t) {
|
|
2410
|
-
!
|
|
2469
|
+
!Xn.has(e) && !Zn.has(e) && (Zn.add(e), $.warn(`no engine event is named "${e}", so this listener will never fire — see EngineEvents`)), super.addEventListener(e, t);
|
|
2411
2470
|
}
|
|
2412
2471
|
animate() {
|
|
2413
2472
|
if (this._headless) throw Error("a headless app has no render loop — drive it with renderFrames() or renderUntilComplete()");
|
|
2414
2473
|
if (this._deviceLost) return;
|
|
2415
2474
|
if (this.animationManagerId = requestAnimationFrame(() => this.animate()), this._loadingInProgress || this._sdf?.isProcessing) {
|
|
2416
|
-
this.dispatchEvent({ type:
|
|
2475
|
+
this.dispatchEvent({ type: b.FRAME });
|
|
2417
2476
|
return;
|
|
2418
2477
|
}
|
|
2419
2478
|
this._beginFrame();
|
|
@@ -2426,29 +2485,29 @@ var Kn = class extends V {
|
|
|
2426
2485
|
if (this._beforeTrace(), this.stages.pathTracer?.isReady) {
|
|
2427
2486
|
if (this.stages.pathTracer.isComplete && this.completion.renderCompleteDispatched) {
|
|
2428
2487
|
if (this._needsDisplayRefresh && (this._needsDisplayRefresh = !1, this.stages.compositor.render(this.pipeline.context), this._renderHelperOverlay()), this._settling()) {
|
|
2429
|
-
this.dispatchEvent({ type:
|
|
2488
|
+
this.dispatchEvent({ type: b.FRAME });
|
|
2430
2489
|
return;
|
|
2431
2490
|
}
|
|
2432
2491
|
this.stopAnimation();
|
|
2433
2492
|
return;
|
|
2434
2493
|
}
|
|
2435
2494
|
if (this._holdTrace(e)) {
|
|
2436
|
-
this._renderHelperOverlay(), this.dispatchEvent({ type:
|
|
2495
|
+
this._renderHelperOverlay(), this.dispatchEvent({ type: b.FRAME });
|
|
2437
2496
|
return;
|
|
2438
2497
|
}
|
|
2439
2498
|
if (this.stages.pathTracer.readbackWait()) {
|
|
2440
|
-
this.dispatchEvent({ type:
|
|
2499
|
+
this.dispatchEvent({ type: b.FRAME });
|
|
2441
2500
|
return;
|
|
2442
2501
|
}
|
|
2443
2502
|
this._traceFrame({ liveDenoise: !0 }), this.stages.pathTracer.isComplete && this.completion.markComplete() && this._announceComplete();
|
|
2444
2503
|
}
|
|
2445
|
-
this._renderHelperOverlay(), this.dispatchEvent({ type:
|
|
2504
|
+
this._renderHelperOverlay(), this.dispatchEvent({ type: b.FRAME });
|
|
2446
2505
|
}
|
|
2447
2506
|
}
|
|
2448
2507
|
_announceComplete() {
|
|
2449
2508
|
let e = this._completionInfo(), t = this.stages.pathTracer.resetCount, n = () => {
|
|
2450
2509
|
!this.completion.renderCompleteDispatched || this.stages.pathTracer?.resetCount !== t || (this._renderCompleted(), this.dispatchEvent({
|
|
2451
|
-
type:
|
|
2510
|
+
type: b.RENDER_COMPLETE,
|
|
2452
2511
|
...e
|
|
2453
2512
|
}));
|
|
2454
2513
|
}, r = this._finishImage();
|
|
@@ -2458,9 +2517,9 @@ var Kn = class extends V {
|
|
|
2458
2517
|
let t = this.stages.pathTracer;
|
|
2459
2518
|
this.pipeline.render(), this._afterTrace(t, e), t.isComplete || this.completion.updateTime(), this._ensureVRAMWiring();
|
|
2460
2519
|
let n = t.vramTracker, r = t.frameCount ?? 0;
|
|
2461
|
-
n && (r <= 1 || r % 30 == 0) && n.measure(),
|
|
2520
|
+
n && (r <= 1 || r % 30 == 0) && n.measure(), le({
|
|
2462
2521
|
timeElapsed: this.completion.timeElapsed,
|
|
2463
|
-
samples:
|
|
2522
|
+
samples: ne(t),
|
|
2464
2523
|
memoryUsed: n?.current ?? 0,
|
|
2465
2524
|
memoryPeak: n?.peak ?? 0
|
|
2466
2525
|
}), this.completion.isTimeLimitReached(t, this.settings.get("renderLimitMode"), this.settings.get("renderTimeLimit")) && (t.isComplete = !0);
|
|
@@ -2478,7 +2537,7 @@ var Kn = class extends V {
|
|
|
2478
2537
|
}
|
|
2479
2538
|
_handleDeviceLost(e) {
|
|
2480
2539
|
this._deviceLost || (this._deviceLost = !0, $.error(`WebGPU device lost (${e?.reason || "unknown"}): ${e?.message || ""}`), this.stopAnimation(), this.dispatchEvent({
|
|
2481
|
-
type:
|
|
2540
|
+
type: b.DEVICE_LOST,
|
|
2482
2541
|
reason: e?.reason,
|
|
2483
2542
|
message: e?.message
|
|
2484
2543
|
}));
|
|
@@ -2493,35 +2552,37 @@ var Kn = class extends V {
|
|
|
2493
2552
|
this._paused = !1, !this.animationManagerId && !this._headless && this.animate();
|
|
2494
2553
|
}
|
|
2495
2554
|
reset(e = !1, { motion: t = !1 } = {}) {
|
|
2496
|
-
t && this.stages.pathTracer?.noteViewChanged(), this._beforeReset(e || t), this.pipeline && (this.pipeline.reset(), e || this.pipeline.eventBus.emit("pipeline:historyReset")), this._afterReset(), this.completion.reset(), this.wake(), this.dispatchEvent({ type:
|
|
2555
|
+
t && this.stages.pathTracer?.noteViewChanged(), this._beforeReset(e || t), this.pipeline && (this.pipeline.reset(), e || this.pipeline.eventBus.emit("pipeline:historyReset")), this._afterReset(), this.completion.reset(), this.wake(), this.dispatchEvent({ type: b.RENDER_RESET });
|
|
2497
2556
|
}
|
|
2498
2557
|
dispose() {
|
|
2499
2558
|
if (this._disposed) return;
|
|
2500
|
-
|
|
2559
|
+
this._disposed = !0, this.dispatchEvent({ type: b.DISPOSE }), this.stopAnimation(), clearTimeout(this._resizeDebounceTimer), this._resizeDebounceTimer = null, clearTimeout(this._respillTimer), this._respillTimer = null, this._removeTrackedListeners(), pe(null), this._storageRelease?.(), this._storageRelease = null, this.storage = null, this._sceneSource = this._sceneSourceInput = null, this._issues.detach(), this.color?.dispose(), this.color = null, this._pictureCopy = null, this._textureReadback?.dispose(), this._textureReadback = null;
|
|
2560
|
+
for (let e of this._readbackToneMappers?.values() ?? []) e.dispose();
|
|
2561
|
+
if (this._readbackToneMappers = null, this._disposeExtensions(), this.lightManager?.dispose(), this.pipeline?.dispose(), this._sdf?.dispose(), this._sdf = null, this.assetLoader?.dispose(), this.assetLoader = null, this.meshScene) {
|
|
2501
2562
|
this.meshScene.environment?.dispose(), this.meshScene.environment = null;
|
|
2502
2563
|
for (let e of [...this.meshScene.children]) se(e);
|
|
2503
2564
|
this.meshScene.clear(), this.meshScene = null;
|
|
2504
2565
|
}
|
|
2505
2566
|
this._sceneHelpers?.clear(), this._sceneHelpers = null, this.scene?.clear(), this.scene = null;
|
|
2506
2567
|
try {
|
|
2507
|
-
let e =
|
|
2568
|
+
let e = rt().value, t = Ze().value;
|
|
2508
2569
|
e?._listeners?.dispose && (e._listeners.dispose.length = 0), t?._listeners?.dispose && (t._listeners.dispose.length = 0);
|
|
2509
2570
|
} catch (e) {
|
|
2510
2571
|
$.warn("failed to clear TSL texture singleton listeners", e);
|
|
2511
2572
|
}
|
|
2512
2573
|
this.canvas && Q.get(this.canvas) === this && Q.delete(this.canvas);
|
|
2513
2574
|
let e = this._gpuDevice;
|
|
2514
|
-
e && (e.onuncapturederror = null, this._gpuDevice = null), this._deviceLostHolder &&= (this._deviceLostHolder.app = null, null), Promise.resolve(
|
|
2575
|
+
e && (e.onuncapturederror = null, this._gpuDevice = null), this._deviceLostHolder &&= (this._deviceLostHolder.app = null, null), Promise.resolve(ce(this.renderer)).finally(() => e?.destroy()), this.renderer = null, this.stages = {}, this.isInitialized = !1;
|
|
2515
2576
|
}
|
|
2516
2577
|
unloadScene() {
|
|
2517
2578
|
if (this.isInitialized) {
|
|
2518
2579
|
if (this._loadingInProgress) throw Error("PathTracerApp.unloadScene: cannot unload while a load is in progress");
|
|
2519
|
-
this._disposed || (this._releaseSceneState(), this.assetLoader?.releaseTargetModel(), this._sceneSource = this._sceneSourceInput = null, this.lightManager?.clearLights?.(), this.stages.pathTracer && (this.stages.pathTracer.setTriangleData(new Uint32Array(
|
|
2580
|
+
this._disposed || (this._releaseSceneState(), this.assetLoader?.releaseTargetModel(), this._sceneSource = this._sceneSourceInput = null, this.lightManager?.clearLights?.(), this.stages.pathTracer && (this.stages.pathTracer.setTriangleData(new Uint32Array(be.FLOATS_PER_TRIANGLE), 0), this.stages.pathTracer.setBVHData($n()), 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: b.SCENE_UNLOADED }));
|
|
2520
2581
|
}
|
|
2521
2582
|
}
|
|
2522
2583
|
async loadModel(e, t = {}) {
|
|
2523
2584
|
await this._loadWithSceneRebuild(() => this.assetLoader.loadModel(e, t), {
|
|
2524
|
-
type:
|
|
2585
|
+
type: b.MODEL_LOADED,
|
|
2525
2586
|
url: e
|
|
2526
2587
|
}, {
|
|
2527
2588
|
kind: "url",
|
|
@@ -2531,7 +2592,7 @@ var Kn = class extends V {
|
|
|
2531
2592
|
}
|
|
2532
2593
|
async loadObject3D(e, t = "object3d") {
|
|
2533
2594
|
await this._loadWithSceneRebuild(() => this.assetLoader.loadObject3D(e, t), {
|
|
2534
|
-
type:
|
|
2595
|
+
type: b.OBJECT3D_LOADED,
|
|
2535
2596
|
name: t
|
|
2536
2597
|
}, {
|
|
2537
2598
|
kind: "object3d",
|
|
@@ -2549,7 +2610,7 @@ var Kn = class extends V {
|
|
|
2549
2610
|
await this.assetLoader.loadEnvironment(e);
|
|
2550
2611
|
let t = this.meshScene.environment;
|
|
2551
2612
|
t && this.stages.pathTracer && await this.stages.pathTracer.environment.setEnvironmentMap(t), this.pipeline?.eventBus.emit("pipeline:lightingChanged"), this.reset(), this.dispatchEvent({
|
|
2552
|
-
type:
|
|
2613
|
+
type: b.ENVIRONMENT_LOADED,
|
|
2553
2614
|
url: e
|
|
2554
2615
|
});
|
|
2555
2616
|
} finally {
|
|
@@ -2568,31 +2629,31 @@ var Kn = class extends V {
|
|
|
2568
2629
|
...t,
|
|
2569
2630
|
filename: n
|
|
2570
2631
|
}), {
|
|
2571
|
-
type:
|
|
2632
|
+
type: b.MODEL_LOADED,
|
|
2572
2633
|
filename: n
|
|
2573
2634
|
}, {
|
|
2574
2635
|
kind: "url",
|
|
2575
2636
|
url: e,
|
|
2576
2637
|
filename: n,
|
|
2577
2638
|
cacheKey: t.cacheKey ?? null,
|
|
2578
|
-
...
|
|
2639
|
+
...Jn(t)
|
|
2579
2640
|
});
|
|
2580
2641
|
return;
|
|
2581
2642
|
}
|
|
2582
|
-
if (
|
|
2583
|
-
let n =
|
|
2643
|
+
if (Le(e)) {
|
|
2644
|
+
let n = ze(e, { isModel: (e) => this.assetLoader?.getFileFormat(e)?.type === "model" });
|
|
2584
2645
|
if (n.files.length === 0) throw Error(`${n.name} holds no files to load`);
|
|
2585
2646
|
await this._loadWithSceneRebuild(() => this.assetLoader.loadFolder(n, t), {
|
|
2586
|
-
type:
|
|
2647
|
+
type: b.MODEL_LOADED,
|
|
2587
2648
|
filename: n.name
|
|
2588
2649
|
}, async () => {
|
|
2589
|
-
let e = await
|
|
2650
|
+
let e = await Ie(n);
|
|
2590
2651
|
return {
|
|
2591
2652
|
kind: "local-folder",
|
|
2592
2653
|
folder: e,
|
|
2593
|
-
key:
|
|
2654
|
+
key: O(e),
|
|
2594
2655
|
...n.flat ? { flat: !0 } : {},
|
|
2595
|
-
...
|
|
2656
|
+
...Jn(t)
|
|
2596
2657
|
};
|
|
2597
2658
|
}), this._sceneSourceInput = n;
|
|
2598
2659
|
return;
|
|
@@ -2600,22 +2661,22 @@ var Kn = class extends V {
|
|
|
2600
2661
|
let n = this.assetLoader?.getFileFormat(e?.name || "");
|
|
2601
2662
|
if (!n) throw this.assetLoader.formatError(e?.name || "");
|
|
2602
2663
|
if (n.type !== "environment" && n.type !== "image") {
|
|
2603
|
-
let n =
|
|
2664
|
+
let n = Fe(e).catch(() => ({
|
|
2604
2665
|
name: e.name,
|
|
2605
2666
|
size: e.size,
|
|
2606
2667
|
lastModified: e.lastModified ?? 0,
|
|
2607
2668
|
sample: null
|
|
2608
2669
|
}));
|
|
2609
2670
|
await this._loadWithSceneRebuild(() => this.assetLoader.loadAssetFromFile(e, t), {
|
|
2610
|
-
type:
|
|
2671
|
+
type: b.MODEL_LOADED,
|
|
2611
2672
|
filename: e.name
|
|
2612
2673
|
}, async () => {
|
|
2613
2674
|
let e = await n;
|
|
2614
2675
|
return {
|
|
2615
2676
|
kind: "local-file",
|
|
2616
2677
|
file: e,
|
|
2617
|
-
key: e.sample ?
|
|
2618
|
-
...
|
|
2678
|
+
key: e.sample ? O(e) : null,
|
|
2679
|
+
...Jn(t)
|
|
2619
2680
|
};
|
|
2620
2681
|
}), this._sceneSourceInput = e;
|
|
2621
2682
|
return;
|
|
@@ -2626,7 +2687,7 @@ var Kn = class extends V {
|
|
|
2626
2687
|
await this.assetLoader.loadAssetFromFile(e);
|
|
2627
2688
|
let t = this.meshScene.environment;
|
|
2628
2689
|
t && this.stages.pathTracer && await this.stages.pathTracer.environment.applyHDRI(t), this.pipeline?.eventBus.emit("pipeline:lightingChanged"), this.reset(), this.dispatchEvent({
|
|
2629
|
-
type:
|
|
2690
|
+
type: b.ENVIRONMENT_LOADED,
|
|
2630
2691
|
filename: e.name
|
|
2631
2692
|
});
|
|
2632
2693
|
} finally {
|
|
@@ -2635,7 +2696,7 @@ var Kn = class extends V {
|
|
|
2635
2696
|
}
|
|
2636
2697
|
async loadExampleModels(e, t) {
|
|
2637
2698
|
await this._loadWithSceneRebuild(() => this.assetLoader.loadExampleModels(e, t), {
|
|
2638
|
-
type:
|
|
2699
|
+
type: b.MODEL_LOADED,
|
|
2639
2700
|
index: e
|
|
2640
2701
|
}, {
|
|
2641
2702
|
kind: "url",
|
|
@@ -2652,7 +2713,7 @@ var Kn = class extends V {
|
|
|
2652
2713
|
this._loadingInProgress = !0;
|
|
2653
2714
|
try {
|
|
2654
2715
|
await this.loadSceneData(), this.reset(), this.dispatchEvent({
|
|
2655
|
-
type:
|
|
2716
|
+
type: b.TEXTURES_REPROCESSED,
|
|
2656
2717
|
maxTextureSize: r
|
|
2657
2718
|
});
|
|
2658
2719
|
} finally {
|
|
@@ -2664,20 +2725,20 @@ var Kn = class extends V {
|
|
|
2664
2725
|
return this._sceneSource ?? null;
|
|
2665
2726
|
}
|
|
2666
2727
|
get sceneSourceFile() {
|
|
2667
|
-
return this._sceneSourceInput && !
|
|
2728
|
+
return this._sceneSourceInput && !Le(this._sceneSourceInput) ? this._sceneSourceInput : null;
|
|
2668
2729
|
}
|
|
2669
2730
|
get sceneSourceFolder() {
|
|
2670
|
-
return
|
|
2731
|
+
return Le(this._sceneSourceInput) ? this._sceneSourceInput : null;
|
|
2671
2732
|
}
|
|
2672
2733
|
async _loadWithSceneRebuild(e, t, n = null) {
|
|
2673
2734
|
if (this._loadingInProgress) throw this._busyError("PathTracerApp");
|
|
2674
|
-
this._loadingInProgress = !0, this.assetLoader && (this.assetLoader.maxEnvironmentWidth = this._memorySpill === !0 ?
|
|
2735
|
+
this._loadingInProgress = !0, this.assetLoader && (this.assetLoader.maxEnvironmentWidth = this._memorySpill === !0 ? fe : 0);
|
|
2675
2736
|
try {
|
|
2676
2737
|
await e(), this._sceneSource = typeof n == "function" ? await n() : n, this._sceneSourceInput = null, this._emissiveSamplingUserSet = !1, this._clearAppendedModels(), this._modelReplaced(), this._planSpill();
|
|
2677
2738
|
let r = await this.loadSceneData({ pendingEnvironment: this._beginSceneMetadataEnvironment() });
|
|
2678
2739
|
this._maybeSpill(), this.pipeline?.eventBus.emit("pipeline:lightingChanged"), this._dropDisplay(), this.reset(), this.dispatchEvent(t), this._modelAnnounced(), r && this.assetLoader?.commitPendingGraph(this.sceneModel);
|
|
2679
2740
|
} catch (e) {
|
|
2680
|
-
throw (!e || e.code !== "LOAD_IN_PROGRESS") && this._discardFailedLoad(), e?.code === "ARCHIVE_NEEDS_ELEMENT" ?
|
|
2741
|
+
throw (!e || e.code !== "LOAD_IN_PROGRESS") && this._discardFailedLoad(), e?.code === "ARCHIVE_NEEDS_ELEMENT" ? ie() : e?.code !== "LOAD_IN_PROGRESS" && x({
|
|
2681
2742
|
status: `Error: ${e?.message ?? e}`,
|
|
2682
2743
|
failed: !0,
|
|
2683
2744
|
progress: 100
|
|
@@ -2700,7 +2761,7 @@ var Kn = class extends V {
|
|
|
2700
2761
|
_beginSceneMetadataEnvironment() {
|
|
2701
2762
|
this._restoreUnlitSettings();
|
|
2702
2763
|
let e = this.sceneMetadata?.environment;
|
|
2703
|
-
return this._applySceneMetadataEnabled && e?.enabled === !1 ? (this._applyUnlitSettings(), null) : !this._applySceneMetadataEnabled || !e?.sourceFile || !this.stages.pathTracer ? null : (this.stages.pathTracer.environment.beginHDRI(), this._applyingSceneMetadata = !0, this.assetLoader.loadEnvironment(e.sourceFile).catch((t) => (this._issues.record(
|
|
2764
|
+
return this._applySceneMetadataEnabled && e?.enabled === !1 ? (this._applyUnlitSettings(), null) : !this._applySceneMetadataEnabled || !e?.sourceFile || !this.stages.pathTracer ? null : (this.stages.pathTracer.environment.beginHDRI(), this._applyingSceneMetadata = !0, this.assetLoader.loadEnvironment(e.sourceFile).catch((t) => (this._issues.record(w.ENVIRONMENT_LOAD_FAILED, `authored environment "${e.sourceFile}" failed to load — lighting falls back to the previous environment`, {
|
|
2704
2765
|
sourceFile: e.sourceFile,
|
|
2705
2766
|
cause: String(t?.message ?? t)
|
|
2706
2767
|
}), null)).finally(() => {
|
|
@@ -2719,7 +2780,7 @@ var Kn = class extends V {
|
|
|
2719
2780
|
reset: !1,
|
|
2720
2781
|
source: Y.SCENE_METADATA
|
|
2721
2782
|
}), this.scene && (this.scene.background = e), this.dispatchEvent({
|
|
2722
|
-
type:
|
|
2783
|
+
type: b.SCENE_METADATA_APPLIED,
|
|
2723
2784
|
metadata: t,
|
|
2724
2785
|
environment: { ...n }
|
|
2725
2786
|
});
|
|
@@ -2736,7 +2797,7 @@ var Kn = class extends V {
|
|
|
2736
2797
|
reset: !1,
|
|
2737
2798
|
source: Y.SCENE_METADATA
|
|
2738
2799
|
}), this.dispatchEvent({
|
|
2739
|
-
type:
|
|
2800
|
+
type: b.SCENE_METADATA_APPLIED,
|
|
2740
2801
|
metadata: this.sceneMetadata,
|
|
2741
2802
|
environment: { enabled: !1 }
|
|
2742
2803
|
});
|
|
@@ -2751,51 +2812,50 @@ var Kn = class extends V {
|
|
|
2751
2812
|
source: i
|
|
2752
2813
|
});
|
|
2753
2814
|
this.dispatchEvent({
|
|
2754
|
-
type:
|
|
2815
|
+
type: b.SCENE_METADATA_APPLIED,
|
|
2755
2816
|
metadata: this.sceneMetadata,
|
|
2756
2817
|
environment: { enabled: this.settings.get("enableEnvironment") }
|
|
2757
2818
|
});
|
|
2758
2819
|
}
|
|
2759
|
-
async loadSceneData({ pendingEnvironment: e = null, keepUserLights:
|
|
2820
|
+
async loadSceneData({ pendingEnvironment: e = null, keepUserLights: n = !1 } = {}) {
|
|
2760
2821
|
this._releaseSceneState({ keepSelection: !!this._preserveSelectionOnRebuild }), this._tagPrimarySceneObject();
|
|
2761
|
-
let
|
|
2822
|
+
let r = new t("", {
|
|
2762
2823
|
namespace: "scene",
|
|
2763
2824
|
level: "info"
|
|
2764
|
-
}),
|
|
2765
|
-
if (e ? (
|
|
2825
|
+
}), i = () => this.stages.pathTracer.environment.envParams.mode === "hdri" ? this.meshScene.environment : null, a = i(), o = null;
|
|
2826
|
+
if (e ? (r.start("Environment fetch + CDF (concurrent)"), o = e.then(async (e) => {
|
|
2766
2827
|
e && (await this.stages.pathTracer.environment.applyHDRI(e), this._applySceneMetadataSettings(e));
|
|
2767
|
-
}).catch((e) => this._issues.record(
|
|
2768
|
-
|
|
2769
|
-
})),
|
|
2828
|
+
}).catch((e) => this._issues.record(w.ENVIRONMENT_LOAD_FAILED, "authored environment failed to install — the scene is lit by whatever was already loaded", { cause: String(e?.message ?? e) })).finally(() => r.end("Environment fetch + CDF (concurrent)"))) : a?.image?.data && (r.start("Environment CDF build (worker)"), this.stages.pathTracer.scene.environment = a, o = this.stages.pathTracer.environment.buildEnvironmentCDF().then(() => {
|
|
2829
|
+
r.end("Environment CDF build (worker)"), this._applySceneMetadataEnabled && this._applySceneMetadataSettings(a);
|
|
2830
|
+
})), r.start("BVH build (SceneProcessor)"), this._sdf.setMaxTextureSize(this.settings.get("maxTextureSize")), await this._sdf.buildBVH(this.meshScene, {
|
|
2770
2831
|
sceneKey: this.assetLoader?.sceneSourceKey ?? null,
|
|
2771
2832
|
progressive: this._progressiveSpill()
|
|
2772
|
-
}), this.assetLoader?.flushPendingGraph(this._sdf.performanceMetrics.totalProcessingTime),
|
|
2833
|
+
}), this.assetLoader?.flushPendingGraph(this._sdf.performanceMetrics.totalProcessingTime), r.end("BVH build (SceneProcessor)"), x({
|
|
2773
2834
|
status: "Transferring data to GPU...",
|
|
2774
2835
|
progress: 86
|
|
2775
|
-
}), await new Promise((e) => setTimeout(e, 0)),
|
|
2776
|
-
|
|
2777
|
-
this.stages.pathTracer._meshRefs = this.stages.pathTracer._collectMeshRefs(this.meshScene), this.stages.pathTracer.setMeshVisibilityData(this.stages.pathTracer._meshRefs), this._refreshEmissiveForVisibility(), n.end("GPU data transfer"), b({
|
|
2836
|
+
}), await new Promise((e) => setTimeout(e, 0)), r.start("GPU data transfer"), await this._sdf.uploadChunks(this._chunkUploader()), !this._sdf.uploadToPathTracer(this.stages.pathTracer, this.lightManager, this.meshScene, i(), { keepUserLights: n })) return !1;
|
|
2837
|
+
await this.stages.pathTracer.uploadTextureArrays([...this._sdf.srgbBucketTextures ?? [], ...this._sdf.linearBucketTextures ?? []]), this.stages.pathTracer._meshRefs = this.stages.pathTracer._collectMeshRefs(this.meshScene), this.stages.pathTracer.setMeshVisibilityData(this.stages.pathTracer._meshRefs), this._refreshEmissiveForVisibility(), r.end("GPU data transfer"), x({
|
|
2778
2838
|
status: "Compiling shaders...",
|
|
2779
2839
|
progress: 90
|
|
2780
|
-
}), await new Promise((e) => setTimeout(e, 0)),
|
|
2840
|
+
}), await new Promise((e) => setTimeout(e, 0)), r.start("Material setup (TSL compile)"), this.stages.pathTracer.setupMaterial(), r.end("Material setup (TSL compile)"), this._rasterPrecompile = null, this._pathTracerEnabled || (r.start("Pipeline precompile"), await this.precompileRaster(), r.end("Pipeline precompile")), o && (x({
|
|
2781
2841
|
status: "Finalizing environment map...",
|
|
2782
2842
|
progress: 95
|
|
2783
|
-
}), await
|
|
2784
|
-
let
|
|
2785
|
-
if (this.settings.set("groundProjectionLevel",
|
|
2843
|
+
}), await o, this.stages.pathTracer.environment.applyCDFResults());
|
|
2844
|
+
let s = this.getSceneMinY();
|
|
2845
|
+
if (this.settings.set("groundProjectionLevel", s, { reset: !1 }), this.settings.set("groundCatcherHeight", s, { reset: !1 }), !this._emissiveSamplingUserSet) {
|
|
2786
2846
|
let e = (this._sdf?.emissiveTriangleBuilder?.emissiveTriangles?.length ?? this._sdf?.emissiveTriangleCount ?? 0) > 0;
|
|
2787
2847
|
this.settings.set("enableEmissiveTriangleSampling", e, { reset: !1 });
|
|
2788
2848
|
}
|
|
2789
|
-
return
|
|
2849
|
+
return r.start("Apply settings"), this.settings.applyAll(), this.stages.compositor.setTransparentBackground(this.settings.get("transparentBackground")), r.end("Apply settings"), r.print(this._sceneSummaryParts()), ie(), this._sceneRebuilt(), this.dispatchEvent({ type: b.SCENE_REBUILD }), !0;
|
|
2790
2850
|
}
|
|
2791
2851
|
_sceneSummaryParts() {
|
|
2792
2852
|
let e = this.stages.pathTracer, t = this._sdf?.instanceTable?.setCount ?? 0, n = this._sdf?.geometryExtractor?.maps?.length ?? 0;
|
|
2793
2853
|
return [
|
|
2794
|
-
|
|
2795
|
-
t ?
|
|
2796
|
-
|
|
2797
|
-
n ?
|
|
2798
|
-
|
|
2854
|
+
S.count(e.triangleCount, "tri"),
|
|
2855
|
+
t ? S.count(t, "mesh", "meshes") : null,
|
|
2856
|
+
S.count(e.materialData.materialCount, "material"),
|
|
2857
|
+
n ? S.count(n, "map") : null,
|
|
2858
|
+
S.count(e.bvhNodeCount, "BVH node")
|
|
2799
2859
|
];
|
|
2800
2860
|
}
|
|
2801
2861
|
_tagPrimarySceneObject() {
|
|
@@ -2817,7 +2877,7 @@ var Kn = class extends V {
|
|
|
2817
2877
|
try {
|
|
2818
2878
|
let { root: r } = await this.assetLoader.appendModel(e, { cacheKey: n });
|
|
2819
2879
|
return r.userData.__rayzeeSceneObject = !0, r.userData.__rayzeeSourceUrl = e, n && (r.userData.__rayzeeCacheKey = n), t && (r.userData.__rayzeeName = t), await this._finishRebuildNoReframe({
|
|
2820
|
-
type:
|
|
2880
|
+
type: b.MODEL_ADDED,
|
|
2821
2881
|
url: e,
|
|
2822
2882
|
id: r.uuid
|
|
2823
2883
|
}), r.uuid;
|
|
@@ -2831,7 +2891,7 @@ var Kn = class extends V {
|
|
|
2831
2891
|
try {
|
|
2832
2892
|
let { root: n } = this.assetLoader.appendObject3D(e, t || "object3d");
|
|
2833
2893
|
return n.userData.__rayzeeSceneObject = !0, t && (n.userData.__rayzeeName = t), await this._finishRebuildNoReframe({
|
|
2834
|
-
type:
|
|
2894
|
+
type: b.MODEL_ADDED,
|
|
2835
2895
|
id: n.uuid
|
|
2836
2896
|
}), n.uuid;
|
|
2837
2897
|
} finally {
|
|
@@ -2848,7 +2908,7 @@ var Kn = class extends V {
|
|
|
2848
2908
|
this._loadingInProgress = !0;
|
|
2849
2909
|
try {
|
|
2850
2910
|
return this._releaseSceneState(), n === this.sceneModel ? this.assetLoader.releaseTargetModel() : this.assetLoader.removeModelRoot(n), await this._finishRebuildNoReframe({
|
|
2851
|
-
type:
|
|
2911
|
+
type: b.SCENE_OBJECT_REMOVED,
|
|
2852
2912
|
id: e
|
|
2853
2913
|
}), !0;
|
|
2854
2914
|
} finally {
|
|
@@ -2872,16 +2932,16 @@ var Kn = class extends V {
|
|
|
2872
2932
|
}
|
|
2873
2933
|
_sceneBudgets(e) {
|
|
2874
2934
|
return this._memorySpill === !1 || !this.storage ? e : {
|
|
2875
|
-
maxTriangles:
|
|
2935
|
+
maxTriangles: ue,
|
|
2876
2936
|
maxPlacements: he,
|
|
2877
2937
|
...e
|
|
2878
2938
|
};
|
|
2879
2939
|
}
|
|
2880
2940
|
_planSpill() {
|
|
2881
2941
|
let e = this._memorySpill !== !1 && !!this.storage && (this.assetLoader?.animations?.length ?? 0) === 0 && (this._memorySpill === !0 || this._sdf.needsSpill(this.meshScene));
|
|
2882
|
-
this.assetLoader && (this.assetLoader.maxEnvironmentWidth = e ?
|
|
2942
|
+
this.assetLoader && (this.assetLoader.maxEnvironmentWidth = e ? fe : 0);
|
|
2883
2943
|
let t = e ? this.meshScene?.environment : null, n = t?.image;
|
|
2884
|
-
return n &&
|
|
2944
|
+
return n && Rn(t, fe), t && t.image !== n && (t.dispose(), t.needsUpdate = !0), e && this._memorySpill === "auto" && $.info("scene is past the in-memory line: building it through disk"), this._spillPlan = e, e;
|
|
2885
2945
|
}
|
|
2886
2946
|
_progressiveSpill() {
|
|
2887
2947
|
let e = this._spillPlan ?? this._planSpill();
|
|
@@ -2895,15 +2955,15 @@ var Kn = class extends V {
|
|
|
2895
2955
|
return (t, n, r) => n === "triangles" ? e.createTriangleChunkUploader(t, r) : e.createChunkUploader(t);
|
|
2896
2956
|
}
|
|
2897
2957
|
_maybeSpill() {
|
|
2898
|
-
!this._sdf?.spilling || !this.storage || (this._sdf.spillAfterLoad().catch((e) => this._issues.warn(
|
|
2899
|
-
type:
|
|
2958
|
+
!this._sdf?.spilling || !this.storage || (this._sdf.spillAfterLoad().catch((e) => this._issues.warn(w.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`)), this._sdf.spillToDisk(this.storage).then((e) => e && this.dispatchEvent({
|
|
2959
|
+
type: b.SCENE_SPILLED,
|
|
2900
2960
|
...e
|
|
2901
|
-
})).catch((e) => this._issues.warn(
|
|
2961
|
+
})).catch((e) => this._issues.warn(w.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`)));
|
|
2902
2962
|
}
|
|
2903
2963
|
_scheduleRespill() {
|
|
2904
2964
|
this._sdf?.spilling && (clearTimeout(this._respillTimer), this._respillTimer = setTimeout(() => {
|
|
2905
|
-
this._respillTimer = null, this._sdf?.respill().catch((e) => this._issues.warn(
|
|
2906
|
-
},
|
|
2965
|
+
this._respillTimer = null, this._sdf?.respill().catch((e) => this._issues.warn(w.STORAGE_WRITE_FAILED, `memory spill failed: ${e.message}`));
|
|
2966
|
+
}, Yn), this._respillTimer.unref?.());
|
|
2907
2967
|
}
|
|
2908
2968
|
async ensureSceneResident() {
|
|
2909
2969
|
this._sdf?.spilled && await this._sdf.ensureResident(), await this._sdf?.ensureGeometryResident();
|
|
@@ -2932,40 +2992,40 @@ var Kn = class extends V {
|
|
|
2932
2992
|
}), r;
|
|
2933
2993
|
}
|
|
2934
2994
|
updateMeshTransforms(e) {
|
|
2935
|
-
if (this._sdf?.needsPageInForMove(e)) return this._sdf.ensureMovable(e).then(() => this.updateMeshTransforms(e)).catch((e) => this._issues.warn(
|
|
2995
|
+
if (this._sdf?.needsPageInForMove(e)) return this._sdf.ensureMovable(e).then(() => this.updateMeshTransforms(e)).catch((e) => this._issues.warn(w.STORAGE_READ_FAILED, `reading instance matrices back failed: ${e.message}`)), null;
|
|
2936
2996
|
this._notePlacementsMoving(e);
|
|
2937
2997
|
let t = this._sdf.updateMeshTransforms(e);
|
|
2938
2998
|
return this.stages.pathTracer.updateBufferRanges([], this._sdf.takeMoveRanges()), this.reset(!1, { motion: !0 }), this._scheduleRespill(), t;
|
|
2939
2999
|
}
|
|
2940
|
-
setReservedRenderResolution(e, { allowLower:
|
|
2941
|
-
let
|
|
3000
|
+
setReservedRenderResolution(e, { allowLower: t = !1 } = {}) {
|
|
3001
|
+
let n = t ? e : Math.max(e, p);
|
|
2942
3002
|
if (!this.renderer) return this._pendingReservedRenderSize = {
|
|
2943
3003
|
requestedPx: e,
|
|
2944
|
-
allowLower:
|
|
2945
|
-
}, Math.max(256, Math.min(
|
|
2946
|
-
let
|
|
2947
|
-
if (
|
|
3004
|
+
allowLower: t
|
|
3005
|
+
}, Math.max(256, Math.min(s, Math.floor(n) || 256));
|
|
3006
|
+
let r = this.renderer.backend?.device?.limits?.maxStorageBufferBindingSize || 128 * 1024 * 1024, i = de(this._hostMemoryGB), a = i.gb >= 8 && r >= 1024 * 1024 * 1024 ? s : 2048, o = c(Math.min(n, a));
|
|
3007
|
+
if (o < Math.floor(e) && this._issues.warn(w.RENDER_RESERVE_CAPPED, `reserved render size ${S.n(e)}px was capped to ${S.n(o)}px by this device's limits — renders above ${S.n(o)}px will be declined` + (i.assumed && i.gb < 8 ? " (host memory unknown, 4 GB assumed: pass hostMemoryGB)" : ""), {
|
|
2948
3008
|
requested: e,
|
|
2949
|
-
applied:
|
|
2950
|
-
deviceMemoryGB:
|
|
2951
|
-
assumed:
|
|
2952
|
-
maxStorageBufferBindingSize:
|
|
2953
|
-
}), (this.stages?.pathTracer?.storageTextures?.writeColor?.image?.width ??
|
|
3009
|
+
applied: o,
|
|
3010
|
+
deviceMemoryGB: i.gb,
|
|
3011
|
+
assumed: i.assumed,
|
|
3012
|
+
maxStorageBufferBindingSize: r
|
|
3013
|
+
}), (this.stages?.pathTracer?.storageTextures?.writeColor?.image?.width ?? o) !== o) {
|
|
2954
3014
|
let e = this.pauseRendering;
|
|
2955
3015
|
this.pauseRendering = !0;
|
|
2956
3016
|
try {
|
|
2957
3017
|
let e = this.renderer.domElement;
|
|
2958
|
-
(e.width >
|
|
3018
|
+
(e.width > o || e.height > o) && this.renderer.setSize(Math.min(e.width, o), Math.min(e.height, o), !1);
|
|
2959
3019
|
for (let e of Object.values(this.stages)) e?.reallocateReservedStorage?.();
|
|
2960
3020
|
} finally {
|
|
2961
3021
|
this.pauseRendering = e;
|
|
2962
3022
|
}
|
|
2963
3023
|
this.reset(), this.dispatchEvent({
|
|
2964
|
-
type:
|
|
2965
|
-
size:
|
|
3024
|
+
type: b.RESERVED_RENDER_SIZE_CHANGED,
|
|
3025
|
+
size: o
|
|
2966
3026
|
});
|
|
2967
3027
|
}
|
|
2968
|
-
return
|
|
3028
|
+
return o;
|
|
2969
3029
|
}
|
|
2970
3030
|
_applyPendingReservedRenderSize() {
|
|
2971
3031
|
let e = this._pendingReservedRenderSize;
|
|
@@ -2973,18 +3033,18 @@ var Kn = class extends V {
|
|
|
2973
3033
|
this._pendingReservedRenderSize = null;
|
|
2974
3034
|
let t = this.setReservedRenderResolution(e.requestedPx, { allowLower: e.allowLower });
|
|
2975
3035
|
this.dispatchEvent({
|
|
2976
|
-
type:
|
|
3036
|
+
type: b.RESERVED_RENDER_SIZE_CHANGED,
|
|
2977
3037
|
size: t
|
|
2978
3038
|
});
|
|
2979
3039
|
}
|
|
2980
3040
|
getReservedRenderResolution() {
|
|
2981
|
-
return
|
|
3041
|
+
return p;
|
|
2982
3042
|
}
|
|
2983
3043
|
_isRenderSizeSupported(e, t) {
|
|
2984
|
-
return e >
|
|
3044
|
+
return e > p || t > p ? (this._issues.record(w.RENDER_SIZE_DECLINED, `render resolution ${e}×${t} exceeds the ${p}px storage reserve — resize ignored, so output stays at the previous size. Raise it with setReservedRenderResolution( ${Math.max(e, t)} ) before init().`, {
|
|
2985
3045
|
width: e,
|
|
2986
3046
|
height: t,
|
|
2987
|
-
reserve:
|
|
3047
|
+
reserve: p
|
|
2988
3048
|
}), !1) : !0;
|
|
2989
3049
|
}
|
|
2990
3050
|
onResize() {
|
|
@@ -2995,7 +3055,7 @@ var Kn = class extends V {
|
|
|
2995
3055
|
}
|
|
2996
3056
|
_applyRenderResize(e, t) {
|
|
2997
3057
|
this._isRenderSizeSupported(e, t) && (this.pipeline?.setSize(this._scaled(e), this._scaled(t)), this._renderWidth = e, this._renderHeight = t, this._renderSizeChanged(e, t), this.needsReset = !0, this.dispatchEvent({
|
|
2998
|
-
type:
|
|
3058
|
+
type: b.RESOLUTION_CHANGED,
|
|
2999
3059
|
width: e,
|
|
3000
3060
|
height: t
|
|
3001
3061
|
}));
|
|
@@ -3115,7 +3175,7 @@ var Kn = class extends V {
|
|
|
3115
3175
|
}
|
|
3116
3176
|
let l = this._completionInfo();
|
|
3117
3177
|
await this._finishImage(), this.completion.markComplete() && this.dispatchEvent({
|
|
3118
|
-
type:
|
|
3178
|
+
type: b.RENDER_COMPLETE,
|
|
3119
3179
|
...l
|
|
3120
3180
|
});
|
|
3121
3181
|
let u = t ? await this._finalDenoise() : !1, { reason: d, ...f } = l;
|
|
@@ -3134,9 +3194,9 @@ var Kn = class extends V {
|
|
|
3134
3194
|
}
|
|
3135
3195
|
getProvenance() {
|
|
3136
3196
|
let e = this.stages.pathTracer, t = this.color?.status();
|
|
3137
|
-
return
|
|
3138
|
-
engine:
|
|
3139
|
-
three:
|
|
3197
|
+
return g({
|
|
3198
|
+
engine: me,
|
|
3199
|
+
three: kt,
|
|
3140
3200
|
adapter: this.adapterInfo ?? null,
|
|
3141
3201
|
mode: {
|
|
3142
3202
|
headless: this._headless,
|
|
@@ -3178,7 +3238,7 @@ var Kn = class extends V {
|
|
|
3178
3238
|
let t = await e.captureAccumulation();
|
|
3179
3239
|
return {
|
|
3180
3240
|
v: 1,
|
|
3181
|
-
engine:
|
|
3241
|
+
engine: me,
|
|
3182
3242
|
savedAt: Date.now(),
|
|
3183
3243
|
samples: t.state.frameCount,
|
|
3184
3244
|
...t
|
|
@@ -3189,53 +3249,37 @@ var Kn = class extends V {
|
|
|
3189
3249
|
let t = this.stages.pathTracer;
|
|
3190
3250
|
if (!t) throw Error("restoreRenderCheckpoint: app is not initialized");
|
|
3191
3251
|
t.restoreAccumulation(e), this.needsReset = !1, this.dispatchEvent({
|
|
3192
|
-
type:
|
|
3252
|
+
type: b.RENDER_RESET,
|
|
3193
3253
|
restored: e.samples
|
|
3194
3254
|
});
|
|
3195
3255
|
}
|
|
3196
|
-
async renderToBuffer({ colorSpace: e = "srgb", preserveAlpha: t = !1, source: n = "accumulation" } = {}) {
|
|
3256
|
+
async renderToBuffer({ colorSpace: e = "srgb", preserveAlpha: t = !1, source: n = "accumulation", bitDepth: r = 8 } = {}) {
|
|
3197
3257
|
if (e !== "linear" && e !== "srgb" && !this.color?.hasConfig) throw Error(`renderToBuffer: colorSpace must be 'linear' or 'srgb' without a colour config loaded, got "${e}"`);
|
|
3198
|
-
let
|
|
3199
|
-
if (!
|
|
3200
|
-
let { width:
|
|
3201
|
-
if (e === "srgb") {
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
fn: f,
|
|
3214
|
-
width: a,
|
|
3215
|
-
height: o,
|
|
3216
|
-
backdrop: p
|
|
3217
|
-
} : null
|
|
3218
|
-
}),
|
|
3219
|
-
width: a,
|
|
3220
|
-
height: o,
|
|
3221
|
-
colorSpace: e,
|
|
3222
|
-
displayColorSpace: this.color?.canvasColorSpace ?? "srgb",
|
|
3223
|
-
source: r?.source ?? "accumulation",
|
|
3224
|
-
toneMappedOn: d ? "gpu" : "cpu"
|
|
3225
|
-
};
|
|
3226
|
-
}
|
|
3227
|
-
let { data: u, source: d } = n === "display" ? await this._readDisplaySource(i, a, o) : {
|
|
3228
|
-
data: await c(this.renderer, i, a, o),
|
|
3258
|
+
let i = this.stages?.pathTracer, a = i?.storageTextures?.readTarget;
|
|
3259
|
+
if (!a) throw Error("renderToBuffer: no render target — call init() and render at least one sample");
|
|
3260
|
+
let { width: o, height: s } = i, c = !!this.settings.get("transparentBackground");
|
|
3261
|
+
if (e === "srgb") return {
|
|
3262
|
+
...await this._readPicture(a, o, s, {
|
|
3263
|
+
source: n,
|
|
3264
|
+
preserveAlpha: t && c,
|
|
3265
|
+
output: r === 16 ? "rgba16" : "rgba8"
|
|
3266
|
+
}),
|
|
3267
|
+
width: o,
|
|
3268
|
+
height: s,
|
|
3269
|
+
colorSpace: e
|
|
3270
|
+
};
|
|
3271
|
+
let { data: u, source: d } = n === "display" ? await this._readDisplaySource(a, o, s) : {
|
|
3272
|
+
data: await l(this.renderer, a, o, s),
|
|
3229
3273
|
source: "accumulation"
|
|
3230
3274
|
};
|
|
3231
|
-
if (!
|
|
3275
|
+
if (!c) {
|
|
3232
3276
|
let e = u instanceof Uint16Array ? 15360 : 1;
|
|
3233
3277
|
for (let t = 3; t < u.length; t += 4) u[t] = e;
|
|
3234
3278
|
}
|
|
3235
3279
|
if (e === "linear") return {
|
|
3236
3280
|
data: u,
|
|
3237
|
-
width:
|
|
3238
|
-
height:
|
|
3281
|
+
width: o,
|
|
3282
|
+
height: s,
|
|
3239
3283
|
colorSpace: e,
|
|
3240
3284
|
workingSpace: this.color?.workingSpace ?? null,
|
|
3241
3285
|
source: d
|
|
@@ -3243,28 +3287,67 @@ var Kn = class extends V {
|
|
|
3243
3287
|
let { rgba: f, colorSpace: p } = this.color.exportPixels(u, e);
|
|
3244
3288
|
return {
|
|
3245
3289
|
data: f,
|
|
3246
|
-
width:
|
|
3247
|
-
height:
|
|
3290
|
+
width: o,
|
|
3291
|
+
height: s,
|
|
3248
3292
|
colorSpace: p,
|
|
3249
3293
|
source: d
|
|
3250
3294
|
};
|
|
3251
3295
|
}
|
|
3252
|
-
async
|
|
3253
|
-
let
|
|
3254
|
-
|
|
3296
|
+
async _readPicture(e, t, r, { source: i, preserveAlpha: a, output: s }) {
|
|
3297
|
+
let c = i === "display" ? this._displaySource(e) : null, u = {
|
|
3298
|
+
exposure: this.renderer.toneMappingExposure,
|
|
3299
|
+
toneMapping: this.renderer.toneMapping,
|
|
3300
|
+
saturation: this.settings.get("saturation") ?? 1,
|
|
3301
|
+
preserveAlpha: a,
|
|
3302
|
+
gain: this._displayGain()
|
|
3303
|
+
}, d = await this._toneMapOnGPU(c?.texture ?? null, e, t, r, u, s), f = !d && u.gain?.cpu ? await u.gain.cpu() : null, p = u.gain?.backdrop ?? 0, h = {
|
|
3304
|
+
rgba8: o,
|
|
3305
|
+
rgba16: n,
|
|
3306
|
+
displayLinear: m
|
|
3307
|
+
}[s];
|
|
3308
|
+
return {
|
|
3309
|
+
data: d ?? h(c ? await this._readTexture(c.texture, t, r) : await l(this.renderer, e, t, r), {
|
|
3310
|
+
...u,
|
|
3311
|
+
pixelGain: f || p ? {
|
|
3312
|
+
fn: f,
|
|
3313
|
+
width: t,
|
|
3314
|
+
height: r,
|
|
3315
|
+
backdrop: p
|
|
3316
|
+
} : null
|
|
3317
|
+
}),
|
|
3318
|
+
displayColorSpace: this.color?.canvasColorSpace ?? "srgb",
|
|
3319
|
+
source: c?.source ?? "accumulation",
|
|
3320
|
+
toneMappedOn: d ? "gpu" : "cpu"
|
|
3321
|
+
};
|
|
3322
|
+
}
|
|
3323
|
+
async _toneMapOnGPU(e, t, n, r, i, a = "rgba8") {
|
|
3324
|
+
let o = this.renderer?.backend;
|
|
3325
|
+
if (!o?.device) return this._toneMapFallback("the renderer has no WebGPU device");
|
|
3255
3326
|
try {
|
|
3256
|
-
let
|
|
3257
|
-
|
|
3327
|
+
let s = e ? this._readbackPass().draw(e, n, r).texture : t.textures[0], c = o.get(s).texture;
|
|
3328
|
+
if (!c) return this._toneMapFallback("the picture has no GPU texture yet");
|
|
3329
|
+
this._readbackToneMappers ??= /* @__PURE__ */ new Map();
|
|
3330
|
+
let l = this._readbackToneMappers.get(a);
|
|
3331
|
+
l || this._readbackToneMappers.set(a, l = new Ue(o.device, `rayzee:readback-${a}`, {
|
|
3332
|
+
input: "texture",
|
|
3333
|
+
output: a
|
|
3334
|
+
})), l.ensureSize(n, r);
|
|
3335
|
+
let u = {
|
|
3336
|
+
rgba8: "toRGBA8",
|
|
3337
|
+
rgba16: "toRGBA16",
|
|
3338
|
+
displayLinear: "toDisplayLinear"
|
|
3339
|
+
}[a];
|
|
3340
|
+
return await l[u](c, i);
|
|
3258
3341
|
} catch (e) {
|
|
3259
|
-
if (e instanceof
|
|
3342
|
+
if (e instanceof Ce) throw e;
|
|
3260
3343
|
return this._toneMapFallback("the GPU pass threw", e);
|
|
3261
3344
|
} finally {
|
|
3262
|
-
this.
|
|
3345
|
+
this._readbackToneMappers?.get(a)?.release(), e && this._textureReadback?.release();
|
|
3263
3346
|
}
|
|
3264
3347
|
}
|
|
3265
3348
|
_toneMapFallback(e, t = null) {
|
|
3266
3349
|
let n = t ? String(t?.message ?? t) : null, r = `renderToBuffer: tone mapped on the CPU — ${e}${n ? `: ${n}` : ""}`;
|
|
3267
|
-
return $.warn(r), this._issues.warn(
|
|
3350
|
+
return $.warn(r), this._issues.warn(w.OUTPUT_TONEMAP_FALLBACK, r, {
|
|
3268
3351
|
reason: e,
|
|
3269
3352
|
cause: n
|
|
3270
3353
|
}), null;
|
|
@@ -3322,7 +3405,7 @@ var Kn = class extends V {
|
|
|
3322
3405
|
}
|
|
3323
3406
|
_pictureCanvas() {
|
|
3324
3407
|
let e = this.renderer.domElement, t = this.stages.compositor, n = this.pipeline?.context;
|
|
3325
|
-
if (!t || !n || (t.renderPicture(n), !(this.renderer.backend?.parameters?.outputType ===
|
|
3408
|
+
if (!t || !n || (t.renderPicture(n), !(this.renderer.backend?.parameters?.outputType === gt || t.showsCanvasTransform) || this._headless || typeof document > "u")) return e;
|
|
3326
3409
|
let r = e.getContext("webgpu")?.getConfiguration?.()?.colorSpace ?? "srgb", i = this._pictureCopy;
|
|
3327
3410
|
(!i || i.colorSpace !== r) && (i = this._pictureCopy = {
|
|
3328
3411
|
canvas: document.createElement("canvas"),
|
|
@@ -3335,6 +3418,256 @@ var Kn = class extends V {
|
|
|
3335
3418
|
let n = this.getCanvas();
|
|
3336
3419
|
return n ? new Promise((r) => n.toBlob(r, e, t)) : Promise.resolve(null);
|
|
3337
3420
|
}
|
|
3421
|
+
async exportImage({ format: e = "png", bitDepth: t = 8, quality: n = .92, gainMap: r = !1, precision: i = "half", asShown: a = !1, colorSpace: o, passes: s = [], source: c = "display", upscaled: l = !0, alpha: u = !0, metadata: d = !0 } = {}) {
|
|
3422
|
+
let f = await import("./encoders.es.js"), p = f.IMAGE_FORMATS[e];
|
|
3423
|
+
if (!p) throw Error(`exportImage: no format "${e}"; one of ${Object.keys(f.IMAGE_FORMATS).join(", ")}`);
|
|
3424
|
+
let m = e === "exr" || e === "hdr", h = d ? {
|
|
3425
|
+
...this._exportDetails(e, m && a),
|
|
3426
|
+
...typeof d == "object" ? d : {}
|
|
3427
|
+
} : {}, g = async (e, t, n = {}) => ({
|
|
3428
|
+
blob: e,
|
|
3429
|
+
mimeType: p.mimeType,
|
|
3430
|
+
extension: p.extension,
|
|
3431
|
+
width: t.width,
|
|
3432
|
+
height: t.height,
|
|
3433
|
+
colorSpace: t.displayColorSpace,
|
|
3434
|
+
source: t.source,
|
|
3435
|
+
passes: [],
|
|
3436
|
+
...n
|
|
3437
|
+
});
|
|
3438
|
+
if (m) return this._exportLight(f, g, {
|
|
3439
|
+
format: e,
|
|
3440
|
+
precision: i,
|
|
3441
|
+
asShown: a,
|
|
3442
|
+
colorSpace: o,
|
|
3443
|
+
passes: s,
|
|
3444
|
+
source: c,
|
|
3445
|
+
alpha: u,
|
|
3446
|
+
text: h
|
|
3447
|
+
});
|
|
3448
|
+
let _ = e === "heic" || e === "avif";
|
|
3449
|
+
if (_ || e === "jpeg" && r) {
|
|
3450
|
+
if (r && !this.stages.compositor?.showsCanvasTransform) throw Error("exportImage: an HDR photo needs the screen showing HDR (color.setHdrOutput)");
|
|
3451
|
+
let t = r ? Kn((await this._readShown({
|
|
3452
|
+
source: c,
|
|
3453
|
+
preserveAlpha: !1
|
|
3454
|
+
})).data) : null, i = await this.renderToBuffer({
|
|
3455
|
+
colorSpace: "srgb",
|
|
3456
|
+
source: c
|
|
3457
|
+
}), a = {
|
|
3458
|
+
sdr: i.data,
|
|
3459
|
+
hdr: t,
|
|
3460
|
+
width: i.width,
|
|
3461
|
+
height: i.height,
|
|
3462
|
+
colorSpace: i.displayColorSpace,
|
|
3463
|
+
quality: n
|
|
3464
|
+
};
|
|
3465
|
+
return g(_ ? await f.encodeStill({
|
|
3466
|
+
...a,
|
|
3467
|
+
format: e
|
|
3468
|
+
}) : await f.encodeGainMapJPEG({
|
|
3469
|
+
...a,
|
|
3470
|
+
text: h
|
|
3471
|
+
}), i);
|
|
3472
|
+
}
|
|
3473
|
+
let v = u && e !== "jpeg" && !!this.settings.get("transparentBackground");
|
|
3474
|
+
if (e === "png" && t === 16) {
|
|
3475
|
+
let e = await this.renderToBuffer({
|
|
3476
|
+
colorSpace: "srgb",
|
|
3477
|
+
bitDepth: 16,
|
|
3478
|
+
source: c,
|
|
3479
|
+
preserveAlpha: v
|
|
3480
|
+
});
|
|
3481
|
+
return g(await f.encodePNG({
|
|
3482
|
+
data: e.data,
|
|
3483
|
+
width: e.width,
|
|
3484
|
+
height: e.height,
|
|
3485
|
+
alpha: v,
|
|
3486
|
+
colorSpace: e.displayColorSpace,
|
|
3487
|
+
text: h
|
|
3488
|
+
}), e);
|
|
3489
|
+
}
|
|
3490
|
+
let y = l ? this._displayCanvas() : null, b = y ? qn(y) : await this.renderToBuffer({
|
|
3491
|
+
colorSpace: "srgb",
|
|
3492
|
+
source: c,
|
|
3493
|
+
preserveAlpha: v
|
|
3494
|
+
}), ee = {
|
|
3495
|
+
data: b.data,
|
|
3496
|
+
width: b.width,
|
|
3497
|
+
height: b.height,
|
|
3498
|
+
colorSpace: b.displayColorSpace,
|
|
3499
|
+
text: h
|
|
3500
|
+
};
|
|
3501
|
+
return g(e === "png" ? await f.encodePNG({
|
|
3502
|
+
...ee,
|
|
3503
|
+
alpha: v
|
|
3504
|
+
}) : await f.encodeWithCanvas({
|
|
3505
|
+
...ee,
|
|
3506
|
+
format: e,
|
|
3507
|
+
quality: n
|
|
3508
|
+
}), b);
|
|
3509
|
+
}
|
|
3510
|
+
exportInfo() {
|
|
3511
|
+
let e = this.stages?.pathTracer, t = this._displayCanvas(), n = !!e?.hasAuxBuffers;
|
|
3512
|
+
return {
|
|
3513
|
+
width: e?.width ?? 0,
|
|
3514
|
+
height: e?.height ?? 0,
|
|
3515
|
+
upscaled: t ? {
|
|
3516
|
+
width: t.width,
|
|
3517
|
+
height: t.height
|
|
3518
|
+
} : null,
|
|
3519
|
+
hdr: !!this.stages?.compositor?.showsCanvasTransform,
|
|
3520
|
+
layers: {
|
|
3521
|
+
albedo: n,
|
|
3522
|
+
normal: n,
|
|
3523
|
+
depth: !!(e?.bvhStorageAttr && e.materialData?.materialStorageAttr)
|
|
3524
|
+
}
|
|
3525
|
+
};
|
|
3526
|
+
}
|
|
3527
|
+
async _exportLight(e, t, { format: n, precision: r, asShown: i, colorSpace: a, passes: o, source: s, alpha: c, text: l }) {
|
|
3528
|
+
let u, d, f;
|
|
3529
|
+
if (i) u = await this._readShown({
|
|
3530
|
+
source: s,
|
|
3531
|
+
preserveAlpha: c && !!this.settings.get("transparentBackground")
|
|
3532
|
+
}), d = `${u.displayColorSpace}-linear`, f = e.DISPLAY_CHROMATICITIES[u.displayColorSpace];
|
|
3533
|
+
else {
|
|
3534
|
+
let t = a === void 0 ? this.color?.exportSpace ?? null : a;
|
|
3535
|
+
u = await this.renderToBuffer({
|
|
3536
|
+
colorSpace: t ?? "linear",
|
|
3537
|
+
source: s
|
|
3538
|
+
}), d = u.colorSpace === "linear" ? u.workingSpace ?? this.color.workingSpace : u.colorSpace;
|
|
3539
|
+
let n = this.color.chromaticities?.(d) ?? null;
|
|
3540
|
+
f = n && e.standardChromaticities(n);
|
|
3541
|
+
}
|
|
3542
|
+
let p = Kn(u.data), { width: m, height: h } = u, g = { colorSpace: d };
|
|
3543
|
+
if (n === "hdr") return t(await e.encodeHDR({
|
|
3544
|
+
data: p,
|
|
3545
|
+
width: m,
|
|
3546
|
+
height: h,
|
|
3547
|
+
chromaticities: f,
|
|
3548
|
+
text: l
|
|
3549
|
+
}), u, g);
|
|
3550
|
+
let _ = [
|
|
3551
|
+
"R",
|
|
3552
|
+
"G",
|
|
3553
|
+
"B",
|
|
3554
|
+
...c ? ["A"] : []
|
|
3555
|
+
].map((e, t) => ({
|
|
3556
|
+
name: e,
|
|
3557
|
+
data: p,
|
|
3558
|
+
stride: 4,
|
|
3559
|
+
offset: t,
|
|
3560
|
+
type: r
|
|
3561
|
+
})), v = [], y = (e, t) => this._issues.record(w.OUTPUT_PASS_UNAVAILABLE, `exportImage: no ${e} layer — ${t}`, { pass: e }), b = new Set(o);
|
|
3562
|
+
if (b.has("albedo") || b.has("normal")) {
|
|
3563
|
+
let e = await this.stages.pathTracer.readAuxBuffers();
|
|
3564
|
+
for (let t of ["albedo", "normal"]) {
|
|
3565
|
+
if (!b.has(t)) continue;
|
|
3566
|
+
if (!e) {
|
|
3567
|
+
y(t, "the denoisers' guides are written only while a denoiser is on");
|
|
3568
|
+
continue;
|
|
3569
|
+
}
|
|
3570
|
+
let n = Kn(e[t]);
|
|
3571
|
+
if (t === "albedo") !i && d !== this.color.workingSpace && this.color.exportPixels(n, d);
|
|
3572
|
+
else for (let e = 0; e < n.length; e += 4) for (let t = 0; t < 3; t++) n[e + t] = n[e + t] * 2 - 1;
|
|
3573
|
+
let a = t === "albedo" ? [
|
|
3574
|
+
"R",
|
|
3575
|
+
"G",
|
|
3576
|
+
"B"
|
|
3577
|
+
] : [
|
|
3578
|
+
"X",
|
|
3579
|
+
"Y",
|
|
3580
|
+
"Z"
|
|
3581
|
+
];
|
|
3582
|
+
_.push(...a.map((e, i) => ({
|
|
3583
|
+
name: `${t}.${e}`,
|
|
3584
|
+
data: n,
|
|
3585
|
+
stride: 4,
|
|
3586
|
+
offset: i,
|
|
3587
|
+
type: r
|
|
3588
|
+
}))), v.push(t);
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
if (b.has("depth")) {
|
|
3592
|
+
let { DepthPass: e } = await import("./DepthPass-D4Zh108s.js"), t = await new e(this.renderer).read(this.stages.pathTracer);
|
|
3593
|
+
t ? (_.push({
|
|
3594
|
+
name: "depth.Z",
|
|
3595
|
+
data: t,
|
|
3596
|
+
type: "float"
|
|
3597
|
+
}), v.push("depth")) : y("depth", "no scene is built");
|
|
3598
|
+
}
|
|
3599
|
+
return t(await e.encodeEXR({
|
|
3600
|
+
width: m,
|
|
3601
|
+
height: h,
|
|
3602
|
+
channels: _,
|
|
3603
|
+
chromaticities: f,
|
|
3604
|
+
text: l
|
|
3605
|
+
}), u, {
|
|
3606
|
+
...g,
|
|
3607
|
+
passes: v
|
|
3608
|
+
});
|
|
3609
|
+
}
|
|
3610
|
+
async _readShown({ source: e, preserveAlpha: t }) {
|
|
3611
|
+
let n = this.stages?.pathTracer, r = n?.storageTextures?.readTarget;
|
|
3612
|
+
if (!r) throw Error("exportImage: no render target — call init() and render at least one sample");
|
|
3613
|
+
let { width: i, height: a } = n, o = this.stages.compositor, s = this.pipeline?.context;
|
|
3614
|
+
if (o?.showsCanvasTransform && s) {
|
|
3615
|
+
let e = new Mt(i, a, {
|
|
3616
|
+
type: ht,
|
|
3617
|
+
format: At,
|
|
3618
|
+
depthBuffer: !1,
|
|
3619
|
+
minFilter: Ct,
|
|
3620
|
+
magFilter: Ct
|
|
3621
|
+
});
|
|
3622
|
+
try {
|
|
3623
|
+
if (o.renderShown(s, e)) return {
|
|
3624
|
+
data: await l(this.renderer, e, i, a),
|
|
3625
|
+
width: i,
|
|
3626
|
+
height: a,
|
|
3627
|
+
displayColorSpace: this.color.canvasColorSpace,
|
|
3628
|
+
source: o.resolveLightSource(s)?.key.split(":")[0] ?? "accumulation"
|
|
3629
|
+
};
|
|
3630
|
+
} finally {
|
|
3631
|
+
e.dispose();
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3634
|
+
return {
|
|
3635
|
+
...await this._readPicture(r, i, a, {
|
|
3636
|
+
source: e,
|
|
3637
|
+
preserveAlpha: t,
|
|
3638
|
+
output: "displayLinear"
|
|
3639
|
+
}),
|
|
3640
|
+
width: i,
|
|
3641
|
+
height: a
|
|
3642
|
+
};
|
|
3643
|
+
}
|
|
3644
|
+
_exportDetails(e, t = !1) {
|
|
3645
|
+
let n = this.getProvenance(), r = n.render, i = n.color?.view, a = i && typeof i == "object" ? [i.view, i.look].filter(Boolean).join(", ") : i, o = [
|
|
3646
|
+
r && `${r.samples} samples`,
|
|
3647
|
+
r && `${r.width}×${r.height}`,
|
|
3648
|
+
a,
|
|
3649
|
+
t && "as shown on screen"
|
|
3650
|
+
].filter(Boolean).join(", "), s = Object.fromEntries(Object.entries(n.settings ?? {}).map(([e, t]) => [e, t?.value])), c = JSON.stringify({
|
|
3651
|
+
engine: n.engine,
|
|
3652
|
+
render: r,
|
|
3653
|
+
color: n.color,
|
|
3654
|
+
settings: s
|
|
3655
|
+
}), l = `Rayzee ${me}`, u = /* @__PURE__ */ new Date(), d = (e) => String(e).padStart(2, "0");
|
|
3656
|
+
return e === "exr" ? {
|
|
3657
|
+
software: l,
|
|
3658
|
+
comments: o,
|
|
3659
|
+
capDate: `${u.getFullYear()}:${d(u.getMonth() + 1)}:${d(u.getDate())} ${d(u.getHours())}:${d(u.getMinutes())}:${d(u.getSeconds())}`,
|
|
3660
|
+
rayzee: c
|
|
3661
|
+
} : e === "png" ? {
|
|
3662
|
+
Software: l,
|
|
3663
|
+
"Creation Time": u.toISOString(),
|
|
3664
|
+
Comment: o,
|
|
3665
|
+
rayzee: c
|
|
3666
|
+
} : {
|
|
3667
|
+
Software: l,
|
|
3668
|
+
Comment: o
|
|
3669
|
+
};
|
|
3670
|
+
}
|
|
3338
3671
|
getStatistics() {
|
|
3339
3672
|
try {
|
|
3340
3673
|
return this._sdf?.getStatistics?.() ?? null;
|
|
@@ -3390,7 +3723,7 @@ var Kn = class extends V {
|
|
|
3390
3723
|
...this._canvasResources()
|
|
3391
3724
|
]);
|
|
3392
3725
|
let t = () => e.measure();
|
|
3393
|
-
this._addTrackedListener(this,
|
|
3726
|
+
this._addTrackedListener(this, b.SCENE_REBUILD, t), this._addTrackedListener(this, b.ENVIRONMENT_LOADED, t), this._addTrackedListener(this, b.RESOLUTION_CHANGED, t), this._vramWired = !0;
|
|
3394
3727
|
}
|
|
3395
3728
|
_collectStageTextures() {
|
|
3396
3729
|
let e = [], t = this.stages || {}, n = t.pathTracer;
|
|
@@ -3405,7 +3738,7 @@ var Kn = class extends V {
|
|
|
3405
3738
|
}
|
|
3406
3739
|
getSceneMinY() {
|
|
3407
3740
|
if (!this.meshScene) return 0;
|
|
3408
|
-
let e = new
|
|
3741
|
+
let e = new ot().setFromObject(this.meshScene);
|
|
3409
3742
|
return Number.isFinite(e.min.y) ? e.min.y : 0;
|
|
3410
3743
|
}
|
|
3411
3744
|
getMaterialProperty(e, t) {
|
|
@@ -3415,7 +3748,7 @@ var Kn = class extends V {
|
|
|
3415
3748
|
return this.stages.pathTracer?.materialData.getMaterialPropertySource(e, t);
|
|
3416
3749
|
}
|
|
3417
3750
|
setMaterialProperty(e, t, n) {
|
|
3418
|
-
if (this._sdf?.spilled &&
|
|
3751
|
+
if (this._sdf?.spilled && _.has(t)) {
|
|
3419
3752
|
this.ensureSceneResident().then(() => this.setMaterialProperty(e, t, n));
|
|
3420
3753
|
return;
|
|
3421
3754
|
}
|
|
@@ -3448,7 +3781,7 @@ var Kn = class extends V {
|
|
|
3448
3781
|
e(), this._refreshEmissiveForVisibility(), this.reset(), this._scheduleRespill();
|
|
3449
3782
|
}, n = this._sdf?.whenTLASEditable();
|
|
3450
3783
|
if (!n) return t();
|
|
3451
|
-
n.then(t).catch((e) => this._issues.warn(
|
|
3784
|
+
n.then(t).catch((e) => this._issues.warn(w.STORAGE_READ_FAILED, `reading the TLAS back failed: ${e.message}`));
|
|
3452
3785
|
}
|
|
3453
3786
|
getScene() {
|
|
3454
3787
|
return this.meshScene || this.scene;
|
|
@@ -3467,7 +3800,7 @@ var Kn = class extends V {
|
|
|
3467
3800
|
return n && n.key !== "pathtracer:color" && n.texture !== e.texture ? {
|
|
3468
3801
|
texture: n.texture,
|
|
3469
3802
|
source: n.key.split(":")[0]
|
|
3470
|
-
} : (this._denoiserInUse() && this._issues.record(
|
|
3803
|
+
} : (this._denoiserInUse() && this._issues.record(w.OUTPUT_SOURCE_FALLBACK, "renderToBuffer: 'display' was asked for, but no denoiser has published a picture — returned the raw accumulation", {
|
|
3471
3804
|
requested: "display",
|
|
3472
3805
|
read: "accumulation"
|
|
3473
3806
|
}), null);
|
|
@@ -3478,12 +3811,12 @@ var Kn = class extends V {
|
|
|
3478
3811
|
data: await this._readTexture(r.texture, t, n),
|
|
3479
3812
|
source: r.source
|
|
3480
3813
|
} : {
|
|
3481
|
-
data: await
|
|
3814
|
+
data: await l(this.renderer, e, t, n),
|
|
3482
3815
|
source: "accumulation"
|
|
3483
3816
|
};
|
|
3484
3817
|
}
|
|
3485
3818
|
_readbackPass() {
|
|
3486
|
-
return this._textureReadback ??= new
|
|
3819
|
+
return this._textureReadback ??= new h(this.renderer);
|
|
3487
3820
|
}
|
|
3488
3821
|
_readTexture(e, t, n) {
|
|
3489
3822
|
return this._readbackPass().read(e, t, n);
|
|
@@ -3494,15 +3827,15 @@ var Kn = class extends V {
|
|
|
3494
3827
|
n.__rayzeeOriginalColorSpace === void 0 && (n.__rayzeeOriginalColorSpace = e.colorSpace);
|
|
3495
3828
|
let r = n.__rayzeeOriginalColorSpace;
|
|
3496
3829
|
if (delete n.ocioColorSpace, delete n.__rayzeeColorSpaceChoice, t == null) e.colorSpace = r, delete n.__rayzeeOriginalColorSpace;
|
|
3497
|
-
else if (t === "srgb" || t === "linear") e.colorSpace = t === "srgb" ?
|
|
3830
|
+
else if (t === "srgb" || t === "linear") e.colorSpace = t === "srgb" ? Ke : We, n.__rayzeeColorSpaceChoice = t;
|
|
3498
3831
|
else {
|
|
3499
3832
|
if (!this.color?.hasConfig) throw Error(`"${t}" needs a colour config loaded`);
|
|
3500
|
-
n.ocioColorSpace = t, e.colorSpace =
|
|
3833
|
+
n.ocioColorSpace = t, e.colorSpace = Ke;
|
|
3501
3834
|
}
|
|
3502
3835
|
e.needsUpdate = !0, this.stages.pathTracer?.sdfs && await this.rebuildMaterials();
|
|
3503
3836
|
}
|
|
3504
3837
|
setColorManagement(e) {
|
|
3505
|
-
this.color?.dispose(), this.color = new e({ issues: this._issues }),
|
|
3838
|
+
this.color?.dispose(), this.color = new e({ issues: this._issues }), De(this.color), this.color.on?.("canvas", () => this._applyCanvasTransform()), this.renderer && this.color.attachRenderer(this.renderer);
|
|
3506
3839
|
}
|
|
3507
3840
|
_applyCanvasTransform() {
|
|
3508
3841
|
let e = this.stages?.compositor;
|
|
@@ -3510,8 +3843,8 @@ var Kn = class extends V {
|
|
|
3510
3843
|
}
|
|
3511
3844
|
async loadColorConfig(e = {}) {
|
|
3512
3845
|
await this._leaveColorWorkingSpace();
|
|
3513
|
-
let t =
|
|
3514
|
-
return this.color.workingSpaceAdopted && await this.applyColorWorkingSpace(), (!(t?.source === "ocio" &&
|
|
3846
|
+
let t = D(this.renderer?.toneMapping), n = await this.color.loadConfig(e);
|
|
3847
|
+
return this.color.workingSpaceAdopted && await this.applyColorWorkingSpace(), (!(t?.source === "ocio" && D(this.renderer?.toneMapping) === t) || this.color.workingSpaceAdopted) && this.reset(), n;
|
|
3515
3848
|
}
|
|
3516
3849
|
async unloadColorConfig() {
|
|
3517
3850
|
await this._leaveColorWorkingSpace(), this.color.unloadConfig(), this.reset();
|
|
@@ -3531,17 +3864,17 @@ var Kn = class extends V {
|
|
|
3531
3864
|
async rebuildMaterials(e) {
|
|
3532
3865
|
await this.ensureSceneResident();
|
|
3533
3866
|
let t = this.stages.pathTracer;
|
|
3534
|
-
await t?.rebuildMaterials(e || this.meshScene), t?.triangleStorageNode?.withoutUV && this._sdf?.triangles &&
|
|
3867
|
+
await t?.rebuildMaterials(e || this.meshScene), t?.triangleStorageNode?.withoutUV && this._sdf?.triangles && ae(e || this.meshScene) && (this._sdf.textureCoordinates = !0, t.setTriangleData(this._sdf.triangles, this._sdf.triangleCount, { textureCoordinates: !0 }), t.setupMaterial()), this.reset();
|
|
3535
3868
|
}
|
|
3536
3869
|
async _initRenderer() {
|
|
3537
|
-
|
|
3870
|
+
pe((e) => this.dispatchEvent(e)), (typeof navigator > "u" || !navigator.gpu) && this._issues.fail(w.WEBGPU_UNAVAILABLE, "WebGPU is not available — outside a browser, install one as navigator.gpu (for Node, the `webgpu` package)");
|
|
3538
3871
|
let e = null, t;
|
|
3539
3872
|
try {
|
|
3540
3873
|
e = await navigator.gpu.requestAdapter({ powerPreference: "high-performance" });
|
|
3541
3874
|
} catch (e) {
|
|
3542
3875
|
t = e;
|
|
3543
3876
|
}
|
|
3544
|
-
e || this._issues.fail(
|
|
3877
|
+
e || this._issues.fail(w.ADAPTER_UNAVAILABLE, `no WebGPU adapter${t ? ": " + t.message : ""}`, {}, t), this.adapterInfo = rr(e), this.adapterInfo.isSoftware && (this._issues.warn(w.ADAPTER_SOFTWARE, `software GPU adapter "${this.adapterInfo.description || this.adapterInfo.vendor}" — renders are correct but orders of magnitude slower than hardware`, { ...this.adapterInfo }), $.warn(`software GPU adapter — check app.adapterInfo.isSoftware. ${this.adapterInfo.description}`));
|
|
3545
3878
|
let n = e.limits, r = { maxColorAttachmentBytesPerSample: 128 };
|
|
3546
3879
|
for (let e of [
|
|
3547
3880
|
"maxBufferSize",
|
|
@@ -3563,32 +3896,33 @@ var Kn = class extends V {
|
|
|
3563
3896
|
let i;
|
|
3564
3897
|
try {
|
|
3565
3898
|
i = await e.requestDevice({
|
|
3566
|
-
requiredFeatures:
|
|
3899
|
+
requiredFeatures: tr.filter((t) => e.features.has(t)),
|
|
3567
3900
|
requiredLimits: r
|
|
3568
3901
|
});
|
|
3569
3902
|
} catch (e) {
|
|
3570
|
-
this._issues.fail(
|
|
3903
|
+
this._issues.fail(w.DEVICE_UNAVAILABLE, `WebGPU device request failed: ${e.message}`, { adapter: { ...this.adapterInfo } }, e);
|
|
3571
3904
|
}
|
|
3572
|
-
this.renderer = new
|
|
3905
|
+
this.renderer = new Je({
|
|
3573
3906
|
canvas: this.canvas,
|
|
3574
3907
|
alpha: !0,
|
|
3575
3908
|
device: i
|
|
3576
3909
|
});
|
|
3577
3910
|
try {
|
|
3578
|
-
await
|
|
3911
|
+
await Qn(this.renderer, this._headless);
|
|
3579
3912
|
} catch (e) {
|
|
3580
3913
|
throw i.destroy(), e;
|
|
3581
3914
|
}
|
|
3582
|
-
this.renderer.backend?.isWebGPUBackend || (i.destroy(), this._issues.fail(
|
|
3915
|
+
this.renderer.backend?.isWebGPUBackend || (i.destroy(), this._issues.fail(w.WEBGPU_UNAVAILABLE, "three.js fell back to WebGL2, which cannot run the path tracer's compute kernels. Check GPU process flags and driver support.")), this._gpuDevice = i, i.lost && (this._deviceLostHolder = { app: this }, er(i, this._deviceLostHolder), i.onuncapturederror = (e) => $.error("WebGPU uncaptured error:", e.error)), Ge.setLTC(Rt.init()), this.renderer.outputColorSpace = Ke, this.renderer.toneMapping = Pe, this.renderer.toneMappingExposure = 1, this.renderer.setPixelRatio(1), this.color.attachRenderer(this.renderer);
|
|
3583
3916
|
}
|
|
3584
3917
|
_initScenes() {
|
|
3585
|
-
this.scene = new
|
|
3918
|
+
this.scene = new Nt(), this.meshScene = new Nt(), this._sceneHelpers = new Wt();
|
|
3586
3919
|
}
|
|
3587
3920
|
_initAssetPipeline() {
|
|
3588
|
-
this._sdf = new
|
|
3921
|
+
this._sdf = new a({
|
|
3589
3922
|
issues: this._issues,
|
|
3923
|
+
layerSink: i(this.renderer),
|
|
3590
3924
|
...this._maxSceneBytes === void 0 ? {} : { maxSceneBytes: this._maxSceneBytes }
|
|
3591
|
-
}), this.assetLoader = new
|
|
3925
|
+
}), this.assetLoader = new Ln(this.meshScene, this.camera, null, {
|
|
3592
3926
|
issues: this._issues,
|
|
3593
3927
|
areaLightIntensityScale: () => this.settings.get("areaLightIntensityScale")
|
|
3594
3928
|
}), this.assetLoader.setRenderer(this.renderer), this.assetLoader.createFloorPlane();
|
|
@@ -3596,14 +3930,14 @@ var Kn = class extends V {
|
|
|
3596
3930
|
_initPipeline() {
|
|
3597
3931
|
this._createStages();
|
|
3598
3932
|
let { clientWidth: e, clientHeight: t } = this.canvas;
|
|
3599
|
-
this.pipeline = new
|
|
3933
|
+
this.pipeline = new on(this.renderer, e || 1, t || 1, { issues: this._issues }), this.pipeline.addStage(this.stages.pathTracer);
|
|
3600
3934
|
for (let e of this._extraStages) this.pipeline.addStage(e);
|
|
3601
3935
|
this.pipeline.addStage(this.stages.compositor);
|
|
3602
3936
|
let n = this.canvas.clientWidth || 1, r = this.canvas.clientHeight || 1;
|
|
3603
3937
|
this._displayWidth = n, this._displayHeight = r, this._renderWidth = n, this._renderHeight = r, this.pipeline.setSize(n, r);
|
|
3604
3938
|
}
|
|
3605
3939
|
async _initManagers() {
|
|
3606
|
-
this.lightManager = new
|
|
3940
|
+
this.lightManager = new Gn(this.scene, this._sceneHelpers, this.stages.pathTracer, {
|
|
3607
3941
|
onReset: () => this.reset(),
|
|
3608
3942
|
onLightRemoved: (e) => this._lightRemoved(e)
|
|
3609
3943
|
}), this.environmentManager = this.stages.pathTracer.environment, this.environmentManager.issues = this._issues, this.stages.pathTracer.issues = this._issues, this.environmentManager.callbacks.onLightingChanged = () => this.pipeline.eventBus.emit("pipeline:lightingChanged"), this.environmentManager.callbacks.onReset = () => this.reset();
|
|
@@ -3614,12 +3948,12 @@ var Kn = class extends V {
|
|
|
3614
3948
|
if (e.model) this._clearAppendedModels(), await this.loadSceneData({ pendingEnvironment: this._beginSceneMetadataEnvironment() }) && this.assetLoader?.commitPendingGraph(e.model);
|
|
3615
3949
|
else if (e.texture) {
|
|
3616
3950
|
let e = this.meshScene.environment;
|
|
3617
|
-
e && this.stages.pathTracer && await this.stages.pathTracer.environment.setEnvironmentMap(e),
|
|
3951
|
+
e && this.stages.pathTracer && await this.stages.pathTracer.environment.setEnvironmentMap(e), ie();
|
|
3618
3952
|
}
|
|
3619
3953
|
this.pauseRendering = !1, this.reset();
|
|
3620
3954
|
}
|
|
3621
3955
|
}, this._addTrackedListener(this.assetLoader, "load", this._onAssetLoaded), this.pipeline.eventBus.on("pathtracer:compiling", ({ compiling: e }) => this.dispatchEvent({
|
|
3622
|
-
type:
|
|
3956
|
+
type: b.SHADERS_COMPILING,
|
|
3623
3957
|
compiling: e
|
|
3624
3958
|
}));
|
|
3625
3959
|
}
|
|
@@ -3627,8 +3961,8 @@ var Kn = class extends V {
|
|
|
3627
3961
|
this.stages.pathTracer = new d(this.renderer, this.scene, this.camera, {
|
|
3628
3962
|
hostMemoryGB: this._hostMemoryGB,
|
|
3629
3963
|
sortMaterials: this.settings.get("wavefrontSortMaterials")
|
|
3630
|
-
}), this._extraStages = this._createExtraStages(), this.stages.compositor = new
|
|
3631
|
-
saturation: this.settings.get("saturation") ??
|
|
3964
|
+
}), this._extraStages = this._createExtraStages(), this.stages.compositor = new Kt(this.renderer, {
|
|
3965
|
+
saturation: this.settings.get("saturation") ?? C.saturation,
|
|
3632
3966
|
pathTracer: this.stages.pathTracer,
|
|
3633
3967
|
displaySources: this._displaySources(),
|
|
3634
3968
|
canvasTransform: this.color?.canvasTransform ?? null
|
|
@@ -3638,13 +3972,13 @@ var Kn = class extends V {
|
|
|
3638
3972
|
let e = this.stages.pathTracer;
|
|
3639
3973
|
if (!e) return;
|
|
3640
3974
|
let t = this.completion.isLimitReached(e, this.settings.get("renderLimitMode"), this.settings.get("renderTimeLimit"));
|
|
3641
|
-
t && !e.isComplete ? e.isComplete = !0 : !t && e.isComplete && (e.isComplete = !1, this.completion.resumeFromPause(), this._completionReopened(), this.dispatchEvent({ type:
|
|
3975
|
+
t && !e.isComplete ? e.isComplete = !0 : !t && e.isComplete && (e.isComplete = !1, this.completion.resumeFromPause(), this._completionReopened(), this.dispatchEvent({ type: b.RENDER_RESET }), this.wake());
|
|
3642
3976
|
}
|
|
3643
3977
|
_forwardEvents(e, t) {
|
|
3644
3978
|
if (e) for (let n of t) this._addTrackedListener(e, n, (e) => this.dispatchEvent(e));
|
|
3645
3979
|
}
|
|
3646
3980
|
_createCamera() {
|
|
3647
|
-
let e = new
|
|
3981
|
+
let e = new Hn(60, this.canvas.clientWidth / this.canvas.clientHeight || 1, .01, 1e3);
|
|
3648
3982
|
return e.position.set(0, 0, 5), e;
|
|
3649
3983
|
}
|
|
3650
3984
|
_createExtraStages() {
|
|
@@ -3714,4 +4048,4 @@ var Kn = class extends V {
|
|
|
3714
4048
|
_disposeExtensions() {}
|
|
3715
4049
|
};
|
|
3716
4050
|
//#endregion
|
|
3717
|
-
export {
|
|
4051
|
+
export { qt as _, yn as a, J as c, q as d, gn as f, Qt as g, $t as h, Hn as i, _n as l, en as m, rr as n, Y as o, on as p, Gn as r, G as s, ir as t, hn as u };
|