rayzee 9.5.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +22 -20
  2. package/dist/{ArchiveImporter-xuUJiklP.js → ArchiveImporter-BRQvLggb.js} +12 -13
  3. package/dist/{BidirectionalIntegrator-C5PKjJoT.js → BidirectionalIntegrator-9lZQxFVH.js} +87 -87
  4. package/dist/BufferLayout-D_IBo2ci.js +150 -0
  5. package/dist/{ColorManagement-CheBCPaW.js → ColorManagement-oeEk7oSu.js} +171 -171
  6. package/dist/{NeuralRetouch-CW11yLZ_.js → NeuralRetouch-BCXylThH.js} +3 -3
  7. package/dist/{NeuralSuperRes-BekaecYg.js → NeuralSuperRes-sZAeS142.js} +3 -3
  8. package/dist/{PathTracer-Ccl9KOuF.js → PathTracer-CQPW06Mm.js} +2911 -2669
  9. package/dist/{PhysicalSky-Dv2PMFGW.js → PhysicalSky-BvqCw_dy.js} +2 -2
  10. package/dist/{RayzeeRenderer-BQxnzCTD.js → RayzeeRenderer-COpwotpU.js} +338 -329
  11. package/dist/{SolarLimb-ken-JbDK.js → SolarLimb-CPaeZVwz.js} +10 -10
  12. package/dist/{ToneMapGPU-BHi5JzIq.js → ToneMapGPU-CjU3osDd.js} +1 -1
  13. package/dist/{ViewTransforms-D0rTLBsX.js → ViewTransforms-CYN7bq2w.js} +2 -2
  14. package/dist/addons/archives.es.js +1 -1
  15. package/dist/addons/bidirectional.es.js +1 -1
  16. package/dist/addons/color.es.js +1 -1
  17. package/dist/addons/physical-sky.es.js +1 -1
  18. package/dist/rayzee-core.es.js +11 -11
  19. package/dist/rayzee.es.js +734 -599
  20. package/dist/rayzee.umd.js +102 -102
  21. package/dist/sceneCachePolicy-BSSsKY98.js +443 -0
  22. package/package.json +1 -1
  23. package/src/Color/ViewTransforms.js +5 -1
  24. package/src/EngineDefaults.js +59 -1032
  25. package/src/Headless.js +6 -5
  26. package/src/Passes/OIDNTemporalHistory.js +1 -1
  27. package/src/PathTracerApp.js +5 -3
  28. package/src/Processor/AssetLoader.js +6 -5
  29. package/src/Processor/BVHBuilder.js +10 -31
  30. package/src/Processor/BVHLeafFold.js +4 -6
  31. package/src/Processor/BVHRefitter.js +3 -46
  32. package/src/Processor/BufferLayout.js +291 -0
  33. package/src/Processor/EmissiveTriangleBuilder.js +1 -1
  34. package/src/Processor/GeometryExtractor.js +3 -3
  35. package/src/Processor/HostMemory.js +7 -1
  36. package/src/Processor/InstanceTable.js +1 -1
  37. package/src/Processor/MaterialPacking.js +2 -1
  38. package/src/Processor/PBRT/PBRTSceneBuilder.js +1 -1
  39. package/src/Processor/QueueManager.js +28 -3
  40. package/src/Processor/SceneProcessor.js +4 -2
  41. package/src/Processor/SplitBLAS.js +1 -1
  42. package/src/Processor/StorageTexturePool.js +22 -1
  43. package/src/Processor/TLASBuilder.js +1 -3
  44. package/src/Processor/TextureBuckets.js +237 -0
  45. package/src/Processor/TextureCreator.js +10 -1
  46. package/src/Processor/Workers/TexturesWorker.js +5 -6
  47. package/src/RayzeeRenderer.js +29 -32
  48. package/src/RenderSettings.js +26 -28
  49. package/src/Stages/ASVGF.js +8 -7
  50. package/src/Stages/AutoExposure.js +14 -5
  51. package/src/Stages/BilateralFilter.js +2 -1
  52. package/src/Stages/DenoiserSettings.js +182 -0
  53. package/src/Stages/EdgeFilter.js +2 -1
  54. package/src/Stages/MotionVector.js +1 -1
  55. package/src/Stages/NRD.js +2 -3
  56. package/src/Stages/NormalDepth.js +3 -2
  57. package/src/Stages/PathTracer.js +72 -4
  58. package/src/Stages/PathTracerStage.js +2 -1
  59. package/src/Stages/Variance.js +1 -1
  60. package/src/TSL/BVHTraversal.js +4 -1
  61. package/src/TSL/Common.js +1 -1
  62. package/src/TSL/EmissiveSampling.js +1 -1
  63. package/src/TSL/LightVisibility.js +111 -0
  64. package/src/TSL/LightsSampling.js +151 -15
  65. package/src/TSL/Random.js +1 -1
  66. package/src/TSL/ShadeKernel.js +88 -3
  67. package/src/TSL/TextureSampling.js +1 -1
  68. package/src/core.js +5 -9
  69. package/src/index.js +10 -21
  70. package/src/integrators/BidirectionalIntegrator.js +2 -1
  71. package/src/managers/CameraManager.js +17 -7
  72. package/src/managers/DenoisingManager.js +14 -10
  73. package/src/managers/EnvironmentManager.js +32 -13
  74. package/src/managers/MaterialDataManager.js +3 -3
  75. package/src/managers/UniformManager.js +2 -2
  76. package/dist/EngineDefaults-DH3bI5t-.js +0 -844
  77. package/dist/sceneCachePolicy-BmwYOYDu.js +0 -183
  78. /package/dist/{Logger-BnHghprG.js → Logger-dDDGj9Av.js} +0 -0
@@ -0,0 +1,443 @@
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 T = 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
+ }, E = 5;
292
+ function D(e, t) {
293
+ e && t && (e.userData.__rayzeeSource = t);
294
+ }
295
+ function O(e) {
296
+ let t = e?.userData?.__rayzeeSource;
297
+ if (!t) return null;
298
+ let { width: n = 0, height: r = 0 } = e.image ?? {};
299
+ return `cdf:${E}:${t}|${n}x${r}|${e.userData.__rayzeeColorSpace ?? "native"}`;
300
+ }
301
+ var k = () => n(i().cacheNamespace)?.area(r.CDF) ?? null, A = [
302
+ "exactConditional",
303
+ "exactMarginal",
304
+ "exactRowGuide",
305
+ "exactMarginalGuide"
306
+ ], j = A.map((e) => `${e}.f32`);
307
+ async function M(e) {
308
+ let t = O(e), n = t ? await k()?.open(t) : null;
309
+ if (!n) return null;
310
+ try {
311
+ let e = await Promise.all(j.map((e) => n.file(e)));
312
+ if (e.some((e) => !e)) return null;
313
+ 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;
314
+ return {
315
+ ...Object.fromEntries(A.map((e, n) => [e, t[n]])),
316
+ totalSum: r,
317
+ width: i,
318
+ height: a,
319
+ exactWidth: o,
320
+ exactHeight: s,
321
+ radianceIntegral: c
322
+ };
323
+ } finally {
324
+ n.release();
325
+ }
326
+ }
327
+ async function N(e, t) {
328
+ let { totalSum: n, width: r, height: i, exactWidth: a, exactHeight: o, radianceIntegral: s } = t, c = A.map((e) => t[e]), l = O(e), u = l ? k() : null;
329
+ if (!u || c.some((e) => !e)) return !1;
330
+ let d = await u.create(l, {
331
+ label: e.name || "environment",
332
+ expectedBytes: c.reduce((e, t) => e + t.byteLength, 0)
333
+ });
334
+ if (!d) return !1;
335
+ try {
336
+ for (let e = 0; e < j.length; e++) await d.write(j[e], c[e]);
337
+ return await d.commit({
338
+ totalSum: n,
339
+ width: r,
340
+ height: i,
341
+ exactWidth: a,
342
+ exactHeight: o,
343
+ radianceIntegral: s
344
+ }), !0;
345
+ } catch {
346
+ return await d.abort(), !1;
347
+ }
348
+ }
349
+ //#endregion
350
+ //#region src/Processor/HostMemory.js
351
+ var P = t.FLOATS_PER_TRIANGLE * 4, F = 64, I = .9, L = 64, R = 4, z = 1536 * 1024 * 1024, B = 7040 * 1024 * 1024, V = 9216 * 1024 * 1024, H = 6e7, U = 8e6;
352
+ function W(e) {
353
+ if (e > 0) return {
354
+ gb: e,
355
+ assumed: !1
356
+ };
357
+ let t = typeof navigator < "u" ? navigator.deviceMemory : void 0;
358
+ return t > 0 ? {
359
+ gb: t,
360
+ assumed: !1
361
+ } : {
362
+ gb: 4,
363
+ assumed: !0
364
+ };
365
+ }
366
+ var G = 1.15, K = 12 * 1024 * 1024 * 1024;
367
+ function q({ triangles: e, placements: t, geometryBytes: n = 0 }) {
368
+ let r = {
369
+ triangles: e * P,
370
+ bvh: Math.ceil(e * I) * F,
371
+ geometry: n,
372
+ placements: t * L,
373
+ orderMaps: e * R
374
+ };
375
+ return r.total = r.triangles + r.bvh + r.geometry + r.placements + r.orderMaps, r;
376
+ }
377
+ function J(e, { chunkBytes: t = b, shared: n = !1, allocate: r = null } = {}) {
378
+ let i = Math.min(e, K), a = r ?? (n ? (e) => new SharedArrayBuffer(e) : (e) => new ArrayBuffer(e)), o = [], s = 0;
379
+ try {
380
+ for (; s < i;) {
381
+ let e = Math.min(t, i - s);
382
+ o.push(a(e)), s += e;
383
+ }
384
+ } catch {}
385
+ for (let e = o.length - 1; e >= 0; e--) o[e] = null;
386
+ return o.length = 0, {
387
+ placed: s,
388
+ want: i,
389
+ exhausted: s < i,
390
+ capped: e > i
391
+ };
392
+ }
393
+ var Y = class {
394
+ constructor() {
395
+ this.reset();
396
+ }
397
+ reset() {
398
+ this.phase = "idle", this.events = [], this.samples = [], this.allocatedBytes = 0, this.peakLiveBytes = 0, this.byPhase = Object.create(null);
399
+ }
400
+ mark(e) {
401
+ return this.phase = e, this.byPhase[e] ??= {
402
+ allocated: 0,
403
+ chunks: 0
404
+ }, this;
405
+ }
406
+ alloc(e, t = "chunk") {
407
+ if (!(e > 0)) return;
408
+ let n = this.byPhase[this.phase] ??= {
409
+ allocated: 0,
410
+ chunks: 0
411
+ };
412
+ n.allocated += e, n.chunks++, this.allocatedBytes += e, this.events.push({
413
+ phase: this.phase,
414
+ bytes: e,
415
+ what: t,
416
+ at: performance.now()
417
+ });
418
+ }
419
+ sample(e, t) {
420
+ let n = 0;
421
+ for (let e in t) n += t[e] || 0;
422
+ return n > this.peakLiveBytes && (this.peakLiveBytes = n), this.samples.push({
423
+ label: e,
424
+ phase: this.phase,
425
+ total: n,
426
+ parts: t,
427
+ at: performance.now()
428
+ }), n;
429
+ }
430
+ get report() {
431
+ return {
432
+ allocatedBytes: this.allocatedBytes,
433
+ peakLiveBytes: this.peakLiveBytes,
434
+ byPhase: { ...this.byPhase },
435
+ samples: this.samples.slice()
436
+ };
437
+ }
438
+ }, X = "11.0.0", Z = 1e4, Q = 15e5;
439
+ function $(e, t, n = Z) {
440
+ return e >= n && t / Q < e / 3;
441
+ }
442
+ //#endregion
443
+ export { c as A, g as C, s as D, u as E, o as O, y as S, m as T, T as _, Y as a, C as b, B as c, W as d, q as f, D as g, N as h, V as i, l as j, _ as k, U as l, M as m, $ as n, z as o, J as p, X as r, G as s, Z as t, H as u, b as v, h as w, v as x, x as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rayzee",
3
- "version": "9.5.0",
3
+ "version": "11.0.0",
4
4
  "type": "module",
5
5
  "description": "Real-time WebGPU path tracing engine built on Three.js",
6
6
  "main": "dist/rayzee.umd.js",
@@ -18,7 +18,7 @@
18
18
  * `outputEncoded` is what tells each consumer which it is holding.
19
19
  */
20
20
 
21
- import { NoToneMapping } from 'three';
21
+ import { NoToneMapping, AgXToneMapping } from 'three';
22
22
  import { BUILTIN_VIEWS } from './BuiltinViews.js';
23
23
 
24
24
  /** First id an OCIO-derived view gets. Clear of three.js's own constants and room to grow. */
@@ -321,3 +321,7 @@ export function resetViewTransforms() {
321
321
 
322
322
  /** The id to fall back to when a chosen one disappears. */
323
323
  export const FALLBACK_VIEW = NoToneMapping;
324
+
325
+ // The view a renderer starts on: AgX, Blender/Cycles' default. ACES crushes shadows on this engine's own
326
+ // corpus (shade 1.48 against AgX's 3.01 from identical radiance).
327
+ export const DEFAULT_VIEW = AgXToneMapping;