@nebula-spatial/viewer 0.5.7 → 0.5.8
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/CHANGELOG.md +21 -0
- package/dist/assets/{usd-worker-B-HuMXLo.js → usd-worker-Cd5zDKyA.js} +192 -189
- package/dist/collision-debug-B9HJ34H8.js +2896 -0
- package/dist/{index-BTAC6njT.js → index-CIMsZtyY.js} +6 -6
- package/dist/index.js +1 -1
- package/dist/{mjcf-visual-BVT3h87h.js → mjcf-visual-DCfPUwyh.js} +1 -1
- package/dist/{mujoco-runtime-CAyK0LHM.js → mujoco-runtime-B9AZiFiG.js} +1 -1
- package/dist/session-C-yjpG8R.js +2519 -0
- package/dist/{session-BQ8eCFRL.js → session-uIv9-Ok1.js} +8 -8
- package/dist/{stage-DUC-YNhD.js → stage-C2FchK6h.js} +2 -2
- package/dist/urdf-session-CjGG32Zy.js +1264 -0
- package/dist/{usd-session-BUD3KtCr.js → usd-session-Cb1e-Bx8.js} +1745 -1649
- package/dist/version.d.ts +1 -1
- package/dist/{xacro-F7rdDouN.js → xacro-C2EgfvS8.js} +1 -1
- package/package.json +1 -1
- package/dist/collision-debug-B2CISPB9.js +0 -792
- package/dist/session-Dwoi1H46.js +0 -965
- package/dist/urdf-session-E0Nnr4Vs.js +0 -3266
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
function
|
|
2
|
-
return /^https?:$/.test(t.protocol) && e.origin === t.origin && !e.username && !e.password && e.pathname.startsWith(new URL(".", t).pathname);
|
|
1
|
+
function Me(e, t) {
|
|
2
|
+
return /^https?:$/.test(t.protocol) && e.origin === t.origin && !e.username && !e.password && me(e.pathname).startsWith(me(new URL(".", t).pathname));
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function me(e) {
|
|
5
|
+
return e.endsWith("/") ? e : e.slice(0, e.lastIndexOf("/") + 1);
|
|
6
|
+
}
|
|
7
|
+
function Ce(e, t) {
|
|
5
8
|
for (const n of e) for (const a of n.shaders) for (const i of Object.values(a.inputs)) {
|
|
6
9
|
if (!i || typeof i != "object" || Array.isArray(i)) continue;
|
|
7
10
|
const r = i, s = [r.path, r.url, r.resolvedPath].find((c) => typeof c == "string" && c);
|
|
8
11
|
!s || /^(?:data|blob):/i.test(s) || /\.mdl(?:[?#].*)?$/i.test(s) || t(r, s);
|
|
9
12
|
}
|
|
10
13
|
}
|
|
11
|
-
function
|
|
14
|
+
function je(e, t, n) {
|
|
12
15
|
const a = [];
|
|
13
16
|
try {
|
|
14
|
-
return
|
|
17
|
+
return Ce(e, (i, r) => {
|
|
15
18
|
if (t(r)) return;
|
|
16
19
|
const s = {};
|
|
17
20
|
for (const c of ["path", "resolvedPath", "url"])
|
|
@@ -22,7 +25,7 @@ function Ce(e, t, n) {
|
|
|
22
25
|
for (const { asset: i, values: r } of a) Object.assign(i, r);
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
|
-
const
|
|
28
|
+
const Ve = "E_ASSET_RESOURCE_NOT_FOUND", Ae = "E_ASSET_RESOURCE_INVALID", Ge = "E_ASSET_FETCH", Be = "E_ASSET_EXTERNAL_DENIED", Fe = "E_ASSET_AUTH", ze = /* @__PURE__ */ new Set([
|
|
26
29
|
"png",
|
|
27
30
|
"jpg",
|
|
28
31
|
"jpeg",
|
|
@@ -35,50 +38,50 @@ const je = "E_ASSET_RESOURCE_NOT_FOUND", Me = "E_ASSET_RESOURCE_INVALID", Ve = "
|
|
|
35
38
|
"hdr",
|
|
36
39
|
"exr",
|
|
37
40
|
"ktx2"
|
|
38
|
-
]),
|
|
39
|
-
function
|
|
41
|
+
]), He = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
|
|
42
|
+
function We(e) {
|
|
40
43
|
var n;
|
|
41
44
|
return ((n = (e.split(/[?#]/, 1)[0] ?? e).split(".").pop()) == null ? void 0 : n.toLowerCase()) ?? "";
|
|
42
45
|
}
|
|
43
|
-
function
|
|
44
|
-
const t =
|
|
45
|
-
return
|
|
46
|
+
function Xe(e) {
|
|
47
|
+
const t = We(e);
|
|
48
|
+
return ze.has(t) && !He.has(t);
|
|
46
49
|
}
|
|
47
|
-
function
|
|
50
|
+
function Je(e, t) {
|
|
48
51
|
return Object.assign(new Error(e), { code: t });
|
|
49
52
|
}
|
|
50
|
-
function
|
|
53
|
+
function Ze(e) {
|
|
51
54
|
var a;
|
|
52
55
|
if (e instanceof Error && e.name === "AbortError") return "aborted";
|
|
53
56
|
const t = e == null ? void 0 : e.code;
|
|
54
|
-
if (t ===
|
|
55
|
-
if (t ===
|
|
56
|
-
if (t ===
|
|
57
|
-
if (t ===
|
|
57
|
+
if (t === Ve) return "missing";
|
|
58
|
+
if (t === Ae) return "invalid";
|
|
59
|
+
if (t === Ge) return "unavailable";
|
|
60
|
+
if (t === Fe || t === Be) return "denied";
|
|
58
61
|
const n = (a = /\((\d{3})\)/.exec(e instanceof Error ? e.message : "")) == null ? void 0 : a[1];
|
|
59
62
|
return n === "404" || n === "410" ? "missing" : n === "401" || n === "403" ? "denied" : n != null && n.startsWith("5") ? "unavailable" : "unknown";
|
|
60
63
|
}
|
|
61
|
-
function
|
|
62
|
-
const t =
|
|
64
|
+
function Ye(e) {
|
|
65
|
+
const t = Ze(e);
|
|
63
66
|
return t === "missing" || t === "invalid" || t === "unavailable";
|
|
64
67
|
}
|
|
65
|
-
function
|
|
68
|
+
function qe(e, t) {
|
|
66
69
|
return e && /\bhtml\b/i.test(e) ? `返回 HTML 页面(${e})` : e && !/^text\//i.test(e) ? null : /^\uFEFF?\s*(?:<!doctype\s+html|<html|<\?xml[^>]*\bhtml)/i.test(t) ? "返回 HTML 兜底页" : null;
|
|
67
70
|
}
|
|
68
|
-
function
|
|
69
|
-
return t.byteLength ?
|
|
71
|
+
function Ke(e, t) {
|
|
72
|
+
return t.byteLength ? qe(e, new TextDecoder().decode(t.subarray(0, 512))) : "响应内容为空";
|
|
70
73
|
}
|
|
71
|
-
const
|
|
72
|
-
function
|
|
73
|
-
const n =
|
|
74
|
-
if (!
|
|
75
|
-
const a =
|
|
74
|
+
const Qe = /<UDIM>/i;
|
|
75
|
+
function et(e, t) {
|
|
76
|
+
const n = we(e).replaceAll("\\", "/");
|
|
77
|
+
if (!Qe.test(n)) return null;
|
|
78
|
+
const a = ye(n), i = a.split("/").at(-1);
|
|
76
79
|
if (!i) return { paths: [], tiles: [] };
|
|
77
|
-
const r =
|
|
80
|
+
const r = tt(i);
|
|
78
81
|
if (!r) return { paths: [], tiles: [] };
|
|
79
82
|
const s = [];
|
|
80
83
|
for (const u of new Set(t)) {
|
|
81
|
-
const h =
|
|
84
|
+
const h = we(u).replaceAll("\\", "/"), g = ye(h), l = g.split("/").at(-1);
|
|
82
85
|
if (!l) continue;
|
|
83
86
|
const f = r.exec(l);
|
|
84
87
|
if (!f) continue;
|
|
@@ -86,7 +89,7 @@ function Qe(e, t) {
|
|
|
86
89
|
!Number.isInteger(p) || p < 1001 || p > 9999 || s.push({
|
|
87
90
|
path: u,
|
|
88
91
|
tile: p,
|
|
89
|
-
score:
|
|
92
|
+
score: nt(a, g)
|
|
90
93
|
});
|
|
91
94
|
}
|
|
92
95
|
if (!s.length) return { paths: [], tiles: [] };
|
|
@@ -96,11 +99,11 @@ function Qe(e, t) {
|
|
|
96
99
|
tiles: o.map((u) => u.tile)
|
|
97
100
|
};
|
|
98
101
|
}
|
|
99
|
-
function
|
|
102
|
+
function tt(e) {
|
|
100
103
|
const t = e.split(/<UDIM>/i);
|
|
101
|
-
return t.length !== 2 ? null : new RegExp(`^${
|
|
104
|
+
return t.length !== 2 ? null : new RegExp(`^${_e(t[0])}(\\d{4})${_e(t[1])}$`, "i");
|
|
102
105
|
}
|
|
103
|
-
function
|
|
106
|
+
function nt(e, t) {
|
|
104
107
|
const n = e.split("/").slice(0, -1).filter(Boolean), a = t.split("/").slice(0, -1).filter(Boolean);
|
|
105
108
|
let i = 0;
|
|
106
109
|
for (; i < n.length && i < a.length; ) {
|
|
@@ -110,7 +113,7 @@ function tt(e, t) {
|
|
|
110
113
|
}
|
|
111
114
|
return i;
|
|
112
115
|
}
|
|
113
|
-
function
|
|
116
|
+
function we(e) {
|
|
114
117
|
const t = e.replace(/%3CUDIM%3E/gi, "<UDIM>");
|
|
115
118
|
try {
|
|
116
119
|
return decodeURIComponent(t);
|
|
@@ -118,39 +121,39 @@ function me(e) {
|
|
|
118
121
|
return t;
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
|
-
function
|
|
124
|
+
function ye(e) {
|
|
122
125
|
const t = e.search(/[?#]/);
|
|
123
126
|
return t < 0 ? e : e.slice(0, t);
|
|
124
127
|
}
|
|
125
|
-
function
|
|
128
|
+
function _e(e) {
|
|
126
129
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
127
130
|
}
|
|
128
|
-
const
|
|
129
|
-
function
|
|
131
|
+
const rt = 67324752, st = 33639248, ot = 101010256, ie = 4294967295, at = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "webp"]);
|
|
132
|
+
function it(e) {
|
|
130
133
|
return e.length > 3 && e[0] === 80 && e[1] === 75;
|
|
131
134
|
}
|
|
132
|
-
async function
|
|
133
|
-
const n = new DataView(e.buffer, e.byteOffset, e.byteLength), a =
|
|
135
|
+
async function ct(e, t = {}) {
|
|
136
|
+
const n = new DataView(e.buffer, e.byteOffset, e.byteLength), a = pt(n);
|
|
134
137
|
if (a < 0) throw new Error("Not a zip package: end of central directory not found.");
|
|
135
138
|
const i = n.getUint16(a + 10, !0);
|
|
136
139
|
let r = n.getUint32(a + 16, !0);
|
|
137
140
|
if (i === 65535 || r === ie) throw new Error("ZIP64 usdz packages are not supported.");
|
|
138
141
|
const s = /* @__PURE__ */ new Map(), c = [];
|
|
139
142
|
for (let o = 0; o < i; o += 1) {
|
|
140
|
-
if (r + 46 > n.byteLength || n.getUint32(r, !0) !==
|
|
143
|
+
if (r + 46 > n.byteLength || n.getUint32(r, !0) !== st)
|
|
141
144
|
throw new Error(`Corrupt zip central directory at entry ${o}.`);
|
|
142
145
|
const u = n.getUint16(r + 10, !0), h = n.getUint32(r + 20, !0), g = n.getUint16(r + 28, !0), l = n.getUint16(r + 30, !0), f = n.getUint16(r + 32, !0), p = n.getUint32(r + 42, !0);
|
|
143
146
|
if (h === ie || p === ie)
|
|
144
147
|
throw new Error("ZIP64 usdz packages are not supported.");
|
|
145
148
|
const y = new TextDecoder().decode(e.subarray(r + 46, r + 46 + g));
|
|
146
|
-
r += 46 + g + l + f, !y.endsWith("/") && (t.include && !t.include(y) || c.push(
|
|
149
|
+
r += 46 + g + l + f, !y.endsWith("/") && (t.include && !t.include(y) || c.push(lt(e, n, p, h, u).then((w) => ({ name: y, data: w }))));
|
|
147
150
|
}
|
|
148
151
|
for (const { name: o, data: u } of await Promise.all(c)) s.set(o, u);
|
|
149
152
|
return s;
|
|
150
153
|
}
|
|
151
|
-
function
|
|
154
|
+
function ut(e) {
|
|
152
155
|
if (typeof URL > "u" || typeof URL.createObjectURL != "function") return null;
|
|
153
|
-
const t = new Map([...e].filter(([s]) =>
|
|
156
|
+
const t = new Map([...e].filter(([s]) => xe(s)));
|
|
154
157
|
if (t.size === 0) return null;
|
|
155
158
|
const n = /* @__PURE__ */ new Map();
|
|
156
159
|
for (const s of t.keys()) {
|
|
@@ -161,12 +164,12 @@ function ct(e) {
|
|
|
161
164
|
let c = a.get(s);
|
|
162
165
|
if (!c) {
|
|
163
166
|
const o = t.get(s);
|
|
164
|
-
c = URL.createObjectURL(new Blob([new Uint8Array(o)], { type:
|
|
167
|
+
c = URL.createObjectURL(new Blob([new Uint8Array(o)], { type: ht(s) })), a.set(s, c);
|
|
165
168
|
}
|
|
166
169
|
return c;
|
|
167
170
|
}, r = (s) => {
|
|
168
171
|
if (!s) return null;
|
|
169
|
-
const c = dt(
|
|
172
|
+
const c = ft(dt(s));
|
|
170
173
|
if (!c) return null;
|
|
171
174
|
if (t.has(c)) return i(c);
|
|
172
175
|
const o = [...t.keys()].filter((g) => g.endsWith(`/${c}`));
|
|
@@ -186,22 +189,22 @@ function ct(e) {
|
|
|
186
189
|
}
|
|
187
190
|
};
|
|
188
191
|
}
|
|
189
|
-
function
|
|
190
|
-
return
|
|
192
|
+
function xe(e) {
|
|
193
|
+
return at.has(ke(e));
|
|
191
194
|
}
|
|
192
|
-
async function
|
|
193
|
-
if (t.getUint32(n, !0) !==
|
|
195
|
+
async function lt(e, t, n, a, i) {
|
|
196
|
+
if (t.getUint32(n, !0) !== rt) throw new Error("Corrupt zip local file header.");
|
|
194
197
|
const r = t.getUint16(n + 26, !0), s = t.getUint16(n + 28, !0), c = n + 30 + r + s, o = e.subarray(c, c + a);
|
|
195
198
|
if (i === 0) return o.slice();
|
|
196
199
|
if (i !== 8) throw new Error(`Unsupported zip compression method ${i}.`);
|
|
197
200
|
const u = new Blob([new Uint8Array(o)]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
|
|
198
201
|
return new Uint8Array(await new Response(u).arrayBuffer());
|
|
199
202
|
}
|
|
200
|
-
function
|
|
203
|
+
function dt(e) {
|
|
201
204
|
const t = e.indexOf("[");
|
|
202
205
|
return t >= 0 && e.endsWith("]") ? e.slice(t + 1, -1) : e;
|
|
203
206
|
}
|
|
204
|
-
function
|
|
207
|
+
function ft(e) {
|
|
205
208
|
const t = [];
|
|
206
209
|
for (const n of e.replaceAll("\\", "/").split("/"))
|
|
207
210
|
!n || n === "." || (n === ".." ? t.pop() : t.push(n));
|
|
@@ -211,7 +214,7 @@ function ke(e) {
|
|
|
211
214
|
const t = e.split(/[?#]/)[0] ?? e, n = t.lastIndexOf(".");
|
|
212
215
|
return n < 0 ? "" : t.slice(n + 1).toLowerCase();
|
|
213
216
|
}
|
|
214
|
-
function
|
|
217
|
+
function ht(e) {
|
|
215
218
|
switch (ke(e)) {
|
|
216
219
|
case "png":
|
|
217
220
|
return "image/png";
|
|
@@ -224,30 +227,30 @@ function ft(e) {
|
|
|
224
227
|
return "application/octet-stream";
|
|
225
228
|
}
|
|
226
229
|
}
|
|
227
|
-
function
|
|
230
|
+
function pt(e) {
|
|
228
231
|
const t = Math.max(0, e.byteLength - 65535 - 22);
|
|
229
232
|
for (let n = e.byteLength - 22; n >= t; n -= 1)
|
|
230
|
-
if (e.getUint32(n, !0) ===
|
|
233
|
+
if (e.getUint32(n, !0) === ot) return n;
|
|
231
234
|
return -1;
|
|
232
235
|
}
|
|
233
|
-
const
|
|
236
|
+
const gt = 1, mt = 1, wt = "9590c7fb3e7636719062", yt = {
|
|
234
237
|
file: "openusd_probe.js",
|
|
235
238
|
sha256: "83a14d264f2348a0899de8f1bc0c021fdcd8cae554ef545fb9e5b88da6f30b4e",
|
|
236
239
|
bytes: 95918
|
|
237
|
-
},
|
|
240
|
+
}, _t = {
|
|
238
241
|
file: "openusd_probe.wasm",
|
|
239
242
|
sha256: "e5fdec65f543d38b9ab956b7698fbd597cd7c49c0f8dbd13f334086a59c9670f",
|
|
240
243
|
bytes: 10652138
|
|
241
244
|
};
|
|
242
|
-
var
|
|
243
|
-
schemaVersion:
|
|
244
|
-
apiVersion:
|
|
245
|
-
runtimeId:
|
|
246
|
-
js:
|
|
247
|
-
wasm:
|
|
245
|
+
var bt = {
|
|
246
|
+
schemaVersion: gt,
|
|
247
|
+
apiVersion: mt,
|
|
248
|
+
runtimeId: wt,
|
|
249
|
+
js: yt,
|
|
250
|
+
wasm: _t
|
|
248
251
|
};
|
|
249
|
-
const
|
|
250
|
-
function
|
|
252
|
+
const St = Ut(bt);
|
|
253
|
+
function Ut(e) {
|
|
251
254
|
if (!e || typeof e != "object") throw new Error("OpenUSD runtime manifest is missing.");
|
|
252
255
|
const t = e;
|
|
253
256
|
if (t.schemaVersion !== 1 || !Number.isInteger(t.apiVersion) || Number(t.apiVersion) < 1 || typeof t.runtimeId != "string" || !/^[0-9a-f]{20}$/.test(t.runtimeId))
|
|
@@ -256,11 +259,11 @@ function St(e) {
|
|
|
256
259
|
schemaVersion: t.schemaVersion,
|
|
257
260
|
apiVersion: Number(t.apiVersion),
|
|
258
261
|
runtimeId: t.runtimeId,
|
|
259
|
-
js:
|
|
260
|
-
wasm:
|
|
262
|
+
js: be(t.js, "openusd_probe.js"),
|
|
263
|
+
wasm: be(t.wasm, "openusd_probe.wasm")
|
|
261
264
|
});
|
|
262
265
|
}
|
|
263
|
-
function
|
|
266
|
+
function be(e, t) {
|
|
264
267
|
if (!e || typeof e != "object") throw new Error(`OpenUSD runtime manifest omits ${t}.`);
|
|
265
268
|
const n = e;
|
|
266
269
|
if (n.file !== t || typeof n.sha256 != "string" || !/^[0-9a-f]{64}$/.test(n.sha256) || !Number.isInteger(n.bytes) || Number(n.bytes) < 1)
|
|
@@ -271,7 +274,7 @@ function _e(e, t) {
|
|
|
271
274
|
bytes: Number(n.bytes)
|
|
272
275
|
});
|
|
273
276
|
}
|
|
274
|
-
function
|
|
277
|
+
function Et(e, t, n) {
|
|
275
278
|
return WebAssembly.instantiate(e, t).then(
|
|
276
279
|
(a) => n(a, e),
|
|
277
280
|
(a) => {
|
|
@@ -281,7 +284,7 @@ function Ut(e, t, n) {
|
|
|
281
284
|
}
|
|
282
285
|
), {};
|
|
283
286
|
}
|
|
284
|
-
function
|
|
287
|
+
function Re(e, t) {
|
|
285
288
|
const n = async (r, s) => {
|
|
286
289
|
var o;
|
|
287
290
|
const c = e.GetPrimAtPath(r);
|
|
@@ -453,13 +456,13 @@ function xe(e, t) {
|
|
|
453
456
|
}
|
|
454
457
|
};
|
|
455
458
|
}
|
|
456
|
-
const
|
|
457
|
-
function
|
|
458
|
-
const n = new Set(t.map(
|
|
459
|
+
const vt = /^physics$/i, Pt = /^(newton|mjc|mujoco)(?:[_-]|$)/i, It = /^(physx|newton|mjc|mujoco)(?:[_-]|)/i;
|
|
460
|
+
function Mt(e, t = []) {
|
|
461
|
+
const n = new Set(t.map(Se)), a = [];
|
|
459
462
|
for (const i of e) {
|
|
460
|
-
if (!
|
|
461
|
-
const r = i.variantNames.map((o, u) => ({ selection: o, index: u, rank:
|
|
462
|
-
if (r.length === 0 || i.selection &&
|
|
463
|
+
if (!vt.test(i.setName) || n.has(Se(i))) continue;
|
|
464
|
+
const r = i.variantNames.map((o, u) => ({ selection: o, index: u, rank: At(o) })).filter((o) => o.rank !== null);
|
|
465
|
+
if (r.length === 0 || i.selection && Pt.test(i.selection)) continue;
|
|
463
466
|
const s = ce(i.selection), c = [...r].sort((o, u) => {
|
|
464
467
|
const h = s !== null && ce(o.selection) === s, g = s !== null && ce(u.selection) === s;
|
|
465
468
|
return Number(g) - Number(h) || o.rank - u.rank || o.index - u.index;
|
|
@@ -472,16 +475,16 @@ function It(e, t = []) {
|
|
|
472
475
|
}
|
|
473
476
|
return a;
|
|
474
477
|
}
|
|
475
|
-
function
|
|
478
|
+
function At(e) {
|
|
476
479
|
return /^newton(?:[_-]|$)/i.test(e) ? 0 : /^mjc(?:[_-]|$)/i.test(e) ? 1 : /^mujoco(?:[_-]|$)/i.test(e) ? 2 : null;
|
|
477
480
|
}
|
|
478
481
|
function ce(e) {
|
|
479
|
-
return e && e.replace(
|
|
482
|
+
return e && e.replace(It, "").toLowerCase() || null;
|
|
480
483
|
}
|
|
481
|
-
function
|
|
484
|
+
function Se(e) {
|
|
482
485
|
return `${e.primPath}\0${e.setName}`;
|
|
483
486
|
}
|
|
484
|
-
function
|
|
487
|
+
function xt(e) {
|
|
485
488
|
let t = 0;
|
|
486
489
|
const n = () => {
|
|
487
490
|
for (; t < e.length; ) {
|
|
@@ -599,33 +602,33 @@ const kt = [
|
|
|
599
602
|
0,
|
|
600
603
|
1
|
|
601
604
|
];
|
|
602
|
-
function
|
|
605
|
+
function Rt(e) {
|
|
603
606
|
const t = new Map(e.map((r) => [r.path, r])), n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), i = (r) => {
|
|
604
607
|
const s = n.get(r.path);
|
|
605
608
|
if (s) return s;
|
|
606
|
-
if (a.has(r.path)) return
|
|
609
|
+
if (a.has(r.path)) return Ue(r.localMatrix);
|
|
607
610
|
a.add(r.path);
|
|
608
|
-
const c =
|
|
611
|
+
const c = Ue(r.localMatrix), o = r.parentPath ? t.get(r.parentPath) : void 0, u = !o || r.resetsXformStack ? c : Ee(c, i(o));
|
|
609
612
|
return a.delete(r.path), n.set(r.path, u), u;
|
|
610
613
|
};
|
|
611
614
|
return e.map((r) => {
|
|
612
615
|
if (!r.resetsXformStack || !r.parentPath) return r;
|
|
613
616
|
const s = t.get(r.parentPath);
|
|
614
617
|
if (!s) return r;
|
|
615
|
-
const c = i(s), o =
|
|
618
|
+
const c = i(s), o = Nt(c);
|
|
616
619
|
return o ? {
|
|
617
620
|
...r,
|
|
618
|
-
localMatrix:
|
|
621
|
+
localMatrix: Ee(i(r), o)
|
|
619
622
|
} : r;
|
|
620
623
|
});
|
|
621
624
|
}
|
|
622
|
-
function
|
|
623
|
-
return
|
|
625
|
+
function Ue(e) {
|
|
626
|
+
return Dt(e) ? e : kt;
|
|
624
627
|
}
|
|
625
|
-
function
|
|
628
|
+
function Dt(e) {
|
|
626
629
|
return (e == null ? void 0 : e.length) === 16 && e.every(Number.isFinite);
|
|
627
630
|
}
|
|
628
|
-
function
|
|
631
|
+
function Ee(e, t) {
|
|
629
632
|
const n = new Array(16);
|
|
630
633
|
for (let a = 0; a < 4; a++)
|
|
631
634
|
for (let i = 0; i < 4; i++) {
|
|
@@ -636,7 +639,7 @@ function Ue(e, t) {
|
|
|
636
639
|
}
|
|
637
640
|
return n;
|
|
638
641
|
}
|
|
639
|
-
function
|
|
642
|
+
function Nt(e) {
|
|
640
643
|
const [
|
|
641
644
|
t,
|
|
642
645
|
n,
|
|
@@ -664,11 +667,11 @@ function Dt(e) {
|
|
|
664
667
|
);
|
|
665
668
|
if (!Number.isFinite(w) || Math.abs(w) <= Number.EPSILON * d * 16)
|
|
666
669
|
return null;
|
|
667
|
-
const m = 1 / w, S = f * m, b = p * m,
|
|
670
|
+
const m = 1 / w, S = f * m, b = p * m, x = y * m, j = (s * c - i * u) * m, V = (t * u - a * c) * m, G = (a * i - t * s) * m, U = (i * o - r * c) * m, M = (n * c - t * o) * m, E = (t * r - n * i) * m;
|
|
668
671
|
return [
|
|
669
672
|
S,
|
|
670
673
|
b,
|
|
671
|
-
|
|
674
|
+
x,
|
|
672
675
|
0,
|
|
673
676
|
j,
|
|
674
677
|
V,
|
|
@@ -680,21 +683,21 @@ function Dt(e) {
|
|
|
680
683
|
0,
|
|
681
684
|
-(h * S + g * j + l * U),
|
|
682
685
|
-(h * b + g * V + l * M),
|
|
683
|
-
-(h *
|
|
686
|
+
-(h * x + g * G + l * E),
|
|
684
687
|
1
|
|
685
688
|
];
|
|
686
689
|
}
|
|
687
|
-
function
|
|
690
|
+
function Tt(e, t = []) {
|
|
688
691
|
return {
|
|
689
692
|
stage: e.stage,
|
|
690
693
|
view: {
|
|
691
694
|
...e.view,
|
|
692
|
-
prims:
|
|
695
|
+
prims: Rt(e.view.prims)
|
|
693
696
|
},
|
|
694
697
|
elements: e.elements,
|
|
695
698
|
materials: e.materials,
|
|
696
699
|
materialAliases: e.materialAliases,
|
|
697
|
-
physics:
|
|
700
|
+
physics: Ot(),
|
|
698
701
|
joints: [],
|
|
699
702
|
cameras: [],
|
|
700
703
|
lights: [],
|
|
@@ -703,10 +706,10 @@ function Nt(e, t = []) {
|
|
|
703
706
|
variants: t
|
|
704
707
|
};
|
|
705
708
|
}
|
|
706
|
-
function
|
|
709
|
+
function $t(e, t) {
|
|
707
710
|
e.physics = t.physics, e.joints = t.joints;
|
|
708
711
|
}
|
|
709
|
-
function
|
|
712
|
+
function Ot() {
|
|
710
713
|
return {
|
|
711
714
|
scenes: [],
|
|
712
715
|
rigidBodies: [],
|
|
@@ -715,18 +718,18 @@ function $t() {
|
|
|
715
718
|
articulationRoots: []
|
|
716
719
|
};
|
|
717
720
|
}
|
|
718
|
-
const
|
|
719
|
-
async function
|
|
721
|
+
const Lt = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
|
|
722
|
+
async function Ct(e) {
|
|
720
723
|
const t = await import(
|
|
721
724
|
/* @vite-ignore */
|
|
722
725
|
e.moduleUrl
|
|
723
726
|
), n = t.default ?? t.createOpenUsdProbe, a = e.wasmModule ? {
|
|
724
727
|
instantiateWasm(w, d) {
|
|
725
|
-
return
|
|
728
|
+
return Et(e.wasmModule, w, d);
|
|
726
729
|
}
|
|
727
730
|
} : {
|
|
728
|
-
wasmBinary: await (typeof e.wasmBinary == "function" ? e.wasmBinary() : e.wasmBinary ??
|
|
729
|
-
}, i = await n(a), r = e.apiVersion ??
|
|
731
|
+
wasmBinary: await (typeof e.wasmBinary == "function" ? e.wasmBinary() : e.wasmBinary ?? Xt(e.wasmUrl))
|
|
732
|
+
}, i = await n(a), r = e.apiVersion ?? St.apiVersion, s = Number(i.ccall("usd_probe_api_version", "number", [], []));
|
|
730
733
|
if (s !== r)
|
|
731
734
|
throw Object.assign(
|
|
732
735
|
new Error(`OpenUSD runtime API mismatch: expected ${r}, received ${s}.`),
|
|
@@ -737,10 +740,10 @@ async function Lt(e) {
|
|
|
737
740
|
if (!d.ok) throw Object.assign(new Error(`USD resource request failed (${d.status}): ${w}`), {
|
|
738
741
|
code: d.status === 401 || d.status === 403 ? "E_ASSET_AUTH" : "E_ASSET_FETCH"
|
|
739
742
|
});
|
|
740
|
-
const m = new Uint8Array(await d.arrayBuffer()), S =
|
|
741
|
-
if (S) throw
|
|
743
|
+
const m = new Uint8Array(await d.arrayBuffer()), S = Ke(d.headers.get("content-type"), m);
|
|
744
|
+
if (S) throw Je(`USD resource is not usable (${S}): ${w}`, Ae);
|
|
742
745
|
return m;
|
|
743
|
-
}), u = (w, d, m) => JSON.parse(i.ccall(w, "string", d, m)), h = /* @__PURE__ */ new Set(), g =
|
|
746
|
+
}), u = (w, d, m) => JSON.parse(i.ccall(w, "string", d, m)), h = /* @__PURE__ */ new Set(), g = ve(i);
|
|
744
747
|
let l = 0, f = null;
|
|
745
748
|
async function p() {
|
|
746
749
|
return f || (f = (async () => {
|
|
@@ -759,32 +762,32 @@ async function Lt(e) {
|
|
|
759
762
|
})(), f);
|
|
760
763
|
}
|
|
761
764
|
async function y(w, d) {
|
|
762
|
-
const m = new URL(d.sourcePath, "file:///"), S = `${c}/load-${++l}`, b = J(m.href, S),
|
|
763
|
-
let z,
|
|
765
|
+
const m = new URL(d.sourcePath, "file:///"), S = `${c}/load-${++l}`, b = J(m.href, S), x = /* @__PURE__ */ new Set(), j = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Map(), G = d.readTextureBytes ?? !0, U = d.collectTextureUrls ?? !G, M = U || G ? De : Ht, E = /* @__PURE__ */ new Map();
|
|
766
|
+
let z, k = null, P = null;
|
|
764
767
|
const A = () => {
|
|
765
|
-
z !== void 0 && h.delete(z) && u("usd_probe_stage_release", ["number"], [z]),
|
|
768
|
+
z !== void 0 && h.delete(z) && u("usd_probe_stage_release", ["number"], [z]), k == null || k.dispose(), $e(i.FS, S);
|
|
766
769
|
};
|
|
767
770
|
try {
|
|
768
|
-
const T = await
|
|
769
|
-
de(i, b, T,
|
|
771
|
+
const T = await Ie(w);
|
|
772
|
+
de(i, b, T, x), j.set(b, M(T));
|
|
770
773
|
for (const [_, I] of Object.entries(d.files ?? {})) {
|
|
771
|
-
const v = J(new URL(_, m).href, S), F = await
|
|
772
|
-
|
|
774
|
+
const v = J(new URL(_, m).href, S), F = await Ie(I);
|
|
775
|
+
x.has(v) || j.set(v, M(F)), de(i, v, F, x);
|
|
773
776
|
}
|
|
774
|
-
const H = new Set(
|
|
777
|
+
const H = new Set(x);
|
|
775
778
|
for (const _ of d.packagePaths ?? [])
|
|
776
779
|
H.add(J(new URL(_, m).href, S));
|
|
777
|
-
const O = d.externalReferenceMode ?? "complete", L =
|
|
780
|
+
const O = d.externalReferenceMode ?? "complete", L = it(T) ? await ct(T, { include: xe }) : null;
|
|
778
781
|
let B = {};
|
|
779
782
|
if (!L && d.autoResolveAssets !== !1) {
|
|
780
783
|
const _ = d.resolveBytes ?? ((I) => o(I));
|
|
781
|
-
B = await
|
|
784
|
+
B = await Bt(
|
|
782
785
|
i,
|
|
783
786
|
m,
|
|
784
787
|
S,
|
|
785
788
|
_,
|
|
786
789
|
u,
|
|
787
|
-
|
|
790
|
+
x,
|
|
788
791
|
E,
|
|
789
792
|
U ? V : null,
|
|
790
793
|
j,
|
|
@@ -798,10 +801,10 @@ async function Lt(e) {
|
|
|
798
801
|
d.onResourceFailed
|
|
799
802
|
);
|
|
800
803
|
}
|
|
801
|
-
|
|
802
|
-
const Z = d.textureResolver ||
|
|
804
|
+
k = L ? ut(L) : null;
|
|
805
|
+
const Z = d.textureResolver || k ? (_) => {
|
|
803
806
|
var I;
|
|
804
|
-
return ((I = d.textureResolver) == null ? void 0 : I.call(d, _)) ?? (
|
|
807
|
+
return ((I = d.textureResolver) == null ? void 0 : I.call(d, _)) ?? (k == null ? void 0 : k.resolve(_)) ?? null;
|
|
805
808
|
} : void 0, R = Object.keys(B).length > 0;
|
|
806
809
|
if (R && typeof i._usd_probe_stage_open_mapped != "function")
|
|
807
810
|
throw Object.assign(new Error("USD dependency mapping requires the matching packaged openusd_probe.js and .wasm runtime."), { code: "E_USD_RUNTIME_VERSION" });
|
|
@@ -821,7 +824,7 @@ async function Lt(e) {
|
|
|
821
824
|
throw new Error(String(_.error ?? "Failed to enumerate USD variants."));
|
|
822
825
|
ne = _.variants ?? [], W = [
|
|
823
826
|
...$,
|
|
824
|
-
...
|
|
827
|
+
...Mt(ne, $)
|
|
825
828
|
];
|
|
826
829
|
}
|
|
827
830
|
for (const _ of W) {
|
|
@@ -833,7 +836,7 @@ async function Lt(e) {
|
|
|
833
836
|
if (I.ok !== !0)
|
|
834
837
|
throw new Error(String(I.error ?? `Failed to select USD variant ${_.primPath}:${_.setName}=${_.selection}`));
|
|
835
838
|
}
|
|
836
|
-
const re =
|
|
839
|
+
const re = ve(i, E, b), se = re.openStage(D.stageId);
|
|
837
840
|
if (d.selectMuJoCoPhysicsVariant !== !1) {
|
|
838
841
|
const _ = new Set($.map(ue)), I = /* @__PURE__ */ new Set();
|
|
839
842
|
for (const v of W) {
|
|
@@ -852,20 +855,20 @@ async function Lt(e) {
|
|
|
852
855
|
}
|
|
853
856
|
I.size > 0 && (W = W.filter((v) => !I.has(ue(v))));
|
|
854
857
|
}
|
|
855
|
-
const fe = await
|
|
858
|
+
const fe = await jt(i, D.stageId, b, {
|
|
856
859
|
batchSize: d.geometryBatchSize,
|
|
857
860
|
onProgress: d.onGeometryProgress
|
|
858
861
|
});
|
|
859
|
-
|
|
860
|
-
const
|
|
862
|
+
Te(fe.materials, E);
|
|
863
|
+
const Oe = new Map(W.map((_) => [
|
|
861
864
|
`${_.primPath}\0${_.setName}`,
|
|
862
865
|
_.selection
|
|
863
|
-
])),
|
|
866
|
+
])), Le = ne.map((_) => ({
|
|
864
867
|
..._,
|
|
865
|
-
selection:
|
|
866
|
-
})), ae =
|
|
868
|
+
selection: Oe.get(`${_.primPath}\0${_.setName}`) ?? _.selection
|
|
869
|
+
})), ae = Tt(fe, Le), he = L ? void 0 : d.isTextureAllowed ?? (O === "package" ? (_) => {
|
|
867
870
|
const I = new URL(_, m);
|
|
868
|
-
return H.has(J(I.href, S)) ||
|
|
871
|
+
return H.has(J(I.href, S)) || Me(I, m);
|
|
869
872
|
} : void 0);
|
|
870
873
|
return {
|
|
871
874
|
data: ae,
|
|
@@ -894,11 +897,11 @@ async function Lt(e) {
|
|
|
894
897
|
{
|
|
895
898
|
// Keep package texture identities on the model so the visual adapter
|
|
896
899
|
// can resolve textures referenced by unsupported-but-known MDL nodes.
|
|
897
|
-
usdzTextureURLs: (
|
|
900
|
+
usdzTextureURLs: (k == null ? void 0 : k.urls) ?? /* @__PURE__ */ new Map(),
|
|
898
901
|
autoTextureURLs: /* @__PURE__ */ new Map()
|
|
899
902
|
}
|
|
900
|
-
), v = he ?
|
|
901
|
-
v.usdQuery =
|
|
903
|
+
), v = he ? je(ae.materials, he, I) : I();
|
|
904
|
+
v.usdQuery = Re(se, re);
|
|
902
905
|
const F = v.dispose.bind(v);
|
|
903
906
|
let C = !1;
|
|
904
907
|
return v.dispose = () => {
|
|
@@ -930,7 +933,7 @@ async function Lt(e) {
|
|
|
930
933
|
async parseAsync(w, d) {
|
|
931
934
|
const m = await y(w, d);
|
|
932
935
|
try {
|
|
933
|
-
return
|
|
936
|
+
return $t(m.data, await m.readPhysics()), await m.buildModel();
|
|
934
937
|
} catch (S) {
|
|
935
938
|
throw m.release(), S;
|
|
936
939
|
}
|
|
@@ -940,7 +943,7 @@ async function Lt(e) {
|
|
|
940
943
|
}
|
|
941
944
|
};
|
|
942
945
|
}
|
|
943
|
-
function
|
|
946
|
+
function ve(e, t = /* @__PURE__ */ new Map(), n) {
|
|
944
947
|
const a = (l, f, p) => JSON.parse(e.ccall(l, "string", f, p));
|
|
945
948
|
class i {
|
|
946
949
|
constructor(f) {
|
|
@@ -959,7 +962,7 @@ function Ee(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
959
962
|
if (n && typeof S == "function") {
|
|
960
963
|
const b = e.ccall("usd_probe_flatten_stage", "string", ["string"], [n]);
|
|
961
964
|
if (typeof b != "string" || !b.startsWith("#usda")) throw new Error("Unable to read flattened USD joint metadata");
|
|
962
|
-
r =
|
|
965
|
+
r = xt(b);
|
|
963
966
|
} else
|
|
964
967
|
r = /* @__PURE__ */ new Map();
|
|
965
968
|
}
|
|
@@ -967,8 +970,8 @@ function Ee(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
967
970
|
if (p || s.has(f)) return p ?? s.get(f);
|
|
968
971
|
const y = ["rotX", "rotY", "rotZ", "transX", "transY", "transZ", "X", "Y", "Z"], w = [], d = /* @__PURE__ */ new Map();
|
|
969
972
|
for (const S of y) {
|
|
970
|
-
const b = `physxMimicJoint:${S}:referenceJoint`,
|
|
971
|
-
|
|
973
|
+
const b = `physxMimicJoint:${S}:referenceJoint`, x = a("usd_probe_relationship_targets", ["number", "string", "string"], [l, f, b]).paths ?? [];
|
|
974
|
+
x.length && (w.push(`PhysxMimicJointAPI:${S}`), d.set(b, x));
|
|
972
975
|
}
|
|
973
976
|
const m = w.length ? { schemas: w, relationships: d } : void 0;
|
|
974
977
|
return m && s.set(f, m), m;
|
|
@@ -1090,7 +1093,7 @@ function Ee(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
1090
1093
|
openStage: h
|
|
1091
1094
|
};
|
|
1092
1095
|
}
|
|
1093
|
-
async function
|
|
1096
|
+
async function jt(e, t, n, a = {}) {
|
|
1094
1097
|
var c;
|
|
1095
1098
|
if (typeof e._usd_probe_scene_visual != "function" || typeof e._usd_probe_scene_geometry != "function" || typeof e._usd_probe_scene_geometry_end != "function")
|
|
1096
1099
|
throw Object.assign(
|
|
@@ -1118,41 +1121,41 @@ async function Ct(e, t, n, a = {}) {
|
|
|
1118
1121
|
));
|
|
1119
1122
|
if (!l.ok) throw new Error(l.error ?? `Failed to stream USD geometry for ${u.path}`);
|
|
1120
1123
|
u.geometry = Object.fromEntries(
|
|
1121
|
-
Object.entries(l.geometry ?? {}).map(([f, p]) => [f,
|
|
1122
|
-
), (c = a.onProgress) == null || c.call(a, o + 1, r.elements.length, u.path), (o + 1) % s === 0 && await
|
|
1124
|
+
Object.entries(l.geometry ?? {}).map(([f, p]) => [f, Gt(e, p)])
|
|
1125
|
+
), (c = a.onProgress) == null || c.call(a, o + 1, r.elements.length, u.path), (o + 1) % s === 0 && await Vt();
|
|
1123
1126
|
}
|
|
1124
1127
|
} finally {
|
|
1125
1128
|
e.ccall("usd_probe_scene_geometry_end", "string", ["number"], [t]);
|
|
1126
1129
|
}
|
|
1127
1130
|
return r;
|
|
1128
1131
|
}
|
|
1129
|
-
function
|
|
1132
|
+
function Vt() {
|
|
1130
1133
|
return new Promise((e) => setTimeout(e, 0));
|
|
1131
1134
|
}
|
|
1132
|
-
function
|
|
1135
|
+
function Gt(e, t) {
|
|
1133
1136
|
if (!t || typeof t != "object") return t ?? null;
|
|
1134
1137
|
const { ptr: n, length: a, kind: i } = t;
|
|
1135
1138
|
return typeof n != "number" ? t : a ? (i === "i32" ? new Int32Array(e.HEAP32.buffer, n, a) : new Float32Array(e.HEAPF32.buffer, n, a)).slice() : i === "i32" ? new Int32Array() : new Float32Array();
|
|
1136
1139
|
}
|
|
1137
|
-
async function
|
|
1140
|
+
async function Bt(e, t, n, a, i, r, s, c, o, u, h, g, l, f, p, y, w) {
|
|
1138
1141
|
const d = {}, m = [...f];
|
|
1139
1142
|
let S = [
|
|
1140
1143
|
{ url: t, depth: 0, recurse: !0, absolute: !1 }
|
|
1141
1144
|
];
|
|
1142
|
-
const b = /* @__PURE__ */ new Set(),
|
|
1145
|
+
const b = /* @__PURE__ */ new Set(), x = /* @__PURE__ */ new Set();
|
|
1143
1146
|
for (; S.length; ) {
|
|
1144
1147
|
const j = S;
|
|
1145
1148
|
S = [];
|
|
1146
1149
|
const V = [];
|
|
1147
1150
|
for (const U of j) {
|
|
1148
|
-
const M = U.absolute ? U.url.href :
|
|
1151
|
+
const M = U.absolute ? U.url.href : Pe(U.url.href, t);
|
|
1149
1152
|
if (!b.has(M)) {
|
|
1150
1153
|
if (U.depth > h) throw new Error(`USD dependency depth limit exceeded (${h}): ${M}`);
|
|
1151
1154
|
if (b.size >= u) throw new Error(`USD dependency limit exceeded (${u}).`);
|
|
1152
1155
|
b.add(M), V.push({ item: U, identifier: M });
|
|
1153
1156
|
}
|
|
1154
1157
|
}
|
|
1155
|
-
S = (await
|
|
1158
|
+
S = (await Ft(
|
|
1156
1159
|
V,
|
|
1157
1160
|
Math.max(1, g),
|
|
1158
1161
|
async ({ item: U, identifier: M }) => {
|
|
@@ -1162,15 +1165,15 @@ async function Gt(e, t, n, a, i, r, s, c, o, u, h, g, l, f, p, y, w) {
|
|
|
1162
1165
|
try {
|
|
1163
1166
|
P = await a(U.url, M);
|
|
1164
1167
|
} catch (A) {
|
|
1165
|
-
if (!U.owner || !
|
|
1168
|
+
if (!U.owner || !Xe(M) || !Ye(A)) throw A;
|
|
1166
1169
|
const T = `${n}/__unavailable__/${encodeURIComponent(M)}`;
|
|
1167
1170
|
return d[U.owner.path][U.owner.reference] = T, s.set(T, M), w == null || w(M, A), [];
|
|
1168
1171
|
}
|
|
1169
|
-
o.set(E,
|
|
1172
|
+
o.set(E, De(P)), de(e, E, P, r);
|
|
1170
1173
|
}
|
|
1171
1174
|
if (s.set(E, M), !U.recurse) return [];
|
|
1172
1175
|
if (d[E] ?? (d[E] = {}), o.get(E) === !1) return [];
|
|
1173
|
-
const z = i("usd_probe_external_references", ["string"], [E]).paths ?? [],
|
|
1176
|
+
const z = i("usd_probe_external_references", ["string"], [E]).paths ?? [], k = [];
|
|
1174
1177
|
for (const P of z) {
|
|
1175
1178
|
if (!P || /^(?:data|blob):/i.test(P) || /\.mdl(?:[?#].*)?$/i.test(P)) continue;
|
|
1176
1179
|
let A;
|
|
@@ -1179,22 +1182,22 @@ async function Gt(e, t, n, a, i, r, s, c, o, u, h, g, l, f, p, y, w) {
|
|
|
1179
1182
|
} catch {
|
|
1180
1183
|
continue;
|
|
1181
1184
|
}
|
|
1182
|
-
const T = /^(?:[a-z][a-z\d+.-]*:|\/)/i.test(P), H = J(A.href, n), O =
|
|
1185
|
+
const T = /^(?:[a-z][a-z\d+.-]*:|\/)/i.test(P), H = J(A.href, n), O = et(H, m), L = (O == null ? void 0 : O.paths.length) === 1 ? O.paths[0] : null, B = L ?? H, Z = U.absolute || T, R = Z ? A.href : Pe(A.href, t), D = zt(A.pathname);
|
|
1183
1186
|
if (L && s.set(L, R), l === "package" && O && O.paths.length > 1) {
|
|
1184
1187
|
const $ = `${n}/__deferred_udim__/${encodeURIComponent(R)}`;
|
|
1185
1188
|
d[E][P] = $, s.set($, R);
|
|
1186
1189
|
continue;
|
|
1187
1190
|
}
|
|
1188
|
-
if (l === "package" && !f.has(B) && !
|
|
1191
|
+
if (l === "package" && !f.has(B) && !Me(A, t)) {
|
|
1189
1192
|
const $ = `${n}/__skipped__/${encodeURIComponent(R)}`;
|
|
1190
|
-
d[E][P] = $, s.set($, R),
|
|
1193
|
+
d[E][P] = $, s.set($, R), x.has(R) || (x.add(R), y == null || y(R));
|
|
1191
1194
|
continue;
|
|
1192
1195
|
}
|
|
1193
1196
|
if (!D && c && (c.set(R, A.href), c.set(P, A.href)), d[E][P] = B, !D && !p) {
|
|
1194
1197
|
s.set(B, R);
|
|
1195
1198
|
continue;
|
|
1196
1199
|
}
|
|
1197
|
-
!L && !b.has(R) &&
|
|
1200
|
+
!L && !b.has(R) && k.push({
|
|
1198
1201
|
url: A,
|
|
1199
1202
|
depth: U.depth + 1,
|
|
1200
1203
|
recurse: D,
|
|
@@ -1202,13 +1205,13 @@ async function Gt(e, t, n, a, i, r, s, c, o, u, h, g, l, f, p, y, w) {
|
|
|
1202
1205
|
owner: { path: E, reference: P }
|
|
1203
1206
|
});
|
|
1204
1207
|
}
|
|
1205
|
-
return
|
|
1208
|
+
return k;
|
|
1206
1209
|
}
|
|
1207
1210
|
)).flat();
|
|
1208
1211
|
}
|
|
1209
1212
|
return d;
|
|
1210
1213
|
}
|
|
1211
|
-
async function
|
|
1214
|
+
async function Ft(e, t, n) {
|
|
1212
1215
|
const a = new Array(e.length);
|
|
1213
1216
|
let i = 0;
|
|
1214
1217
|
const r = Array.from({ length: Math.min(t, e.length) }, async () => {
|
|
@@ -1219,16 +1222,16 @@ async function Bt(e, t, n) {
|
|
|
1219
1222
|
});
|
|
1220
1223
|
return await Promise.all(r), a;
|
|
1221
1224
|
}
|
|
1222
|
-
function
|
|
1225
|
+
function zt(e) {
|
|
1223
1226
|
var n, a;
|
|
1224
1227
|
const t = (a = (n = e.split(/[?#]/, 1)[0]) == null ? void 0 : n.split(".").pop()) == null ? void 0 : a.toLowerCase();
|
|
1225
|
-
return t != null &&
|
|
1228
|
+
return t != null && Lt.has(t);
|
|
1226
1229
|
}
|
|
1227
|
-
function
|
|
1228
|
-
return
|
|
1230
|
+
function De(e) {
|
|
1231
|
+
return Ne(e) ? e.includes(64) : !0;
|
|
1229
1232
|
}
|
|
1230
|
-
function
|
|
1231
|
-
return
|
|
1233
|
+
function Ht(e) {
|
|
1234
|
+
return Ne(e) ? Wt(e, [
|
|
1232
1235
|
"subLayers",
|
|
1233
1236
|
"references",
|
|
1234
1237
|
"payload",
|
|
@@ -1236,12 +1239,12 @@ function zt(e) {
|
|
|
1236
1239
|
"clipAssetPaths"
|
|
1237
1240
|
]) : !0;
|
|
1238
1241
|
}
|
|
1239
|
-
function
|
|
1242
|
+
function Ne(e) {
|
|
1240
1243
|
let t = e[0] === 239 && e[1] === 187 && e[2] === 191 ? 3 : 0;
|
|
1241
1244
|
for (; t < e.length && t < 64 && /\s/.test(String.fromCharCode(e[t])); ) t += 1;
|
|
1242
1245
|
return e[t] === 35 && e[t + 1] === 117 && e[t + 2] === 115 && e[t + 3] === 100 && e[t + 4] === 97;
|
|
1243
1246
|
}
|
|
1244
|
-
function
|
|
1247
|
+
function Wt(e, t) {
|
|
1245
1248
|
const n = /* @__PURE__ */ new Map();
|
|
1246
1249
|
let a = 1;
|
|
1247
1250
|
for (const r of t) {
|
|
@@ -1264,7 +1267,7 @@ function Ht(e, t) {
|
|
|
1264
1267
|
}
|
|
1265
1268
|
return !1;
|
|
1266
1269
|
}
|
|
1267
|
-
function
|
|
1270
|
+
function Pe(e, t) {
|
|
1268
1271
|
const n = new URL(e);
|
|
1269
1272
|
if (n.protocol !== t.protocol || n.host !== t.host) return n.href;
|
|
1270
1273
|
const a = new URL(".", t).pathname.split("/").filter(Boolean), i = n.pathname.split("/").filter(Boolean);
|
|
@@ -1282,7 +1285,7 @@ function J(e, t) {
|
|
|
1282
1285
|
}
|
|
1283
1286
|
return `${t}/${a}${i}`;
|
|
1284
1287
|
}
|
|
1285
|
-
function
|
|
1288
|
+
function Te(e, t) {
|
|
1286
1289
|
if (!e || typeof e != "object" || ArrayBuffer.isView(e)) return;
|
|
1287
1290
|
const n = e;
|
|
1288
1291
|
if (typeof n.path == "string" && typeof n.resolvedPath == "string") {
|
|
@@ -1292,14 +1295,14 @@ function Ne(e, t) {
|
|
|
1292
1295
|
}
|
|
1293
1296
|
return;
|
|
1294
1297
|
}
|
|
1295
|
-
for (const a of Object.values(e))
|
|
1298
|
+
for (const a of Object.values(e)) Te(a, t);
|
|
1296
1299
|
}
|
|
1297
|
-
function
|
|
1300
|
+
function $e(e, t) {
|
|
1298
1301
|
if (e.analyzePath(t).exists) {
|
|
1299
1302
|
for (const n of e.readdir(t)) {
|
|
1300
1303
|
if (n === "." || n === "..") continue;
|
|
1301
1304
|
const a = `${t}/${n}`;
|
|
1302
|
-
e.isDir(e.stat(a).mode) ?
|
|
1305
|
+
e.isDir(e.stat(a).mode) ? $e(e, a) : e.unlink(a);
|
|
1303
1306
|
}
|
|
1304
1307
|
e.rmdir(t);
|
|
1305
1308
|
}
|
|
@@ -1310,14 +1313,14 @@ function de(e, t, n, a) {
|
|
|
1310
1313
|
function ue(e) {
|
|
1311
1314
|
return `${e.primPath}\0${e.setName}`;
|
|
1312
1315
|
}
|
|
1313
|
-
async function
|
|
1316
|
+
async function Ie(e) {
|
|
1314
1317
|
return typeof e == "string" ? new TextEncoder().encode(e) : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(await e.arrayBuffer());
|
|
1315
1318
|
}
|
|
1316
|
-
async function
|
|
1319
|
+
async function Xt(e) {
|
|
1317
1320
|
if (!e) throw new Error("createSingleThreadUsd needs wasmUrl or wasmBinary.");
|
|
1318
1321
|
return (await fetch(e)).arrayBuffer();
|
|
1319
1322
|
}
|
|
1320
|
-
function
|
|
1323
|
+
function Jt(e) {
|
|
1321
1324
|
if (e.length < 30) return null;
|
|
1322
1325
|
const t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = (a, i) => {
|
|
1323
1326
|
for (let r = 0; r < i.length; r += 1)
|
|
@@ -1358,7 +1361,7 @@ function Xt(e) {
|
|
|
1358
1361
|
}
|
|
1359
1362
|
return null;
|
|
1360
1363
|
}
|
|
1361
|
-
function
|
|
1364
|
+
function Zt(e, t) {
|
|
1362
1365
|
const n = Math.max(e.width, e.height);
|
|
1363
1366
|
if (t <= 0 || n <= t) return e;
|
|
1364
1367
|
const a = t / n;
|
|
@@ -1379,44 +1382,44 @@ function X(e) {
|
|
|
1379
1382
|
} : { name: "Error", message: String(e) };
|
|
1380
1383
|
}
|
|
1381
1384
|
const K = globalThis;
|
|
1382
|
-
let ee = null, q = null, te = null, oe = null, le = !1,
|
|
1385
|
+
let ee = null, q = null, te = null, oe = null, le = !1, Yt = 1;
|
|
1383
1386
|
const Q = /* @__PURE__ */ new Map();
|
|
1384
1387
|
function N(e, t) {
|
|
1385
1388
|
K.postMessage(e, t);
|
|
1386
1389
|
}
|
|
1387
|
-
function
|
|
1388
|
-
const n =
|
|
1390
|
+
function qt(e, t) {
|
|
1391
|
+
const n = Yt++;
|
|
1389
1392
|
return new Promise((a, i) => {
|
|
1390
1393
|
Q.set(n, { resolve: a, reject: i }), N({ type: "resource-request", id: n, url: e.href, identifier: t });
|
|
1391
1394
|
});
|
|
1392
1395
|
}
|
|
1393
|
-
function qt(e) {
|
|
1394
|
-
return ee ?? (ee = Lt(e)), ee;
|
|
1395
|
-
}
|
|
1396
1396
|
function Kt(e) {
|
|
1397
|
+
return ee ?? (ee = Ct(e)), ee;
|
|
1398
|
+
}
|
|
1399
|
+
function Qt(e) {
|
|
1397
1400
|
const t = /* @__PURE__ */ new Set();
|
|
1398
1401
|
for (const n of e.elements)
|
|
1399
1402
|
for (const a of Object.values(n.geometry ?? {}))
|
|
1400
1403
|
ArrayBuffer.isView(a) && t.add(a.buffer);
|
|
1401
1404
|
return [...t];
|
|
1402
1405
|
}
|
|
1403
|
-
async function
|
|
1406
|
+
async function en(e) {
|
|
1404
1407
|
if (!te) throw new Error("USD worker has no live stage");
|
|
1405
1408
|
const t = te[e.method];
|
|
1406
1409
|
return { type: "query-result", id: e.id, value: await t.apply(te, e.args) };
|
|
1407
1410
|
}
|
|
1408
|
-
async function
|
|
1411
|
+
async function tn(e, t) {
|
|
1409
1412
|
if (typeof createImageBitmap != "function")
|
|
1410
1413
|
throw new Error("This browser cannot decode USD textures in a worker.");
|
|
1411
1414
|
const n = await fetch(e);
|
|
1412
1415
|
if (!n.ok) throw new Error(`HTTP ${n.status} for ${e}`);
|
|
1413
|
-
const a = new Uint8Array(await n.arrayBuffer()), i =
|
|
1416
|
+
const a = new Uint8Array(await n.arrayBuffer()), i = Jt(a), r = {
|
|
1414
1417
|
imageOrientation: "flipY",
|
|
1415
1418
|
premultiplyAlpha: "none",
|
|
1416
1419
|
colorSpaceConversion: "none"
|
|
1417
1420
|
};
|
|
1418
1421
|
if (i) {
|
|
1419
|
-
const s =
|
|
1422
|
+
const s = Zt(i, Math.min(4096, Math.max(1, t)));
|
|
1420
1423
|
(s.width !== i.width || s.height !== i.height) && (r.resizeWidth = s.width, r.resizeHeight = s.height, r.resizeQuality = "high");
|
|
1421
1424
|
}
|
|
1422
1425
|
return createImageBitmap(new Blob([a]), r);
|
|
@@ -1434,7 +1437,7 @@ K.onmessage = async (e) => {
|
|
|
1434
1437
|
}
|
|
1435
1438
|
if (t.type === "query") {
|
|
1436
1439
|
try {
|
|
1437
|
-
N(await
|
|
1440
|
+
N(await en(t));
|
|
1438
1441
|
} catch (n) {
|
|
1439
1442
|
N({ type: "error", id: t.id, error: X(n) });
|
|
1440
1443
|
}
|
|
@@ -1442,7 +1445,7 @@ K.onmessage = async (e) => {
|
|
|
1442
1445
|
}
|
|
1443
1446
|
if (t.type === "decode-texture") {
|
|
1444
1447
|
try {
|
|
1445
|
-
const n = await
|
|
1448
|
+
const n = await tn(t.url, t.maxDimension);
|
|
1446
1449
|
N({
|
|
1447
1450
|
type: "texture-decoded",
|
|
1448
1451
|
id: t.id,
|
|
@@ -1472,7 +1475,7 @@ K.onmessage = async (e) => {
|
|
|
1472
1475
|
}
|
|
1473
1476
|
if (t.type === "prepare") {
|
|
1474
1477
|
try {
|
|
1475
|
-
const n = await
|
|
1478
|
+
const n = await Kt(t.runtime);
|
|
1476
1479
|
t.warmup && await n.warmup(), N({ type: "worker-ready" });
|
|
1477
1480
|
} catch (n) {
|
|
1478
1481
|
N({ type: "error", error: X(n) }), K.close();
|
|
@@ -1484,16 +1487,16 @@ K.onmessage = async (e) => {
|
|
|
1484
1487
|
const a = await (await ee).parseVisualSceneAsync(t.input, {
|
|
1485
1488
|
...t.options,
|
|
1486
1489
|
packagePaths: t.options.packagePaths,
|
|
1487
|
-
readTextureBytes: !1,
|
|
1490
|
+
readTextureBytes: t.options.readTextureBytes ?? !1,
|
|
1488
1491
|
loadTextures: !1,
|
|
1489
1492
|
convertZUp: !1,
|
|
1490
1493
|
loadLights: !1,
|
|
1491
|
-
resolveBytes:
|
|
1494
|
+
resolveBytes: qt,
|
|
1492
1495
|
onReferenceSkipped: (s) => N({ type: "event", event: "reference-skipped", identifier: s }),
|
|
1493
1496
|
onResourceFailed: (s, c) => N({ type: "event", event: "resource-failed", identifier: s, error: X(c) })
|
|
1494
1497
|
});
|
|
1495
|
-
q = a.release, te =
|
|
1496
|
-
const i = a.data, r =
|
|
1498
|
+
q = a.release, te = Re(a.stage, a.pxr), oe = a.readPhysics;
|
|
1499
|
+
const i = a.data, r = Qt(i);
|
|
1497
1500
|
N({
|
|
1498
1501
|
type: "visual-ready",
|
|
1499
1502
|
data: i,
|