rayzee 11.2.0 → 11.3.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 +62 -33
- package/dist/ArchiveImporter-D735xX-4.js +7860 -0
- package/dist/BidirectionalIntegrator-M89c0AlP.js +954 -0
- package/dist/{BufferLayout-D_IBo2ci.js → BufferLayout-xPRH9jYD.js} +41 -5
- package/dist/{NeuralRetouch-DFGbnmLb.js → NeuralRetouch-DiBH63kz.js} +1 -1
- package/dist/{NeuralSuperRes-BtXvyJQl.js → NeuralSuperRes-CZNQP13W.js} +1 -1
- package/dist/{PathTracer-BHXGJtPN.js → PathTracer-BXCCVrPK.js} +4371 -4612
- package/dist/{PhysicalSky-DN6u8UX4.js → PhysicalSky-DqmaS0lb.js} +2 -2
- package/dist/{RayzeeRenderer-Dw1x8mVL.js → RayzeeRenderer-DUSMFhmc.js} +426 -363
- package/dist/SolarLimb-bZE6y63S.js +762 -0
- package/dist/addons/archives.es.js +1 -1
- package/dist/addons/bidirectional.es.js +1 -1
- package/dist/addons/physical-sky.es.js +1 -1
- package/dist/rayzee-core.es.js +7 -7
- package/dist/rayzee.es.js +472 -468
- package/dist/rayzee.umd.js +106 -105
- package/dist/sceneCachePolicy-BAib5fCp.js +1602 -0
- package/package.json +1 -1
- package/src/EngineDefaults.js +1 -1
- package/src/PathTracerApp.js +4 -3
- package/src/Processor/ArchiveImporter.js +173 -94
- package/src/Processor/ArchiveReader.js +20 -23
- package/src/Processor/AssetLoader.js +48 -1
- package/src/Processor/BVHRefitter.js +109 -13
- package/src/Processor/BufferLayout.js +115 -0
- package/src/Processor/ChunkedRecords.js +3 -2
- package/src/Processor/EmissiveTriangleBuilder.js +6 -6
- package/src/Processor/GeometryExtractor.js +189 -79
- package/src/Processor/HostMemory.js +39 -9
- package/src/Processor/InstanceTable.js +714 -42
- package/src/Processor/PBRT/PBRTCurves.js +224 -6
- package/src/Processor/PBRT/PBRTMaterials.js +3 -0
- package/src/Processor/PBRT/PBRTSceneBuilder.js +82 -25
- package/src/Processor/PackedRayBuffer.js +5 -2
- package/src/Processor/SceneProcessor.js +747 -141
- package/src/Processor/TLASBuilder.js +32 -17
- package/src/Processor/USD/USDLayer.js +1149 -0
- package/src/Processor/USD/USDScene.js +1655 -0
- package/src/Processor/USD/USDStage.js +682 -0
- package/src/Processor/USD/USDText.js +674 -0
- package/src/Processor/USD/index.js +138 -0
- package/src/Processor/Workers/BVHRefitWorker.js +3 -3
- package/src/RayzeeRenderer.js +168 -27
- package/src/Stages/NormalDepth.js +7 -12
- package/src/Stages/PathTracer.js +12 -17
- package/src/Stages/PathTracerStage.js +273 -96
- package/src/Storage/GeometrySpill.js +46 -14
- package/src/Storage/SceneGraphCodec.js +17 -3
- package/src/Storage/SpillStore.js +9 -0
- package/src/TSL/BVHTraversal.js +183 -7
- package/src/TSL/Common.js +57 -13
- package/src/TSL/ShadeKernel.js +3 -2
- package/src/TSL/TextureSampling.js +11 -8
- package/src/TSL/patches.js +84 -0
- package/src/integrators/BidirectionalIntegrator.js +20 -2
- package/src/managers/DenoisingManager.js +4 -4
- package/src/managers/InteractionManager.js +19 -6
- package/src/managers/MaterialDataManager.js +22 -5
- package/src/managers/UniformManager.js +3 -0
- package/dist/ArchiveImporter-eNlu0_6F.js +0 -5198
- package/dist/BidirectionalIntegrator-D1-6UySB.js +0 -946
- package/dist/SolarLimb-CPaeZVwz.js +0 -721
- package/dist/sceneCachePolicy-DA7iGoL4.js +0 -485
|
@@ -1,485 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./EngineEvents-Ci8dVWCP.js";
|
|
2
|
-
import { s as t } from "./BufferLayout-D_IBo2ci.js";
|
|
3
|
-
import { n, r } from "./shared-BGBcSxBQ.js";
|
|
4
|
-
import { n as i } from "./AssetConfig-DSEntE65.js";
|
|
5
|
-
import "three";
|
|
6
|
-
//#region src/Processor/utils.js
|
|
7
|
-
var a = null;
|
|
8
|
-
function o(e) {
|
|
9
|
-
a = e;
|
|
10
|
-
}
|
|
11
|
-
var s = () => a?.({ type: e.LOADING_RESET }), c = (t) => {
|
|
12
|
-
a?.({
|
|
13
|
-
type: e.LOADING_UPDATE,
|
|
14
|
-
...t
|
|
15
|
-
});
|
|
16
|
-
}, l = (t) => {
|
|
17
|
-
a?.({
|
|
18
|
-
type: e.STATS_UPDATE,
|
|
19
|
-
...t
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
function u(e) {
|
|
23
|
-
return e.frameCount || 0;
|
|
24
|
-
}
|
|
25
|
-
function d(e) {
|
|
26
|
-
if (Array.isArray(e)) e.forEach((e) => {
|
|
27
|
-
e.userData && e.userData.isFallback || (f(e), e.dispose());
|
|
28
|
-
});
|
|
29
|
-
else {
|
|
30
|
-
if (e.userData && e.userData.isFallback) return;
|
|
31
|
-
f(e), e.dispose();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function f(e) {
|
|
35
|
-
e && [
|
|
36
|
-
"alphaMap",
|
|
37
|
-
"aoMap",
|
|
38
|
-
"bumpMap",
|
|
39
|
-
"clearcoatMap",
|
|
40
|
-
"clearcoatNormalMap",
|
|
41
|
-
"clearcoatRoughnessMap",
|
|
42
|
-
"displacementMap",
|
|
43
|
-
"emissiveMap",
|
|
44
|
-
"envMap",
|
|
45
|
-
"gradientMap",
|
|
46
|
-
"lightMap",
|
|
47
|
-
"map",
|
|
48
|
-
"metalnessMap",
|
|
49
|
-
"normalMap",
|
|
50
|
-
"roughnessMap",
|
|
51
|
-
"specularMap",
|
|
52
|
-
"sheenColorMap",
|
|
53
|
-
"sheenRoughnessMap",
|
|
54
|
-
"specularIntensityMap",
|
|
55
|
-
"specularColorMap",
|
|
56
|
-
"thicknessMap",
|
|
57
|
-
"transmissionMap",
|
|
58
|
-
"diffuseTransmissionMap",
|
|
59
|
-
"diffuseTransmissionColorMap"
|
|
60
|
-
].forEach((t) => {
|
|
61
|
-
e[t] && (e[t].dispose(), e[t] = null);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function p({ material: e, geometry: t, children: n }) {
|
|
65
|
-
if (e && d(e), t && t.dispose(), n.length > 0) for (let e of n) p(e);
|
|
66
|
-
}
|
|
67
|
-
function m(e) {
|
|
68
|
-
if (!e) return;
|
|
69
|
-
e._canvasTarget && e._onCanvasTargetResize && e._canvasTarget.removeEventListener("resize", e._onCanvasTargetResize);
|
|
70
|
-
let t = e.dispose();
|
|
71
|
-
return e._canvasTarget = null, t;
|
|
72
|
-
}
|
|
73
|
-
function h(e, t = []) {
|
|
74
|
-
if (e && !(t.includes(e.name) || e.isScene)) {
|
|
75
|
-
if (e.isMaterial) {
|
|
76
|
-
d(e);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
for (; e.children.length > 0;) for (let t of e.children) h(t);
|
|
80
|
-
p(e), e.removeFromParent(), e.clear();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function g(e) {
|
|
84
|
-
e?.traverse((e) => {
|
|
85
|
-
e.geometry?.userData?.__rayzeeOwned && e.geometry.dispose();
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
function _(e, t) {
|
|
89
|
-
return t;
|
|
90
|
-
}
|
|
91
|
-
function v(e, t = !1) {
|
|
92
|
-
return t ? 1 : 1 / (e + 1);
|
|
93
|
-
}
|
|
94
|
-
function y() {
|
|
95
|
-
let e = 0, t = 0, n = 0, r = 0;
|
|
96
|
-
return {
|
|
97
|
-
start() {
|
|
98
|
-
e = performance.now();
|
|
99
|
-
},
|
|
100
|
-
end() {
|
|
101
|
-
t = performance.now();
|
|
102
|
-
let i = t - e;
|
|
103
|
-
return r += i, n++, i;
|
|
104
|
-
},
|
|
105
|
-
getAverageFrameTime() {
|
|
106
|
-
return n > 0 ? r / n : 0;
|
|
107
|
-
},
|
|
108
|
-
getFPS() {
|
|
109
|
-
let e = this.getAverageFrameTime();
|
|
110
|
-
return e > 0 ? 1e3 / e : 0;
|
|
111
|
-
},
|
|
112
|
-
reset() {
|
|
113
|
-
n = 0, r = 0;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region src/Processor/ChunkedRecords.js
|
|
119
|
-
var b = 64 * 1024 * 1024, x = typeof SharedArrayBuffer < "u", S = null;
|
|
120
|
-
function C(e) {
|
|
121
|
-
S = e;
|
|
122
|
-
}
|
|
123
|
-
function w(e, t, n) {
|
|
124
|
-
let r = n ? new e(new SharedArrayBuffer(t * e.BYTES_PER_ELEMENT)) : new e(t);
|
|
125
|
-
return S && r.byteLength > 0 && S(r.byteLength, n), r;
|
|
126
|
-
}
|
|
127
|
-
var ee = class e {
|
|
128
|
-
constructor(e, t, n, r = b, i = !1) {
|
|
129
|
-
let a = t * n.BYTES_PER_ELEMENT, o = Math.max(1, Math.floor(r / a));
|
|
130
|
-
this.recordCount = e, this.lanesPerRecord = t, this.LaneType = n, this.recordsPerChunk = e <= o ? Math.max(e, 1) : o, this.shared = i, this.chunks = [];
|
|
131
|
-
let s = e;
|
|
132
|
-
for (; s > 0;) {
|
|
133
|
-
let e = Math.min(s, this.recordsPerChunk);
|
|
134
|
-
this.chunks.push(w(n, e * t, i)), s -= e;
|
|
135
|
-
}
|
|
136
|
-
this.chunks.length === 0 && this.chunks.push(w(n, 0, i));
|
|
137
|
-
}
|
|
138
|
-
static adopt(t, n, r, i) {
|
|
139
|
-
let a = Object.create(e.prototype);
|
|
140
|
-
return a.recordCount = n, a.lanesPerRecord = r, a.LaneType = t[0]?.constructor ?? null, a.recordsPerChunk = i, a.chunks = t, a.shared = typeof SharedArrayBuffer < "u" && t[0]?.buffer instanceof SharedArrayBuffer, a;
|
|
141
|
-
}
|
|
142
|
-
static lazy(t, n, r, i = b, a = !1) {
|
|
143
|
-
let o = Math.max(1, Math.floor(i / (n * r.BYTES_PER_ELEMENT))), s = Object.create(e.prototype);
|
|
144
|
-
return s.recordCount = t, s.lanesPerRecord = n, s.LaneType = r, s.recordsPerChunk = t <= o ? Math.max(t, 1) : o, s.shared = a, s.chunks = Array(Math.max(1, Math.ceil(t / s.recordsPerChunk))), s._views = [], s;
|
|
145
|
-
}
|
|
146
|
-
_materialize(e) {
|
|
147
|
-
if (this._owner) return this._owner._materialize(e), this.chunks[e];
|
|
148
|
-
let t = e * this.recordsPerChunk, n = Math.min(this.recordsPerChunk, this.recordCount - t) * this.lanesPerRecord, r = this.chunks[e] = w(this.LaneType, n, this.shared);
|
|
149
|
-
for (let t of this._liveViews()) t.chunks[e] = new t.LaneType(r.buffer, r.byteOffset, r.byteLength / t.LaneType.BYTES_PER_ELEMENT);
|
|
150
|
-
return r;
|
|
151
|
-
}
|
|
152
|
-
materializeAll() {
|
|
153
|
-
for (let e = 0; e < this.chunks.length; e++) !this.chunks[e] && !this._spilled?.has(e) && this._materialize(e);
|
|
154
|
-
return this;
|
|
155
|
-
}
|
|
156
|
-
get chunkCount() {
|
|
157
|
-
return this.chunks.length;
|
|
158
|
-
}
|
|
159
|
-
get single() {
|
|
160
|
-
return this.chunks.length === 1 ? this.chunks[0] : null;
|
|
161
|
-
}
|
|
162
|
-
get byteLength() {
|
|
163
|
-
let e = 0;
|
|
164
|
-
for (let t of this.chunks) t && (e += t.byteLength);
|
|
165
|
-
return e;
|
|
166
|
-
}
|
|
167
|
-
chunkFor(e) {
|
|
168
|
-
let t = e / this.recordsPerChunk | 0, n = this.chunks[t];
|
|
169
|
-
if (n) return n;
|
|
170
|
-
if (this._spilled?.has(t)) throw Error(`ChunkedRecords: chunk ${t} is on disk — await ensureResident() before touching record ${e}`);
|
|
171
|
-
return this._materialize(t);
|
|
172
|
-
}
|
|
173
|
-
async spill(e, { keep: t = () => !1 } = {}) {
|
|
174
|
-
if (this._owner) throw Error("ChunkedRecords: spill the storage, not a view of it");
|
|
175
|
-
this._store = e, this._spilled ??= /* @__PURE__ */ new Set();
|
|
176
|
-
let n = 0;
|
|
177
|
-
for (let r = 0; r < this.chunks.length; r++) {
|
|
178
|
-
let i = this.chunks[r];
|
|
179
|
-
if (!(!i || t(r))) {
|
|
180
|
-
await e.write(r, i), this.chunks[r] = null;
|
|
181
|
-
for (let e of this._liveViews()) e.chunks[r] = null;
|
|
182
|
-
this._spilled.add(r), n += i.byteLength;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return n;
|
|
186
|
-
}
|
|
187
|
-
async spillChunk(e, t) {
|
|
188
|
-
let n = this.chunks[e];
|
|
189
|
-
if (!n) return 0;
|
|
190
|
-
this._store = t, this._spilled ??= /* @__PURE__ */ new Set(), await t.write(e, n), this.chunks[e] = null;
|
|
191
|
-
for (let t of this._liveViews()) t.chunks[e] = null;
|
|
192
|
-
return this._spilled.add(e), n.byteLength;
|
|
193
|
-
}
|
|
194
|
-
async ensureResident(e = 0, t = this.recordCount) {
|
|
195
|
-
if (!this._spilled?.size || t <= 0) return;
|
|
196
|
-
let n = e / this.recordsPerChunk | 0, r = (e + t - 1) / this.recordsPerChunk | 0;
|
|
197
|
-
for (let e = n; e <= r; e++) {
|
|
198
|
-
if (!this._spilled.has(e)) continue;
|
|
199
|
-
let t = Math.min(this.recordsPerChunk, this.recordCount - e * this.recordsPerChunk) * this.lanesPerRecord, n = await this._store.read(e, t * this.LaneType.BYTES_PER_ELEMENT), r = w(this.LaneType, t, this.shared);
|
|
200
|
-
new Uint8Array(r.buffer, r.byteOffset, r.byteLength).set(new Uint8Array(n)), this.chunks[e] = r;
|
|
201
|
-
for (let t of this._liveViews()) t.chunks[e] = new t.LaneType(r.buffer, r.byteOffset, r.byteLength / t.LaneType.BYTES_PER_ELEMENT);
|
|
202
|
-
this._spilled.delete(e);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
_liveViews() {
|
|
206
|
-
return this._weakViews &&= this._weakViews.filter((e) => e.deref()), [...this._views ?? [], ...(this._weakViews ?? []).map((e) => e.deref())];
|
|
207
|
-
}
|
|
208
|
-
isResident(e = 0, t = this.recordCount) {
|
|
209
|
-
if (!this._spilled?.size || t <= 0) return !0;
|
|
210
|
-
let n = e / this.recordsPerChunk | 0, r = (e + t - 1) / this.recordsPerChunk | 0;
|
|
211
|
-
for (let e = n; e <= r; e++) if (this._spilled.has(e)) return !1;
|
|
212
|
-
return !0;
|
|
213
|
-
}
|
|
214
|
-
get spilledChunks() {
|
|
215
|
-
return this._spilled?.size ?? 0;
|
|
216
|
-
}
|
|
217
|
-
baseOf(e) {
|
|
218
|
-
return e % this.recordsPerChunk * this.lanesPerRecord;
|
|
219
|
-
}
|
|
220
|
-
isContiguous(e, t) {
|
|
221
|
-
return t <= 0 ? !0 : (e / this.recordsPerChunk | 0) == ((e + t - 1) / this.recordsPerChunk | 0);
|
|
222
|
-
}
|
|
223
|
-
slice(e, t) {
|
|
224
|
-
let n = this.baseOf(e), r = t * this.lanesPerRecord;
|
|
225
|
-
if (this.isContiguous(e, t)) return this.chunkFor(e).subarray(n, n + r);
|
|
226
|
-
let i = new this.LaneType(r);
|
|
227
|
-
return this.readRecords(e, t, i), i;
|
|
228
|
-
}
|
|
229
|
-
readRecords(e, t, n) {
|
|
230
|
-
let r = 0;
|
|
231
|
-
for (; r < t;) {
|
|
232
|
-
let i = e + r, a = this.chunkFor(i), o = this.baseOf(i), s = this.recordsPerChunk - i % this.recordsPerChunk, c = Math.min(s, t - r);
|
|
233
|
-
n.set(a.subarray(o, o + c * this.lanesPerRecord), r * this.lanesPerRecord), r += c;
|
|
234
|
-
}
|
|
235
|
-
return n;
|
|
236
|
-
}
|
|
237
|
-
setRecords(e, t) {
|
|
238
|
-
let n = t.length / this.lanesPerRecord, r = 0;
|
|
239
|
-
for (; r < n;) {
|
|
240
|
-
let i = e + r, a = this.chunkFor(i), o = this.baseOf(i), s = this.recordsPerChunk - i % this.recordsPerChunk, c = Math.min(s, n - r);
|
|
241
|
-
a.set(t.subarray(r * this.lanesPerRecord, (r + c) * this.lanesPerRecord), o), r += c;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
copyOf(e, t) {
|
|
245
|
-
return this.readRecords(e, t, new this.LaneType(t * this.lanesPerRecord));
|
|
246
|
-
}
|
|
247
|
-
trimTo(t) {
|
|
248
|
-
let n = Math.max(1, Math.ceil(t / this.recordsPerChunk)), r = this.chunks.slice(0, n), i = (t - (n - 1) * this.recordsPerChunk) * this.lanesPerRecord, a = r[n - 1];
|
|
249
|
-
return a.length > i && (r[n - 1] = a.subarray(0, Math.max(0, i))), e.adopt(r, t, this.lanesPerRecord, this.recordsPerChunk);
|
|
250
|
-
}
|
|
251
|
-
grow(e) {
|
|
252
|
-
if (e <= this.recordCount) return;
|
|
253
|
-
let t = this.chunks.length - 1, n = (e, t) => Math.min(this.recordsPerChunk, t - e * this.recordsPerChunk) * this.lanesPerRecord, r = this.chunks[t];
|
|
254
|
-
this.recordCount = e;
|
|
255
|
-
for (let t of this._liveViews()) t.recordCount = e;
|
|
256
|
-
if (this.chunks.length * this.recordsPerChunk < e) {
|
|
257
|
-
this.chunks.length = Math.ceil(e / this.recordsPerChunk);
|
|
258
|
-
for (let e of this._liveViews()) e.chunks.length = this.chunks.length;
|
|
259
|
-
}
|
|
260
|
-
if (r && r.length < n(t, e)) {
|
|
261
|
-
let i = w(this.LaneType, n(t, e), this.shared);
|
|
262
|
-
i.set(r), this.chunks[t] = i;
|
|
263
|
-
for (let e of this._liveViews()) e.chunks[t] = new e.LaneType(i.buffer, i.byteOffset, i.byteLength / e.LaneType.BYTES_PER_ELEMENT);
|
|
264
|
-
} else if (!r && this._spilled?.has(t)) throw Error(`ChunkedRecords: cannot grow past chunk ${t}, which is on disk`);
|
|
265
|
-
}
|
|
266
|
-
release(e, t) {
|
|
267
|
-
let n = this.recordsPerChunk, r = Math.ceil(e / n), i = Math.floor((e + t) / n), a = 0;
|
|
268
|
-
for (let e = r; e < i; e++) {
|
|
269
|
-
let t = this.chunks[e];
|
|
270
|
-
if (t) {
|
|
271
|
-
a += t.byteLength, this.chunks[e] = void 0;
|
|
272
|
-
for (let t of this._liveViews()) t.chunks[e] = void 0;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return a;
|
|
276
|
-
}
|
|
277
|
-
trimInPlace(e) {
|
|
278
|
-
let t = Math.max(1, Math.ceil(e / this.recordsPerChunk)), n = Math.max(0, (e - (t - 1) * this.recordsPerChunk) * this.lanesPerRecord), r = [this, ...this._liveViews()];
|
|
279
|
-
for (let i of r) {
|
|
280
|
-
i.chunks.length = t;
|
|
281
|
-
let r = i.chunks[t - 1];
|
|
282
|
-
r && r.length > n && (i.chunks[t - 1] = r.subarray(0, n)), i.recordCount = e;
|
|
283
|
-
}
|
|
284
|
-
if (this._spilled) for (let e of this._spilled) e >= t && this._spilled.delete(e);
|
|
285
|
-
return this;
|
|
286
|
-
}
|
|
287
|
-
viewAs(t) {
|
|
288
|
-
let n = (e) => new t(e.buffer, e.byteOffset, e.byteLength / t.BYTES_PER_ELEMENT), r = e.adopt(this.chunks.map((e) => e ? n(e) : void 0), this.recordCount, this.lanesPerRecord, this.recordsPerChunk);
|
|
289
|
-
return r.LaneType = t, r._owner = this, this._views ? this._views.push(r) : (this._weakViews ??= []).push(new WeakRef(r)), r._spilled = this._spilled ??= /* @__PURE__ */ new Set(), r;
|
|
290
|
-
}
|
|
291
|
-
}, T = {
|
|
292
|
-
Worker: null,
|
|
293
|
-
decodeImage: null
|
|
294
|
-
};
|
|
295
|
-
function E(e) {
|
|
296
|
-
e && Object.assign(T, e);
|
|
297
|
-
}
|
|
298
|
-
function D() {
|
|
299
|
-
return T;
|
|
300
|
-
}
|
|
301
|
-
function O() {
|
|
302
|
-
return typeof navigator < "u" && navigator.hardwareConcurrency || 4;
|
|
303
|
-
}
|
|
304
|
-
function k() {
|
|
305
|
-
return !!T.decodeImage || typeof self < "u" && (typeof createImageBitmap < "u" || typeof document < "u");
|
|
306
|
-
}
|
|
307
|
-
function A() {
|
|
308
|
-
return !!T.Worker || typeof Worker < "u";
|
|
309
|
-
}
|
|
310
|
-
var j = 0;
|
|
311
|
-
async function M(e) {
|
|
312
|
-
if (!T.Worker || j === 0 && globalThis.Worker !== void 0) return e();
|
|
313
|
-
j++ === 0 && (globalThis.Worker = T.Worker);
|
|
314
|
-
try {
|
|
315
|
-
return await e();
|
|
316
|
-
} finally {
|
|
317
|
-
--j === 0 && globalThis.Worker === T.Worker && delete globalThis.Worker;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
function N(e, t) {
|
|
321
|
-
let n = T.Worker;
|
|
322
|
-
if (!n) return new e(t);
|
|
323
|
-
let r = Object.prototype.hasOwnProperty.call(globalThis, "Worker"), i = globalThis.Worker;
|
|
324
|
-
globalThis.Worker = n;
|
|
325
|
-
try {
|
|
326
|
-
return new e(t);
|
|
327
|
-
} finally {
|
|
328
|
-
r ? globalThis.Worker = i : delete globalThis.Worker;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
//#endregion
|
|
332
|
-
//#region src/Storage/CDFCache.js
|
|
333
|
-
var P = 5;
|
|
334
|
-
function F(e, t) {
|
|
335
|
-
e && t && (e.userData.__rayzeeSource = t);
|
|
336
|
-
}
|
|
337
|
-
function I(e) {
|
|
338
|
-
let t = e?.userData?.__rayzeeSource;
|
|
339
|
-
if (!t) return null;
|
|
340
|
-
let { width: n = 0, height: r = 0 } = e.image ?? {};
|
|
341
|
-
return `cdf:${P}:${t}|${n}x${r}|${e.userData.__rayzeeColorSpace ?? "native"}`;
|
|
342
|
-
}
|
|
343
|
-
var L = () => n(i().cacheNamespace)?.area(r.CDF) ?? null, R = [
|
|
344
|
-
"exactConditional",
|
|
345
|
-
"exactMarginal",
|
|
346
|
-
"exactRowGuide",
|
|
347
|
-
"exactMarginalGuide"
|
|
348
|
-
], z = R.map((e) => `${e}.f32`);
|
|
349
|
-
async function B(e) {
|
|
350
|
-
let t = I(e), n = t ? await L()?.open(t) : null;
|
|
351
|
-
if (!n) return null;
|
|
352
|
-
try {
|
|
353
|
-
let e = await Promise.all(z.map((e) => n.file(e)));
|
|
354
|
-
if (e.some((e) => !e)) return null;
|
|
355
|
-
let t = await Promise.all(e.map(async (e) => new Float32Array(await e.arrayBuffer()))), { totalSum: r, width: i, height: a, exactWidth: o, exactHeight: s, radianceIntegral: c } = n.extra;
|
|
356
|
-
return {
|
|
357
|
-
...Object.fromEntries(R.map((e, n) => [e, t[n]])),
|
|
358
|
-
totalSum: r,
|
|
359
|
-
width: i,
|
|
360
|
-
height: a,
|
|
361
|
-
exactWidth: o,
|
|
362
|
-
exactHeight: s,
|
|
363
|
-
radianceIntegral: c
|
|
364
|
-
};
|
|
365
|
-
} finally {
|
|
366
|
-
n.release();
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
async function te(e, t) {
|
|
370
|
-
let { totalSum: n, width: r, height: i, exactWidth: a, exactHeight: o, radianceIntegral: s } = t, c = R.map((e) => t[e]), l = I(e), u = l ? L() : null;
|
|
371
|
-
if (!u || c.some((e) => !e)) return !1;
|
|
372
|
-
let d = await u.create(l, {
|
|
373
|
-
label: e.name || "environment",
|
|
374
|
-
expectedBytes: c.reduce((e, t) => e + t.byteLength, 0)
|
|
375
|
-
});
|
|
376
|
-
if (!d) return !1;
|
|
377
|
-
try {
|
|
378
|
-
for (let e = 0; e < z.length; e++) await d.write(z[e], c[e]);
|
|
379
|
-
return await d.commit({
|
|
380
|
-
totalSum: n,
|
|
381
|
-
width: r,
|
|
382
|
-
height: i,
|
|
383
|
-
exactWidth: a,
|
|
384
|
-
exactHeight: o,
|
|
385
|
-
radianceIntegral: s
|
|
386
|
-
}), !0;
|
|
387
|
-
} catch {
|
|
388
|
-
return await d.abort(), !1;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
//#endregion
|
|
392
|
-
//#region src/Processor/HostMemory.js
|
|
393
|
-
var V = t.FLOATS_PER_TRIANGLE * 4, H = 64, U = .9, W = 64, G = 4, K = 1536 * 1024 * 1024, q = 7040 * 1024 * 1024, J = 9216 * 1024 * 1024, Y = 6e7, X = 8e6;
|
|
394
|
-
function Z(e) {
|
|
395
|
-
if (e > 0) return {
|
|
396
|
-
gb: e,
|
|
397
|
-
assumed: !1
|
|
398
|
-
};
|
|
399
|
-
let t = typeof navigator < "u" ? navigator.deviceMemory : void 0;
|
|
400
|
-
return t > 0 ? {
|
|
401
|
-
gb: t,
|
|
402
|
-
assumed: !1
|
|
403
|
-
} : {
|
|
404
|
-
gb: 4,
|
|
405
|
-
assumed: !0
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
var Q = 1.15, ne = 12 * 1024 * 1024 * 1024;
|
|
409
|
-
function re({ triangles: e, placements: t, geometryBytes: n = 0 }) {
|
|
410
|
-
let r = {
|
|
411
|
-
triangles: e * V,
|
|
412
|
-
bvh: Math.ceil(e * U) * H,
|
|
413
|
-
geometry: n,
|
|
414
|
-
placements: t * W,
|
|
415
|
-
orderMaps: e * G
|
|
416
|
-
};
|
|
417
|
-
return r.total = r.triangles + r.bvh + r.geometry + r.placements + r.orderMaps, r;
|
|
418
|
-
}
|
|
419
|
-
function ie(e, { chunkBytes: t = b, shared: n = !1, allocate: r = null } = {}) {
|
|
420
|
-
let i = Math.min(e, ne), a = r ?? (n ? (e) => new SharedArrayBuffer(e) : (e) => new ArrayBuffer(e)), o = [], s = 0;
|
|
421
|
-
try {
|
|
422
|
-
for (; s < i;) {
|
|
423
|
-
let e = Math.min(t, i - s);
|
|
424
|
-
o.push(a(e)), s += e;
|
|
425
|
-
}
|
|
426
|
-
} catch {}
|
|
427
|
-
for (let e = o.length - 1; e >= 0; e--) o[e] = null;
|
|
428
|
-
return o.length = 0, {
|
|
429
|
-
placed: s,
|
|
430
|
-
want: i,
|
|
431
|
-
exhausted: s < i,
|
|
432
|
-
capped: e > i
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
var ae = class {
|
|
436
|
-
constructor() {
|
|
437
|
-
this.reset();
|
|
438
|
-
}
|
|
439
|
-
reset() {
|
|
440
|
-
this.phase = "idle", this.events = [], this.samples = [], this.allocatedBytes = 0, this.peakLiveBytes = 0, this.byPhase = Object.create(null);
|
|
441
|
-
}
|
|
442
|
-
mark(e) {
|
|
443
|
-
return this.phase = e, this.byPhase[e] ??= {
|
|
444
|
-
allocated: 0,
|
|
445
|
-
chunks: 0
|
|
446
|
-
}, this;
|
|
447
|
-
}
|
|
448
|
-
alloc(e, t = "chunk") {
|
|
449
|
-
if (!(e > 0)) return;
|
|
450
|
-
let n = this.byPhase[this.phase] ??= {
|
|
451
|
-
allocated: 0,
|
|
452
|
-
chunks: 0
|
|
453
|
-
};
|
|
454
|
-
n.allocated += e, n.chunks++, this.allocatedBytes += e, this.events.push({
|
|
455
|
-
phase: this.phase,
|
|
456
|
-
bytes: e,
|
|
457
|
-
what: t,
|
|
458
|
-
at: performance.now()
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
sample(e, t) {
|
|
462
|
-
let n = 0;
|
|
463
|
-
for (let e in t) n += t[e] || 0;
|
|
464
|
-
return n > this.peakLiveBytes && (this.peakLiveBytes = n), this.samples.push({
|
|
465
|
-
label: e,
|
|
466
|
-
phase: this.phase,
|
|
467
|
-
total: n,
|
|
468
|
-
parts: t,
|
|
469
|
-
at: performance.now()
|
|
470
|
-
}), n;
|
|
471
|
-
}
|
|
472
|
-
get report() {
|
|
473
|
-
return {
|
|
474
|
-
allocatedBytes: this.allocatedBytes,
|
|
475
|
-
peakLiveBytes: this.peakLiveBytes,
|
|
476
|
-
byPhase: { ...this.byPhase },
|
|
477
|
-
samples: this.samples.slice()
|
|
478
|
-
};
|
|
479
|
-
}
|
|
480
|
-
}, oe = "11.2.0", $ = 1e4, se = 15e5;
|
|
481
|
-
function ce(e, t, n = $) {
|
|
482
|
-
return e >= n && t / se < e / 3;
|
|
483
|
-
}
|
|
484
|
-
//#endregion
|
|
485
|
-
export { g as A, M as C, C as D, x as E, o as F, _ as I, c as L, m as M, u as N, v as O, s as P, l as R, A as S, b as T, E as _, ae as a, O as b, q as c, Z as d, re as f, F as g, te as h, J as i, h as j, y as k, X as l, B as m, ce as n, K as o, ie as p, oe as r, Q as s, $ as t, Y as u, N as v, ee as w, k as x, D as y };
|