rayzee 11.12.0 → 11.13.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/dist/{ArchiveImporter-vUowipjh.js → ArchiveImporter-DQU55mit.js} +1322 -1290
- package/dist/{BidirectionalIntegrator-DPh6PSYb.js → BidirectionalIntegrator-CLmFjSN3.js} +2 -2
- package/dist/{NeuralRetouch-wwAwssFM.js → NeuralRetouch-CEkBhI1M.js} +1 -1
- package/dist/{NeuralSuperRes-DqV4v_gQ.js → NeuralSuperRes-Drjws9nE.js} +1 -1
- package/dist/{PathTracer-DW-ElMON.js → PathTracer-7a7L3cGF.js} +3448 -3404
- package/dist/{PhysicalSky-Ispr77Lf.js → PhysicalSky-DUIbTE93.js} +1 -1
- package/dist/{RayzeeRenderer-CPbY683A.js → RayzeeRenderer-CjjGT2e0.js} +340 -340
- package/dist/{SceneMetadata-BNA22-m3.js → SceneMetadata-CoAHTAmo.js} +1 -1
- package/dist/addons/archives.es.js +1 -1
- package/dist/addons/bidirectional.es.js +1 -1
- package/dist/addons/physical-sky.es.js +1 -1
- package/dist/rayzee-core.es.js +4 -4
- package/dist/rayzee.es.js +13 -13
- package/dist/rayzee.umd.js +110 -110
- package/dist/{sceneCachePolicy-BLvdjkVh.js → sceneCachePolicy-DavHt6Ii.js} +217 -185
- package/package.json +1 -1
- package/src/Processor/ArchiveImporter.js +25 -3
- package/src/Processor/AssetLoader.js +6 -4
- package/src/Processor/InstanceTable.js +36 -11
- package/src/Processor/PBRT/PBRTCurves.js +6 -3
- package/src/Processor/PBRT/PBRTSceneBuilder.js +26 -3
- package/src/Processor/PBRT/index.js +1 -0
- package/src/Processor/SceneProcessor.js +43 -5
- package/src/Processor/TLASBuilder.js +5 -4
- package/src/Processor/USD/USDScene.js +6 -1
- package/src/Processor/USD/index.js +2 -2
- package/src/Processor/utils.js +80 -1
- package/src/Stages/PathTracerStage.js +17 -6
- package/src/TSL/BVHTraversal.js +1 -1
|
@@ -4,36 +4,68 @@ import { f as i, v as a, y as o } from "./BufferLayout-BROyMqO1.js";
|
|
|
4
4
|
import { n as s } from "./EngineIssues-CfJiBaNj.js";
|
|
5
5
|
import { n as c, r as l } from "./shared-BGBcSxBQ.js";
|
|
6
6
|
import { n as u } from "./AssetConfig-DSEntE65.js";
|
|
7
|
-
import { BackSide as d,
|
|
7
|
+
import { BackSide as d, Box3 as f, BufferAttribute as p, Color as m, DoubleSide as h, FrontSide as g, Matrix3 as _, Matrix4 as v, RGBAFormat as y, Vector2 as b, Vector3 as x } from "three";
|
|
8
8
|
//#region src/Processor/utils.js
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
|
|
9
|
+
var S = null;
|
|
10
|
+
function C(e) {
|
|
11
|
+
S = e;
|
|
12
12
|
}
|
|
13
|
-
var
|
|
14
|
-
|
|
13
|
+
var w = () => S?.({ type: e.LOADING_RESET }), T = (t) => {
|
|
14
|
+
S?.({
|
|
15
15
|
type: e.LOADING_UPDATE,
|
|
16
16
|
...t
|
|
17
17
|
});
|
|
18
|
-
},
|
|
19
|
-
|
|
18
|
+
}, ee = (t) => {
|
|
19
|
+
S?.({
|
|
20
20
|
type: e.STATS_UPDATE,
|
|
21
21
|
...t
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
|
-
function
|
|
24
|
+
function E() {
|
|
25
|
+
return typeof MessageChannel > "u" ? new Promise((e) => setTimeout(e, 0)) : new Promise((e) => {
|
|
26
|
+
let { port1: t, port2: n } = new MessageChannel();
|
|
27
|
+
t.onmessage = () => {
|
|
28
|
+
t.close(), e();
|
|
29
|
+
}, n.postMessage(null);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function D(e = 50) {
|
|
33
|
+
let t = performance.now(), n = () => {
|
|
34
|
+
t = performance.now();
|
|
35
|
+
};
|
|
36
|
+
return () => performance.now() - t < e ? null : E().then(n);
|
|
37
|
+
}
|
|
38
|
+
function O(e) {
|
|
39
|
+
e.traverse((e) => {
|
|
40
|
+
if (!e.isInstancedMesh || e.boundingBox !== null) return;
|
|
41
|
+
let t = e.geometry;
|
|
42
|
+
t.boundingBox === null && t.computeBoundingBox();
|
|
43
|
+
let n = e.boundingBox = new f(), r = t.boundingBox;
|
|
44
|
+
if (r.isEmpty()) return;
|
|
45
|
+
let i = [r.min.x, r.max.x], a = [r.min.y, r.max.y], o = [r.min.z, r.max.z], s = e.instanceMatrix.array, c = Infinity, l = Infinity, u = Infinity, d = -Infinity, p = -Infinity, m = -Infinity;
|
|
46
|
+
for (let t = 0, n = 0; t < e.count; t++, n += 16) {
|
|
47
|
+
let e = s[n], t = s[n + 1], r = s[n + 2], f = s[n + 3], h = s[n + 4], g = s[n + 5], _ = s[n + 6], v = s[n + 7], y = s[n + 8], b = s[n + 9], x = s[n + 10], S = s[n + 11], C = s[n + 12], w = s[n + 13], T = s[n + 14], ee = s[n + 15];
|
|
48
|
+
for (let n = 0; n < 8; n++) {
|
|
49
|
+
let s = i[n >> 2], E = a[n >> 1 & 1], D = o[n & 1], O = 1 / (f * s + v * E + S * D + ee), k = (e * s + h * E + y * D + C) * O, A = (t * s + g * E + b * D + w) * O, j = (r * s + _ * E + x * D + T) * O;
|
|
50
|
+
c = Math.min(c, k), l = Math.min(l, A), u = Math.min(u, j), d = Math.max(d, k), p = Math.max(p, A), m = Math.max(m, j);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
n.min.set(c, l, u), n.max.set(d, p, m);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function k(e) {
|
|
25
57
|
return e.frameCount || 0;
|
|
26
58
|
}
|
|
27
|
-
function
|
|
59
|
+
function A(e) {
|
|
28
60
|
if (Array.isArray(e)) e.forEach((e) => {
|
|
29
|
-
e.userData && e.userData.isFallback || (
|
|
61
|
+
e.userData && e.userData.isFallback || (j(e), e.dispose());
|
|
30
62
|
});
|
|
31
63
|
else {
|
|
32
64
|
if (e.userData && e.userData.isFallback) return;
|
|
33
|
-
|
|
65
|
+
j(e), e.dispose();
|
|
34
66
|
}
|
|
35
67
|
}
|
|
36
|
-
function
|
|
68
|
+
function j(e) {
|
|
37
69
|
e && [
|
|
38
70
|
"alphaMap",
|
|
39
71
|
"aoMap",
|
|
@@ -63,37 +95,37 @@ function ne(e) {
|
|
|
63
95
|
e[t] && (e[t].dispose(), e[t] = null);
|
|
64
96
|
});
|
|
65
97
|
}
|
|
66
|
-
function
|
|
67
|
-
if (e &&
|
|
98
|
+
function te({ material: e, geometry: t, children: n }) {
|
|
99
|
+
if (e && A(e), t && t.dispose(), n.length > 0) for (let e of n) te(e);
|
|
68
100
|
}
|
|
69
|
-
function
|
|
101
|
+
function ne(e) {
|
|
70
102
|
if (!e) return;
|
|
71
103
|
e._canvasTarget && e._onCanvasTargetResize && e._canvasTarget.removeEventListener("resize", e._onCanvasTargetResize);
|
|
72
104
|
let t = e.dispose();
|
|
73
105
|
return e._canvasTarget = null, t;
|
|
74
106
|
}
|
|
75
|
-
function
|
|
107
|
+
function re(e, t = []) {
|
|
76
108
|
if (e && !(t.includes(e.name) || e.isScene)) {
|
|
77
109
|
if (e.isMaterial) {
|
|
78
|
-
|
|
110
|
+
A(e);
|
|
79
111
|
return;
|
|
80
112
|
}
|
|
81
|
-
for (; e.children.length > 0;) for (let t of e.children)
|
|
82
|
-
|
|
113
|
+
for (; e.children.length > 0;) for (let t of e.children) re(t);
|
|
114
|
+
te(e), e.removeFromParent(), e.clear();
|
|
83
115
|
}
|
|
84
116
|
}
|
|
85
|
-
function
|
|
117
|
+
function ie(e) {
|
|
86
118
|
e?.traverse((e) => {
|
|
87
119
|
e.geometry?.userData?.__rayzeeOwned && e.geometry.dispose();
|
|
88
120
|
});
|
|
89
121
|
}
|
|
90
|
-
function
|
|
122
|
+
function ae(e, t) {
|
|
91
123
|
return t;
|
|
92
124
|
}
|
|
93
|
-
function
|
|
125
|
+
function oe(e, t = !1) {
|
|
94
126
|
return t ? 1 : 1 / (e + 1);
|
|
95
127
|
}
|
|
96
|
-
function
|
|
128
|
+
function se() {
|
|
97
129
|
let e = 0, t = 0, n = 0, r = 0;
|
|
98
130
|
return {
|
|
99
131
|
start() {
|
|
@@ -118,7 +150,7 @@ function le() {
|
|
|
118
150
|
}
|
|
119
151
|
//#endregion
|
|
120
152
|
//#region src/EngineDefaults.js
|
|
121
|
-
var
|
|
153
|
+
var M = le({
|
|
122
154
|
maxBounces: 3,
|
|
123
155
|
transmissiveBounces: 5,
|
|
124
156
|
maxSubsurfaceSteps: 8,
|
|
@@ -180,11 +212,11 @@ var E = de({
|
|
|
180
212
|
areaLightIntensityScale: .1,
|
|
181
213
|
visMode: 0,
|
|
182
214
|
debugVisScale: 100
|
|
183
|
-
}),
|
|
215
|
+
}), ce = Object.freeze({
|
|
184
216
|
perspective: 0,
|
|
185
217
|
equirectangular: 1,
|
|
186
218
|
orthographic: 2
|
|
187
|
-
}),
|
|
219
|
+
}), N = le({
|
|
188
220
|
color: [
|
|
189
221
|
1,
|
|
190
222
|
1,
|
|
@@ -260,11 +292,11 @@ var E = de({
|
|
|
260
292
|
],
|
|
261
293
|
diffuseRoughness: 0
|
|
262
294
|
});
|
|
263
|
-
function
|
|
295
|
+
function le(e) {
|
|
264
296
|
for (let t of Object.values(e)) typeof t == "object" && Object.freeze(t);
|
|
265
297
|
return Object.freeze(e);
|
|
266
298
|
}
|
|
267
|
-
var
|
|
299
|
+
var ue = {
|
|
268
300
|
maxSamples: 30,
|
|
269
301
|
bounces: 20,
|
|
270
302
|
transmissiveBounces: 24,
|
|
@@ -278,13 +310,13 @@ var fe = {
|
|
|
278
310
|
noiseThreshold: .02,
|
|
279
311
|
adaptiveStopFraction: .94,
|
|
280
312
|
usePixelFreeze: !0
|
|
281
|
-
},
|
|
282
|
-
maxSamples:
|
|
283
|
-
bounces:
|
|
284
|
-
renderMode:
|
|
285
|
-
enableAlphaShadows:
|
|
313
|
+
}, de = {
|
|
314
|
+
maxSamples: M.maxSamples,
|
|
315
|
+
bounces: M.maxBounces,
|
|
316
|
+
renderMode: M.renderMode,
|
|
317
|
+
enableAlphaShadows: M.enableAlphaShadows,
|
|
286
318
|
transmissiveBounces: 12,
|
|
287
|
-
maxSubsurfaceSteps:
|
|
319
|
+
maxSubsurfaceSteps: M.maxSubsurfaceSteps,
|
|
288
320
|
enableOIDN: !0,
|
|
289
321
|
oidnQuality: "fast",
|
|
290
322
|
interactionModeEnabled: !0,
|
|
@@ -292,7 +324,7 @@ var fe = {
|
|
|
292
324
|
noiseThreshold: .1,
|
|
293
325
|
usePixelFreeze: !0
|
|
294
326
|
};
|
|
295
|
-
function
|
|
327
|
+
function fe(e) {
|
|
296
328
|
return {
|
|
297
329
|
maxSamples: e.maxSamples,
|
|
298
330
|
maxBounces: e.bounces,
|
|
@@ -300,18 +332,18 @@ function me(e) {
|
|
|
300
332
|
maxSubsurfaceSteps: e.maxSubsurfaceSteps,
|
|
301
333
|
enableAlphaShadows: e.enableAlphaShadows ?? !1,
|
|
302
334
|
useAdaptiveSampling: e.useAdaptiveSampling ?? !1,
|
|
303
|
-
noiseThreshold: e.noiseThreshold ??
|
|
304
|
-
adaptiveStopFraction: e.adaptiveStopFraction ??
|
|
305
|
-
adaptiveMinSamples: e.adaptiveMinSamples ??
|
|
335
|
+
noiseThreshold: e.noiseThreshold ?? M.noiseThreshold,
|
|
336
|
+
adaptiveStopFraction: e.adaptiveStopFraction ?? M.adaptiveStopFraction,
|
|
337
|
+
adaptiveMinSamples: e.adaptiveMinSamples ?? M.adaptiveMinSamples,
|
|
306
338
|
usePixelFreeze: e.usePixelFreeze ?? !1,
|
|
307
|
-
pixelFreezeThreshold: e.pixelFreezeThreshold ??
|
|
308
|
-
pixelFreezeStability: e.pixelFreezeStability ??
|
|
309
|
-
interactionModeEnabled: e.interactionModeEnabled ??
|
|
339
|
+
pixelFreezeThreshold: e.pixelFreezeThreshold ?? M.pixelFreezeThreshold,
|
|
340
|
+
pixelFreezeStability: e.pixelFreezeStability ?? M.pixelFreezeStability,
|
|
341
|
+
interactionModeEnabled: e.interactionModeEnabled ?? M.interactionModeEnabled
|
|
310
342
|
};
|
|
311
343
|
}
|
|
312
344
|
//#endregion
|
|
313
345
|
//#region src/Processor/TextureBuckets.js
|
|
314
|
-
var
|
|
346
|
+
var P = {
|
|
315
347
|
VEC4_PER_BVH_NODE: 4,
|
|
316
348
|
FLOATS_PER_VEC4: 4,
|
|
317
349
|
MIN_TEXTURE_WIDTH: 4,
|
|
@@ -324,12 +356,12 @@ var O = {
|
|
|
324
356
|
MAX_TEXTURES_LIMIT: 4 * 256,
|
|
325
357
|
MATERIAL_BUCKET_COUNT: 4,
|
|
326
358
|
BUCKET_LAYER_STRIDE: 256
|
|
327
|
-
},
|
|
328
|
-
function
|
|
329
|
-
let n = Math.ceil(Math.max(1, e) /
|
|
330
|
-
return Math.min(t, Math.max(
|
|
359
|
+
}, pe = 64;
|
|
360
|
+
function F(e, t) {
|
|
361
|
+
let n = Math.ceil(Math.max(1, e) / pe) * pe;
|
|
362
|
+
return Math.min(t, Math.max(P.MIN_TEXTURE_WIDTH, n));
|
|
331
363
|
}
|
|
332
|
-
function
|
|
364
|
+
function I(e) {
|
|
333
365
|
let t = 0, n = 0, r = 0;
|
|
334
366
|
for (let i of e) t = Math.max(t, i.width), n = Math.max(n, i.height), r += i.count;
|
|
335
367
|
return {
|
|
@@ -339,18 +371,18 @@ function A(e) {
|
|
|
339
371
|
count: r
|
|
340
372
|
};
|
|
341
373
|
}
|
|
342
|
-
function
|
|
343
|
-
return
|
|
374
|
+
function L(e, t) {
|
|
375
|
+
return F(e.width, t) * e.height * e.count * 4;
|
|
344
376
|
}
|
|
345
|
-
function
|
|
346
|
-
return e.reduce((e, n) => e +
|
|
377
|
+
function R(e, t) {
|
|
378
|
+
return e.reduce((e, n) => e + L(n, t), 0);
|
|
347
379
|
}
|
|
348
|
-
function
|
|
380
|
+
function me(e, t, n) {
|
|
349
381
|
let r = e.slice();
|
|
350
382
|
for (; r.length > t;) {
|
|
351
383
|
let e = null;
|
|
352
384
|
for (let t = 0; t < r.length; t++) for (let i = t + 1; i < r.length; i++) {
|
|
353
|
-
let a =
|
|
385
|
+
let a = I(r[t].units.concat(r[i].units)), o = L(a, n) - L(r[t], n) - L(r[i], n);
|
|
354
386
|
(!e || o < e.delta) && (e = {
|
|
355
387
|
i: t,
|
|
356
388
|
j: i,
|
|
@@ -362,17 +394,17 @@ function ge(e, t, n) {
|
|
|
362
394
|
}
|
|
363
395
|
return r;
|
|
364
396
|
}
|
|
365
|
-
function
|
|
397
|
+
function he(e, t, n) {
|
|
366
398
|
let r = [];
|
|
367
|
-
for (let e = t - 1; e >= 0; e--) r.push(Math.max(
|
|
399
|
+
for (let e = t - 1; e >= 0; e--) r.push(Math.max(P.MIN_TEXTURE_WIDTH, Math.round(n / 2 ** e)));
|
|
368
400
|
let i = r.map(() => []);
|
|
369
401
|
for (let t of e) {
|
|
370
402
|
let e = 2 ** Math.ceil(Math.log2(Math.max(t.width, t.height))), n = r.findIndex((t) => e <= t);
|
|
371
403
|
n < 0 && (n = r.length - 1), i[n].push(t);
|
|
372
404
|
}
|
|
373
|
-
return i.filter((e) => e.length).map(
|
|
405
|
+
return i.filter((e) => e.length).map(I);
|
|
374
406
|
}
|
|
375
|
-
function
|
|
407
|
+
function ge(e, t) {
|
|
376
408
|
let n = e;
|
|
377
409
|
for (let e = 0; e < 8; e++) {
|
|
378
410
|
let e = !1;
|
|
@@ -383,9 +415,9 @@ function ve(e, t) {
|
|
|
383
415
|
let o = [];
|
|
384
416
|
for (let e = 0; e < n.length; e++) if (e === i) {
|
|
385
417
|
let t = n[e].units.filter((e) => e !== r);
|
|
386
|
-
t.length && o.push(
|
|
387
|
-
} else e === a ? o.push(
|
|
388
|
-
if (
|
|
418
|
+
t.length && o.push(I(t));
|
|
419
|
+
} else e === a ? o.push(I(n[e].units.concat([r]))) : o.push(n[e]);
|
|
420
|
+
if (R(o, t) < R(n, t)) {
|
|
389
421
|
n = o, e = !0;
|
|
390
422
|
break;
|
|
391
423
|
}
|
|
@@ -395,7 +427,7 @@ function ve(e, t) {
|
|
|
395
427
|
}
|
|
396
428
|
return n;
|
|
397
429
|
}
|
|
398
|
-
function
|
|
430
|
+
function _e(e, t, n = P.MATERIAL_BUCKET_COUNT) {
|
|
399
431
|
let r = /* @__PURE__ */ new Map();
|
|
400
432
|
for (let { width: n, height: i } of e) {
|
|
401
433
|
let e = Math.min(t, Math.max(1, n || 1)), a = Math.min(t, Math.max(1, i || 1)), o = `${e}x${a}`, s = r.get(o);
|
|
@@ -405,56 +437,56 @@ function ye(e, t, n = O.MATERIAL_BUCKET_COUNT) {
|
|
|
405
437
|
count: 1
|
|
406
438
|
});
|
|
407
439
|
}
|
|
408
|
-
let i = [...r.values()], a = i.map((e) =>
|
|
440
|
+
let i = [...r.values()], a = i.map((e) => I([e]));
|
|
409
441
|
if (a.length > n) {
|
|
410
|
-
let e =
|
|
411
|
-
a =
|
|
442
|
+
let e = he(i, n, t), r = me(a, n, t);
|
|
443
|
+
a = R(e, t) < R(r, t) ? e : r, a = ge(a, t);
|
|
412
444
|
}
|
|
413
445
|
return a.map((e) => ({
|
|
414
|
-
width:
|
|
446
|
+
width: F(e.width, t),
|
|
415
447
|
height: e.height
|
|
416
448
|
})).sort((e, t) => e.width * e.height - t.width * t.height);
|
|
417
449
|
}
|
|
418
|
-
function
|
|
450
|
+
function ve(e, t, n) {
|
|
419
451
|
let r = Math.max(1, e || 1), i = Math.max(1, t || 1);
|
|
420
452
|
for (let e = 0; e < n.length; e++) if (n[e].width >= r && n[e].height >= i) return e;
|
|
421
453
|
return Math.max(0, n.length - 1);
|
|
422
454
|
}
|
|
423
|
-
function
|
|
424
|
-
return e *
|
|
455
|
+
function ye(e, t) {
|
|
456
|
+
return e * P.BUCKET_LAYER_STRIDE + t;
|
|
425
457
|
}
|
|
426
458
|
//#endregion
|
|
427
459
|
//#region src/Processor/ChunkedRecords.js
|
|
428
|
-
var
|
|
429
|
-
function
|
|
430
|
-
|
|
460
|
+
var z = 64 * 1024 * 1024, be = typeof SharedArrayBuffer < "u", B = null;
|
|
461
|
+
function xe(e) {
|
|
462
|
+
B = e;
|
|
431
463
|
}
|
|
432
|
-
function
|
|
464
|
+
function V(e, t, n) {
|
|
433
465
|
let r = n ? new e(new SharedArrayBuffer(t * e.BYTES_PER_ELEMENT)) : new e(t);
|
|
434
|
-
return
|
|
466
|
+
return B && r.byteLength > 0 && B(r.byteLength, n), r;
|
|
435
467
|
}
|
|
436
|
-
var
|
|
437
|
-
constructor(e, t, n, r =
|
|
468
|
+
var H = class e {
|
|
469
|
+
constructor(e, t, n, r = z, i = !1) {
|
|
438
470
|
let a = t * n.BYTES_PER_ELEMENT, o = Math.max(1, Math.floor(r / a));
|
|
439
471
|
this.recordCount = e, this.lanesPerRecord = t, this.LaneType = n, this.recordsPerChunk = e <= o ? Math.max(e, 1) : o, this.shared = i, this.chunks = [];
|
|
440
472
|
let s = e;
|
|
441
473
|
for (; s > 0;) {
|
|
442
474
|
let e = Math.min(s, this.recordsPerChunk);
|
|
443
|
-
this.chunks.push(
|
|
475
|
+
this.chunks.push(V(n, e * t, i)), s -= e;
|
|
444
476
|
}
|
|
445
|
-
this.chunks.length === 0 && this.chunks.push(
|
|
477
|
+
this.chunks.length === 0 && this.chunks.push(V(n, 0, i));
|
|
446
478
|
}
|
|
447
479
|
static adopt(t, n, r, i) {
|
|
448
480
|
let a = Object.create(e.prototype);
|
|
449
481
|
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;
|
|
450
482
|
}
|
|
451
|
-
static lazy(t, n, r, i =
|
|
483
|
+
static lazy(t, n, r, i = z, a = !1) {
|
|
452
484
|
let o = Math.max(1, Math.floor(i / (n * r.BYTES_PER_ELEMENT))), s = Object.create(e.prototype);
|
|
453
485
|
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;
|
|
454
486
|
}
|
|
455
487
|
_materialize(e) {
|
|
456
488
|
if (this._owner) return this._owner._materialize(e), this.chunks[e];
|
|
457
|
-
let t = e * this.recordsPerChunk, n = Math.min(this.recordsPerChunk, this.recordCount - t) * this.lanesPerRecord, r = this.chunks[e] =
|
|
489
|
+
let t = e * this.recordsPerChunk, n = Math.min(this.recordsPerChunk, this.recordCount - t) * this.lanesPerRecord, r = this.chunks[e] = V(this.LaneType, n, this.shared);
|
|
458
490
|
for (let t of this._liveViews()) t.chunks[e] = new t.LaneType(r.buffer, r.byteOffset, r.byteLength / t.LaneType.BYTES_PER_ELEMENT);
|
|
459
491
|
return r;
|
|
460
492
|
}
|
|
@@ -505,7 +537,7 @@ var L = class e {
|
|
|
505
537
|
let n = e / this.recordsPerChunk | 0, r = (e + t - 1) / this.recordsPerChunk | 0;
|
|
506
538
|
for (let e = n; e <= r; e++) {
|
|
507
539
|
if (!this._spilled.has(e)) continue;
|
|
508
|
-
let t = Math.min(this.recordsPerChunk, this.recordCount - e * this.recordsPerChunk) * this.lanesPerRecord, n =
|
|
540
|
+
let t = Math.min(this.recordsPerChunk, this.recordCount - e * this.recordsPerChunk) * this.lanesPerRecord, n = V(this.LaneType, t, this.shared), r = new Uint8Array(n.buffer, n.byteOffset, n.byteLength);
|
|
509
541
|
this._store.readInto ? await this._store.readInto(e, r) : r.set(new Uint8Array(await this._store.read(e, r.byteLength))), this.chunks[e] = n;
|
|
510
542
|
for (let t of this._liveViews()) t.chunks[e] = new t.LaneType(n.buffer, n.byteOffset, n.byteLength / t.LaneType.BYTES_PER_ELEMENT);
|
|
511
543
|
this._spilled.delete(e);
|
|
@@ -567,7 +599,7 @@ var L = class e {
|
|
|
567
599
|
for (let e of this._liveViews()) e.chunks.length = this.chunks.length;
|
|
568
600
|
}
|
|
569
601
|
if (r && r.length < n(t, e)) {
|
|
570
|
-
let i =
|
|
602
|
+
let i = V(this.LaneType, n(t, e), this.shared);
|
|
571
603
|
i.set(r), this.chunks[t] = i;
|
|
572
604
|
for (let e of this._liveViews()) e.chunks[t] = new e.LaneType(i.buffer, i.byteOffset, i.byteLength / e.LaneType.BYTES_PER_ELEMENT);
|
|
573
605
|
} else if (!r && this._spilled?.has(t)) throw Error(`ChunkedRecords: cannot grow past chunk ${t}, which is on disk`);
|
|
@@ -597,12 +629,12 @@ var L = class e {
|
|
|
597
629
|
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);
|
|
598
630
|
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;
|
|
599
631
|
}
|
|
600
|
-
},
|
|
632
|
+
}, Se = 32 * 1024 * 1024, U = "chunks.bin", Ce = class e {
|
|
601
633
|
static async create(t, n, r, { label: i = "", expectedBytes: a = 0 } = {}) {
|
|
602
634
|
let o = t?.area(l.SPILL), s = await o?.create(n, {
|
|
603
635
|
label: i,
|
|
604
636
|
expectedBytes: a,
|
|
605
|
-
growable: [
|
|
637
|
+
growable: [U]
|
|
606
638
|
});
|
|
607
639
|
return s ? new e(o, n, r, s) : null;
|
|
608
640
|
}
|
|
@@ -616,11 +648,11 @@ var L = class e {
|
|
|
616
648
|
if (!this._writer && (this._entry?.release(), this._entry = this._file = null, this._writer = await this._area.edit(this._key), !this._writer)) throw Error("spill: its storage entry is gone");
|
|
617
649
|
let n = new Uint8Array(t.buffer, t.byteOffset, t.byteLength), r = 0;
|
|
618
650
|
do
|
|
619
|
-
await this._writer.write(
|
|
651
|
+
await this._writer.write(U, n.subarray(r, Math.min(n.length, r + Se)), { at: e + r }), r += Se;
|
|
620
652
|
while (r < n.length);
|
|
621
653
|
}
|
|
622
654
|
async flush() {
|
|
623
|
-
if (this._writer &&= (await this._writer.commit(), null), !this._entry && (this._entry = await this._area.open(this._key, { wait: !0 }), this._file = await this._entry?.file(
|
|
655
|
+
if (this._writer &&= (await this._writer.commit(), null), !this._entry && (this._entry = await this._area.open(this._key, { wait: !0 }), this._file = await this._entry?.file(U), !this._file)) throw Error("spill: its storage entry is gone");
|
|
624
656
|
}
|
|
625
657
|
read(e, t) {
|
|
626
658
|
return this.readAt(e * this._chunkBytes, t);
|
|
@@ -635,17 +667,17 @@ var L = class e {
|
|
|
635
667
|
async dispose() {
|
|
636
668
|
this._writer && await this._writer.abort(), this._writer = null, this._entry?.release(), this._entry = this._file = null, await this._area.remove(this._key);
|
|
637
669
|
}
|
|
638
|
-
},
|
|
639
|
-
function
|
|
640
|
-
|
|
670
|
+
}, W = 32 * 1024 * 1024, we = W / 4, Te = 64 * 1024 * 1024, Ee = /* @__PURE__ */ new Map(), G = /* @__PURE__ */ new WeakSet();
|
|
671
|
+
function K(e) {
|
|
672
|
+
G.delete(e), e.transfer?.(0);
|
|
641
673
|
}
|
|
642
|
-
function
|
|
643
|
-
let t =
|
|
644
|
-
return t ||
|
|
674
|
+
function De(e) {
|
|
675
|
+
let t = Ee.get(e);
|
|
676
|
+
return t || Ee.set(e, t = new e(0)), t;
|
|
645
677
|
}
|
|
646
|
-
var
|
|
678
|
+
var Oe = class e {
|
|
647
679
|
static async create(t, n, r = 0) {
|
|
648
|
-
let i = await
|
|
680
|
+
let i = await Ce.create(t, n, 0, {
|
|
649
681
|
label: "Scene geometry (while building)",
|
|
650
682
|
expectedBytes: r
|
|
651
683
|
});
|
|
@@ -677,7 +709,7 @@ var ke = class e {
|
|
|
677
709
|
let e = n.array;
|
|
678
710
|
if (!e?.byteLength) continue;
|
|
679
711
|
let r = t.get(e);
|
|
680
|
-
r || t.set(e, r = this._write(e)), r.attributes.push(n), n.array =
|
|
712
|
+
r || t.set(e, r = this._write(e)), r.attributes.push(n), n.array = De(e.constructor);
|
|
681
713
|
}
|
|
682
714
|
}
|
|
683
715
|
_write(e) {
|
|
@@ -690,7 +722,7 @@ var ke = class e {
|
|
|
690
722
|
pack: null,
|
|
691
723
|
offset: 0
|
|
692
724
|
};
|
|
693
|
-
return this._records.push(n), this.bytes += t.byteLength, t.byteLength >=
|
|
725
|
+
return this._records.push(n), this.bytes += t.byteLength, t.byteLength >= we ? (n.at = this._end, n.array = e, this._end += t.byteLength, this._queue(n.at, t, [n]), n) : (this._pack && this._packUsed + t.byteLength > W && this._flushPack(), this._pack || (this._pack = new Uint8Array(W), this._packAt = this._end, this._packUsed = 0, this._end += W), this._pack.set(t, this._packUsed), n.at = this._packAt + this._packUsed, n.pack = this._pack, n.offset = this._packUsed, this._packUsed += n.byteLength, this._packRecords.push(n), G.has(e.buffer) && K(e.buffer), n);
|
|
694
726
|
}
|
|
695
727
|
_flushPack() {
|
|
696
728
|
this._pack && (this._queue(this._packAt, this._pack.subarray(0, this._packUsed), this._packRecords, !0), this._pack = null, this._packRecords = []);
|
|
@@ -702,7 +734,7 @@ var ke = class e {
|
|
|
702
734
|
await this._store.writeAt(e, t);
|
|
703
735
|
for (let e of n) {
|
|
704
736
|
let t = e.array?.buffer;
|
|
705
|
-
e.array = e.pack = null,
|
|
737
|
+
e.array = e.pack = null, G.has(t) && K(t);
|
|
706
738
|
}
|
|
707
739
|
r && t.buffer.transfer?.(0);
|
|
708
740
|
}
|
|
@@ -718,18 +750,18 @@ var ke = class e {
|
|
|
718
750
|
let t = null, n = 0;
|
|
719
751
|
for (let r of e) {
|
|
720
752
|
let e;
|
|
721
|
-
if (r.array ? e = r.array : r.pack ? e = new r.Type(r.pack.slice(r.offset, r.offset + r.byteLength).buffer) : r.byteLength >
|
|
722
|
-
e !== r.array &&
|
|
753
|
+
if (r.array ? e = r.array : r.pack ? e = new r.Type(r.pack.slice(r.offset, r.offset + r.byteLength).buffer) : r.byteLength > Te ? e = new r.Type(await this._store.readAt(r.at, r.byteLength)) : ((!t || r.at + r.byteLength > n + t.byteLength) && (t && K(t), n = r.at, t = await this._store.readAt(r.at, Te)), e = new r.Type(t.slice(r.at - n, r.at - n + r.byteLength))), e.byteLength !== r.byteLength) throw Error("geometry spill: an array came back short");
|
|
754
|
+
e !== r.array && G.add(e.buffer);
|
|
723
755
|
for (let t of r.attributes) t.array = e;
|
|
724
756
|
}
|
|
725
|
-
t &&
|
|
757
|
+
t && K(t);
|
|
726
758
|
for (let { geometry: e, box: t, sphere: n } of this._geometries) e.boundingBox = t, e.boundingSphere = n;
|
|
727
759
|
this._records = [], this._geometries = [], this.bytes = 0;
|
|
728
760
|
}
|
|
729
761
|
async dispose() {
|
|
730
762
|
await this._chain, this._records = [], this._geometries = [], this._pack = null, this._packRecords = [], await this._store.dispose();
|
|
731
763
|
}
|
|
732
|
-
},
|
|
764
|
+
}, ke = r("geometry"), q = P.MAX_TEXTURES_LIMIT, Ae = new Set([
|
|
733
765
|
"color",
|
|
734
766
|
"emissive",
|
|
735
767
|
"attenuationColor",
|
|
@@ -737,12 +769,12 @@ var ke = class e {
|
|
|
737
769
|
"specularColor",
|
|
738
770
|
"subsurfaceColor",
|
|
739
771
|
"diffuseTransmissionColor"
|
|
740
|
-
]),
|
|
772
|
+
]), J = Object.freeze({
|
|
741
773
|
MATERIAL: "material",
|
|
742
774
|
MAPPED: "mapped",
|
|
743
775
|
DEFAULT: "default",
|
|
744
776
|
HOST: "host"
|
|
745
|
-
}),
|
|
777
|
+
}), je = [
|
|
746
778
|
1,
|
|
747
779
|
0,
|
|
748
780
|
0,
|
|
@@ -760,11 +792,11 @@ var ke = class e {
|
|
|
760
792
|
0,
|
|
761
793
|
1
|
|
762
794
|
];
|
|
763
|
-
function
|
|
764
|
-
for (let t = 0; t < 16; t++) if (e[t] !==
|
|
795
|
+
function Me(e) {
|
|
796
|
+
for (let t = 0; t < 16; t++) if (e[t] !== je[t]) return !1;
|
|
765
797
|
return !0;
|
|
766
798
|
}
|
|
767
|
-
function
|
|
799
|
+
function Ne(e) {
|
|
768
800
|
return {
|
|
769
801
|
map: e.map,
|
|
770
802
|
normalMap: e.normalMap,
|
|
@@ -793,7 +825,7 @@ function Pe(e) {
|
|
|
793
825
|
let t = e.userData.gltfExtensions.KHR_materials_unlit.alphaMode;
|
|
794
826
|
return t === "BLEND" ? 2 : +(t === "MASK");
|
|
795
827
|
}
|
|
796
|
-
return e.alphaTest > 0 ? 1 : e.transparent && e.opacity < 1 || e.map && e.map.format ===
|
|
828
|
+
return e.alphaTest > 0 ? 1 : e.transparent && e.opacity < 1 || e.map && e.map.format === y && e.transparent ? 2 : 0;
|
|
797
829
|
}
|
|
798
830
|
function Fe(e) {
|
|
799
831
|
let t = 0, n = /* @__PURE__ */ new Set(), r = (e) => {
|
|
@@ -814,16 +846,16 @@ function Ie(e) {
|
|
|
814
846
|
r && !n.has(r) && (n.add(r), t += r.byteLength);
|
|
815
847
|
}), t;
|
|
816
848
|
}
|
|
817
|
-
function
|
|
849
|
+
function Y(e, t) {
|
|
818
850
|
let n = e.x, r = e.y, i = e.z;
|
|
819
851
|
e.x = t[0] * n + t[4] * r + t[8] * i + t[12], e.y = t[1] * n + t[5] * r + t[9] * i + t[13], e.z = t[2] * n + t[6] * r + t[10] * i + t[14];
|
|
820
852
|
}
|
|
821
|
-
function
|
|
853
|
+
function X(e, t) {
|
|
822
854
|
let n = e.x, r = e.y, i = e.z;
|
|
823
855
|
e.x = t[0] * n + t[3] * r + t[6] * i, e.y = t[1] * n + t[4] * r + t[7] * i, e.z = t[2] * n + t[5] * r + t[8] * i;
|
|
824
856
|
}
|
|
825
|
-
var
|
|
826
|
-
function
|
|
857
|
+
var Z = 1 << 21;
|
|
858
|
+
function Q(e) {
|
|
827
859
|
return !!(e.isSkinnedMesh || Object.keys(e.geometry?.morphAttributes ?? {}).length);
|
|
828
860
|
}
|
|
829
861
|
function Le(e) {
|
|
@@ -850,12 +882,12 @@ function ze(e, t) {
|
|
|
850
882
|
}
|
|
851
883
|
let i = new Int16Array(r.length);
|
|
852
884
|
for (let e = 0; e < r.length; e++) i[e] = Math.round(Math.max(-1, Math.min(1, r[e])) * 32767);
|
|
853
|
-
e.setAttribute(t, new
|
|
885
|
+
e.setAttribute(t, new p(i, n.itemSize, !0));
|
|
854
886
|
}
|
|
855
887
|
var Be = class {
|
|
856
888
|
constructor({ issues: e = null } = {}) {
|
|
857
889
|
this._issues = e, this._droppedTextures = 0, this._vectorPool = {
|
|
858
|
-
vec3: Array(9).fill().map(() => new
|
|
890
|
+
vec3: Array(9).fill().map(() => new x()),
|
|
859
891
|
vec2: [
|
|
860
892
|
,
|
|
861
893
|
,
|
|
@@ -863,10 +895,10 @@ var Be = class {
|
|
|
863
895
|
,
|
|
864
896
|
,
|
|
865
897
|
,
|
|
866
|
-
].fill().map(() => new
|
|
898
|
+
].fill().map(() => new b())
|
|
867
899
|
}, this._geometryRanges = /* @__PURE__ */ new Map(), this.expandedTriangleCount = 0, this._allocatePlacements(0), this._matrixPool = {
|
|
868
|
-
mat3: new
|
|
869
|
-
mat4: new
|
|
900
|
+
mat3: new _(),
|
|
901
|
+
mat4: new v()
|
|
870
902
|
}, this.resetArrays(), this.triangleCount = 0, this.currentTriangleIndex = 0;
|
|
871
903
|
}
|
|
872
904
|
_getVec3(e = 0) {
|
|
@@ -898,8 +930,8 @@ var Be = class {
|
|
|
898
930
|
let t = /* @__PURE__ */ new Set(), n = 0, r = (e) => {
|
|
899
931
|
if (e.isMesh && e.geometry && e.material) {
|
|
900
932
|
let r = e.geometry, i = Math.ceil((r.index ? r.index.count : r.attributes.position?.count ?? 0) / 3), a = Array.isArray(e.material) ? e.material[0] : e.material, o = a?.emissive, s = a?.emissiveIntensity > 0 && !!o && (o.r > 0 || o.g > 0 || o.b > 0), c = e.isInstancedMesh ? e.count ?? 0 : 1;
|
|
901
|
-
if (s && e.isInstancedMesh && !
|
|
902
|
-
else if (s ||
|
|
933
|
+
if (s && e.isInstancedMesh && !Q(e) && i * c <= Z) n += i * c;
|
|
934
|
+
else if (s || Q(e)) n += i;
|
|
903
935
|
else {
|
|
904
936
|
let e = `${r.uuid}|${a?.uuid}`;
|
|
905
937
|
t.has(e) || (t.add(e), n += i);
|
|
@@ -915,7 +947,7 @@ var Be = class {
|
|
|
915
947
|
let o = e.isMesh && e.material ? e.geometry : null;
|
|
916
948
|
if (o) {
|
|
917
949
|
if (!n.has(o)) {
|
|
918
|
-
|
|
950
|
+
Oe.canTake(o) || i.add(o);
|
|
919
951
|
for (let e of [...Object.values(o.attributes), o.index]) {
|
|
920
952
|
let t = e?.array;
|
|
921
953
|
if (!t) continue;
|
|
@@ -923,7 +955,7 @@ var Be = class {
|
|
|
923
955
|
n && n !== o ? i.add(o).add(n) : r.set(t, o);
|
|
924
956
|
}
|
|
925
957
|
}
|
|
926
|
-
n.set(o, (n.get(o) ?? 0) + 1), (t ||
|
|
958
|
+
n.set(o, (n.get(o) ?? 0) + 1), (t || Q(e)) && i.add(o);
|
|
927
959
|
}
|
|
928
960
|
if (e.children) for (let n of e.children) a(n, t);
|
|
929
961
|
};
|
|
@@ -1035,7 +1067,7 @@ var Be = class {
|
|
|
1035
1067
|
this._triangleCapacity = e;
|
|
1036
1068
|
}
|
|
1037
1069
|
_allocateTriangles(e, t = !1) {
|
|
1038
|
-
this.triangles = (t ?
|
|
1070
|
+
this.triangles = (t ? H.lazy : (...e) => new H(...e))(e, i.FLOATS_PER_TRIANGLE, Uint32Array, void 0, be), this.triangleFloatChunks = this.triangles.viewAs(Float32Array), this.triangleData = this.triangles.single, this.triangleFloats = this.triangleFloatChunks.single;
|
|
1039
1071
|
}
|
|
1040
1072
|
traverseObject(e) {
|
|
1041
1073
|
if (this._visit(e), e.children) for (let t of e.children) this.traverseObject(t);
|
|
@@ -1052,7 +1084,7 @@ var Be = class {
|
|
|
1052
1084
|
e.userData.materialIndex = t;
|
|
1053
1085
|
let n = this.meshes.length;
|
|
1054
1086
|
this.meshes.push(e), e.userData.meshIndex = n;
|
|
1055
|
-
let r = `${e.geometry.uuid}|${t}`, i =
|
|
1087
|
+
let r = `${e.geometry.uuid}|${t}`, i = Q(e), a = !this._emissiveMaterial(t) && !i, o = a ? this._geometryRanges.get(r) : null;
|
|
1056
1088
|
if (o) {
|
|
1057
1089
|
let t = {
|
|
1058
1090
|
start: o.start,
|
|
@@ -1096,7 +1128,7 @@ var Be = class {
|
|
|
1096
1128
|
});
|
|
1097
1129
|
}
|
|
1098
1130
|
if (c <= 0) return;
|
|
1099
|
-
let l =
|
|
1131
|
+
let l = Me(a) && s.length >= c * 16, u = l ? s : new Float32Array(c * 16);
|
|
1100
1132
|
this._beginRun(l ? e.instanceMatrix : u, 0, +!l);
|
|
1101
1133
|
for (let e = 0; e < c; e++) {
|
|
1102
1134
|
let n = e * 16, r = this._nextPlacement(), i = e * 16;
|
|
@@ -1133,10 +1165,10 @@ var Be = class {
|
|
|
1133
1165
|
}
|
|
1134
1166
|
_canExpand(e) {
|
|
1135
1167
|
let t = e.geometry, n = (t.index ? t.index.count : t.attributes.position.count) / 3, r = e.count ?? (e.instanceMatrix?.array.length ?? 0) / 16;
|
|
1136
|
-
return n * r <=
|
|
1168
|
+
return n * r <= Z ? !0 : (this._issues?.record(s.EMISSIVE_INSTANCES_COLLAPSED, `"${e.name || "instanced mesh"}" would need ${Math.round(n * r).toLocaleString()} triangles to light every instance; lighting the first one only`, {
|
|
1137
1169
|
instances: r,
|
|
1138
1170
|
trianglesPerInstance: n,
|
|
1139
|
-
limit:
|
|
1171
|
+
limit: Z
|
|
1140
1172
|
}), !1);
|
|
1141
1173
|
}
|
|
1142
1174
|
_emissiveMaterial(e) {
|
|
@@ -1148,7 +1180,7 @@ var Be = class {
|
|
|
1148
1180
|
processMaterial(e) {
|
|
1149
1181
|
let n = this._materialUuidMap.get(e.uuid) ?? -1;
|
|
1150
1182
|
if (n === -1) {
|
|
1151
|
-
e.depthWrite === !1 && (e.depthWrite = !0, t(
|
|
1183
|
+
e.depthWrite === !1 && (e.depthWrite = !0, t(ke, "depthWrite", "material had depthWrite disabled — enabled for rastered rendering"));
|
|
1152
1184
|
let r = this.createMaterialObject(e);
|
|
1153
1185
|
this.materials.push(r), n = this.materials.length - 1, this._materialUuidMap.set(e.uuid, n);
|
|
1154
1186
|
}
|
|
@@ -1159,17 +1191,17 @@ var Be = class {
|
|
|
1159
1191
|
}
|
|
1160
1192
|
getPhysicalDefaults() {
|
|
1161
1193
|
let e = {};
|
|
1162
|
-
for (let [t, n] of Object.entries(
|
|
1194
|
+
for (let [t, n] of Object.entries(N)) e[t] = Ae.has(t) ? new m().fromArray(n) : Array.isArray(n) ? [...n] : n;
|
|
1163
1195
|
return e.normalScale = {
|
|
1164
|
-
x:
|
|
1165
|
-
y:
|
|
1196
|
+
x: N.normalScale[0],
|
|
1197
|
+
y: N.normalScale[1]
|
|
1166
1198
|
}, e;
|
|
1167
1199
|
}
|
|
1168
1200
|
mapLegacyMaterialToPhysical(e, t) {
|
|
1169
1201
|
let n = {};
|
|
1170
1202
|
switch (t) {
|
|
1171
1203
|
case "basic":
|
|
1172
|
-
n.emissive = e.color.clone(), n.emissiveIntensity = 1, n.color = new
|
|
1204
|
+
n.emissive = e.color.clone(), n.emissiveIntensity = 1, n.color = new m(0), n.roughness = 1, n.metalness = 0, n.specularIntensity = 0;
|
|
1173
1205
|
break;
|
|
1174
1206
|
case "lambert":
|
|
1175
1207
|
n.roughness = 1, n.metalness = 0, n.specularIntensity = 0;
|
|
@@ -1181,7 +1213,7 @@ var Be = class {
|
|
|
1181
1213
|
}
|
|
1182
1214
|
if (e.specular) {
|
|
1183
1215
|
let t = e.specular, r = t.r * .299 + t.g * .587 + t.b * .114, i = Math.max(t.r, t.g, t.b);
|
|
1184
|
-
n.specularIntensity = Math.min(r * 2, 1), n.specularColor = i > 0 ? t.clone().multiplyScalar(1 / i) : new
|
|
1216
|
+
n.specularIntensity = Math.min(r * 2, 1), n.specularColor = i > 0 ? t.clone().multiplyScalar(1 / i) : new m(1, 1, 1);
|
|
1185
1217
|
}
|
|
1186
1218
|
break;
|
|
1187
1219
|
case "toon":
|
|
@@ -1193,13 +1225,13 @@ var Be = class {
|
|
|
1193
1225
|
return n;
|
|
1194
1226
|
}
|
|
1195
1227
|
createMaterialObject(e) {
|
|
1196
|
-
let t = this.getPhysicalDefaults(), n = this.getMaterialType(e), r = this.mapLegacyMaterialToPhysical(e, n), i =
|
|
1228
|
+
let t = this.getPhysicalDefaults(), n = this.getMaterialType(e), r = this.mapLegacyMaterialToPhysical(e, n), i = Ne(e), a = {}, o = (n) => r[n] === void 0 ? e[n] !== void 0 && e[n] !== null ? (a[n] = J.MATERIAL, e[n]) : (a[n] = J.DEFAULT, t[n]) : (a[n] = J.MAPPED, r[n]);
|
|
1197
1229
|
for (let e of [
|
|
1198
1230
|
"transparent",
|
|
1199
1231
|
"alphaMode",
|
|
1200
1232
|
"side",
|
|
1201
1233
|
"depthWrite"
|
|
1202
|
-
]) a[e] =
|
|
1234
|
+
]) a[e] = J.MATERIAL;
|
|
1203
1235
|
return {
|
|
1204
1236
|
uuid: e.uuid,
|
|
1205
1237
|
color: o("color"),
|
|
@@ -1277,14 +1309,14 @@ var Be = class {
|
|
|
1277
1309
|
};
|
|
1278
1310
|
}
|
|
1279
1311
|
getTextureMatrix(e) {
|
|
1280
|
-
return e ? (e.matrixAutoUpdate && e.updateMatrix(), e.matrix.elements) : new
|
|
1312
|
+
return e ? (e.matrixAutoUpdate && e.updateMatrix(), e.matrix.elements) : new _().elements;
|
|
1281
1313
|
}
|
|
1282
1314
|
getMaterialSide(e) {
|
|
1283
1315
|
if (e.transmission > 0) return 2;
|
|
1284
1316
|
switch (e.side) {
|
|
1285
|
-
case
|
|
1317
|
+
case g: return 0;
|
|
1286
1318
|
case d: return 1;
|
|
1287
|
-
case
|
|
1319
|
+
case h: return 2;
|
|
1288
1320
|
default: return 0;
|
|
1289
1321
|
}
|
|
1290
1322
|
}
|
|
@@ -1294,13 +1326,13 @@ var Be = class {
|
|
|
1294
1326
|
n || (n = /* @__PURE__ */ new Map(), this._textureIndexCache.set(t, n));
|
|
1295
1327
|
let r = e.source.uuid, i = n.get(r);
|
|
1296
1328
|
if (i !== void 0) return i;
|
|
1297
|
-
if (t.length <
|
|
1329
|
+
if (t.length < q) {
|
|
1298
1330
|
t.push(e);
|
|
1299
1331
|
let i = t.length - 1;
|
|
1300
1332
|
return n.set(r, i), i;
|
|
1301
1333
|
}
|
|
1302
|
-
return this._droppedTextures++, this._droppedTextures === 1 && this._issues?.record(s.TEXTURE_LIMIT_EXCEEDED, `scene needs more than ${
|
|
1303
|
-
limit:
|
|
1334
|
+
return this._droppedTextures++, this._droppedTextures === 1 && this._issues?.record(s.TEXTURE_LIMIT_EXCEEDED, `scene needs more than ${q} distinct textures for one map type; the rest render untextured`, {
|
|
1335
|
+
limit: q,
|
|
1304
1336
|
firstDropped: e.name || e.source?.uuid
|
|
1305
1337
|
}), -1;
|
|
1306
1338
|
}
|
|
@@ -1311,10 +1343,10 @@ var Be = class {
|
|
|
1311
1343
|
a.attributes.normal || a.computeVertexNormals();
|
|
1312
1344
|
let s = a.attributes.normal, c = a.attributes.uv, l = a.index ? a.index.array : null, u = Math.floor((l ? l.length : o.count) / 3);
|
|
1313
1345
|
if (i) {
|
|
1314
|
-
let r = e.count ?? e.instanceMatrix.array.length / 16, i = this._matrixPool.mat4, a = new
|
|
1346
|
+
let r = e.count ?? e.instanceMatrix.array.length / 16, i = this._matrixPool.mat4, a = new v();
|
|
1315
1347
|
for (let d = 0; d < r; d++) {
|
|
1316
1348
|
i.fromArray(e.instanceMatrix.array, d * 16), a.multiplyMatrices(e.matrixWorld, i);
|
|
1317
|
-
let r = new
|
|
1349
|
+
let r = new _().getNormalMatrix(a);
|
|
1318
1350
|
this.extractTrianglesInBatch(o, s, c, l, u, t, n, a, r, Le(a.elements) < 0);
|
|
1319
1351
|
}
|
|
1320
1352
|
return;
|
|
@@ -1330,7 +1362,7 @@ var Be = class {
|
|
|
1330
1362
|
let y = s?.elements, b = c?.elements;
|
|
1331
1363
|
for (let c = 0; c < i; c++) {
|
|
1332
1364
|
let i = c * 3, x = r ? r[i + 0] : i + 0, S = l ? 2 : 1, C = l ? 1 : 2, w = r ? r[i + S] : i + S, T = r ? r[i + C] : i + C;
|
|
1333
|
-
this.getVertex(e, x, u), this.getVertex(e, w, d), this.getVertex(e, T, f), this.getVertex(t, x, p), this.getVertex(t, w, m), this.getVertex(t, T, h), n ? (this.getVertex(n, x, g), this.getVertex(n, w, _), this.getVertex(n, T, v)) : (g.set(0, 0), _.set(0, 0), v.set(0, 0)), s && (
|
|
1365
|
+
this.getVertex(e, x, u), this.getVertex(e, w, d), this.getVertex(e, T, f), this.getVertex(t, x, p), this.getVertex(t, w, m), this.getVertex(t, T, h), n ? (this.getVertex(n, x, g), this.getVertex(n, w, _), this.getVertex(n, T, v)) : (g.set(0, 0), _.set(0, 0), v.set(0, 0)), s && (Y(u, y), Y(d, y), Y(f, y), X(p, b), X(m, b), X(h, b)), p.normalize(), m.normalize(), h.normalize(), this.packTriangleDataTextureFormat(this.currentTriangleIndex, u, d, f, p, m, h, g, _, v, a, o), this.currentTriangleIndex++;
|
|
1334
1366
|
}
|
|
1335
1367
|
}
|
|
1336
1368
|
packTriangleDataTextureFormat(e, t, n, r, s, c, l, u, d, f, p, m) {
|
|
@@ -1351,7 +1383,7 @@ var Be = class {
|
|
|
1351
1383
|
}
|
|
1352
1384
|
logStats() {
|
|
1353
1385
|
let e = this.currentTriangleIndex * i.FLOATS_PER_TRIANGLE * 4;
|
|
1354
|
-
|
|
1386
|
+
ke.debug(n.list([
|
|
1355
1387
|
`${n.count(this.currentTriangleIndex, "tri")} (${n.mb(e)})`,
|
|
1356
1388
|
n.count(this.materials.length, "material"),
|
|
1357
1389
|
n.count(this.maps.length, "map")
|
|
@@ -1410,37 +1442,37 @@ var Be = class {
|
|
|
1410
1442
|
cameras: this.cameras
|
|
1411
1443
|
};
|
|
1412
1444
|
}
|
|
1413
|
-
},
|
|
1445
|
+
}, $ = {
|
|
1414
1446
|
Worker: null,
|
|
1415
1447
|
decodeImage: null
|
|
1416
1448
|
};
|
|
1417
1449
|
function Ve(e) {
|
|
1418
|
-
e && Object.assign(
|
|
1450
|
+
e && Object.assign($, e);
|
|
1419
1451
|
}
|
|
1420
1452
|
function He() {
|
|
1421
|
-
return
|
|
1453
|
+
return $;
|
|
1422
1454
|
}
|
|
1423
1455
|
function Ue() {
|
|
1424
1456
|
return typeof navigator < "u" && navigator.hardwareConcurrency || 4;
|
|
1425
1457
|
}
|
|
1426
1458
|
function We() {
|
|
1427
|
-
return
|
|
1459
|
+
return !!$.decodeImage || typeof self < "u" && (typeof createImageBitmap < "u" || typeof document < "u");
|
|
1428
1460
|
}
|
|
1429
1461
|
function Ge() {
|
|
1430
|
-
return
|
|
1462
|
+
return !!$.Worker || typeof Worker < "u";
|
|
1431
1463
|
}
|
|
1432
|
-
var
|
|
1433
|
-
async function
|
|
1434
|
-
if (
|
|
1435
|
-
|
|
1464
|
+
var Ke = 0;
|
|
1465
|
+
async function qe(e) {
|
|
1466
|
+
if (!$.Worker || Ke === 0 && globalThis.Worker !== void 0) return e();
|
|
1467
|
+
Ke++ === 0 && (globalThis.Worker = $.Worker);
|
|
1436
1468
|
try {
|
|
1437
1469
|
return await e();
|
|
1438
1470
|
} finally {
|
|
1439
|
-
--
|
|
1471
|
+
--Ke === 0 && globalThis.Worker === $.Worker && delete globalThis.Worker;
|
|
1440
1472
|
}
|
|
1441
1473
|
}
|
|
1442
|
-
function
|
|
1443
|
-
let n =
|
|
1474
|
+
function Je(e, t) {
|
|
1475
|
+
let n = $.Worker;
|
|
1444
1476
|
if (!n) return new e(t);
|
|
1445
1477
|
let r = Object.prototype.hasOwnProperty.call(globalThis, "Worker"), i = globalThis.Worker;
|
|
1446
1478
|
globalThis.Worker = n;
|
|
@@ -1452,31 +1484,31 @@ function qe(e, t) {
|
|
|
1452
1484
|
}
|
|
1453
1485
|
//#endregion
|
|
1454
1486
|
//#region src/Storage/CDFCache.js
|
|
1455
|
-
var
|
|
1456
|
-
function
|
|
1487
|
+
var Ye = 5;
|
|
1488
|
+
function Xe(e, t) {
|
|
1457
1489
|
e && t && (e.userData.__rayzeeSource = t);
|
|
1458
1490
|
}
|
|
1459
|
-
function
|
|
1491
|
+
function Ze(e) {
|
|
1460
1492
|
let t = e?.userData?.__rayzeeSource;
|
|
1461
1493
|
if (!t) return null;
|
|
1462
1494
|
let { width: n = 0, height: r = 0 } = e.image ?? {};
|
|
1463
|
-
return `cdf:${
|
|
1495
|
+
return `cdf:${Ye}:${t}|${n}x${r}|${e.userData.__rayzeeColorSpace ?? "native"}`;
|
|
1464
1496
|
}
|
|
1465
|
-
var
|
|
1497
|
+
var Qe = () => c(u().cacheNamespace)?.area(l.CDF) ?? null, $e = [
|
|
1466
1498
|
"exactConditional",
|
|
1467
1499
|
"exactMarginal",
|
|
1468
1500
|
"exactRowGuide",
|
|
1469
1501
|
"exactMarginalGuide"
|
|
1470
|
-
],
|
|
1471
|
-
async function
|
|
1472
|
-
let t =
|
|
1502
|
+
], et = $e.map((e) => `${e}.f32`);
|
|
1503
|
+
async function tt(e) {
|
|
1504
|
+
let t = Ze(e), n = t ? await Qe()?.open(t) : null;
|
|
1473
1505
|
if (!n) return null;
|
|
1474
1506
|
try {
|
|
1475
|
-
let e = await Promise.all(
|
|
1507
|
+
let e = await Promise.all(et.map((e) => n.file(e)));
|
|
1476
1508
|
if (e.some((e) => !e)) return null;
|
|
1477
1509
|
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;
|
|
1478
1510
|
return {
|
|
1479
|
-
...Object.fromEntries(
|
|
1511
|
+
...Object.fromEntries($e.map((e, n) => [e, t[n]])),
|
|
1480
1512
|
totalSum: r,
|
|
1481
1513
|
width: i,
|
|
1482
1514
|
height: a,
|
|
@@ -1488,8 +1520,8 @@ async function Qe(e) {
|
|
|
1488
1520
|
n.release();
|
|
1489
1521
|
}
|
|
1490
1522
|
}
|
|
1491
|
-
async function
|
|
1492
|
-
let { totalSum: n, width: r, height: i, exactWidth: a, exactHeight: o, radianceIntegral: s } = t, c =
|
|
1523
|
+
async function nt(e, t) {
|
|
1524
|
+
let { totalSum: n, width: r, height: i, exactWidth: a, exactHeight: o, radianceIntegral: s } = t, c = $e.map((e) => t[e]), l = Ze(e), u = l ? Qe() : null;
|
|
1493
1525
|
if (!u || c.some((e) => !e)) return !1;
|
|
1494
1526
|
let d = await u.create(l, {
|
|
1495
1527
|
label: e.name || "environment",
|
|
@@ -1497,7 +1529,7 @@ async function $e(e, t) {
|
|
|
1497
1529
|
});
|
|
1498
1530
|
if (!d) return !1;
|
|
1499
1531
|
try {
|
|
1500
|
-
for (let e = 0; e <
|
|
1532
|
+
for (let e = 0; e < et.length; e++) await d.write(et[e], c[e]);
|
|
1501
1533
|
return await d.commit({
|
|
1502
1534
|
totalSum: n,
|
|
1503
1535
|
width: r,
|
|
@@ -1512,8 +1544,8 @@ async function $e(e, t) {
|
|
|
1512
1544
|
}
|
|
1513
1545
|
//#endregion
|
|
1514
1546
|
//#region src/Processor/HostMemory.js
|
|
1515
|
-
var
|
|
1516
|
-
function
|
|
1547
|
+
var rt = i.FLOATS_PER_TRIANGLE * 4, it = 64, at = .9, ot = 28, st = 45, ct = 4, lt = 1536 * 1024 * 1024, ut = 7040 * 1024 * 1024, dt = 9216 * 1024 * 1024, ft = 12e7, pt = 6e7, mt = 8192;
|
|
1548
|
+
function ht(e) {
|
|
1517
1549
|
if (e > 0) return {
|
|
1518
1550
|
gb: e,
|
|
1519
1551
|
assumed: !1
|
|
@@ -1527,24 +1559,24 @@ function ft(e) {
|
|
|
1527
1559
|
assumed: !0
|
|
1528
1560
|
};
|
|
1529
1561
|
}
|
|
1530
|
-
var
|
|
1531
|
-
function
|
|
1562
|
+
var gt = 1.15, _t = 12 * 1024 * 1024 * 1024;
|
|
1563
|
+
function vt({ triangles: e, placements: t, geometryBytes: n = 0, instanceBytes: r = 0 }) {
|
|
1532
1564
|
let i = {
|
|
1533
|
-
triangles: e *
|
|
1534
|
-
bvh: Math.ceil(e *
|
|
1565
|
+
triangles: e * rt,
|
|
1566
|
+
bvh: Math.ceil(e * at) * it,
|
|
1535
1567
|
geometry: n,
|
|
1536
1568
|
instances: r,
|
|
1537
|
-
placements: t *
|
|
1538
|
-
orderMaps: e *
|
|
1569
|
+
placements: t * ot,
|
|
1570
|
+
orderMaps: e * ct
|
|
1539
1571
|
};
|
|
1540
1572
|
return i.total = i.triangles + i.bvh + i.geometry + i.instances + i.placements + i.orderMaps, i;
|
|
1541
1573
|
}
|
|
1542
|
-
function
|
|
1543
|
-
let r = e.geometry + e.instances + t * 4 + n, i = e.instances + e.placements + t *
|
|
1574
|
+
function yt(e, t, n) {
|
|
1575
|
+
let r = e.geometry + e.instances + t * 4 + n, i = e.instances + e.placements + t * st + e.orderMaps;
|
|
1544
1576
|
return Math.max(r, i);
|
|
1545
1577
|
}
|
|
1546
|
-
function
|
|
1547
|
-
let i = Math.min(e,
|
|
1578
|
+
function bt(e, { chunkBytes: t = z, shared: n = !1, allocate: r = null } = {}) {
|
|
1579
|
+
let i = Math.min(e, _t), a = r ?? (n ? (e) => new SharedArrayBuffer(e) : (e) => new ArrayBuffer(e)), o = [], s = 0;
|
|
1548
1580
|
try {
|
|
1549
1581
|
for (; s < i;) {
|
|
1550
1582
|
let e = Math.min(t, i - s);
|
|
@@ -1559,7 +1591,7 @@ function _t(e, { chunkBytes: t = N, shared: n = !1, allocate: r = null } = {}) {
|
|
|
1559
1591
|
capped: e > i
|
|
1560
1592
|
};
|
|
1561
1593
|
}
|
|
1562
|
-
var
|
|
1594
|
+
var xt = class {
|
|
1563
1595
|
constructor() {
|
|
1564
1596
|
this.reset();
|
|
1565
1597
|
}
|
|
@@ -1604,9 +1636,9 @@ var vt = class {
|
|
|
1604
1636
|
samples: this.samples.slice()
|
|
1605
1637
|
};
|
|
1606
1638
|
}
|
|
1607
|
-
},
|
|
1608
|
-
function
|
|
1609
|
-
return e >= n && t /
|
|
1639
|
+
}, St = "11.13.0", Ct = 1e4, wt = 15e5;
|
|
1640
|
+
function Tt(e, t, n = Ct) {
|
|
1641
|
+
return e >= n && t / wt < e / 3;
|
|
1610
1642
|
}
|
|
1611
1643
|
//#endregion
|
|
1612
|
-
export {
|
|
1644
|
+
export { ie as $, ze as A, F as B, We as C, J as D, Be as E, H as F, M as G, ye as H, z as I, ue as J, de as K, be as L, Re as M, Oe as N, Pe as O, Ce as P, se as Q, xe as R, Ue as S, qe as T, _e as U, ve as V, ce as W, oe as X, fe as Y, O as Z, nt as _, xt as a, D as at, Je as b, ut as c, ee as ct, ft as d, re as et, ht as f, tt as g, yt as h, dt as i, C as it, Ne as j, Fe as k, mt as l, bt as m, Tt as n, k as nt, lt as o, ae as ot, vt as p, N as q, St as r, w as rt, gt as s, T as st, Ct as t, ne as tt, pt as u, Xe as v, Ge as w, He as x, Ve as y, P as z };
|