@nebula-spatial/viewer 0.6.4 → 0.6.6
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 +22 -0
- package/README.md +5 -0
- package/dist/assets/mujoco-physics-worker-MMv4Gmu_.js +5482 -0
- package/dist/assets/{usd-worker-jdyS9s6r.js → usd-worker-HijL9KRX.js} +266 -262
- package/dist/dynamic-raycast-Ctu2X5u5.js +677 -0
- package/dist/{index-QdE4B8Hz.js → index-DyBfusq5.js} +3910 -3522
- package/dist/index.js +12 -12
- package/dist/{mjcf-visual-De37eJ9x.js → mjcf-visual-5WZebsIs.js} +7 -7
- package/dist/mujoco-runtime-CZSNQ7An.js +1601 -0
- package/dist/{session-b0epJBBq.js → session-BerXscrf.js} +7 -7
- package/dist/{session-DDGiY6I8.js → session-CzJBN0Us.js} +19 -19
- package/dist/session-DXUACJAS.js +719 -0
- package/dist/simulation/types.d.ts +26 -0
- package/dist/{spark-renderer-upJSRoni.js → spark-renderer-dvFIUjr0.js} +1 -1
- package/dist/{urdf-session-B-nvkfBZ.js → urdf-session-DRHt0jW4.js} +34 -34
- package/dist/usd-session-CLU3UR4C.js +12726 -0
- package/dist/version.d.ts +1 -1
- package/dist/{xacro-BoRKvNlt.js → xacro-BV6bRVpX.js} +1 -1
- package/openusd/openusd-runtime-manifest.json +3 -3
- package/openusd/openusd_probe.wasm +0 -0
- package/package.json +2 -2
- package/dist/asset-ir-CodOg3S4.js +0 -637
- package/dist/mujoco-runtime-BGh1TiiB.js +0 -791
- package/dist/session-BSSjaFpR.js +0 -562
- package/dist/usd-session-CU8fHxm9.js +0 -11603
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Ne(e, t) {
|
|
2
2
|
return /^https?:$/.test(t.protocol) && e.origin === t.origin && !e.username && !e.password && ye(e.pathname).startsWith(ye(new URL(".", t).pathname));
|
|
3
3
|
}
|
|
4
4
|
function ye(e) {
|
|
5
5
|
return e.endsWith("/") ? e : e.slice(0, e.lastIndexOf("/") + 1);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function We(e, t) {
|
|
8
8
|
for (const n of e) for (const s of n.shaders) for (const a of Object.values(s.inputs)) {
|
|
9
9
|
if (!a || typeof a != "object" || Array.isArray(a)) continue;
|
|
10
10
|
const o = a, r = [o.path, o.url, o.resolvedPath].find((c) => typeof c == "string" && c);
|
|
11
11
|
!r || /^(?:data|blob):/i.test(r) || /\.mdl(?:[?#].*)?$/i.test(r) || t(o, r);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function He(e, t, n) {
|
|
15
15
|
const s = [];
|
|
16
16
|
try {
|
|
17
|
-
return
|
|
17
|
+
return We(e, (a, o) => {
|
|
18
18
|
if (t(o)) return;
|
|
19
19
|
const r = {};
|
|
20
20
|
for (const c of ["path", "resolvedPath", "url"])
|
|
@@ -25,7 +25,7 @@ function We(e, t, n) {
|
|
|
25
25
|
for (const { asset: a, values: o } of s) Object.assign(a, o);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const Je = "E_ASSET_RESOURCE_NOT_FOUND", De = "E_ASSET_RESOURCE_INVALID", Xe = "E_ASSET_FETCH", qe = "E_ASSET_EXTERNAL_DENIED", Ze = "E_ASSET_AUTH", Ye = /* @__PURE__ */ new Set([
|
|
29
29
|
"png",
|
|
30
30
|
"jpg",
|
|
31
31
|
"jpeg",
|
|
@@ -38,46 +38,46 @@ const He = "E_ASSET_RESOURCE_NOT_FOUND", Ne = "E_ASSET_RESOURCE_INVALID", Je = "
|
|
|
38
38
|
"hdr",
|
|
39
39
|
"exr",
|
|
40
40
|
"ktx2"
|
|
41
|
-
]),
|
|
42
|
-
function
|
|
41
|
+
]), Ke = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
|
|
42
|
+
function Qe(e) {
|
|
43
43
|
var n;
|
|
44
44
|
return ((n = (e.split(/[?#]/, 1)[0] ?? e).split(".").pop()) == null ? void 0 : n.toLowerCase()) ?? "";
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
const t =
|
|
48
|
-
return
|
|
46
|
+
function et(e) {
|
|
47
|
+
const t = Qe(e);
|
|
48
|
+
return Ye.has(t) && !Ke.has(t);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function tt(e, t) {
|
|
51
51
|
return Object.assign(new Error(e), { code: t });
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function nt(e) {
|
|
54
54
|
var s;
|
|
55
55
|
if (e instanceof Error && e.name === "AbortError") return "aborted";
|
|
56
56
|
const t = e == null ? void 0 : e.code;
|
|
57
|
-
if (t ===
|
|
58
|
-
if (t ===
|
|
59
|
-
if (t ===
|
|
60
|
-
if (t ===
|
|
57
|
+
if (t === Je) return "missing";
|
|
58
|
+
if (t === De) return "invalid";
|
|
59
|
+
if (t === Xe) return "unavailable";
|
|
60
|
+
if (t === Ze || t === qe) return "denied";
|
|
61
61
|
const n = (s = /\((\d{3})\)/.exec(e instanceof Error ? e.message : "")) == null ? void 0 : s[1];
|
|
62
62
|
return n === "404" || n === "410" ? "missing" : n === "401" || n === "403" ? "denied" : n != null && n.startsWith("5") ? "unavailable" : "unknown";
|
|
63
63
|
}
|
|
64
|
-
function
|
|
65
|
-
const t =
|
|
64
|
+
function rt(e) {
|
|
65
|
+
const t = nt(e);
|
|
66
66
|
return t === "missing" || t === "invalid" || t === "unavailable";
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function st(e, t) {
|
|
69
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;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
return t.byteLength ?
|
|
71
|
+
function ot(e, t) {
|
|
72
|
+
return t.byteLength ? st(e, new TextDecoder().decode(t.subarray(0, 512))) : "响应内容为空";
|
|
73
73
|
}
|
|
74
|
-
const
|
|
75
|
-
function
|
|
74
|
+
const at = /<UDIM>/i;
|
|
75
|
+
function it(e, t) {
|
|
76
76
|
const n = we(e).replaceAll("\\", "/");
|
|
77
|
-
if (!
|
|
77
|
+
if (!at.test(n)) return null;
|
|
78
78
|
const s = _e(n), a = s.split("/").at(-1);
|
|
79
79
|
if (!a) return { paths: [], tiles: [] };
|
|
80
|
-
const o =
|
|
80
|
+
const o = ct(a);
|
|
81
81
|
if (!o) return { paths: [], tiles: [] };
|
|
82
82
|
const r = [];
|
|
83
83
|
for (const f of new Set(t)) {
|
|
@@ -89,7 +89,7 @@ function at(e, t) {
|
|
|
89
89
|
!Number.isInteger(h) || h < 1001 || h > 9999 || r.push({
|
|
90
90
|
path: f,
|
|
91
91
|
tile: h,
|
|
92
|
-
score:
|
|
92
|
+
score: lt(s, y)
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
if (!r.length) return { paths: [], tiles: [] };
|
|
@@ -99,11 +99,11 @@ function at(e, t) {
|
|
|
99
99
|
tiles: i.map((f) => f.tile)
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function ct(e) {
|
|
103
103
|
const t = e.split(/<UDIM>/i);
|
|
104
104
|
return t.length !== 2 ? null : new RegExp(`^${be(t[0])}(\\d{4})${be(t[1])}$`, "i");
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function lt(e, t) {
|
|
107
107
|
const n = e.split("/").slice(0, -1).filter(Boolean), s = t.split("/").slice(0, -1).filter(Boolean);
|
|
108
108
|
let a = 0;
|
|
109
109
|
for (; a < n.length && a < s.length; ) {
|
|
@@ -128,32 +128,32 @@ function _e(e) {
|
|
|
128
128
|
function be(e) {
|
|
129
129
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
130
130
|
}
|
|
131
|
-
const
|
|
132
|
-
function
|
|
131
|
+
const ut = 67324752, ft = 33639248, dt = 101010256, ce = 4294967295, ht = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "webp"]);
|
|
132
|
+
function pt(e) {
|
|
133
133
|
return e.length > 3 && e[0] === 80 && e[1] === 75;
|
|
134
134
|
}
|
|
135
|
-
async function
|
|
136
|
-
const n = new DataView(e.buffer, e.byteOffset, e.byteLength), s =
|
|
135
|
+
async function gt(e, t = {}) {
|
|
136
|
+
const n = new DataView(e.buffer, e.byteOffset, e.byteLength), s = St(n);
|
|
137
137
|
if (s < 0) throw new Error("Not a zip package: end of central directory not found.");
|
|
138
138
|
const a = n.getUint16(s + 10, !0);
|
|
139
139
|
let o = n.getUint32(s + 16, !0);
|
|
140
140
|
if (a === 65535 || o === ce) throw new Error("ZIP64 usdz packages are not supported.");
|
|
141
141
|
const r = /* @__PURE__ */ new Map(), c = [];
|
|
142
142
|
for (let i = 0; i < a; i += 1) {
|
|
143
|
-
if (o + 46 > n.byteLength || n.getUint32(o, !0) !==
|
|
143
|
+
if (o + 46 > n.byteLength || n.getUint32(o, !0) !== ft)
|
|
144
144
|
throw new Error(`Corrupt zip central directory at entry ${i}.`);
|
|
145
145
|
const f = n.getUint16(o + 10, !0), p = n.getUint32(o + 20, !0), y = n.getUint16(o + 28, !0), l = n.getUint16(o + 30, !0), u = n.getUint16(o + 32, !0), h = n.getUint32(o + 42, !0);
|
|
146
146
|
if (p === ce || h === ce)
|
|
147
147
|
throw new Error("ZIP64 usdz packages are not supported.");
|
|
148
148
|
const w = new TextDecoder().decode(e.subarray(o + 46, o + 46 + y));
|
|
149
|
-
o += 46 + y + l + u, !w.endsWith("/") && (t.include && !t.include(w) || c.push(
|
|
149
|
+
o += 46 + y + l + u, !w.endsWith("/") && (t.include && !t.include(w) || c.push(yt(e, n, h, p, f).then((g) => ({ name: w, data: g }))));
|
|
150
150
|
}
|
|
151
151
|
for (const { name: i, data: f } of await Promise.all(c)) r.set(i, f);
|
|
152
152
|
return r;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function mt(e) {
|
|
155
155
|
if (typeof URL > "u" || typeof URL.createObjectURL != "function") return null;
|
|
156
|
-
const t = new Map([...e].filter(([r]) =>
|
|
156
|
+
const t = new Map([...e].filter(([r]) => Me(r)));
|
|
157
157
|
if (t.size === 0) return null;
|
|
158
158
|
const n = /* @__PURE__ */ new Map();
|
|
159
159
|
for (const r of t.keys()) {
|
|
@@ -164,12 +164,12 @@ function gt(e) {
|
|
|
164
164
|
let c = s.get(r);
|
|
165
165
|
if (!c) {
|
|
166
166
|
const i = t.get(r);
|
|
167
|
-
c = URL.createObjectURL(new Blob([new Uint8Array(i)], { type:
|
|
167
|
+
c = URL.createObjectURL(new Blob([new Uint8Array(i)], { type: bt(r) })), s.set(r, c);
|
|
168
168
|
}
|
|
169
169
|
return c;
|
|
170
170
|
}, o = (r) => {
|
|
171
171
|
if (!r) return null;
|
|
172
|
-
const c = wt(
|
|
172
|
+
const c = _t(wt(r));
|
|
173
173
|
if (!c) return null;
|
|
174
174
|
if (t.has(c)) return a(c);
|
|
175
175
|
const i = [...t.keys()].filter((y) => y.endsWith(`/${c}`));
|
|
@@ -189,33 +189,33 @@ function gt(e) {
|
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
return
|
|
192
|
+
function Me(e) {
|
|
193
|
+
return ht.has(xe(e));
|
|
194
194
|
}
|
|
195
|
-
async function
|
|
196
|
-
if (t.getUint32(n, !0) !==
|
|
195
|
+
async function yt(e, t, n, s, a) {
|
|
196
|
+
if (t.getUint32(n, !0) !== ut) throw new Error("Corrupt zip local file header.");
|
|
197
197
|
const o = t.getUint16(n + 26, !0), r = t.getUint16(n + 28, !0), c = n + 30 + o + r, i = e.subarray(c, c + s);
|
|
198
198
|
if (a === 0) return i.slice();
|
|
199
199
|
if (a !== 8) throw new Error(`Unsupported zip compression method ${a}.`);
|
|
200
200
|
const f = new Blob([new Uint8Array(i)]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
|
|
201
201
|
return new Uint8Array(await new Response(f).arrayBuffer());
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function wt(e) {
|
|
204
204
|
const t = e.indexOf("[");
|
|
205
205
|
return t >= 0 && e.endsWith("]") ? e.slice(t + 1, -1) : e;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function _t(e) {
|
|
208
208
|
const t = [];
|
|
209
209
|
for (const n of e.replaceAll("\\", "/").split("/"))
|
|
210
210
|
!n || n === "." || (n === ".." ? t.pop() : t.push(n));
|
|
211
211
|
return t.join("/");
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function xe(e) {
|
|
214
214
|
const t = e.split(/[?#]/)[0] ?? e, n = t.lastIndexOf(".");
|
|
215
215
|
return n < 0 ? "" : t.slice(n + 1).toLowerCase();
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
switch (
|
|
217
|
+
function bt(e) {
|
|
218
|
+
switch (xe(e)) {
|
|
219
219
|
case "png":
|
|
220
220
|
return "image/png";
|
|
221
221
|
case "jpg":
|
|
@@ -227,30 +227,30 @@ function _t(e) {
|
|
|
227
227
|
return "application/octet-stream";
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function St(e) {
|
|
231
231
|
const t = Math.max(0, e.byteLength - 65535 - 22);
|
|
232
232
|
for (let n = e.byteLength - 22; n >= t; n -= 1)
|
|
233
|
-
if (e.getUint32(n, !0) ===
|
|
233
|
+
if (e.getUint32(n, !0) === dt) return n;
|
|
234
234
|
return -1;
|
|
235
235
|
}
|
|
236
|
-
const
|
|
236
|
+
const Et = 1, Ut = 7, vt = "4008c14402c2cc40e0a6", It = {
|
|
237
237
|
file: "openusd_probe.js",
|
|
238
238
|
sha256: "729ce6e77c5c1f81a1c95597800de55d902d46b4f86bc04474c43f411ab520c7",
|
|
239
239
|
bytes: 98305
|
|
240
240
|
}, At = {
|
|
241
241
|
file: "openusd_probe.wasm",
|
|
242
|
-
sha256: "
|
|
243
|
-
bytes:
|
|
242
|
+
sha256: "7acebe01370dd422ddc0382863a756a85c1e38221efb0c6207e0ce7a87dd1085",
|
|
243
|
+
bytes: 10874858
|
|
244
244
|
};
|
|
245
|
-
var
|
|
246
|
-
schemaVersion:
|
|
247
|
-
apiVersion:
|
|
248
|
-
runtimeId:
|
|
249
|
-
js:
|
|
245
|
+
var Pt = {
|
|
246
|
+
schemaVersion: Et,
|
|
247
|
+
apiVersion: Ut,
|
|
248
|
+
runtimeId: vt,
|
|
249
|
+
js: It,
|
|
250
250
|
wasm: At
|
|
251
251
|
};
|
|
252
|
-
const
|
|
253
|
-
function
|
|
252
|
+
const Rt = Nt(Pt);
|
|
253
|
+
function Nt(e) {
|
|
254
254
|
if (!e || typeof e != "object") throw new Error("OpenUSD runtime manifest is missing.");
|
|
255
255
|
const t = e;
|
|
256
256
|
if (t.schemaVersion !== 1 || !Number.isInteger(t.apiVersion) || Number(t.apiVersion) < 1 || typeof t.runtimeId != "string" || !/^[0-9a-f]{20}$/.test(t.runtimeId))
|
|
@@ -274,7 +274,7 @@ function Se(e, t) {
|
|
|
274
274
|
bytes: Number(n.bytes)
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function Dt(e, t, n) {
|
|
278
278
|
return WebAssembly.instantiate(e, t).then(
|
|
279
279
|
(s) => n(s, e),
|
|
280
280
|
(s) => {
|
|
@@ -284,7 +284,7 @@ function Nt(e, t, n) {
|
|
|
284
284
|
}
|
|
285
285
|
), {};
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function ke(e, t) {
|
|
288
288
|
const n = async (o, r) => {
|
|
289
289
|
var i;
|
|
290
290
|
const c = e.GetPrimAtPath(o);
|
|
@@ -456,13 +456,13 @@ function xe(e, t) {
|
|
|
456
456
|
}
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
|
-
const
|
|
460
|
-
function
|
|
459
|
+
const Mt = /^physics$/i, xt = /^(newton|mjc|mujoco)(?:[_-]|$)/i, kt = /^(physx|newton|mjc|mujoco)(?:[_-]|)/i;
|
|
460
|
+
function Ot(e, t = []) {
|
|
461
461
|
const n = new Set(t.map(Ee)), s = [];
|
|
462
462
|
for (const a of e) {
|
|
463
|
-
if (!
|
|
464
|
-
const o = a.variantNames.map((i, f) => ({ selection: i, index: f, rank:
|
|
465
|
-
if (o.length === 0 || a.selection &&
|
|
463
|
+
if (!Mt.test(a.setName) || n.has(Ee(a))) continue;
|
|
464
|
+
const o = a.variantNames.map((i, f) => ({ selection: i, index: f, rank: Tt(i) })).filter((i) => i.rank !== null);
|
|
465
|
+
if (o.length === 0 || a.selection && xt.test(a.selection)) continue;
|
|
466
466
|
const r = le(a.selection), c = [...o].sort((i, f) => {
|
|
467
467
|
const p = r !== null && le(i.selection) === r, y = r !== null && le(f.selection) === r;
|
|
468
468
|
return Number(y) - Number(p) || i.rank - f.rank || i.index - f.index;
|
|
@@ -475,16 +475,16 @@ function kt(e, t = []) {
|
|
|
475
475
|
}
|
|
476
476
|
return s;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function Tt(e) {
|
|
479
479
|
return /^newton(?:[_-]|$)/i.test(e) ? 0 : /^mjc(?:[_-]|$)/i.test(e) ? 1 : /^mujoco(?:[_-]|$)/i.test(e) ? 2 : null;
|
|
480
480
|
}
|
|
481
481
|
function le(e) {
|
|
482
|
-
return e && e.replace(
|
|
482
|
+
return e && e.replace(kt, "").toLowerCase() || null;
|
|
483
483
|
}
|
|
484
484
|
function Ee(e) {
|
|
485
485
|
return `${e.primPath}\0${e.setName}`;
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function $t(e) {
|
|
488
488
|
let t = 0;
|
|
489
489
|
const n = () => {
|
|
490
490
|
for (; t < e.length; ) {
|
|
@@ -584,7 +584,7 @@ function Tt(e) {
|
|
|
584
584
|
}
|
|
585
585
|
return new Map([...o].filter(([, i]) => i.schemas.length || i.relationships.size));
|
|
586
586
|
}
|
|
587
|
-
const
|
|
587
|
+
const Ct = [
|
|
588
588
|
1,
|
|
589
589
|
0,
|
|
590
590
|
0,
|
|
@@ -602,7 +602,7 @@ const $t = [
|
|
|
602
602
|
0,
|
|
603
603
|
1
|
|
604
604
|
];
|
|
605
|
-
function
|
|
605
|
+
function Lt(e) {
|
|
606
606
|
const t = new Map(e.map((o) => [o.path, o])), n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), a = (o) => {
|
|
607
607
|
const r = n.get(o.path);
|
|
608
608
|
if (r) return r;
|
|
@@ -615,7 +615,7 @@ function Ct(e) {
|
|
|
615
615
|
if (!o.resetsXformStack || !o.parentPath) return o;
|
|
616
616
|
const r = t.get(o.parentPath);
|
|
617
617
|
if (!r) return o;
|
|
618
|
-
const c = a(r), i =
|
|
618
|
+
const c = a(r), i = jt(c);
|
|
619
619
|
return i ? {
|
|
620
620
|
...o,
|
|
621
621
|
localMatrix: ve(a(o), i)
|
|
@@ -623,9 +623,9 @@ function Ct(e) {
|
|
|
623
623
|
});
|
|
624
624
|
}
|
|
625
625
|
function Ue(e) {
|
|
626
|
-
return
|
|
626
|
+
return Ft(e) ? e : Ct;
|
|
627
627
|
}
|
|
628
|
-
function
|
|
628
|
+
function Ft(e) {
|
|
629
629
|
return (e == null ? void 0 : e.length) === 16 && e.every(Number.isFinite);
|
|
630
630
|
}
|
|
631
631
|
function ve(e, t) {
|
|
@@ -639,7 +639,7 @@ function ve(e, t) {
|
|
|
639
639
|
}
|
|
640
640
|
return n;
|
|
641
641
|
}
|
|
642
|
-
function
|
|
642
|
+
function jt(e) {
|
|
643
643
|
const [
|
|
644
644
|
t,
|
|
645
645
|
n,
|
|
@@ -667,7 +667,7 @@ function Ft(e) {
|
|
|
667
667
|
);
|
|
668
668
|
if (!Number.isFinite(g) || Math.abs(g) <= Number.EPSILON * d * 16)
|
|
669
669
|
return null;
|
|
670
|
-
const m = 1 / g, b = u * m, _ = h * m, R = w * m, x = (r * c - a * f) * m, O = (t * f - s * c) * m,
|
|
670
|
+
const m = 1 / g, b = u * m, _ = h * m, R = w * m, x = (r * c - a * f) * m, O = (t * f - s * c) * m, V = (s * a - t * r) * m, L = (a * i - o * c) * m, H = (n * c - t * i) * m, z = (t * o - n * a) * m;
|
|
671
671
|
return [
|
|
672
672
|
b,
|
|
673
673
|
_,
|
|
@@ -675,31 +675,31 @@ function Ft(e) {
|
|
|
675
675
|
0,
|
|
676
676
|
x,
|
|
677
677
|
O,
|
|
678
|
-
|
|
678
|
+
V,
|
|
679
679
|
0,
|
|
680
|
-
|
|
680
|
+
L,
|
|
681
681
|
H,
|
|
682
682
|
z,
|
|
683
683
|
0,
|
|
684
|
-
-(p * b + y * x + l *
|
|
684
|
+
-(p * b + y * x + l * L),
|
|
685
685
|
-(p * _ + y * O + l * H),
|
|
686
|
-
-(p * R + y *
|
|
686
|
+
-(p * R + y * V + l * z),
|
|
687
687
|
1
|
|
688
688
|
];
|
|
689
689
|
}
|
|
690
|
-
function
|
|
690
|
+
function Vt(e, t = []) {
|
|
691
691
|
return {
|
|
692
692
|
stage: e.stage,
|
|
693
693
|
view: {
|
|
694
694
|
...e.view,
|
|
695
|
-
prims:
|
|
695
|
+
prims: Lt(e.view.prims)
|
|
696
696
|
},
|
|
697
697
|
elements: e.elements,
|
|
698
698
|
pointClouds: e.pointClouds,
|
|
699
699
|
gaussianSplats: e.gaussianSplats,
|
|
700
700
|
materials: e.materials,
|
|
701
701
|
materialAliases: e.materialAliases,
|
|
702
|
-
physics:
|
|
702
|
+
physics: Bt(),
|
|
703
703
|
joints: [],
|
|
704
704
|
cameras: [],
|
|
705
705
|
lights: [],
|
|
@@ -708,10 +708,10 @@ function jt(e, t = []) {
|
|
|
708
708
|
variants: t
|
|
709
709
|
};
|
|
710
710
|
}
|
|
711
|
-
function
|
|
711
|
+
function Gt(e, t) {
|
|
712
712
|
e.physics = t.physics, e.joints = t.joints;
|
|
713
713
|
}
|
|
714
|
-
function
|
|
714
|
+
function Bt() {
|
|
715
715
|
return {
|
|
716
716
|
scenes: [],
|
|
717
717
|
rigidBodies: [],
|
|
@@ -720,17 +720,17 @@ function Gt() {
|
|
|
720
720
|
articulationRoots: []
|
|
721
721
|
};
|
|
722
722
|
}
|
|
723
|
-
const
|
|
723
|
+
const zt = /^(Warning|Error|Fatal|Info|Runtime Error|Coding Error):\s+in\s+(\S+)\s+at line \d+ of .*?\s+--\s+([\s\S]*)$/s, Wt = /(^|[\s(\[])(?:[A-Za-z]:[\\/]|\/)(?:[^ \t\r\n()'"]+[\\/])*[^ \t\r\n()'"]+\.(?:cpp|cxx|cc|hpp|c|h|mjs|js|ts)(?::\d+)*/gi, Ht = /<0x[0-9a-f]+>/gi, Jt = /* @__PURE__ */ new Set([
|
|
724
724
|
"USD_MATERIAL_BINDING_API_MISSING",
|
|
725
725
|
"USD_EXTERNAL_REFERENCE_UNRESOLVED"
|
|
726
726
|
]);
|
|
727
|
-
function Jt(e) {
|
|
728
|
-
const t = Bt.exec(e);
|
|
729
|
-
return (t ? `${t[1]}: ${t[2]} -- ${t[3]}` : e).replace(zt, "$1<OpenUSD source>").replace(Wt, "<stage>").trim();
|
|
730
|
-
}
|
|
731
727
|
function Xt(e) {
|
|
728
|
+
const t = zt.exec(e);
|
|
729
|
+
return (t ? `${t[1]}: ${t[2]} -- ${t[3]}` : e).replace(Wt, "$1<OpenUSD source>").replace(Ht, "<stage>").trim();
|
|
730
|
+
}
|
|
731
|
+
function qt(e) {
|
|
732
732
|
if (!e || /^(?:Info|Status):/.test(e)) return null;
|
|
733
|
-
const t =
|
|
733
|
+
const t = Xt(e);
|
|
734
734
|
if (!t) return null;
|
|
735
735
|
if (/Found material bindings on prim at path .* but MaterialBindingAPI is not applied/.test(t))
|
|
736
736
|
return { severity: "warning", code: "USD_MATERIAL_BINDING_API_MISSING", message: t };
|
|
@@ -750,7 +750,7 @@ function Xt(e) {
|
|
|
750
750
|
message: t
|
|
751
751
|
};
|
|
752
752
|
}
|
|
753
|
-
function
|
|
753
|
+
function Ie(e = {}) {
|
|
754
754
|
const t = e.console ?? console, n = /* @__PURE__ */ new Set(), s = Math.max(1, e.maxUniqueDiagnostics ?? 64);
|
|
755
755
|
let a = !1;
|
|
756
756
|
const o = (r) => {
|
|
@@ -763,19 +763,19 @@ function Ae(e = {}) {
|
|
|
763
763
|
));
|
|
764
764
|
return;
|
|
765
765
|
}
|
|
766
|
-
n.add(c), (i = e.onDiagnostic) == null || i.call(e, r), !e.onDiagnostic && (
|
|
766
|
+
n.add(c), (i = e.onDiagnostic) == null || i.call(e, r), !e.onDiagnostic && (Jt.has(r.code) || (r.severity === "error" ? t.error(r.message) : t.warn(r.message)));
|
|
767
767
|
}
|
|
768
768
|
};
|
|
769
769
|
return (r) => {
|
|
770
770
|
const c = String(r ?? "");
|
|
771
771
|
for (const i of c.split(/\r?\n/)) {
|
|
772
|
-
const f =
|
|
772
|
+
const f = qt(i.trim());
|
|
773
773
|
f && o(f);
|
|
774
774
|
}
|
|
775
775
|
};
|
|
776
776
|
}
|
|
777
|
-
const ue = "[USD material] ",
|
|
778
|
-
function
|
|
777
|
+
const ue = "[USD material] ", Zt = /* @__PURE__ */ new WeakMap();
|
|
778
|
+
function Yt(e) {
|
|
779
779
|
const t = [], n = console.warn;
|
|
780
780
|
console.warn = (...s) => {
|
|
781
781
|
const a = s.length === 1 && typeof s[0] == "string" && s[0].startsWith(ue) ? s[0].slice(ue.length) : null;
|
|
@@ -795,23 +795,23 @@ function Zt(e) {
|
|
|
795
795
|
console.warn = n;
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
|
-
function
|
|
799
|
-
t.length &&
|
|
798
|
+
function Kt(e, t) {
|
|
799
|
+
t.length && Zt.set(e, Object.freeze([...t]));
|
|
800
800
|
}
|
|
801
|
-
const
|
|
802
|
-
async function
|
|
801
|
+
const Qt = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
|
|
802
|
+
async function en(e) {
|
|
803
803
|
const t = await import(
|
|
804
804
|
/* @vite-ignore */
|
|
805
805
|
e.moduleUrl
|
|
806
806
|
), n = t.default ?? t.createOpenUsdProbe, s = e.wasmModule ? {
|
|
807
|
-
printErr:
|
|
807
|
+
printErr: Ie({ onDiagnostic: e.onRuntimeDiagnostic }),
|
|
808
808
|
instantiateWasm(g, d) {
|
|
809
|
-
return
|
|
809
|
+
return Dt(e.wasmModule, g, d);
|
|
810
810
|
}
|
|
811
811
|
} : {
|
|
812
|
-
printErr:
|
|
812
|
+
printErr: Ie({ onDiagnostic: e.onRuntimeDiagnostic }),
|
|
813
813
|
wasmBinary: await (typeof e.wasmBinary == "function" ? e.wasmBinary() : e.wasmBinary ?? an(e.wasmUrl))
|
|
814
|
-
}, a = await n(s), o = e.apiVersion ??
|
|
814
|
+
}, a = await n(s), o = e.apiVersion ?? Rt.apiVersion, r = Number(a.ccall("usd_probe_api_version", "number", [], []));
|
|
815
815
|
if (r !== o)
|
|
816
816
|
throw Object.assign(
|
|
817
817
|
new Error(`OpenUSD runtime API mismatch: expected ${o}, received ${r}.`),
|
|
@@ -822,10 +822,10 @@ async function Qt(e) {
|
|
|
822
822
|
if (!d.ok) throw Object.assign(new Error(`USD resource request failed (${d.status}): ${g}`), {
|
|
823
823
|
code: d.status === 401 || d.status === 403 ? "E_ASSET_AUTH" : "E_ASSET_FETCH"
|
|
824
824
|
});
|
|
825
|
-
const m = new Uint8Array(await d.arrayBuffer()), b =
|
|
826
|
-
if (b) throw
|
|
825
|
+
const m = new Uint8Array(await d.arrayBuffer()), b = ot(d.headers.get("content-type"), m);
|
|
826
|
+
if (b) throw tt(`USD resource is not usable (${b}): ${g}`, De);
|
|
827
827
|
return m;
|
|
828
|
-
}), f = (g, d, m) => JSON.parse(a.ccall(g, "string", d, m)), p = /* @__PURE__ */ new Set(), y =
|
|
828
|
+
}), f = (g, d, m) => JSON.parse(a.ccall(g, "string", d, m)), p = /* @__PURE__ */ new Set(), y = Ae(a);
|
|
829
829
|
let l = 0, u = null;
|
|
830
830
|
async function h() {
|
|
831
831
|
return u || (u = (async () => {
|
|
@@ -844,79 +844,79 @@ async function Qt(e) {
|
|
|
844
844
|
})(), u);
|
|
845
845
|
}
|
|
846
846
|
async function w(g, d) {
|
|
847
|
-
const m = new URL(d.sourcePath, "file:///"), b = `${c}/load-${++l}`, _ = Z(m.href, b), R = /* @__PURE__ */ new Set(), x = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map(),
|
|
848
|
-
let S,
|
|
847
|
+
const m = new URL(d.sourcePath, "file:///"), b = `${c}/load-${++l}`, _ = Z(m.href, b), R = /* @__PURE__ */ new Set(), x = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map(), V = d.readTextureBytes ?? !0, L = d.collectTextureUrls ?? !V, H = L || V ? Te : sn, z = /* @__PURE__ */ new Map();
|
|
848
|
+
let S, M = null, v = null;
|
|
849
849
|
const N = () => {
|
|
850
|
-
S !== void 0 && p.delete(S) && f("usd_probe_stage_release", ["number"], [S]),
|
|
850
|
+
S !== void 0 && p.delete(S) && f("usd_probe_stage_release", ["number"], [S]), M == null || M.dispose(), Ve(a.FS, b);
|
|
851
851
|
};
|
|
852
852
|
try {
|
|
853
|
-
const
|
|
854
|
-
he(a, _,
|
|
855
|
-
for (const [
|
|
856
|
-
const q = Z(new URL(
|
|
853
|
+
const A = await Re(g);
|
|
854
|
+
he(a, _, A, R), x.set(_, H(A));
|
|
855
|
+
for (const [U, j] of Object.entries(d.files ?? {})) {
|
|
856
|
+
const q = Z(new URL(U, m).href, b), X = await Re(j);
|
|
857
857
|
R.has(q) || x.set(q, H(X)), he(a, q, X, R);
|
|
858
858
|
}
|
|
859
859
|
const T = new Set(R);
|
|
860
|
-
for (const
|
|
861
|
-
T.add(Z(new URL(
|
|
862
|
-
const
|
|
863
|
-
let
|
|
864
|
-
if (!
|
|
865
|
-
const
|
|
860
|
+
for (const U of d.packagePaths ?? [])
|
|
861
|
+
T.add(Z(new URL(U, m).href, b));
|
|
862
|
+
const E = d.externalReferenceMode ?? "complete", P = pt(A) ? await gt(A, { include: Me }) : null;
|
|
863
|
+
let I = {}, k, D;
|
|
864
|
+
if (!P && d.autoResolveAssets !== !1) {
|
|
865
|
+
const U = d.resolveBytes ?? ((q) => i(q)), j = await nn(
|
|
866
866
|
a,
|
|
867
867
|
m,
|
|
868
868
|
b,
|
|
869
|
-
|
|
869
|
+
U,
|
|
870
870
|
f,
|
|
871
871
|
R,
|
|
872
872
|
z,
|
|
873
|
-
|
|
873
|
+
L ? O : null,
|
|
874
874
|
x,
|
|
875
875
|
d.maxFiles ?? 1024,
|
|
876
876
|
d.maxDepth ?? 8,
|
|
877
877
|
d.maxConcurrency ?? 1,
|
|
878
|
-
|
|
878
|
+
E,
|
|
879
879
|
T,
|
|
880
|
-
|
|
880
|
+
V,
|
|
881
881
|
d,
|
|
882
882
|
d.onReferenceSkipped,
|
|
883
883
|
d.onResourceFailed
|
|
884
884
|
);
|
|
885
|
-
|
|
885
|
+
I = j.mappings, k = j.opened, D = j.variantConfiguration;
|
|
886
886
|
} else {
|
|
887
|
-
if (k = Object.keys(
|
|
888
|
-
|
|
887
|
+
if (k = Object.keys(I).length > 0 ? f("usd_probe_stage_open_mapped", ["string", "string"], [_, JSON.stringify(I)]) : f("usd_probe_stage_open", ["string"], [_]), !k.ok) throw new Error(k.error ?? `Failed to open ${_}`);
|
|
888
|
+
D = Oe(a, k, d, !0);
|
|
889
889
|
}
|
|
890
|
-
|
|
891
|
-
const $ = d.textureResolver ||
|
|
892
|
-
var
|
|
893
|
-
return ((
|
|
890
|
+
M = P ? mt(P) : null;
|
|
891
|
+
const $ = d.textureResolver || M ? (U) => {
|
|
892
|
+
var j;
|
|
893
|
+
return ((j = d.textureResolver) == null ? void 0 : j.call(d, U)) ?? (M == null ? void 0 : M.resolve(U)) ?? null;
|
|
894
894
|
} : void 0;
|
|
895
895
|
S = k.stageId, p.add(k.stageId);
|
|
896
|
-
const { discoveredVariants:
|
|
896
|
+
const { discoveredVariants: F, selections: J } = D, W = Ae(a, z, _), C = W.openStage(k.stageId), ae = await tn(a, k.stageId, _, {
|
|
897
897
|
batchSize: d.geometryBatchSize,
|
|
898
898
|
onProgress: d.onGeometryProgress
|
|
899
899
|
});
|
|
900
|
-
|
|
901
|
-
const
|
|
902
|
-
`${
|
|
903
|
-
|
|
904
|
-
])),
|
|
905
|
-
...
|
|
906
|
-
selection:
|
|
907
|
-
})), ie =
|
|
908
|
-
const
|
|
909
|
-
return T.has(Z(
|
|
910
|
-
} : void 0), ge =
|
|
900
|
+
je(ae.materials, z, m), Fe(ae.materials, z);
|
|
901
|
+
const Ge = new Map(J.map((U) => [
|
|
902
|
+
`${U.primPath}\0${U.setName}`,
|
|
903
|
+
U.selection
|
|
904
|
+
])), Be = F.map((U) => ({
|
|
905
|
+
...U,
|
|
906
|
+
selection: Ge.get(`${U.primPath}\0${U.setName}`) ?? U.selection
|
|
907
|
+
})), ie = Vt(ae, Be), pe = d.isTextureAllowed ?? (E === "package" ? (U) => {
|
|
908
|
+
const j = new URL(U, m);
|
|
909
|
+
return T.has(Z(j.href, b)) || Ne(j, m);
|
|
910
|
+
} : void 0), ge = P ? void 0 : pe ? (U) => O.has(U) || pe(U) : O.size > 0 ? (U) => O.has(U) : void 0;
|
|
911
911
|
return {
|
|
912
912
|
data: ie,
|
|
913
913
|
pxr: W,
|
|
914
|
-
stage:
|
|
914
|
+
stage: C,
|
|
915
915
|
entryPath: _,
|
|
916
916
|
textureURLs: O,
|
|
917
|
-
...
|
|
917
|
+
...M ? { packageTextures: M } : {},
|
|
918
918
|
buildModel: async () => {
|
|
919
|
-
const { createUSDLoadedModel:
|
|
919
|
+
const { createUSDLoadedModel: U } = await import("@openusd-wasm/three-loader"), j = () => U(
|
|
920
920
|
ie,
|
|
921
921
|
W,
|
|
922
922
|
_,
|
|
@@ -932,39 +932,39 @@ async function Qt(e) {
|
|
|
932
932
|
...d.textureCache ? { textureCache: d.textureCache } : {},
|
|
933
933
|
...$ ? { textureResolver: $ } : {}
|
|
934
934
|
},
|
|
935
|
-
|
|
935
|
+
C,
|
|
936
936
|
{
|
|
937
937
|
// Keep package texture identities on the model so the visual adapter
|
|
938
938
|
// can resolve textures referenced by unsupported-but-known MDL nodes.
|
|
939
|
-
usdzTextureURLs: (
|
|
939
|
+
usdzTextureURLs: (M == null ? void 0 : M.urls) ?? /* @__PURE__ */ new Map(),
|
|
940
940
|
autoTextureURLs: /* @__PURE__ */ new Map()
|
|
941
941
|
}
|
|
942
|
-
), q =
|
|
943
|
-
() => ge ?
|
|
942
|
+
), q = Yt(
|
|
943
|
+
() => ge ? He(ie.materials, ge, j) : j()
|
|
944
944
|
), X = q.value;
|
|
945
|
-
|
|
946
|
-
const
|
|
945
|
+
Kt(X, q.warnings), X.usdQuery = ke(C, W);
|
|
946
|
+
const ze = X.dispose.bind(X);
|
|
947
947
|
let me = !1;
|
|
948
948
|
return X.dispose = () => {
|
|
949
|
-
me || (me = !0,
|
|
949
|
+
me || (me = !0, ze(), N());
|
|
950
950
|
}, X;
|
|
951
951
|
},
|
|
952
952
|
readPhysics() {
|
|
953
|
-
return
|
|
953
|
+
return v || (v = (async () => {
|
|
954
954
|
if (typeof a._usd_probe_scene_physics != "function")
|
|
955
955
|
throw Object.assign(
|
|
956
956
|
new Error("USD physics phase requires the matching packaged openusd_probe runtime."),
|
|
957
957
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
958
958
|
);
|
|
959
|
-
const
|
|
960
|
-
if (
|
|
961
|
-
return
|
|
962
|
-
})(),
|
|
959
|
+
const U = f("usd_probe_scene_physics", ["number"], [k.stageId]);
|
|
960
|
+
if (U.ok !== !0) throw new Error(String(U.error ?? "Failed to extract USD physics."));
|
|
961
|
+
return U;
|
|
962
|
+
})(), v);
|
|
963
963
|
},
|
|
964
964
|
release: N
|
|
965
965
|
};
|
|
966
|
-
} catch (
|
|
967
|
-
throw N(),
|
|
966
|
+
} catch (A) {
|
|
967
|
+
throw N(), A;
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
970
|
return {
|
|
@@ -974,7 +974,7 @@ async function Qt(e) {
|
|
|
974
974
|
async parseAsync(g, d) {
|
|
975
975
|
const m = await w(g, d);
|
|
976
976
|
try {
|
|
977
|
-
return
|
|
977
|
+
return Gt(m.data, await m.readPhysics()), await m.buildModel();
|
|
978
978
|
} catch (b) {
|
|
979
979
|
throw m.release(), b;
|
|
980
980
|
}
|
|
@@ -984,7 +984,7 @@ async function Qt(e) {
|
|
|
984
984
|
}
|
|
985
985
|
};
|
|
986
986
|
}
|
|
987
|
-
function
|
|
987
|
+
function Ae(e, t = /* @__PURE__ */ new Map(), n) {
|
|
988
988
|
const s = (l, u, h) => JSON.parse(e.ccall(l, "string", u, h));
|
|
989
989
|
class a {
|
|
990
990
|
constructor(u) {
|
|
@@ -1003,7 +1003,7 @@ function Ie(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
1003
1003
|
if (n && typeof b == "function") {
|
|
1004
1004
|
const _ = e.ccall("usd_probe_flatten_stage", "string", ["string"], [n]);
|
|
1005
1005
|
if (typeof _ != "string" || !_.startsWith("#usda")) throw new Error("Unable to read flattened USD joint metadata");
|
|
1006
|
-
o =
|
|
1006
|
+
o = $t(_);
|
|
1007
1007
|
} else
|
|
1008
1008
|
o = /* @__PURE__ */ new Map();
|
|
1009
1009
|
}
|
|
@@ -1134,7 +1134,7 @@ function Ie(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
1134
1134
|
openStage: p
|
|
1135
1135
|
};
|
|
1136
1136
|
}
|
|
1137
|
-
async function
|
|
1137
|
+
async function tn(e, t, n, s = {}) {
|
|
1138
1138
|
var f, p, y;
|
|
1139
1139
|
if (typeof e._usd_probe_scene_visual != "function" || typeof e._usd_probe_scene_geometry != "function" || typeof e._usd_probe_scene_geometry_end != "function" || typeof e._usd_probe_scene_point_cloud != "function" || typeof e._usd_probe_scene_point_clouds_end != "function" || typeof e._usd_probe_scene_gaussian != "function" || typeof e._usd_probe_scene_gaussians_end != "function")
|
|
1140
1140
|
throw Object.assign(
|
|
@@ -1209,20 +1209,20 @@ async function en(e, t, n, s = {}) {
|
|
|
1209
1209
|
));
|
|
1210
1210
|
if (!w.ok)
|
|
1211
1211
|
throw new Error(w.error ?? `Failed to stream USD Gaussian geometry for ${u.path}`);
|
|
1212
|
-
const g = w.geometry ?? {}, d = G(e, g.positions), m = G(e, g.scales), b = G(e, g.orientations), _ = G(e, g.opacities), R = G(e, g.sphericalHarmonics), x = G(e, g.displayColor), O = Number(g.splatCount),
|
|
1213
|
-
if (!Number.isSafeInteger(O) || O <= 0 || ![0, 1, 2, 3].includes(
|
|
1212
|
+
const g = w.geometry ?? {}, d = G(e, g.positions), m = G(e, g.scales), b = G(e, g.orientations), _ = G(e, g.opacities), R = G(e, g.sphericalHarmonics), x = G(e, g.displayColor), O = Number(g.splatCount), V = Number(g.shDegree), L = g.worldMatrix;
|
|
1213
|
+
if (!Number.isSafeInteger(O) || O <= 0 || ![0, 1, 2, 3].includes(V) || !(d instanceof Float32Array) || !(m instanceof Float32Array) || !(b instanceof Float32Array) || !(_ instanceof Float32Array) || !(R instanceof Float32Array) || x !== null && !(x instanceof Float32Array) || !Array.isArray(L) || L.length !== 16 || L.some((H) => typeof H != "number" || !Number.isFinite(H)))
|
|
1214
1214
|
throw new Error(`USD Gaussian geometry has invalid typed buffers: ${u.path}`);
|
|
1215
1215
|
i.push({
|
|
1216
1216
|
path: u.path,
|
|
1217
1217
|
splatCount: O,
|
|
1218
|
-
shDegree:
|
|
1218
|
+
shDegree: V,
|
|
1219
1219
|
positions: d,
|
|
1220
1220
|
scales: m,
|
|
1221
1221
|
orientations: b,
|
|
1222
1222
|
opacities: _,
|
|
1223
1223
|
sphericalHarmonics: R,
|
|
1224
1224
|
displayColor: x,
|
|
1225
|
-
worldMatrix:
|
|
1225
|
+
worldMatrix: L
|
|
1226
1226
|
}), (y = s.onProgress) == null || y.call(
|
|
1227
1227
|
s,
|
|
1228
1228
|
o.elements.length + o.pointClouds.length + l + 1,
|
|
@@ -1243,7 +1243,7 @@ function G(e, t) {
|
|
|
1243
1243
|
const { ptr: n, length: s, kind: a } = t;
|
|
1244
1244
|
return typeof n != "number" ? t : s ? (a === "i32" ? new Int32Array(e.HEAP32.buffer, n, s) : new Float32Array(e.HEAPF32.buffer, n, s)).slice() : a === "i32" ? new Int32Array() : new Float32Array();
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function Oe(e, t, n, s) {
|
|
1247
1247
|
const a = (l, u, h) => JSON.parse(e.ccall(l, "string", u, h)), o = [...n.variantSelections ?? []];
|
|
1248
1248
|
let r = [];
|
|
1249
1249
|
if (n.selectMuJoCoPhysicsVariant !== !1) {
|
|
@@ -1257,7 +1257,7 @@ function ke(e, t, n, s) {
|
|
|
1257
1257
|
throw new Error(String(l.error ?? "Failed to enumerate USD variants."));
|
|
1258
1258
|
r = l.variants ?? [];
|
|
1259
1259
|
}
|
|
1260
|
-
const c = new Set(r.map(Y)), i = s || r.length === 0 ? o : o.filter((l) => c.has(Y(l))), f = n.selectMuJoCoPhysicsVariant === !1 ? [] :
|
|
1260
|
+
const c = new Set(r.map(Y)), i = s || r.length === 0 ? o : o.filter((l) => c.has(Y(l))), f = n.selectMuJoCoPhysicsVariant === !1 ? [] : Ot(r, i), p = /* @__PURE__ */ new Map();
|
|
1261
1261
|
for (const l of [...i, ...f])
|
|
1262
1262
|
p.set(Y(l), l);
|
|
1263
1263
|
let y = [];
|
|
@@ -1302,10 +1302,10 @@ function ke(e, t, n, s) {
|
|
|
1302
1302
|
}
|
|
1303
1303
|
return { discoveredVariants: r, selections: y };
|
|
1304
1304
|
}
|
|
1305
|
-
async function
|
|
1306
|
-
const m = {}, b = [...u], _ = Z(t.href, n), R =
|
|
1305
|
+
async function nn(e, t, n, s, a, o, r, c, i, f, p, y, l, u, h, w, g, d) {
|
|
1306
|
+
const m = {}, b = [...u], _ = Z(t.href, n), R = Ce(t.href, t), x = /* @__PURE__ */ new Set([R]), O = /* @__PURE__ */ new Map([[_, 0]]), V = /* @__PURE__ */ new Set([_]);
|
|
1307
1307
|
r.set(_, R);
|
|
1308
|
-
const
|
|
1308
|
+
const L = /* @__PURE__ */ new Set(), H = () => {
|
|
1309
1309
|
const S = Object.keys(m).length > 0;
|
|
1310
1310
|
if (S && typeof e._usd_probe_stage_open_mapped != "function")
|
|
1311
1311
|
throw Object.assign(
|
|
@@ -1315,50 +1315,54 @@ async function tn(e, t, n, s, a, o, r, c, i, f, p, y, l, u, h, w, g, d) {
|
|
|
1315
1315
|
return S ? a("usd_probe_stage_open_mapped", ["string", "string"], [_, JSON.stringify(m)]) : a("usd_probe_stage_open", ["string"], [_]);
|
|
1316
1316
|
}, z = (S) => {
|
|
1317
1317
|
var J, W;
|
|
1318
|
-
const
|
|
1319
|
-
if (
|
|
1318
|
+
const M = r.get(S.layer);
|
|
1319
|
+
if (M === void 0)
|
|
1320
1320
|
throw new Error(`Missing USD layer identity for ${S.layer}`);
|
|
1321
|
-
const
|
|
1322
|
-
if (!
|
|
1321
|
+
const v = ((J = Object.entries(m[S.layer] ?? {}).find(([, C]) => C === S.path)) == null ? void 0 : J[0]) ?? S.path;
|
|
1322
|
+
if (!v || /^(?:data|blob):/i.test(v) || /\.mdl(?:[?#].*)?$/i.test(v))
|
|
1323
1323
|
return null;
|
|
1324
|
-
const N =
|
|
1324
|
+
const N = Le(v, M, t);
|
|
1325
1325
|
if (!N) return null;
|
|
1326
|
-
const { resolved:
|
|
1327
|
-
if (k && r.set(k,
|
|
1328
|
-
const
|
|
1329
|
-
return m[S.layer][
|
|
1326
|
+
const { resolved: A, absolute: T, childIdentifier: E } = N, P = Z(A.href, n), I = it(P, b), k = (I == null ? void 0 : I.paths.length) === 1 ? I.paths[0] : null, D = k ?? P, $ = S.kind !== "resource" || Pe(A.pathname), F = (O.get(S.layer) ?? 0) + 1;
|
|
1327
|
+
if (k && r.set(k, E), m[W = S.layer] ?? (m[W] = {}), S.kind === "resource" && l === "package" && I && I.paths.length > 1) {
|
|
1328
|
+
const C = `${n}/__deferred_udim__/${encodeURIComponent(E)}`;
|
|
1329
|
+
return m[S.layer][v] = C, r.set(C, E), null;
|
|
1330
1330
|
}
|
|
1331
|
-
if (l === "package" && !u.has(
|
|
1332
|
-
const
|
|
1333
|
-
return m[S.layer][
|
|
1331
|
+
if (l === "package" && !u.has(D) && !Ne(A, t)) {
|
|
1332
|
+
const C = `${n}/__skipped__/${encodeURIComponent(E)}`;
|
|
1333
|
+
return m[S.layer][v] = C, r.set(C, E), L.has(E) || (L.add(E), g == null || g(E)), null;
|
|
1334
1334
|
}
|
|
1335
|
-
if (
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
if (
|
|
1340
|
-
|
|
1341
|
-
|
|
1335
|
+
if (l === "complete" && S.kind === "resource" && Pe(A.pathname) && t.protocol === "file:" && A.protocol === "file:" && !u.has(D) && !w.resolveBytes) {
|
|
1336
|
+
const C = `${n}/__skipped__/${encodeURIComponent(E)}`;
|
|
1337
|
+
return m[S.layer][v] = C, r.set(C, E), L.has(E) || (L.add(E), g == null || g(E)), null;
|
|
1338
|
+
}
|
|
1339
|
+
if (!$ && c && (c.set(E, A.href), c.set(v, A.href)), !$ && !h)
|
|
1340
|
+
return m[S.layer][v] = D, r.set(D, E), null;
|
|
1341
|
+
if (m[S.layer][v] = D, o.has(D))
|
|
1342
|
+
return r.set(D, E), O.set(D, F), $ && V.add(D), null;
|
|
1343
|
+
if (x.has(E)) return null;
|
|
1344
|
+
if (F > p)
|
|
1345
|
+
throw new Error(`USD dependency depth limit exceeded (${p}): ${E}`);
|
|
1342
1346
|
if (x.size >= f)
|
|
1343
1347
|
throw new Error(`USD dependency limit exceeded (${f}).`);
|
|
1344
|
-
return x.add(
|
|
1348
|
+
return x.add(E), O.set(D, F), {
|
|
1345
1349
|
item: {
|
|
1346
|
-
url:
|
|
1347
|
-
depth:
|
|
1350
|
+
url: A,
|
|
1351
|
+
depth: F,
|
|
1348
1352
|
recurse: $,
|
|
1349
1353
|
absolute: T,
|
|
1350
1354
|
resource: S.kind === "resource",
|
|
1351
|
-
owner: { path: S.layer, reference:
|
|
1355
|
+
owner: { path: S.layer, reference: v }
|
|
1352
1356
|
},
|
|
1353
|
-
identifier:
|
|
1357
|
+
identifier: E
|
|
1354
1358
|
};
|
|
1355
1359
|
};
|
|
1356
1360
|
for (; ; ) {
|
|
1357
1361
|
const S = H();
|
|
1358
1362
|
if (!S.ok) throw new Error(S.error ?? `Failed to open ${_}`);
|
|
1359
|
-
let
|
|
1363
|
+
let M, v = [];
|
|
1360
1364
|
try {
|
|
1361
|
-
if (
|
|
1365
|
+
if (M = Oe(e, S, w, !1), typeof e._usd_probe_stage_external_references != "function")
|
|
1362
1366
|
throw Object.assign(
|
|
1363
1367
|
new Error("Variant-aware USD dependency discovery requires the matching packaged openusd_probe runtime."),
|
|
1364
1368
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
@@ -1366,77 +1370,77 @@ async function tn(e, t, n, s, a, o, r, c, i, f, p, y, l, u, h, w, g, d) {
|
|
|
1366
1370
|
const N = a("usd_probe_stage_external_references", ["number"], [S.stageId]);
|
|
1367
1371
|
if (N.ok !== !0)
|
|
1368
1372
|
throw new Error(String(N.error ?? "Failed to enumerate active USD dependencies."));
|
|
1369
|
-
const
|
|
1370
|
-
for (const
|
|
1371
|
-
const
|
|
1372
|
-
if (!
|
|
1373
|
-
const
|
|
1374
|
-
T.has(
|
|
1373
|
+
const A = N.dependencies ?? [], T = /* @__PURE__ */ new Set();
|
|
1374
|
+
for (const E of A) {
|
|
1375
|
+
const P = z(E);
|
|
1376
|
+
if (!P) continue;
|
|
1377
|
+
const I = `${P.item.url.href}\0${P.identifier}`;
|
|
1378
|
+
T.has(I) || (T.add(I), v.push(P));
|
|
1375
1379
|
}
|
|
1376
|
-
if (
|
|
1377
|
-
const
|
|
1378
|
-
for (const
|
|
1379
|
-
if (i.get(
|
|
1380
|
-
const
|
|
1381
|
-
if (
|
|
1380
|
+
if (v.length === 0) {
|
|
1381
|
+
const E = /* @__PURE__ */ new Map();
|
|
1382
|
+
for (const P of V) {
|
|
1383
|
+
if (i.get(P) === !1) continue;
|
|
1384
|
+
const I = a("usd_probe_external_references", ["string"], [P]);
|
|
1385
|
+
if (E.set(P, I), I.hasVariantSets !== !1) continue;
|
|
1382
1386
|
const k = new Set(
|
|
1383
|
-
|
|
1387
|
+
I.compositionPaths ?? []
|
|
1384
1388
|
);
|
|
1385
|
-
for (const $ of
|
|
1389
|
+
for (const $ of I.subLayers ?? []) {
|
|
1386
1390
|
if (!$) continue;
|
|
1387
|
-
const
|
|
1388
|
-
|
|
1391
|
+
const F = z({ kind: "sublayer", layer: P, path: $ });
|
|
1392
|
+
F && !v.some((J) => J.identifier === F.identifier) && v.push(F);
|
|
1389
1393
|
}
|
|
1390
|
-
const
|
|
1391
|
-
["reference",
|
|
1392
|
-
["payload",
|
|
1394
|
+
const D = [
|
|
1395
|
+
["reference", I.references],
|
|
1396
|
+
["payload", I.payloads]
|
|
1393
1397
|
];
|
|
1394
|
-
for (const [$,
|
|
1395
|
-
for (const J of
|
|
1398
|
+
for (const [$, F] of D)
|
|
1399
|
+
for (const J of F ?? []) {
|
|
1396
1400
|
if (!J || !k.has(J)) continue;
|
|
1397
|
-
const W = z({ kind: $, layer:
|
|
1398
|
-
W && !
|
|
1401
|
+
const W = z({ kind: $, layer: P, path: J });
|
|
1402
|
+
W && !v.some((C) => C.identifier === W.identifier) && v.push(W);
|
|
1399
1403
|
}
|
|
1400
1404
|
}
|
|
1401
|
-
if (
|
|
1402
|
-
for (const [
|
|
1405
|
+
if (v.length === 0)
|
|
1406
|
+
for (const [P, I] of E) {
|
|
1403
1407
|
const k = new Set(
|
|
1404
|
-
|
|
1408
|
+
I.compositionPaths ?? []
|
|
1405
1409
|
);
|
|
1406
|
-
for (const
|
|
1407
|
-
if (!
|
|
1408
|
-
const $ = z({ kind: "resource", layer:
|
|
1409
|
-
$ && !
|
|
1410
|
+
for (const D of I.paths ?? []) {
|
|
1411
|
+
if (!D || k.has(D)) continue;
|
|
1412
|
+
const $ = z({ kind: "resource", layer: P, path: D });
|
|
1413
|
+
$ && !v.some((F) => F.identifier === $.identifier) && v.push($);
|
|
1410
1414
|
}
|
|
1411
1415
|
}
|
|
1412
1416
|
}
|
|
1413
1417
|
} catch (N) {
|
|
1414
1418
|
throw a("usd_probe_stage_release", ["number"], [S.stageId]), N;
|
|
1415
1419
|
}
|
|
1416
|
-
if (
|
|
1417
|
-
return { mappings: m, opened: S, variantConfiguration:
|
|
1418
|
-
a("usd_probe_stage_release", ["number"], [S.stageId]), await
|
|
1419
|
-
|
|
1420
|
+
if (v.length === 0)
|
|
1421
|
+
return { mappings: m, opened: S, variantConfiguration: M };
|
|
1422
|
+
a("usd_probe_stage_release", ["number"], [S.stageId]), await rn(
|
|
1423
|
+
v,
|
|
1420
1424
|
Math.max(1, y),
|
|
1421
|
-
async ({ item: N, identifier:
|
|
1425
|
+
async ({ item: N, identifier: A }) => {
|
|
1422
1426
|
if (!N.recurse && !h) return;
|
|
1423
1427
|
const T = Z(N.url.href, n);
|
|
1424
|
-
let
|
|
1428
|
+
let E;
|
|
1425
1429
|
try {
|
|
1426
|
-
|
|
1427
|
-
} catch (
|
|
1428
|
-
if (!N.resource || !
|
|
1429
|
-
throw
|
|
1430
|
-
const
|
|
1431
|
-
N.owner && (m[N.owner.path][N.owner.reference] =
|
|
1430
|
+
E = await s(N.url, A);
|
|
1431
|
+
} catch (P) {
|
|
1432
|
+
if (!N.resource || !et(A) || !rt(P))
|
|
1433
|
+
throw P;
|
|
1434
|
+
const I = `${n}/__unavailable__/${encodeURIComponent(A)}`;
|
|
1435
|
+
N.owner && (m[N.owner.path][N.owner.reference] = I), r.set(I, A), d == null || d(A, P);
|
|
1432
1436
|
return;
|
|
1433
1437
|
}
|
|
1434
|
-
i.set(T,
|
|
1438
|
+
i.set(T, Te(E)), he(e, T, E, o), r.set(T, A), N.recurse && (m[T] ?? (m[T] = {}), V.add(T));
|
|
1435
1439
|
}
|
|
1436
1440
|
);
|
|
1437
1441
|
}
|
|
1438
1442
|
}
|
|
1439
|
-
async function
|
|
1443
|
+
async function rn(e, t, n) {
|
|
1440
1444
|
const s = new Array(e.length);
|
|
1441
1445
|
let a = 0;
|
|
1442
1446
|
const o = Array.from({ length: Math.min(t, e.length) }, async () => {
|
|
@@ -1447,16 +1451,16 @@ async function nn(e, t, n) {
|
|
|
1447
1451
|
});
|
|
1448
1452
|
return await Promise.all(o), s;
|
|
1449
1453
|
}
|
|
1450
|
-
function
|
|
1454
|
+
function Pe(e) {
|
|
1451
1455
|
var n, s;
|
|
1452
1456
|
const t = (s = (n = e.split(/[?#]/, 1)[0]) == null ? void 0 : n.split(".").pop()) == null ? void 0 : s.toLowerCase();
|
|
1453
|
-
return t != null &&
|
|
1457
|
+
return t != null && Qt.has(t);
|
|
1454
1458
|
}
|
|
1455
|
-
function
|
|
1456
|
-
return
|
|
1459
|
+
function Te(e) {
|
|
1460
|
+
return $e(e) ? e.includes(64) : !0;
|
|
1457
1461
|
}
|
|
1458
1462
|
function sn(e) {
|
|
1459
|
-
return
|
|
1463
|
+
return $e(e) ? on(e, [
|
|
1460
1464
|
"subLayers",
|
|
1461
1465
|
"references",
|
|
1462
1466
|
"payload",
|
|
@@ -1464,7 +1468,7 @@ function sn(e) {
|
|
|
1464
1468
|
"clipAssetPaths"
|
|
1465
1469
|
]) : !0;
|
|
1466
1470
|
}
|
|
1467
|
-
function
|
|
1471
|
+
function $e(e) {
|
|
1468
1472
|
let t = e[0] === 239 && e[1] === 187 && e[2] === 191 ? 3 : 0;
|
|
1469
1473
|
for (; t < e.length && t < 64 && /\s/.test(String.fromCharCode(e[t])); ) t += 1;
|
|
1470
1474
|
return e[t] === 35 && e[t + 1] === 117 && e[t + 2] === 115 && e[t + 3] === 100 && e[t + 4] === 97;
|
|
@@ -1492,7 +1496,7 @@ function on(e, t) {
|
|
|
1492
1496
|
}
|
|
1493
1497
|
return !1;
|
|
1494
1498
|
}
|
|
1495
|
-
function
|
|
1499
|
+
function Ce(e, t) {
|
|
1496
1500
|
const n = new URL(e);
|
|
1497
1501
|
if (n.protocol !== t.protocol || n.host !== t.host) return n.href;
|
|
1498
1502
|
const s = new URL(".", t).pathname.split("/").filter(Boolean), a = n.pathname.split("/").filter(Boolean);
|
|
@@ -1501,7 +1505,7 @@ function $e(e, t) {
|
|
|
1501
1505
|
const r = [...s.slice(o).map(() => ".."), ...a.slice(o)].join("/");
|
|
1502
1506
|
return decodeURIComponent(r) + n.search + n.hash;
|
|
1503
1507
|
}
|
|
1504
|
-
function
|
|
1508
|
+
function Le(e, t, n) {
|
|
1505
1509
|
let s;
|
|
1506
1510
|
try {
|
|
1507
1511
|
s = new URL(e, new URL(t, n));
|
|
@@ -1512,7 +1516,7 @@ function Ce(e, t, n) {
|
|
|
1512
1516
|
return {
|
|
1513
1517
|
resolved: s,
|
|
1514
1518
|
absolute: r,
|
|
1515
|
-
childIdentifier: r ? s.href :
|
|
1519
|
+
childIdentifier: r ? s.href : Ce(s.href, n)
|
|
1516
1520
|
};
|
|
1517
1521
|
}
|
|
1518
1522
|
function Z(e, t) {
|
|
@@ -1524,7 +1528,7 @@ function Z(e, t) {
|
|
|
1524
1528
|
}
|
|
1525
1529
|
return `${t}/${s}${a}`;
|
|
1526
1530
|
}
|
|
1527
|
-
function
|
|
1531
|
+
function Fe(e, t) {
|
|
1528
1532
|
if (!e || typeof e != "object" || ArrayBuffer.isView(e)) return;
|
|
1529
1533
|
const n = e;
|
|
1530
1534
|
if (typeof n.path == "string" && typeof n.resolvedPath == "string") {
|
|
@@ -1534,9 +1538,9 @@ function Le(e, t) {
|
|
|
1534
1538
|
}
|
|
1535
1539
|
return;
|
|
1536
1540
|
}
|
|
1537
|
-
for (const s of Object.values(e))
|
|
1541
|
+
for (const s of Object.values(e)) Fe(s, t);
|
|
1538
1542
|
}
|
|
1539
|
-
function
|
|
1543
|
+
function je(e, t, n) {
|
|
1540
1544
|
if (!e || typeof e != "object" || ArrayBuffer.isView(e)) return;
|
|
1541
1545
|
const s = e;
|
|
1542
1546
|
if (typeof s.path == "string" && typeof s.ownerLayer == "string") {
|
|
@@ -1546,21 +1550,21 @@ function Fe(e, t, n) {
|
|
|
1546
1550
|
else {
|
|
1547
1551
|
const o = t.get(s.ownerLayer);
|
|
1548
1552
|
if (o) {
|
|
1549
|
-
const r =
|
|
1553
|
+
const r = Le(s.path, o, n);
|
|
1550
1554
|
r && (s.path = r.childIdentifier, s.resolvedPath = r.childIdentifier);
|
|
1551
1555
|
}
|
|
1552
1556
|
}
|
|
1553
1557
|
delete s.ownerLayer;
|
|
1554
1558
|
return;
|
|
1555
1559
|
}
|
|
1556
|
-
for (const a of Object.values(e))
|
|
1560
|
+
for (const a of Object.values(e)) je(a, t, n);
|
|
1557
1561
|
}
|
|
1558
|
-
function
|
|
1562
|
+
function Ve(e, t) {
|
|
1559
1563
|
if (e.analyzePath(t).exists) {
|
|
1560
1564
|
for (const n of e.readdir(t)) {
|
|
1561
1565
|
if (n === "." || n === "..") continue;
|
|
1562
1566
|
const s = `${t}/${n}`;
|
|
1563
|
-
e.isDir(e.stat(s).mode) ?
|
|
1567
|
+
e.isDir(e.stat(s).mode) ? Ve(e, s) : e.unlink(s);
|
|
1564
1568
|
}
|
|
1565
1569
|
e.rmdir(t);
|
|
1566
1570
|
}
|
|
@@ -1571,7 +1575,7 @@ function he(e, t, n, s) {
|
|
|
1571
1575
|
function Y(e) {
|
|
1572
1576
|
return `${e.primPath}\0${e.setName}`;
|
|
1573
1577
|
}
|
|
1574
|
-
async function
|
|
1578
|
+
async function Re(e) {
|
|
1575
1579
|
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());
|
|
1576
1580
|
}
|
|
1577
1581
|
async function an(e) {
|
|
@@ -1652,7 +1656,7 @@ function fn(e, t) {
|
|
|
1652
1656
|
});
|
|
1653
1657
|
}
|
|
1654
1658
|
function dn(e) {
|
|
1655
|
-
return re ?? (re =
|
|
1659
|
+
return re ?? (re = en(e)), re;
|
|
1656
1660
|
}
|
|
1657
1661
|
function hn(e) {
|
|
1658
1662
|
const t = /* @__PURE__ */ new Set();
|
|
@@ -1773,7 +1777,7 @@ te.onmessage = async (e) => {
|
|
|
1773
1777
|
onReferenceSkipped: (r) => B({ type: "event", event: "reference-skipped", identifier: r }),
|
|
1774
1778
|
onResourceFailed: (r, c) => B({ type: "event", event: "resource-failed", identifier: r, error: K(c) })
|
|
1775
1779
|
});
|
|
1776
|
-
ee = s.release, se =
|
|
1780
|
+
ee = s.release, se = ke(s.stage, s.pxr), oe = s.readPhysics;
|
|
1777
1781
|
const a = s.data, o = hn(a);
|
|
1778
1782
|
B({
|
|
1779
1783
|
type: "visual-ready",
|