@nebula-spatial/viewer 0.5.14 → 0.5.15
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 +19 -0
- package/dist/assets/{usd-worker-CPCXyXkl.js → usd-worker-DU-u_iJN.js} +558 -502
- package/dist/{collision-debug-B2bN8P2g.js → collision-debug-1-acufd9.js} +55 -53
- package/dist/{index-BSDalKkd.js → index-YdnQRm_T.js} +9 -9
- package/dist/index.js +1 -1
- package/dist/{mjcf-visual-D6T3a1uQ.js → mjcf-visual-DTO5j9bm.js} +1 -1
- package/dist/{mujoco-runtime-CFQQsRmc.js → mujoco-runtime-gqyaQh9L.js} +1 -1
- package/dist/{session-Ciaw522_.js → session-AUG5EJBJ.js} +7 -7
- package/dist/{session-BUarD9PA.js → session-mJGcCljH.js} +2 -2
- package/dist/{stage-CvP0yaff.js → stage-BVdJLgsW.js} +1 -1
- package/dist/{urdf-session-DcGOHFg2.js → urdf-session-oLRIcAw1.js} +5 -5
- package/dist/{usd-session-DSFtJk4b.js → usd-session-Dexv9ijX.js} +1861 -1805
- package/dist/version.d.ts +1 -1
- package/dist/{xacro-bURYAikr.js → xacro-BjsYN_8k.js} +1 -1
- package/openusd/openusd-runtime-manifest.json +3 -3
- package/openusd/openusd_probe.wasm +0 -0
- package/package.json +1 -1
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
function
|
|
2
|
-
return /^https?:$/.test(t.protocol) && e.origin === t.origin && !e.username && !e.password &&
|
|
1
|
+
function Ne(e, t) {
|
|
2
|
+
return /^https?:$/.test(t.protocol) && e.origin === t.origin && !e.username && !e.password && we(e.pathname).startsWith(we(new URL(".", t).pathname));
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function we(e) {
|
|
5
5
|
return e.endsWith("/") ? e : e.slice(0, e.lastIndexOf("/") + 1);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function Ge(e, t) {
|
|
8
8
|
for (const n of e) for (const a of n.shaders) for (const i of Object.values(a.inputs)) {
|
|
9
9
|
if (!i || typeof i != "object" || Array.isArray(i)) continue;
|
|
10
|
-
const
|
|
11
|
-
!
|
|
10
|
+
const s = i, r = [s.path, s.url, s.resolvedPath].find((c) => typeof c == "string" && c);
|
|
11
|
+
!r || /^(?:data|blob):/i.test(r) || /\.mdl(?:[?#].*)?$/i.test(r) || t(s, r);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function Ve(e, t, n) {
|
|
15
15
|
const a = [];
|
|
16
16
|
try {
|
|
17
|
-
return
|
|
18
|
-
if (t(
|
|
19
|
-
const
|
|
17
|
+
return Ge(e, (i, s) => {
|
|
18
|
+
if (t(s)) return;
|
|
19
|
+
const r = {};
|
|
20
20
|
for (const c of ["path", "resolvedPath", "url"])
|
|
21
|
-
c in i && (
|
|
22
|
-
a.push({ asset: i, values:
|
|
21
|
+
c in i && (r[c] = i[c], delete i[c]);
|
|
22
|
+
a.push({ asset: i, values: r });
|
|
23
23
|
}), n();
|
|
24
24
|
} finally {
|
|
25
|
-
for (const { asset: i, values:
|
|
25
|
+
for (const { asset: i, values: s } of a) Object.assign(i, s);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const Be = "E_ASSET_RESOURCE_NOT_FOUND", De = "E_ASSET_RESOURCE_INVALID", Fe = "E_ASSET_FETCH", ze = "E_ASSET_EXTERNAL_DENIED", He = "E_ASSET_AUTH", We = /* @__PURE__ */ new Set([
|
|
29
29
|
"png",
|
|
30
30
|
"jpg",
|
|
31
31
|
"jpeg",
|
|
@@ -38,82 +38,82 @@ const Ve = "E_ASSET_RESOURCE_NOT_FOUND", Me = "E_ASSET_RESOURCE_INVALID", Ge = "
|
|
|
38
38
|
"hdr",
|
|
39
39
|
"exr",
|
|
40
40
|
"ktx2"
|
|
41
|
-
]),
|
|
42
|
-
function
|
|
41
|
+
]), Xe = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
|
|
42
|
+
function Je(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 qe(e) {
|
|
47
|
+
const t = Je(e);
|
|
48
|
+
return We.has(t) && !Xe.has(t);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Ze(e, t) {
|
|
51
51
|
return Object.assign(new Error(e), { code: t });
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Ye(e) {
|
|
54
54
|
var a;
|
|
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 === Be) return "missing";
|
|
58
|
+
if (t === De) return "invalid";
|
|
59
|
+
if (t === Fe) return "unavailable";
|
|
60
|
+
if (t === He || t === ze) return "denied";
|
|
61
61
|
const n = (a = /\((\d{3})\)/.exec(e instanceof Error ? e.message : "")) == null ? void 0 : a[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 Ke(e) {
|
|
65
|
+
const t = Ye(e);
|
|
66
66
|
return t === "missing" || t === "invalid" || t === "unavailable";
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function Qe(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 Ke(e, t) {
|
|
72
|
-
return t.byteLength ? qe(e, new TextDecoder().decode(t.subarray(0, 512))) : "响应内容为空";
|
|
73
|
-
}
|
|
74
|
-
const Qe = /<UDIM>/i;
|
|
75
71
|
function et(e, t) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
return t.byteLength ? Qe(e, new TextDecoder().decode(t.subarray(0, 512))) : "响应内容为空";
|
|
73
|
+
}
|
|
74
|
+
const tt = /<UDIM>/i;
|
|
75
|
+
function nt(e, t) {
|
|
76
|
+
const n = ye(e).replaceAll("\\", "/");
|
|
77
|
+
if (!tt.test(n)) return null;
|
|
78
|
+
const a = _e(n), i = a.split("/").at(-1);
|
|
79
79
|
if (!i) return { paths: [], tiles: [] };
|
|
80
|
-
const
|
|
81
|
-
if (!
|
|
82
|
-
const
|
|
80
|
+
const s = rt(i);
|
|
81
|
+
if (!s) return { paths: [], tiles: [] };
|
|
82
|
+
const r = [];
|
|
83
83
|
for (const u of new Set(t)) {
|
|
84
|
-
const h =
|
|
84
|
+
const h = ye(u).replaceAll("\\", "/"), g = _e(h), l = g.split("/").at(-1);
|
|
85
85
|
if (!l) continue;
|
|
86
|
-
const f =
|
|
86
|
+
const f = s.exec(l);
|
|
87
87
|
if (!f) continue;
|
|
88
88
|
const p = Number(f[1]);
|
|
89
|
-
!Number.isInteger(p) || p < 1001 || p > 9999 ||
|
|
89
|
+
!Number.isInteger(p) || p < 1001 || p > 9999 || r.push({
|
|
90
90
|
path: u,
|
|
91
91
|
tile: p,
|
|
92
|
-
score:
|
|
92
|
+
score: st(a, g)
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
if (!
|
|
96
|
-
const c = Math.max(...
|
|
95
|
+
if (!r.length) return { paths: [], tiles: [] };
|
|
96
|
+
const c = Math.max(...r.map((u) => u.score)), o = r.filter((u) => u.score === c).sort((u, h) => u.tile - h.tile || u.path.localeCompare(h.path));
|
|
97
97
|
return {
|
|
98
98
|
paths: o.map((u) => u.path),
|
|
99
99
|
tiles: o.map((u) => u.tile)
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function rt(e) {
|
|
103
103
|
const t = e.split(/<UDIM>/i);
|
|
104
|
-
return t.length !== 2 ? null : new RegExp(`^${
|
|
104
|
+
return t.length !== 2 ? null : new RegExp(`^${Ee(t[0])}(\\d{4})${Ee(t[1])}$`, "i");
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function st(e, t) {
|
|
107
107
|
const n = e.split("/").slice(0, -1).filter(Boolean), a = t.split("/").slice(0, -1).filter(Boolean);
|
|
108
108
|
let i = 0;
|
|
109
109
|
for (; i < n.length && i < a.length; ) {
|
|
110
|
-
const
|
|
111
|
-
if ((
|
|
110
|
+
const s = n.at(-1 - i), r = a.at(-1 - i);
|
|
111
|
+
if ((s == null ? void 0 : s.toLowerCase()) !== (r == null ? void 0 : r.toLowerCase())) break;
|
|
112
112
|
i += 1;
|
|
113
113
|
}
|
|
114
114
|
return i;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function ye(e) {
|
|
117
117
|
const t = e.replace(/%3CUDIM%3E/gi, "<UDIM>");
|
|
118
118
|
try {
|
|
119
119
|
return decodeURIComponent(t);
|
|
@@ -121,55 +121,55 @@ function we(e) {
|
|
|
121
121
|
return t;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function _e(e) {
|
|
125
125
|
const t = e.search(/[?#]/);
|
|
126
126
|
return t < 0 ? e : e.slice(0, t);
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function Ee(e) {
|
|
129
129
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
130
130
|
}
|
|
131
|
-
const
|
|
132
|
-
function
|
|
131
|
+
const ot = 67324752, at = 33639248, it = 101010256, ie = 4294967295, ct = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "webp"]);
|
|
132
|
+
function ut(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), a =
|
|
135
|
+
async function lt(e, t = {}) {
|
|
136
|
+
const n = new DataView(e.buffer, e.byteOffset, e.byteLength), a = mt(n);
|
|
137
137
|
if (a < 0) throw new Error("Not a zip package: end of central directory not found.");
|
|
138
138
|
const i = n.getUint16(a + 10, !0);
|
|
139
|
-
let
|
|
140
|
-
if (i === 65535 ||
|
|
141
|
-
const
|
|
139
|
+
let s = n.getUint32(a + 16, !0);
|
|
140
|
+
if (i === 65535 || s === ie) throw new Error("ZIP64 usdz packages are not supported.");
|
|
141
|
+
const r = /* @__PURE__ */ new Map(), c = [];
|
|
142
142
|
for (let o = 0; o < i; o += 1) {
|
|
143
|
-
if (
|
|
143
|
+
if (s + 46 > n.byteLength || n.getUint32(s, !0) !== at)
|
|
144
144
|
throw new Error(`Corrupt zip central directory at entry ${o}.`);
|
|
145
|
-
const u = n.getUint16(
|
|
145
|
+
const u = n.getUint16(s + 10, !0), h = n.getUint32(s + 20, !0), g = n.getUint16(s + 28, !0), l = n.getUint16(s + 30, !0), f = n.getUint16(s + 32, !0), p = n.getUint32(s + 42, !0);
|
|
146
146
|
if (h === ie || p === ie)
|
|
147
147
|
throw new Error("ZIP64 usdz packages are not supported.");
|
|
148
|
-
const
|
|
149
|
-
|
|
148
|
+
const _ = new TextDecoder().decode(e.subarray(s + 46, s + 46 + g));
|
|
149
|
+
s += 46 + g + l + f, !_.endsWith("/") && (t.include && !t.include(_) || c.push(ft(e, n, p, h, u).then((y) => ({ name: _, data: y }))));
|
|
150
150
|
}
|
|
151
|
-
for (const { name: o, data: u } of await Promise.all(c))
|
|
152
|
-
return
|
|
151
|
+
for (const { name: o, data: u } of await Promise.all(c)) r.set(o, u);
|
|
152
|
+
return r;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function dt(e) {
|
|
155
155
|
if (typeof URL > "u" || typeof URL.createObjectURL != "function") return null;
|
|
156
|
-
const t = new Map([...e].filter(([
|
|
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
|
-
for (const
|
|
160
|
-
const c =
|
|
161
|
-
n.set(c, n.has(c) ? null :
|
|
159
|
+
for (const r of t.keys()) {
|
|
160
|
+
const c = r.split("/").pop() ?? r;
|
|
161
|
+
n.set(c, n.has(c) ? null : r);
|
|
162
162
|
}
|
|
163
|
-
const a = /* @__PURE__ */ new Map(), i = (
|
|
164
|
-
let c = a.get(
|
|
163
|
+
const a = /* @__PURE__ */ new Map(), i = (r) => {
|
|
164
|
+
let c = a.get(r);
|
|
165
165
|
if (!c) {
|
|
166
|
-
const o = t.get(
|
|
167
|
-
c = URL.createObjectURL(new Blob([new Uint8Array(o)], { type:
|
|
166
|
+
const o = t.get(r);
|
|
167
|
+
c = URL.createObjectURL(new Blob([new Uint8Array(o)], { type: gt(r) })), a.set(r, c);
|
|
168
168
|
}
|
|
169
169
|
return c;
|
|
170
|
-
},
|
|
171
|
-
if (!
|
|
172
|
-
const c =
|
|
170
|
+
}, s = (r) => {
|
|
171
|
+
if (!r) return null;
|
|
172
|
+
const c = pt(ht(r));
|
|
173
173
|
if (!c) return null;
|
|
174
174
|
if (t.has(c)) return i(c);
|
|
175
175
|
const o = [...t.keys()].filter((g) => g.endsWith(`/${c}`));
|
|
@@ -179,32 +179,32 @@ function ut(e) {
|
|
|
179
179
|
const h = n.get(c.split("/").pop() ?? "");
|
|
180
180
|
return h ? i(h) : null;
|
|
181
181
|
};
|
|
182
|
-
for (const
|
|
182
|
+
for (const r of t.keys()) i(r);
|
|
183
183
|
return {
|
|
184
184
|
urls: a,
|
|
185
|
-
resolve: (
|
|
185
|
+
resolve: (r) => s(r.resolvedPath) ?? s(r.path) ?? s(r.url) ?? null,
|
|
186
186
|
dispose: () => {
|
|
187
|
-
for (const
|
|
187
|
+
for (const r of a.values()) URL.revokeObjectURL(r);
|
|
188
188
|
a.clear();
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
return
|
|
192
|
+
function Me(e) {
|
|
193
|
+
return ct.has(xe(e));
|
|
194
194
|
}
|
|
195
|
-
async function
|
|
196
|
-
if (t.getUint32(n, !0) !==
|
|
197
|
-
const
|
|
195
|
+
async function ft(e, t, n, a, i) {
|
|
196
|
+
if (t.getUint32(n, !0) !== ot) throw new Error("Corrupt zip local file header.");
|
|
197
|
+
const s = t.getUint16(n + 26, !0), r = t.getUint16(n + 28, !0), c = n + 30 + s + r, o = e.subarray(c, c + a);
|
|
198
198
|
if (i === 0) return o.slice();
|
|
199
199
|
if (i !== 8) throw new Error(`Unsupported zip compression method ${i}.`);
|
|
200
200
|
const u = new Blob([new Uint8Array(o)]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
|
|
201
201
|
return new Uint8Array(await new Response(u).arrayBuffer());
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function ht(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 pt(e) {
|
|
208
208
|
const t = [];
|
|
209
209
|
for (const n of e.replaceAll("\\", "/").split("/"))
|
|
210
210
|
!n || n === "." || (n === ".." ? t.pop() : t.push(n));
|
|
@@ -214,7 +214,7 @@ 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
|
|
217
|
+
function gt(e) {
|
|
218
218
|
switch (xe(e)) {
|
|
219
219
|
case "png":
|
|
220
220
|
return "image/png";
|
|
@@ -227,30 +227,30 @@ function ht(e) {
|
|
|
227
227
|
return "application/octet-stream";
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function mt(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) === it) return n;
|
|
234
234
|
return -1;
|
|
235
235
|
}
|
|
236
|
-
const
|
|
236
|
+
const wt = 1, yt = 3, _t = "26ba7dc16b5a87a490fb", Et = {
|
|
237
237
|
file: "openusd_probe.js",
|
|
238
238
|
sha256: "83a14d264f2348a0899de8f1bc0c021fdcd8cae554ef545fb9e5b88da6f30b4e",
|
|
239
239
|
bytes: 95918
|
|
240
|
-
},
|
|
240
|
+
}, St = {
|
|
241
241
|
file: "openusd_probe.wasm",
|
|
242
|
-
sha256: "
|
|
243
|
-
bytes:
|
|
242
|
+
sha256: "ee1fa0050c8d220e13666325f81fc730940b6704a0900952cbef1505def8c3b4",
|
|
243
|
+
bytes: 10659670
|
|
244
244
|
};
|
|
245
245
|
var bt = {
|
|
246
|
-
schemaVersion:
|
|
247
|
-
apiVersion:
|
|
248
|
-
runtimeId:
|
|
249
|
-
js:
|
|
250
|
-
wasm:
|
|
246
|
+
schemaVersion: wt,
|
|
247
|
+
apiVersion: yt,
|
|
248
|
+
runtimeId: _t,
|
|
249
|
+
js: Et,
|
|
250
|
+
wasm: St
|
|
251
251
|
};
|
|
252
|
-
const
|
|
253
|
-
function
|
|
252
|
+
const Ut = vt(bt);
|
|
253
|
+
function vt(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))
|
|
@@ -259,11 +259,11 @@ function Ut(e) {
|
|
|
259
259
|
schemaVersion: t.schemaVersion,
|
|
260
260
|
apiVersion: Number(t.apiVersion),
|
|
261
261
|
runtimeId: t.runtimeId,
|
|
262
|
-
js:
|
|
263
|
-
wasm:
|
|
262
|
+
js: Se(t.js, "openusd_probe.js"),
|
|
263
|
+
wasm: Se(t.wasm, "openusd_probe.wasm")
|
|
264
264
|
});
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function Se(e, t) {
|
|
267
267
|
if (!e || typeof e != "object") throw new Error(`OpenUSD runtime manifest omits ${t}.`);
|
|
268
268
|
const n = e;
|
|
269
269
|
if (n.file !== t || typeof n.sha256 != "string" || !/^[0-9a-f]{64}$/.test(n.sha256) || !Number.isInteger(n.bytes) || Number(n.bytes) < 1)
|
|
@@ -274,7 +274,7 @@ function be(e, t) {
|
|
|
274
274
|
bytes: Number(n.bytes)
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function It(e, t, n) {
|
|
278
278
|
return WebAssembly.instantiate(e, t).then(
|
|
279
279
|
(a) => n(a, e),
|
|
280
280
|
(a) => {
|
|
@@ -284,90 +284,90 @@ function Et(e, t, n) {
|
|
|
284
284
|
}
|
|
285
285
|
), {};
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
const n = async (
|
|
287
|
+
function ke(e, t) {
|
|
288
|
+
const n = async (s, r) => {
|
|
289
289
|
var o;
|
|
290
|
-
const c = e.GetPrimAtPath(
|
|
290
|
+
const c = e.GetPrimAtPath(s);
|
|
291
291
|
try {
|
|
292
|
-
return
|
|
292
|
+
return r(c);
|
|
293
293
|
} finally {
|
|
294
294
|
(o = c == null ? void 0 : c.delete) == null || o.call(c);
|
|
295
295
|
}
|
|
296
|
-
}, a = (
|
|
296
|
+
}, a = (s, r) => {
|
|
297
297
|
var o, u, h, g;
|
|
298
|
-
const c = (o =
|
|
298
|
+
const c = (o = s == null ? void 0 : s.GetAttribute) == null ? void 0 : o.call(s, r);
|
|
299
299
|
if (!c) return [];
|
|
300
300
|
try {
|
|
301
301
|
return ((u = c.IsValid) == null ? void 0 : u.call(c)) !== !0 ? [] : (((h = c.GetConnections) == null ? void 0 : h.call(c)) ?? []).map((l) => {
|
|
302
|
-
var p,
|
|
302
|
+
var p, _;
|
|
303
303
|
if (typeof l == "string") return l;
|
|
304
304
|
const f = String(((p = l.GetString) == null ? void 0 : p.call(l)) ?? l.path ?? "");
|
|
305
|
-
return (
|
|
305
|
+
return (_ = l.delete) == null || _.call(l), f;
|
|
306
306
|
}).filter(Boolean);
|
|
307
307
|
} finally {
|
|
308
308
|
(g = c.delete) == null || g.call(c);
|
|
309
309
|
}
|
|
310
|
-
}, i = (
|
|
310
|
+
}, i = (s) => {
|
|
311
311
|
var c;
|
|
312
|
-
const
|
|
313
|
-
return
|
|
312
|
+
const r = s && ((c = t.UsdShade) != null && c.ComputeBoundMaterialPath) ? t.UsdShade.ComputeBoundMaterialPath(s) : null;
|
|
313
|
+
return r ? {
|
|
314
314
|
found: !0,
|
|
315
|
-
materialPath: String(
|
|
316
|
-
resolvedTargetPath: String(
|
|
317
|
-
bindingRelationshipPath: String(
|
|
315
|
+
materialPath: String(r.materialPath ?? ""),
|
|
316
|
+
resolvedTargetPath: String(r.resolvedTargetPath ?? ""),
|
|
317
|
+
bindingRelationshipPath: String(r.bindingRelationshipPath ?? "")
|
|
318
318
|
} : { found: !1, materialPath: "", resolvedTargetPath: "", bindingRelationshipPath: "" };
|
|
319
319
|
};
|
|
320
320
|
return {
|
|
321
|
-
async stageMetadata(
|
|
321
|
+
async stageMetadata(s) {
|
|
322
322
|
var c;
|
|
323
|
-
const
|
|
323
|
+
const r = e.GetPseudoRoot();
|
|
324
324
|
try {
|
|
325
|
-
const o =
|
|
325
|
+
const o = r.GetMetadata(s);
|
|
326
326
|
return { valid: !0, found: o != null, value: o };
|
|
327
327
|
} finally {
|
|
328
|
-
(c =
|
|
328
|
+
(c = r.delete) == null || c.call(r);
|
|
329
329
|
}
|
|
330
330
|
},
|
|
331
|
-
async primInfo(
|
|
332
|
-
return n(
|
|
331
|
+
async primInfo(s) {
|
|
332
|
+
return n(s, (r) => {
|
|
333
333
|
var c, o, u, h;
|
|
334
334
|
return {
|
|
335
|
-
valid: !!
|
|
336
|
-
name: String(((o =
|
|
337
|
-
path:
|
|
338
|
-
typeName: String(((u =
|
|
339
|
-
instance: ((h =
|
|
335
|
+
valid: !!r && ((c = r.IsValid) == null ? void 0 : c.call(r)) !== !1,
|
|
336
|
+
name: String(((o = r.GetName) == null ? void 0 : o.call(r)) ?? s.split("/").pop() ?? ""),
|
|
337
|
+
path: s,
|
|
338
|
+
typeName: String(((u = r.GetTypeName) == null ? void 0 : u.call(r)) ?? ""),
|
|
339
|
+
instance: ((h = r.IsInstance) == null ? void 0 : h.call(r)) === !0
|
|
340
340
|
};
|
|
341
341
|
});
|
|
342
342
|
},
|
|
343
|
-
async primChildren(
|
|
344
|
-
return n(
|
|
343
|
+
async primChildren(s) {
|
|
344
|
+
return n(s, (r) => {
|
|
345
345
|
var c;
|
|
346
|
-
return (((c =
|
|
346
|
+
return (((c = r.GetChildren) == null ? void 0 : c.call(r)) ?? []).map((o) => {
|
|
347
347
|
var h, g;
|
|
348
348
|
const u = String(o.__path ?? ((h = o.GetPath) == null ? void 0 : h.call(o)) ?? "");
|
|
349
349
|
return (g = o.delete) == null || g.call(o), u;
|
|
350
350
|
});
|
|
351
351
|
});
|
|
352
352
|
},
|
|
353
|
-
async primDescendants(
|
|
353
|
+
async primDescendants(s, r = "") {
|
|
354
354
|
var c;
|
|
355
|
-
return (((c = e.GetDescendants) == null ? void 0 : c.call(e,
|
|
355
|
+
return (((c = e.GetDescendants) == null ? void 0 : c.call(e, s, r)) ?? []).map(String);
|
|
356
356
|
},
|
|
357
|
-
async primAttributes(
|
|
358
|
-
return n(
|
|
357
|
+
async primAttributes(s) {
|
|
358
|
+
return n(s, (r) => {
|
|
359
359
|
var c;
|
|
360
|
-
return (((c =
|
|
360
|
+
return (((c = r.GetAttributes) == null ? void 0 : c.call(r)) ?? []).map((o) => {
|
|
361
361
|
var h, g;
|
|
362
362
|
const u = String(((h = o.GetName) == null ? void 0 : h.call(o)) ?? "");
|
|
363
363
|
return (g = o.delete) == null || g.call(o), u;
|
|
364
364
|
});
|
|
365
365
|
});
|
|
366
366
|
},
|
|
367
|
-
async primMetadata(
|
|
368
|
-
return n(
|
|
367
|
+
async primMetadata(s, r) {
|
|
368
|
+
return n(s, (c) => {
|
|
369
369
|
var h;
|
|
370
|
-
const o = (h = c == null ? void 0 : c.GetMetadata) == null ? void 0 : h.call(c,
|
|
370
|
+
const o = (h = c == null ? void 0 : c.GetMetadata) == null ? void 0 : h.call(c, r), u = typeof o == "string" ? o : o && typeof o == "object" && typeof o.string == "string" ? String(o.string) : void 0;
|
|
371
371
|
return {
|
|
372
372
|
valid: !0,
|
|
373
373
|
found: o != null,
|
|
@@ -376,10 +376,10 @@ function Re(e, t) {
|
|
|
376
376
|
};
|
|
377
377
|
});
|
|
378
378
|
},
|
|
379
|
-
async relationshipTargets(
|
|
380
|
-
return n(
|
|
379
|
+
async relationshipTargets(s, r) {
|
|
380
|
+
return n(s, (c) => {
|
|
381
381
|
var u, h, g;
|
|
382
|
-
const o = (u = c == null ? void 0 : c.GetRelationship) == null ? void 0 : u.call(c,
|
|
382
|
+
const o = (u = c == null ? void 0 : c.GetRelationship) == null ? void 0 : u.call(c, r);
|
|
383
383
|
if (!o) return [];
|
|
384
384
|
try {
|
|
385
385
|
return (((h = o.GetTargets) == null ? void 0 : h.call(o)) ?? []).map((l) => {
|
|
@@ -391,10 +391,10 @@ function Re(e, t) {
|
|
|
391
391
|
}
|
|
392
392
|
});
|
|
393
393
|
},
|
|
394
|
-
async attributeValue(
|
|
395
|
-
return n(
|
|
394
|
+
async attributeValue(s, r) {
|
|
395
|
+
return n(s, (c) => {
|
|
396
396
|
var u, h, g, l;
|
|
397
|
-
const o = (u = c == null ? void 0 : c.GetAttribute) == null ? void 0 : u.call(c,
|
|
397
|
+
const o = (u = c == null ? void 0 : c.GetAttribute) == null ? void 0 : u.call(c, r);
|
|
398
398
|
if (!o) return { valid: !1, authored: !1, value: null };
|
|
399
399
|
try {
|
|
400
400
|
const f = ((h = o.IsValid) == null ? void 0 : h.call(o)) === !0;
|
|
@@ -408,32 +408,32 @@ function Re(e, t) {
|
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
410
|
},
|
|
411
|
-
async attributeValues(
|
|
412
|
-
const
|
|
413
|
-
for (const c of
|
|
414
|
-
|
|
411
|
+
async attributeValues(s) {
|
|
412
|
+
const r = {};
|
|
413
|
+
for (const c of s)
|
|
414
|
+
r[c.path] = await n(c.path, (o) => Object.fromEntries(
|
|
415
415
|
c.names.map((u) => {
|
|
416
416
|
var g, l, f, p;
|
|
417
417
|
const h = (g = o == null ? void 0 : o.GetAttribute) == null ? void 0 : g.call(o, u);
|
|
418
418
|
if (!h) return [u, { valid: !1, authored: !1, value: null }];
|
|
419
419
|
try {
|
|
420
|
-
const
|
|
420
|
+
const _ = ((l = h.IsValid) == null ? void 0 : l.call(h)) === !0;
|
|
421
421
|
return [u, {
|
|
422
|
-
valid:
|
|
423
|
-
authored:
|
|
424
|
-
value:
|
|
422
|
+
valid: _,
|
|
423
|
+
authored: _ && ((f = h.HasAuthoredValue) == null ? void 0 : f.call(h)) === !0,
|
|
424
|
+
value: _ ? h.Get() : null
|
|
425
425
|
}];
|
|
426
426
|
} finally {
|
|
427
427
|
(p = h.delete) == null || p.call(h);
|
|
428
428
|
}
|
|
429
429
|
})
|
|
430
430
|
));
|
|
431
|
-
return
|
|
431
|
+
return r;
|
|
432
432
|
},
|
|
433
|
-
async attributeMetadata(
|
|
434
|
-
return n(
|
|
433
|
+
async attributeMetadata(s, r, c) {
|
|
434
|
+
return n(s, (o) => {
|
|
435
435
|
var h, g, l;
|
|
436
|
-
const u = (h = o == null ? void 0 : o.GetAttribute) == null ? void 0 : h.call(o,
|
|
436
|
+
const u = (h = o == null ? void 0 : o.GetAttribute) == null ? void 0 : h.call(o, r);
|
|
437
437
|
if (!u) return { valid: !1, found: !1 };
|
|
438
438
|
try {
|
|
439
439
|
if (((g = u.IsValid) == null ? void 0 : g.call(u)) !== !0) return { valid: !1, found: !1 };
|
|
@@ -448,23 +448,23 @@ function Re(e, t) {
|
|
|
448
448
|
}
|
|
449
449
|
});
|
|
450
450
|
},
|
|
451
|
-
async attributeConnections(
|
|
452
|
-
return n(
|
|
451
|
+
async attributeConnections(s, r) {
|
|
452
|
+
return n(s, (c) => a(c, r));
|
|
453
453
|
},
|
|
454
|
-
async boundMaterial(
|
|
455
|
-
return n(
|
|
454
|
+
async boundMaterial(s) {
|
|
455
|
+
return n(s, i);
|
|
456
456
|
}
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
|
-
const
|
|
460
|
-
function
|
|
461
|
-
const n = new Set(t.map(
|
|
459
|
+
const Rt = /^physics$/i, Pt = /^(newton|mjc|mujoco)(?:[_-]|$)/i, At = /^(physx|newton|mjc|mujoco)(?:[_-]|)/i;
|
|
460
|
+
function Nt(e, t = []) {
|
|
461
|
+
const n = new Set(t.map(be)), a = [];
|
|
462
462
|
for (const i of e) {
|
|
463
|
-
if (!
|
|
464
|
-
const
|
|
465
|
-
if (
|
|
466
|
-
const
|
|
467
|
-
const h =
|
|
463
|
+
if (!Rt.test(i.setName) || n.has(be(i))) continue;
|
|
464
|
+
const s = i.variantNames.map((o, u) => ({ selection: o, index: u, rank: Dt(o) })).filter((o) => o.rank !== null);
|
|
465
|
+
if (s.length === 0 || i.selection && Pt.test(i.selection)) continue;
|
|
466
|
+
const r = ce(i.selection), c = [...s].sort((o, u) => {
|
|
467
|
+
const h = r !== null && ce(o.selection) === r, g = r !== null && ce(u.selection) === r;
|
|
468
468
|
return Number(g) - Number(h) || o.rank - u.rank || o.index - u.index;
|
|
469
469
|
})[0];
|
|
470
470
|
a.push({
|
|
@@ -475,16 +475,16 @@ function At(e, t = []) {
|
|
|
475
475
|
}
|
|
476
476
|
return a;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function Dt(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 ce(e) {
|
|
482
|
-
return e && e.replace(
|
|
482
|
+
return e && e.replace(At, "").toLowerCase() || null;
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function be(e) {
|
|
485
485
|
return `${e.primPath}\0${e.setName}`;
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function Mt(e) {
|
|
488
488
|
let t = 0;
|
|
489
489
|
const n = () => {
|
|
490
490
|
for (; t < e.length; ) {
|
|
@@ -535,17 +535,17 @@ function kt(e) {
|
|
|
535
535
|
for (; o && (u = n()); )
|
|
536
536
|
u.value === "{" && u.kind === "symbol" ? o++ : u.value === "}" && u.kind === "symbol" && o--;
|
|
537
537
|
if (o) throw new Error("Unterminated USDA dictionary");
|
|
538
|
-
},
|
|
538
|
+
}, s = /* @__PURE__ */ new Map(), r = [];
|
|
539
539
|
let c;
|
|
540
540
|
for (; c = n(); ) {
|
|
541
541
|
if (c.kind !== "word") {
|
|
542
|
-
c.kind === "symbol" && c.value === "[" ? a() : c.kind === "symbol" && c.value === "{" ? i() : c.kind === "symbol" && c.value === "}" &&
|
|
542
|
+
c.kind === "symbol" && c.value === "[" ? a() : c.kind === "symbol" && c.value === "{" ? i() : c.kind === "symbol" && c.value === "}" && r.pop();
|
|
543
543
|
continue;
|
|
544
544
|
}
|
|
545
545
|
if (["def", "over", "class"].includes(c.value)) {
|
|
546
546
|
const l = n(), f = (l == null ? void 0 : l.kind) === "string" ? l : n();
|
|
547
547
|
if (!f || f.kind !== "string") throw new Error("Invalid USDA prim header");
|
|
548
|
-
const p = [...
|
|
548
|
+
const p = [...r].reverse().find(Boolean), _ = `${(p == null ? void 0 : p.path) ?? ""}/${f.value}`, y = { schemas: [], relationships: /* @__PURE__ */ new Map() };
|
|
549
549
|
let d, m = 0;
|
|
550
550
|
for (; (d = n()) && !(d.kind === "symbol" && d.value === "{" && m === 0); ) {
|
|
551
551
|
if (d.kind === "symbol" && d.value === "(") m++;
|
|
@@ -555,20 +555,20 @@ function kt(e) {
|
|
|
555
555
|
continue;
|
|
556
556
|
}
|
|
557
557
|
if (d.kind === "word" && d.value === "apiSchemas") {
|
|
558
|
-
const S = n(),
|
|
558
|
+
const S = n(), E = n();
|
|
559
559
|
if ((S == null ? void 0 : S.value) !== "=") throw new Error("Invalid USDA apiSchemas");
|
|
560
|
-
if ((
|
|
561
|
-
if ((
|
|
560
|
+
if ((E == null ? void 0 : E.kind) === "word" && E.value === "None") continue;
|
|
561
|
+
if ((E == null ? void 0 : E.value) !== "[") throw new Error(`Invalid USDA apiSchemas at ${_}: ${E == null ? void 0 : E.value}`);
|
|
562
562
|
for (; (d = n()) && d.value !== "]"; )
|
|
563
|
-
d.kind === "string" && d.value.startsWith("PhysxMimicJointAPI:") &&
|
|
563
|
+
d.kind === "string" && d.value.startsWith("PhysxMimicJointAPI:") && y.schemas.push(d.value);
|
|
564
564
|
if (!d) throw new Error("Unterminated USDA apiSchemas");
|
|
565
565
|
} else d.value === "[" && d.kind === "symbol" && a();
|
|
566
566
|
}
|
|
567
567
|
if (!d) throw new Error("Unterminated USDA prim header");
|
|
568
|
-
|
|
568
|
+
s.set(_, y), r.push({ path: _, prim: y });
|
|
569
569
|
continue;
|
|
570
570
|
}
|
|
571
|
-
if (c.value !== "rel" || !
|
|
571
|
+
if (c.value !== "rel" || !r.at(-1)) continue;
|
|
572
572
|
const o = n();
|
|
573
573
|
if (!o || o.kind !== "word" || !/^physxMimicJoint:[^:]+:referenceJoint$/.test(o.value)) continue;
|
|
574
574
|
const u = n(), h = n();
|
|
@@ -580,9 +580,9 @@ function kt(e) {
|
|
|
580
580
|
for (; (l = n()) && l.value !== "]"; ) l.kind === "path" && g.push(l.value);
|
|
581
581
|
if (!l) throw new Error("Unterminated USDA relationship");
|
|
582
582
|
}
|
|
583
|
-
|
|
583
|
+
r.at(-1).prim.relationships.set(o.value, g);
|
|
584
584
|
}
|
|
585
|
-
return new Map([...
|
|
585
|
+
return new Map([...s].filter(([, o]) => o.schemas.length || o.relationships.size));
|
|
586
586
|
}
|
|
587
587
|
const xt = [
|
|
588
588
|
1,
|
|
@@ -602,52 +602,52 @@ const xt = [
|
|
|
602
602
|
0,
|
|
603
603
|
1
|
|
604
604
|
];
|
|
605
|
-
function
|
|
606
|
-
const t = new Map(e.map((
|
|
607
|
-
const
|
|
608
|
-
if (
|
|
609
|
-
if (a.has(
|
|
610
|
-
a.add(
|
|
611
|
-
const c = Ue(
|
|
612
|
-
return a.delete(
|
|
605
|
+
function kt(e) {
|
|
606
|
+
const t = new Map(e.map((s) => [s.path, s])), n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), i = (s) => {
|
|
607
|
+
const r = n.get(s.path);
|
|
608
|
+
if (r) return r;
|
|
609
|
+
if (a.has(s.path)) return Ue(s.localMatrix);
|
|
610
|
+
a.add(s.path);
|
|
611
|
+
const c = Ue(s.localMatrix), o = s.parentPath ? t.get(s.parentPath) : void 0, u = !o || s.resetsXformStack ? c : ve(c, i(o));
|
|
612
|
+
return a.delete(s.path), n.set(s.path, u), u;
|
|
613
613
|
};
|
|
614
|
-
return e.map((
|
|
615
|
-
if (!
|
|
616
|
-
const
|
|
617
|
-
if (!
|
|
618
|
-
const c = i(
|
|
614
|
+
return e.map((s) => {
|
|
615
|
+
if (!s.resetsXformStack || !s.parentPath) return s;
|
|
616
|
+
const r = t.get(s.parentPath);
|
|
617
|
+
if (!r) return s;
|
|
618
|
+
const c = i(r), o = Ot(c);
|
|
619
619
|
return o ? {
|
|
620
|
-
...
|
|
621
|
-
localMatrix:
|
|
622
|
-
} :
|
|
620
|
+
...s,
|
|
621
|
+
localMatrix: ve(i(s), o)
|
|
622
|
+
} : s;
|
|
623
623
|
});
|
|
624
624
|
}
|
|
625
625
|
function Ue(e) {
|
|
626
|
-
return
|
|
626
|
+
return Tt(e) ? e : xt;
|
|
627
627
|
}
|
|
628
|
-
function
|
|
628
|
+
function Tt(e) {
|
|
629
629
|
return (e == null ? void 0 : e.length) === 16 && e.every(Number.isFinite);
|
|
630
630
|
}
|
|
631
|
-
function
|
|
631
|
+
function ve(e, t) {
|
|
632
632
|
const n = new Array(16);
|
|
633
633
|
for (let a = 0; a < 4; a++)
|
|
634
634
|
for (let i = 0; i < 4; i++) {
|
|
635
|
-
let
|
|
636
|
-
for (let
|
|
637
|
-
|
|
638
|
-
n[a * 4 + i] =
|
|
635
|
+
let s = 0;
|
|
636
|
+
for (let r = 0; r < 4; r++)
|
|
637
|
+
s += e[a * 4 + r] * t[r * 4 + i];
|
|
638
|
+
n[a * 4 + i] = s;
|
|
639
639
|
}
|
|
640
640
|
return n;
|
|
641
641
|
}
|
|
642
|
-
function
|
|
642
|
+
function Ot(e) {
|
|
643
643
|
const [
|
|
644
644
|
t,
|
|
645
645
|
n,
|
|
646
646
|
a,
|
|
647
647
|
,
|
|
648
648
|
i,
|
|
649
|
-
r,
|
|
650
649
|
s,
|
|
650
|
+
r,
|
|
651
651
|
,
|
|
652
652
|
c,
|
|
653
653
|
o,
|
|
@@ -656,48 +656,48 @@ function Nt(e) {
|
|
|
656
656
|
h,
|
|
657
657
|
g,
|
|
658
658
|
l
|
|
659
|
-
] = e, f =
|
|
660
|
-
Math.abs(t *
|
|
661
|
-
Math.abs(t *
|
|
659
|
+
] = e, f = s * u - r * o, p = a * o - n * u, _ = n * r - a * s, y = t * f + i * p + c * _, d = Math.max(
|
|
660
|
+
Math.abs(t * s * u),
|
|
661
|
+
Math.abs(t * r * o),
|
|
662
662
|
Math.abs(n * i * u),
|
|
663
|
-
Math.abs(n *
|
|
663
|
+
Math.abs(n * r * c),
|
|
664
664
|
Math.abs(a * i * o),
|
|
665
|
-
Math.abs(a *
|
|
665
|
+
Math.abs(a * s * c),
|
|
666
666
|
1
|
|
667
667
|
);
|
|
668
|
-
if (!Number.isFinite(
|
|
668
|
+
if (!Number.isFinite(y) || Math.abs(y) <= Number.EPSILON * d * 16)
|
|
669
669
|
return null;
|
|
670
|
-
const m = 1 /
|
|
670
|
+
const m = 1 / y, S = f * m, E = p * m, N = _ * m, G = (r * c - i * u) * m, T = (t * u - a * c) * m, V = (a * i - t * r) * m, b = (i * o - s * c) * m, P = (n * c - t * o) * m, U = (t * s - n * i) * m;
|
|
671
671
|
return [
|
|
672
672
|
S,
|
|
673
|
-
|
|
674
|
-
|
|
673
|
+
E,
|
|
674
|
+
N,
|
|
675
675
|
0,
|
|
676
|
-
j,
|
|
677
|
-
V,
|
|
678
676
|
G,
|
|
677
|
+
T,
|
|
678
|
+
V,
|
|
679
679
|
0,
|
|
680
|
+
b,
|
|
681
|
+
P,
|
|
680
682
|
U,
|
|
681
|
-
A,
|
|
682
|
-
E,
|
|
683
683
|
0,
|
|
684
|
-
-(h * S + g *
|
|
685
|
-
-(h *
|
|
686
|
-
-(h *
|
|
684
|
+
-(h * S + g * G + l * b),
|
|
685
|
+
-(h * E + g * T + l * P),
|
|
686
|
+
-(h * N + g * V + l * U),
|
|
687
687
|
1
|
|
688
688
|
];
|
|
689
689
|
}
|
|
690
|
-
function
|
|
690
|
+
function $t(e, t = []) {
|
|
691
691
|
return {
|
|
692
692
|
stage: e.stage,
|
|
693
693
|
view: {
|
|
694
694
|
...e.view,
|
|
695
|
-
prims:
|
|
695
|
+
prims: kt(e.view.prims)
|
|
696
696
|
},
|
|
697
697
|
elements: e.elements,
|
|
698
698
|
materials: e.materials,
|
|
699
699
|
materialAliases: e.materialAliases,
|
|
700
|
-
physics:
|
|
700
|
+
physics: Ct(),
|
|
701
701
|
joints: [],
|
|
702
702
|
cameras: [],
|
|
703
703
|
lights: [],
|
|
@@ -706,10 +706,10 @@ function Tt(e, t = []) {
|
|
|
706
706
|
variants: t
|
|
707
707
|
};
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function Lt(e, t) {
|
|
710
710
|
e.physics = t.physics, e.joints = t.joints;
|
|
711
711
|
}
|
|
712
|
-
function
|
|
712
|
+
function Ct() {
|
|
713
713
|
return {
|
|
714
714
|
scenes: [],
|
|
715
715
|
rigidBodies: [],
|
|
@@ -718,37 +718,93 @@ function Ot() {
|
|
|
718
718
|
articulationRoots: []
|
|
719
719
|
};
|
|
720
720
|
}
|
|
721
|
-
const
|
|
722
|
-
|
|
721
|
+
const jt = /^(Warning|Error|Fatal|Info|Runtime Error|Coding Error):\s+in\s+(\S+)\s+at line \d+ of .*?\s+--\s+([\s\S]*)$/s, Gt = /(^|[\s(\[])(?:[A-Za-z]:[\\/]|\/)(?:[^ \t\r\n()'"]+[\\/])*[^ \t\r\n()'"]+\.(?:cpp|cxx|cc|hpp|c|h|mjs|js|ts)(?::\d+)*/gi, Vt = /<0x[0-9a-f]+>/gi, Bt = /* @__PURE__ */ new Set([
|
|
722
|
+
"USD_MATERIAL_BINDING_API_MISSING",
|
|
723
|
+
"USD_EXTERNAL_REFERENCE_UNRESOLVED"
|
|
724
|
+
]);
|
|
725
|
+
function Ft(e) {
|
|
726
|
+
const t = jt.exec(e);
|
|
727
|
+
return (t ? `${t[1]}: ${t[2]} -- ${t[3]}` : e).replace(Gt, "$1<OpenUSD source>").replace(Vt, "<stage>").trim();
|
|
728
|
+
}
|
|
729
|
+
function zt(e) {
|
|
730
|
+
if (!e || /^(?:Info|Status):/.test(e)) return null;
|
|
731
|
+
const t = Ft(e);
|
|
732
|
+
if (!t) return null;
|
|
733
|
+
if (/Found material bindings on prim at path .* but MaterialBindingAPI is not applied/.test(t))
|
|
734
|
+
return { severity: "warning", code: "USD_MATERIAL_BINDING_API_MISSING", message: t };
|
|
735
|
+
if (/Could not open asset @.*@ for (?:reference|payload|subLayer)/.test(t) || /Could not load sublayers? @.*@ of layer/.test(t))
|
|
736
|
+
return { severity: "warning", code: "USD_EXTERNAL_REFERENCE_UNRESOLVED", message: t };
|
|
737
|
+
if (!/^(?:Warning|Error|Fatal):/.test(t)) {
|
|
738
|
+
const n = /(?:Aborted|Assertion failed|Runtime\s+Error|Coding\s+Error|FATAL|unreachable)/i.test(t);
|
|
739
|
+
return {
|
|
740
|
+
severity: n ? "error" : "warning",
|
|
741
|
+
code: n ? "OPENUSD_ERROR" : "OPENUSD_WARNING",
|
|
742
|
+
message: t
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
return {
|
|
746
|
+
severity: /^(?:Error|Fatal|Runtime Error|Coding Error):/.test(t) ? "error" : "warning",
|
|
747
|
+
code: /^(?:Error|Fatal|Runtime Error|Coding Error):/.test(t) ? "OPENUSD_ERROR" : "OPENUSD_WARNING",
|
|
748
|
+
message: t
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
function Ie(e = {}) {
|
|
752
|
+
const t = e.console ?? console, n = /* @__PURE__ */ new Set(), a = Math.max(1, e.maxUniqueDiagnostics ?? 64);
|
|
753
|
+
let i = !1;
|
|
754
|
+
const s = (r) => {
|
|
755
|
+
var o;
|
|
756
|
+
const c = r.code === "USD_MATERIAL_BINDING_API_MISSING" ? r.code : `${r.code}\0${r.message}`;
|
|
757
|
+
if (!n.has(c)) {
|
|
758
|
+
if (n.size >= a) {
|
|
759
|
+
i || (i = !0, t.warn(
|
|
760
|
+
`[openusd] further runtime diagnostics suppressed after ${a} unique messages`
|
|
761
|
+
));
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
n.add(c), (o = e.onDiagnostic) == null || o.call(e, r), !e.onDiagnostic && (Bt.has(r.code) || (r.severity === "error" ? t.error(r.message) : t.warn(r.message)));
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
return (r) => {
|
|
768
|
+
const c = String(r ?? "");
|
|
769
|
+
for (const o of c.split(/\r?\n/)) {
|
|
770
|
+
const u = zt(o.trim());
|
|
771
|
+
u && s(u);
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
const Ht = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
|
|
776
|
+
async function Wt(e) {
|
|
723
777
|
const t = await import(
|
|
724
778
|
/* @vite-ignore */
|
|
725
779
|
e.moduleUrl
|
|
726
780
|
), n = t.default ?? t.createOpenUsdProbe, a = e.wasmModule ? {
|
|
727
|
-
|
|
728
|
-
|
|
781
|
+
printErr: Ie({ onDiagnostic: e.onRuntimeDiagnostic }),
|
|
782
|
+
instantiateWasm(y, d) {
|
|
783
|
+
return It(e.wasmModule, y, d);
|
|
729
784
|
}
|
|
730
785
|
} : {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
786
|
+
printErr: Ie({ onDiagnostic: e.onRuntimeDiagnostic }),
|
|
787
|
+
wasmBinary: await (typeof e.wasmBinary == "function" ? e.wasmBinary() : e.wasmBinary ?? tn(e.wasmUrl))
|
|
788
|
+
}, i = await n(a), s = e.apiVersion ?? Ut.apiVersion, r = Number(i.ccall("usd_probe_api_version", "number", [], []));
|
|
789
|
+
if (r !== s)
|
|
734
790
|
throw Object.assign(
|
|
735
|
-
new Error(`OpenUSD runtime API mismatch: expected ${
|
|
791
|
+
new Error(`OpenUSD runtime API mismatch: expected ${s}, received ${r}.`),
|
|
736
792
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
737
793
|
);
|
|
738
|
-
const c = e.memfsRoot ?? "/asset", o = e.fetchBytes ?? (async (
|
|
739
|
-
const d = await fetch(
|
|
740
|
-
if (!d.ok) throw Object.assign(new Error(`USD resource request failed (${d.status}): ${
|
|
794
|
+
const c = e.memfsRoot ?? "/asset", o = e.fetchBytes ?? (async (y) => {
|
|
795
|
+
const d = await fetch(y);
|
|
796
|
+
if (!d.ok) throw Object.assign(new Error(`USD resource request failed (${d.status}): ${y}`), {
|
|
741
797
|
code: d.status === 401 || d.status === 403 ? "E_ASSET_AUTH" : "E_ASSET_FETCH"
|
|
742
798
|
});
|
|
743
|
-
const m = new Uint8Array(await d.arrayBuffer()), S =
|
|
744
|
-
if (S) throw
|
|
799
|
+
const m = new Uint8Array(await d.arrayBuffer()), S = et(d.headers.get("content-type"), m);
|
|
800
|
+
if (S) throw Ze(`USD resource is not usable (${S}): ${y}`, De);
|
|
745
801
|
return m;
|
|
746
|
-
}), u = (
|
|
802
|
+
}), u = (y, d, m) => JSON.parse(i.ccall(y, "string", d, m)), h = /* @__PURE__ */ new Set(), g = Re(i);
|
|
747
803
|
let l = 0, f = null;
|
|
748
804
|
async function p() {
|
|
749
805
|
return f || (f = (async () => {
|
|
750
|
-
const
|
|
751
|
-
i.FS.mkdirTree(
|
|
806
|
+
const y = `${c}/__viewer_warmup__`, d = `${y}/empty.usda`;
|
|
807
|
+
i.FS.mkdirTree(y), i.FS.writeFile(d, new TextEncoder().encode(`#usda 1.0
|
|
752
808
|
`));
|
|
753
809
|
let m;
|
|
754
810
|
try {
|
|
@@ -761,56 +817,56 @@ async function Ct(e) {
|
|
|
761
817
|
}
|
|
762
818
|
})(), f);
|
|
763
819
|
}
|
|
764
|
-
async function y
|
|
765
|
-
const m = new URL(d.sourcePath, "file:///"), S = `${c}/load-${++l}`,
|
|
766
|
-
let
|
|
767
|
-
const
|
|
768
|
-
|
|
820
|
+
async function _(y, d) {
|
|
821
|
+
const m = new URL(d.sourcePath, "file:///"), S = `${c}/load-${++l}`, E = J(m.href, S), N = /* @__PURE__ */ new Set(), G = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map(), V = d.readTextureBytes ?? !0, b = d.collectTextureUrls ?? !V, P = b || V ? Te : Qt, U = /* @__PURE__ */ new Map();
|
|
822
|
+
let F, D = null, I = null;
|
|
823
|
+
const A = () => {
|
|
824
|
+
F !== void 0 && h.delete(F) && u("usd_probe_stage_release", ["number"], [F]), D == null || D.dispose(), Le(i.FS, S);
|
|
769
825
|
};
|
|
770
826
|
try {
|
|
771
|
-
const
|
|
772
|
-
de(i,
|
|
773
|
-
for (const [
|
|
774
|
-
const v = J(new URL(
|
|
775
|
-
|
|
827
|
+
const O = await Ae(y);
|
|
828
|
+
de(i, E, O, N), G.set(E, P(O));
|
|
829
|
+
for (const [w, R] of Object.entries(d.files ?? {})) {
|
|
830
|
+
const v = J(new URL(w, m).href, S), B = await Ae(R);
|
|
831
|
+
N.has(v) || G.set(v, P(B)), de(i, v, B, N);
|
|
776
832
|
}
|
|
777
|
-
const
|
|
778
|
-
for (const
|
|
779
|
-
|
|
780
|
-
const
|
|
781
|
-
let
|
|
782
|
-
if (!
|
|
783
|
-
const
|
|
784
|
-
|
|
833
|
+
const z = new Set(N);
|
|
834
|
+
for (const w of d.packagePaths ?? [])
|
|
835
|
+
z.add(J(new URL(w, m).href, S));
|
|
836
|
+
const L = d.externalReferenceMode ?? "complete", C = ut(O) ? await lt(O, { include: Me }) : null;
|
|
837
|
+
let H = {};
|
|
838
|
+
if (!C && d.autoResolveAssets !== !1) {
|
|
839
|
+
const w = d.resolveBytes ?? ((R) => o(R));
|
|
840
|
+
H = await Zt(
|
|
785
841
|
i,
|
|
786
842
|
m,
|
|
787
843
|
S,
|
|
788
|
-
|
|
844
|
+
w,
|
|
789
845
|
u,
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
846
|
+
N,
|
|
847
|
+
U,
|
|
848
|
+
b ? T : null,
|
|
849
|
+
G,
|
|
794
850
|
d.maxFiles ?? 1024,
|
|
795
851
|
d.maxDepth ?? 8,
|
|
796
852
|
d.maxConcurrency ?? 1,
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
853
|
+
L,
|
|
854
|
+
z,
|
|
855
|
+
V,
|
|
800
856
|
d.onReferenceSkipped,
|
|
801
857
|
d.onResourceFailed
|
|
802
858
|
);
|
|
803
859
|
}
|
|
804
|
-
|
|
805
|
-
const
|
|
806
|
-
var
|
|
807
|
-
return ((
|
|
808
|
-
} : void 0,
|
|
809
|
-
if (
|
|
860
|
+
D = C ? dt(C) : null;
|
|
861
|
+
const q = d.textureResolver || D ? (w) => {
|
|
862
|
+
var R;
|
|
863
|
+
return ((R = d.textureResolver) == null ? void 0 : R.call(d, w)) ?? (D == null ? void 0 : D.resolve(w)) ?? null;
|
|
864
|
+
} : void 0, M = Object.keys(H).length > 0;
|
|
865
|
+
if (M && typeof i._usd_probe_stage_open_mapped != "function")
|
|
810
866
|
throw Object.assign(new Error("USD dependency mapping requires the matching packaged openusd_probe.js and .wasm runtime."), { code: "E_USD_RUNTIME_VERSION" });
|
|
811
|
-
const
|
|
812
|
-
if (!
|
|
813
|
-
|
|
867
|
+
const x = M ? u("usd_probe_stage_open_mapped", ["string", "string"], [E, JSON.stringify(H)]) : u("usd_probe_stage_open", ["string"], [E]);
|
|
868
|
+
if (!x.ok) throw new Error(x.error ?? `Failed to open ${E}`);
|
|
869
|
+
F = x.stageId, h.add(x.stageId);
|
|
814
870
|
const $ = d.variantSelections ?? [];
|
|
815
871
|
let ne = [], W = $;
|
|
816
872
|
if (d.selectMuJoCoPhysicsVariant !== !1) {
|
|
@@ -819,68 +875,68 @@ async function Ct(e) {
|
|
|
819
875
|
new Error("USD variant discovery requires the matching packaged openusd_probe runtime."),
|
|
820
876
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
821
877
|
);
|
|
822
|
-
const
|
|
823
|
-
if (
|
|
824
|
-
throw new Error(String(
|
|
825
|
-
ne =
|
|
878
|
+
const w = u("usd_probe_stage_variants", ["number"], [x.stageId]);
|
|
879
|
+
if (w.ok !== !0)
|
|
880
|
+
throw new Error(String(w.error ?? "Failed to enumerate USD variants."));
|
|
881
|
+
ne = w.variants ?? [], W = [
|
|
826
882
|
...$,
|
|
827
|
-
...
|
|
883
|
+
...Nt(ne, $)
|
|
828
884
|
];
|
|
829
885
|
}
|
|
830
|
-
for (const
|
|
831
|
-
const
|
|
886
|
+
for (const w of W) {
|
|
887
|
+
const R = u(
|
|
832
888
|
"usd_probe_stage_set_variant",
|
|
833
889
|
["number", "string", "string", "string"],
|
|
834
|
-
[
|
|
890
|
+
[x.stageId, w.primPath, w.setName, w.selection]
|
|
835
891
|
);
|
|
836
|
-
if (
|
|
837
|
-
throw new Error(String(
|
|
892
|
+
if (R.ok !== !0)
|
|
893
|
+
throw new Error(String(R.error ?? `Failed to select USD variant ${w.primPath}:${w.setName}=${w.selection}`));
|
|
838
894
|
}
|
|
839
|
-
const re =
|
|
895
|
+
const re = Re(i, U, E), se = re.openStage(x.stageId);
|
|
840
896
|
if (d.selectMuJoCoPhysicsVariant !== !1) {
|
|
841
|
-
const
|
|
897
|
+
const w = new Set($.map(ue)), R = /* @__PURE__ */ new Set();
|
|
842
898
|
for (const v of W) {
|
|
843
|
-
const
|
|
844
|
-
if (
|
|
845
|
-
const
|
|
846
|
-
if (!(
|
|
847
|
-
const
|
|
899
|
+
const B = ue(v);
|
|
900
|
+
if (w.has(B)) continue;
|
|
901
|
+
const j = ne.find((me) => me.primPath === v.primPath && me.setName === v.setName);
|
|
902
|
+
if (!(j != null && j.selection) || j.selection === v.selection || se.GetDescendants(v.primPath, "MjcActuator").length === 0) continue;
|
|
903
|
+
const ge = u(
|
|
848
904
|
"usd_probe_stage_set_variant",
|
|
849
905
|
["number", "string", "string", "string"],
|
|
850
|
-
[
|
|
906
|
+
[x.stageId, v.primPath, v.setName, j.selection]
|
|
851
907
|
);
|
|
852
|
-
if (
|
|
853
|
-
throw new Error(String(
|
|
854
|
-
|
|
908
|
+
if (ge.ok !== !0)
|
|
909
|
+
throw new Error(String(ge.error ?? `Failed to restore authored USD variant ${v.primPath}:${v.setName}=${j.selection}`));
|
|
910
|
+
R.add(B);
|
|
855
911
|
}
|
|
856
|
-
|
|
912
|
+
R.size > 0 && (W = W.filter((v) => !R.has(ue(v))));
|
|
857
913
|
}
|
|
858
|
-
const fe = await
|
|
914
|
+
const fe = await Xt(i, x.stageId, E, {
|
|
859
915
|
batchSize: d.geometryBatchSize,
|
|
860
916
|
onProgress: d.onGeometryProgress
|
|
861
917
|
});
|
|
862
|
-
|
|
863
|
-
const
|
|
864
|
-
`${
|
|
865
|
-
|
|
866
|
-
])),
|
|
867
|
-
...
|
|
868
|
-
selection:
|
|
869
|
-
})), ae =
|
|
870
|
-
const
|
|
871
|
-
return
|
|
872
|
-
} : void 0);
|
|
918
|
+
$e(fe.materials, U);
|
|
919
|
+
const Ce = new Map(W.map((w) => [
|
|
920
|
+
`${w.primPath}\0${w.setName}`,
|
|
921
|
+
w.selection
|
|
922
|
+
])), je = ne.map((w) => ({
|
|
923
|
+
...w,
|
|
924
|
+
selection: Ce.get(`${w.primPath}\0${w.setName}`) ?? w.selection
|
|
925
|
+
})), ae = $t(fe, je), he = d.isTextureAllowed ?? (L === "package" ? (w) => {
|
|
926
|
+
const R = new URL(w, m);
|
|
927
|
+
return z.has(J(R.href, S)) || Ne(R, m);
|
|
928
|
+
} : void 0), pe = C ? void 0 : he ? (w) => T.has(w) || he(w) : T.size > 0 ? (w) => T.has(w) : void 0;
|
|
873
929
|
return {
|
|
874
930
|
data: ae,
|
|
875
931
|
pxr: re,
|
|
876
932
|
stage: se,
|
|
877
|
-
entryPath:
|
|
878
|
-
textureURLs:
|
|
933
|
+
entryPath: E,
|
|
934
|
+
textureURLs: T,
|
|
879
935
|
buildModel: async () => {
|
|
880
|
-
const { createUSDLoadedModel:
|
|
936
|
+
const { createUSDLoadedModel: w } = await import("@openusd-wasm/three-loader"), R = () => w(
|
|
881
937
|
ae,
|
|
882
938
|
re,
|
|
883
|
-
|
|
939
|
+
E,
|
|
884
940
|
{
|
|
885
941
|
sourcePath: d.sourcePath,
|
|
886
942
|
// The Viewer normalises USD to world Z-up and draws its own studio
|
|
@@ -891,59 +947,59 @@ async function Ct(e) {
|
|
|
891
947
|
loadTextures: d.loadTextures ?? !0,
|
|
892
948
|
...d.textureLoader ? { textureLoader: d.textureLoader } : {},
|
|
893
949
|
...d.textureCache ? { textureCache: d.textureCache } : {},
|
|
894
|
-
...
|
|
950
|
+
...q ? { textureResolver: q } : {}
|
|
895
951
|
},
|
|
896
952
|
se,
|
|
897
953
|
{
|
|
898
954
|
// Keep package texture identities on the model so the visual adapter
|
|
899
955
|
// can resolve textures referenced by unsupported-but-known MDL nodes.
|
|
900
|
-
usdzTextureURLs: (
|
|
956
|
+
usdzTextureURLs: (D == null ? void 0 : D.urls) ?? /* @__PURE__ */ new Map(),
|
|
901
957
|
autoTextureURLs: /* @__PURE__ */ new Map()
|
|
902
958
|
}
|
|
903
|
-
), v =
|
|
904
|
-
v.usdQuery =
|
|
905
|
-
const
|
|
906
|
-
let
|
|
959
|
+
), v = pe ? Ve(ae.materials, pe, R) : R();
|
|
960
|
+
v.usdQuery = ke(se, re);
|
|
961
|
+
const B = v.dispose.bind(v);
|
|
962
|
+
let j = !1;
|
|
907
963
|
return v.dispose = () => {
|
|
908
|
-
|
|
964
|
+
j || (j = !0, B(), A());
|
|
909
965
|
}, v;
|
|
910
966
|
},
|
|
911
967
|
readPhysics() {
|
|
912
|
-
return
|
|
968
|
+
return I || (I = (async () => {
|
|
913
969
|
if (typeof i._usd_probe_scene_physics != "function")
|
|
914
970
|
throw Object.assign(
|
|
915
971
|
new Error("USD physics phase requires the matching packaged openusd_probe runtime."),
|
|
916
972
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
917
973
|
);
|
|
918
|
-
const
|
|
919
|
-
if (
|
|
920
|
-
return
|
|
921
|
-
})(),
|
|
974
|
+
const w = u("usd_probe_scene_physics", ["number"], [x.stageId]);
|
|
975
|
+
if (w.ok !== !0) throw new Error(String(w.error ?? "Failed to extract USD physics."));
|
|
976
|
+
return w;
|
|
977
|
+
})(), I);
|
|
922
978
|
},
|
|
923
|
-
release:
|
|
979
|
+
release: A
|
|
924
980
|
};
|
|
925
|
-
} catch (
|
|
926
|
-
throw
|
|
981
|
+
} catch (O) {
|
|
982
|
+
throw A(), O;
|
|
927
983
|
}
|
|
928
984
|
}
|
|
929
985
|
return {
|
|
930
986
|
runtime: i,
|
|
931
987
|
pxr: g,
|
|
932
988
|
warmup: p,
|
|
933
|
-
async parseAsync(
|
|
934
|
-
const m = await y
|
|
989
|
+
async parseAsync(y, d) {
|
|
990
|
+
const m = await _(y, d);
|
|
935
991
|
try {
|
|
936
|
-
return
|
|
992
|
+
return Lt(m.data, await m.readPhysics()), await m.buildModel();
|
|
937
993
|
} catch (S) {
|
|
938
994
|
throw m.release(), S;
|
|
939
995
|
}
|
|
940
996
|
},
|
|
941
|
-
async parseVisualSceneAsync(
|
|
942
|
-
return await y
|
|
997
|
+
async parseVisualSceneAsync(y, d) {
|
|
998
|
+
return await _(y, d);
|
|
943
999
|
}
|
|
944
1000
|
};
|
|
945
1001
|
}
|
|
946
|
-
function
|
|
1002
|
+
function Re(e, t = /* @__PURE__ */ new Map(), n) {
|
|
947
1003
|
const a = (l, f, p) => JSON.parse(e.ccall(l, "string", f, p));
|
|
948
1004
|
class i {
|
|
949
1005
|
constructor(f) {
|
|
@@ -955,40 +1011,40 @@ function ve(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
955
1011
|
delete() {
|
|
956
1012
|
}
|
|
957
1013
|
}
|
|
958
|
-
let
|
|
959
|
-
const
|
|
960
|
-
if (!
|
|
1014
|
+
let s;
|
|
1015
|
+
const r = /* @__PURE__ */ new Map(), c = (l, f) => {
|
|
1016
|
+
if (!s) {
|
|
961
1017
|
const S = e._usd_probe_flatten_stage;
|
|
962
1018
|
if (n && typeof S == "function") {
|
|
963
|
-
const
|
|
964
|
-
if (typeof
|
|
965
|
-
|
|
1019
|
+
const E = e.ccall("usd_probe_flatten_stage", "string", ["string"], [n]);
|
|
1020
|
+
if (typeof E != "string" || !E.startsWith("#usda")) throw new Error("Unable to read flattened USD joint metadata");
|
|
1021
|
+
s = Mt(E);
|
|
966
1022
|
} else
|
|
967
|
-
|
|
1023
|
+
s = /* @__PURE__ */ new Map();
|
|
968
1024
|
}
|
|
969
|
-
const p =
|
|
970
|
-
if (p ||
|
|
971
|
-
const
|
|
972
|
-
for (const S of
|
|
973
|
-
const
|
|
974
|
-
|
|
1025
|
+
const p = s.get(f);
|
|
1026
|
+
if (p || r.has(f)) return p ?? r.get(f);
|
|
1027
|
+
const _ = ["rotX", "rotY", "rotZ", "transX", "transY", "transZ", "X", "Y", "Z"], y = [], d = /* @__PURE__ */ new Map();
|
|
1028
|
+
for (const S of _) {
|
|
1029
|
+
const E = `physxMimicJoint:${S}:referenceJoint`, N = a("usd_probe_relationship_targets", ["number", "string", "string"], [l, f, E]).paths ?? [];
|
|
1030
|
+
N.length && (y.push(`PhysxMimicJointAPI:${S}`), d.set(E, N));
|
|
975
1031
|
}
|
|
976
|
-
const m =
|
|
977
|
-
return m &&
|
|
1032
|
+
const m = y.length ? { schemas: y, relationships: d } : void 0;
|
|
1033
|
+
return m && r.set(f, m), m;
|
|
978
1034
|
}, o = (l, f, p) => {
|
|
979
|
-
let
|
|
980
|
-
const
|
|
1035
|
+
let _ = null;
|
|
1036
|
+
const y = () => _ ?? (_ = a(
|
|
981
1037
|
"usd_probe_attribute_value",
|
|
982
1038
|
["number", "string", "string"],
|
|
983
1039
|
[l, f, p]
|
|
984
1040
|
));
|
|
985
1041
|
return {
|
|
986
|
-
IsValid: () =>
|
|
1042
|
+
IsValid: () => y().valid === !0,
|
|
987
1043
|
Get: () => {
|
|
988
|
-
const d =
|
|
1044
|
+
const d = y();
|
|
989
1045
|
return d.valid === !0 ? typeof d.value == "string" ? t.get(d.value) ?? d.value : d.value : null;
|
|
990
1046
|
},
|
|
991
|
-
HasAuthoredValue: () =>
|
|
1047
|
+
HasAuthoredValue: () => y().authored === !0,
|
|
992
1048
|
GetName: () => p,
|
|
993
1049
|
GetMetadata: (d) => {
|
|
994
1050
|
const m = a("usd_probe_attribute_metadata", ["number", "string", "string", "string"], [l, f, p, d]);
|
|
@@ -1013,9 +1069,9 @@ function ve(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
1013
1069
|
},
|
|
1014
1070
|
GetRelationships: () => {
|
|
1015
1071
|
var p;
|
|
1016
|
-
return [...((p = c(l, f)) == null ? void 0 : p.relationships) ?? []].map(([
|
|
1017
|
-
GetName: () =>
|
|
1018
|
-
GetTargets: () =>
|
|
1072
|
+
return [...((p = c(l, f)) == null ? void 0 : p.relationships) ?? []].map(([_, y]) => ({
|
|
1073
|
+
GetName: () => _,
|
|
1074
|
+
GetTargets: () => y.map((d) => new i(d)),
|
|
1019
1075
|
delete: () => {
|
|
1020
1076
|
}
|
|
1021
1077
|
}));
|
|
@@ -1024,21 +1080,21 @@ function ve(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
1024
1080
|
GetAttributes: () => (a("usd_probe_prim_attributes", ["number", "string"], [l, f]).names ?? []).map((p) => o(l, f, p)),
|
|
1025
1081
|
GetChildren: () => (a("usd_probe_prim_children", ["number", "string"], [l, f]).paths ?? []).map((p) => u(l, p)),
|
|
1026
1082
|
GetRelationship: (p) => {
|
|
1027
|
-
const
|
|
1083
|
+
const _ = a(
|
|
1028
1084
|
"usd_probe_relationship_targets",
|
|
1029
1085
|
["number", "string", "string"],
|
|
1030
1086
|
[l, f, p]
|
|
1031
1087
|
).paths ?? [];
|
|
1032
1088
|
return {
|
|
1033
1089
|
GetName: () => p,
|
|
1034
|
-
GetTargets: () =>
|
|
1090
|
+
GetTargets: () => _.map((y) => new i(y)),
|
|
1035
1091
|
delete: () => {
|
|
1036
1092
|
}
|
|
1037
1093
|
};
|
|
1038
1094
|
},
|
|
1039
1095
|
GetMetadata: (p) => {
|
|
1040
|
-
const
|
|
1041
|
-
return
|
|
1096
|
+
const _ = a("usd_probe_prim_metadata", ["number", "string", "string"], [l, f, p]);
|
|
1097
|
+
return _.valid !== !0 ? null : typeof _.text == "string" ? _.text : _.found === !0 ? _.value : null;
|
|
1042
1098
|
},
|
|
1043
1099
|
delete: () => {
|
|
1044
1100
|
}
|
|
@@ -1093,7 +1149,7 @@ function ve(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
1093
1149
|
openStage: h
|
|
1094
1150
|
};
|
|
1095
1151
|
}
|
|
1096
|
-
async function
|
|
1152
|
+
async function Xt(e, t, n, a = {}) {
|
|
1097
1153
|
var c;
|
|
1098
1154
|
if (typeof e._usd_probe_scene_visual != "function" || typeof e._usd_probe_scene_geometry != "function" || typeof e._usd_probe_scene_geometry_end != "function")
|
|
1099
1155
|
throw Object.assign(
|
|
@@ -1107,9 +1163,9 @@ async function jt(e, t, n, a = {}) {
|
|
|
1107
1163
|
[t, n]
|
|
1108
1164
|
));
|
|
1109
1165
|
if (i.error) throw new Error(i.error);
|
|
1110
|
-
const
|
|
1166
|
+
const s = i, r = Math.max(1, Math.floor(a.batchSize ?? 8));
|
|
1111
1167
|
try {
|
|
1112
|
-
for (const [o, u] of
|
|
1168
|
+
for (const [o, u] of s.elements.entries()) {
|
|
1113
1169
|
const g = u.geometry.streamIndex;
|
|
1114
1170
|
if (!Number.isInteger(g))
|
|
1115
1171
|
throw new Error(`USD scene geometry is missing a stream index for ${u.path}`);
|
|
@@ -1121,117 +1177,117 @@ async function jt(e, t, n, a = {}) {
|
|
|
1121
1177
|
));
|
|
1122
1178
|
if (!l.ok) throw new Error(l.error ?? `Failed to stream USD geometry for ${u.path}`);
|
|
1123
1179
|
u.geometry = Object.fromEntries(
|
|
1124
|
-
Object.entries(l.geometry ?? {}).map(([f, p]) => [f,
|
|
1125
|
-
), (c = a.onProgress) == null || c.call(a, o + 1,
|
|
1180
|
+
Object.entries(l.geometry ?? {}).map(([f, p]) => [f, qt(e, p)])
|
|
1181
|
+
), (c = a.onProgress) == null || c.call(a, o + 1, s.elements.length, u.path), (o + 1) % r === 0 && await Jt();
|
|
1126
1182
|
}
|
|
1127
1183
|
} finally {
|
|
1128
1184
|
e.ccall("usd_probe_scene_geometry_end", "string", ["number"], [t]);
|
|
1129
1185
|
}
|
|
1130
|
-
return
|
|
1186
|
+
return s;
|
|
1131
1187
|
}
|
|
1132
|
-
function
|
|
1188
|
+
function Jt() {
|
|
1133
1189
|
return new Promise((e) => setTimeout(e, 0));
|
|
1134
1190
|
}
|
|
1135
|
-
function
|
|
1191
|
+
function qt(e, t) {
|
|
1136
1192
|
if (!t || typeof t != "object") return t ?? null;
|
|
1137
1193
|
const { ptr: n, length: a, kind: i } = t;
|
|
1138
1194
|
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();
|
|
1139
1195
|
}
|
|
1140
|
-
async function
|
|
1196
|
+
async function Zt(e, t, n, a, i, s, r, c, o, u, h, g, l, f, p, _, y) {
|
|
1141
1197
|
const d = {}, m = [...f];
|
|
1142
1198
|
let S = [
|
|
1143
1199
|
{ url: t, depth: 0, recurse: !0, absolute: !1 }
|
|
1144
1200
|
];
|
|
1145
|
-
const
|
|
1201
|
+
const E = /* @__PURE__ */ new Set(), N = /* @__PURE__ */ new Set();
|
|
1146
1202
|
for (; S.length; ) {
|
|
1147
|
-
const
|
|
1203
|
+
const G = S;
|
|
1148
1204
|
S = [];
|
|
1149
|
-
const
|
|
1150
|
-
for (const
|
|
1151
|
-
const
|
|
1152
|
-
if (!
|
|
1153
|
-
if (
|
|
1154
|
-
if (
|
|
1155
|
-
|
|
1205
|
+
const T = [];
|
|
1206
|
+
for (const b of G) {
|
|
1207
|
+
const P = b.absolute ? b.url.href : Pe(b.url.href, t);
|
|
1208
|
+
if (!E.has(P)) {
|
|
1209
|
+
if (b.depth > h) throw new Error(`USD dependency depth limit exceeded (${h}): ${P}`);
|
|
1210
|
+
if (E.size >= u) throw new Error(`USD dependency limit exceeded (${u}).`);
|
|
1211
|
+
E.add(P), T.push({ item: b, identifier: P });
|
|
1156
1212
|
}
|
|
1157
1213
|
}
|
|
1158
|
-
S = (await
|
|
1159
|
-
|
|
1214
|
+
S = (await Yt(
|
|
1215
|
+
T,
|
|
1160
1216
|
Math.max(1, g),
|
|
1161
|
-
async ({ item:
|
|
1162
|
-
const
|
|
1163
|
-
if (!
|
|
1164
|
-
let
|
|
1217
|
+
async ({ item: b, identifier: P }) => {
|
|
1218
|
+
const U = J(b.url.href, n);
|
|
1219
|
+
if (!s.has(U) || b.absolute && !f.has(U)) {
|
|
1220
|
+
let I;
|
|
1165
1221
|
try {
|
|
1166
|
-
|
|
1167
|
-
} catch (
|
|
1168
|
-
if (!
|
|
1169
|
-
const
|
|
1170
|
-
return d[
|
|
1222
|
+
I = await a(b.url, P);
|
|
1223
|
+
} catch (A) {
|
|
1224
|
+
if (!b.owner || !qe(P) || !Ke(A)) throw A;
|
|
1225
|
+
const O = `${n}/__unavailable__/${encodeURIComponent(P)}`;
|
|
1226
|
+
return d[b.owner.path][b.owner.reference] = O, r.set(O, P), y == null || y(P, A), [];
|
|
1171
1227
|
}
|
|
1172
|
-
o.set(
|
|
1228
|
+
o.set(U, Te(I)), de(e, U, I, s);
|
|
1173
1229
|
}
|
|
1174
|
-
if (
|
|
1175
|
-
if (d[
|
|
1176
|
-
const
|
|
1177
|
-
for (const
|
|
1178
|
-
if (!
|
|
1179
|
-
let
|
|
1230
|
+
if (r.set(U, P), !b.recurse) return [];
|
|
1231
|
+
if (d[U] ?? (d[U] = {}), o.get(U) === !1) return [];
|
|
1232
|
+
const F = i("usd_probe_external_references", ["string"], [U]).paths ?? [], D = [];
|
|
1233
|
+
for (const I of F) {
|
|
1234
|
+
if (!I || /^(?:data|blob):/i.test(I) || /\.mdl(?:[?#].*)?$/i.test(I)) continue;
|
|
1235
|
+
let A;
|
|
1180
1236
|
try {
|
|
1181
|
-
|
|
1237
|
+
A = new URL(I, b.url);
|
|
1182
1238
|
} catch {
|
|
1183
1239
|
continue;
|
|
1184
1240
|
}
|
|
1185
|
-
const
|
|
1186
|
-
if (
|
|
1187
|
-
const $ = `${n}/__deferred_udim__/${encodeURIComponent(
|
|
1188
|
-
d[
|
|
1241
|
+
const O = /^(?:[a-z][a-z\d+.-]*:|\/)/i.test(I), z = J(A.href, n), L = nt(z, m), C = (L == null ? void 0 : L.paths.length) === 1 ? L.paths[0] : null, H = C ?? z, q = b.absolute || O, M = q ? A.href : Pe(A.href, t), x = Kt(A.pathname);
|
|
1242
|
+
if (C && r.set(C, M), l === "package" && L && L.paths.length > 1) {
|
|
1243
|
+
const $ = `${n}/__deferred_udim__/${encodeURIComponent(M)}`;
|
|
1244
|
+
d[U][I] = $, r.set($, M);
|
|
1189
1245
|
continue;
|
|
1190
1246
|
}
|
|
1191
|
-
if (l === "package" && !f.has(
|
|
1192
|
-
const $ = `${n}/__skipped__/${encodeURIComponent(
|
|
1193
|
-
d[
|
|
1247
|
+
if (l === "package" && !f.has(H) && !Ne(A, t)) {
|
|
1248
|
+
const $ = `${n}/__skipped__/${encodeURIComponent(M)}`;
|
|
1249
|
+
d[U][I] = $, r.set($, M), N.has(M) || (N.add(M), _ == null || _(M));
|
|
1194
1250
|
continue;
|
|
1195
1251
|
}
|
|
1196
|
-
if (!
|
|
1197
|
-
|
|
1252
|
+
if (!x && c && (c.set(M, A.href), c.set(I, A.href)), !x && !p) {
|
|
1253
|
+
d[U][I] = M;
|
|
1198
1254
|
continue;
|
|
1199
1255
|
}
|
|
1200
|
-
!
|
|
1201
|
-
url:
|
|
1202
|
-
depth:
|
|
1203
|
-
recurse:
|
|
1204
|
-
absolute:
|
|
1205
|
-
owner: { path:
|
|
1256
|
+
d[U][I] = H, !C && !E.has(M) && D.push({
|
|
1257
|
+
url: A,
|
|
1258
|
+
depth: b.depth + 1,
|
|
1259
|
+
recurse: x,
|
|
1260
|
+
absolute: q,
|
|
1261
|
+
owner: { path: U, reference: I }
|
|
1206
1262
|
});
|
|
1207
1263
|
}
|
|
1208
|
-
return
|
|
1264
|
+
return D;
|
|
1209
1265
|
}
|
|
1210
1266
|
)).flat();
|
|
1211
1267
|
}
|
|
1212
1268
|
return d;
|
|
1213
1269
|
}
|
|
1214
|
-
async function
|
|
1270
|
+
async function Yt(e, t, n) {
|
|
1215
1271
|
const a = new Array(e.length);
|
|
1216
1272
|
let i = 0;
|
|
1217
|
-
const
|
|
1273
|
+
const s = Array.from({ length: Math.min(t, e.length) }, async () => {
|
|
1218
1274
|
for (; i < e.length; ) {
|
|
1219
|
-
const
|
|
1220
|
-
a[
|
|
1275
|
+
const r = i++;
|
|
1276
|
+
a[r] = await n(e[r]);
|
|
1221
1277
|
}
|
|
1222
1278
|
});
|
|
1223
|
-
return await Promise.all(
|
|
1279
|
+
return await Promise.all(s), a;
|
|
1224
1280
|
}
|
|
1225
|
-
function
|
|
1281
|
+
function Kt(e) {
|
|
1226
1282
|
var n, a;
|
|
1227
1283
|
const t = (a = (n = e.split(/[?#]/, 1)[0]) == null ? void 0 : n.split(".").pop()) == null ? void 0 : a.toLowerCase();
|
|
1228
|
-
return t != null &&
|
|
1284
|
+
return t != null && Ht.has(t);
|
|
1229
1285
|
}
|
|
1230
|
-
function
|
|
1231
|
-
return
|
|
1286
|
+
function Te(e) {
|
|
1287
|
+
return Oe(e) ? e.includes(64) : !0;
|
|
1232
1288
|
}
|
|
1233
|
-
function
|
|
1234
|
-
return
|
|
1289
|
+
function Qt(e) {
|
|
1290
|
+
return Oe(e) ? en(e, [
|
|
1235
1291
|
"subLayers",
|
|
1236
1292
|
"references",
|
|
1237
1293
|
"payload",
|
|
@@ -1239,26 +1295,26 @@ function Ht(e) {
|
|
|
1239
1295
|
"clipAssetPaths"
|
|
1240
1296
|
]) : !0;
|
|
1241
1297
|
}
|
|
1242
|
-
function
|
|
1298
|
+
function Oe(e) {
|
|
1243
1299
|
let t = e[0] === 239 && e[1] === 187 && e[2] === 191 ? 3 : 0;
|
|
1244
1300
|
for (; t < e.length && t < 64 && /\s/.test(String.fromCharCode(e[t])); ) t += 1;
|
|
1245
1301
|
return e[t] === 35 && e[t + 1] === 117 && e[t + 2] === 115 && e[t + 3] === 100 && e[t + 4] === 97;
|
|
1246
1302
|
}
|
|
1247
|
-
function
|
|
1303
|
+
function en(e, t) {
|
|
1248
1304
|
const n = /* @__PURE__ */ new Map();
|
|
1249
1305
|
let a = 1;
|
|
1250
|
-
for (const
|
|
1251
|
-
const
|
|
1252
|
-
n.set(
|
|
1306
|
+
for (const s of t) {
|
|
1307
|
+
const r = s.charCodeAt(0);
|
|
1308
|
+
n.set(r, [...n.get(r) ?? [], s]), a = Math.max(a, s.length);
|
|
1253
1309
|
}
|
|
1254
1310
|
const i = e.length - a;
|
|
1255
|
-
for (let
|
|
1256
|
-
const
|
|
1257
|
-
if (
|
|
1258
|
-
for (const c of
|
|
1311
|
+
for (let s = 0; s <= i; ++s) {
|
|
1312
|
+
const r = n.get(e[s]);
|
|
1313
|
+
if (r)
|
|
1314
|
+
for (const c of r) {
|
|
1259
1315
|
let o = !0;
|
|
1260
1316
|
for (let u = 1; u < c.length; ++u)
|
|
1261
|
-
if (e[
|
|
1317
|
+
if (e[s + u] !== c.charCodeAt(u)) {
|
|
1262
1318
|
o = !1;
|
|
1263
1319
|
break;
|
|
1264
1320
|
}
|
|
@@ -1271,21 +1327,21 @@ function Pe(e, t) {
|
|
|
1271
1327
|
const n = new URL(e);
|
|
1272
1328
|
if (n.protocol !== t.protocol || n.host !== t.host) return n.href;
|
|
1273
1329
|
const a = new URL(".", t).pathname.split("/").filter(Boolean), i = n.pathname.split("/").filter(Boolean);
|
|
1274
|
-
let
|
|
1275
|
-
for (;
|
|
1276
|
-
const
|
|
1277
|
-
return decodeURIComponent(
|
|
1330
|
+
let s = 0;
|
|
1331
|
+
for (; s < a.length && a[s] === i[s]; ) s++;
|
|
1332
|
+
const r = [...a.slice(s).map(() => ".."), ...i.slice(s)].join("/");
|
|
1333
|
+
return decodeURIComponent(r) + n.search + n.hash;
|
|
1278
1334
|
}
|
|
1279
1335
|
function J(e, t) {
|
|
1280
1336
|
const n = new URL(e), a = encodeURIComponent(`${n.protocol}//${n.host}`);
|
|
1281
|
-
let i = n.pathname.split("/").map((
|
|
1337
|
+
let i = n.pathname.split("/").map((s) => decodeURIComponent(s).replaceAll("/", "%2F").replaceAll("\\", "%5C")).join("/");
|
|
1282
1338
|
if (n.search || n.hash) {
|
|
1283
|
-
const
|
|
1284
|
-
i = `${i.slice(0,
|
|
1339
|
+
const s = i.lastIndexOf("."), r = s > i.lastIndexOf("/") ? s : i.length;
|
|
1340
|
+
i = `${i.slice(0, r)}.__url_${encodeURIComponent(n.search + n.hash)}${i.slice(r)}`;
|
|
1285
1341
|
}
|
|
1286
1342
|
return `${t}/${a}${i}`;
|
|
1287
1343
|
}
|
|
1288
|
-
function
|
|
1344
|
+
function $e(e, t) {
|
|
1289
1345
|
if (!e || typeof e != "object" || ArrayBuffer.isView(e)) return;
|
|
1290
1346
|
const n = e;
|
|
1291
1347
|
if (typeof n.path == "string" && typeof n.resolvedPath == "string") {
|
|
@@ -1295,14 +1351,14 @@ function Te(e, t) {
|
|
|
1295
1351
|
}
|
|
1296
1352
|
return;
|
|
1297
1353
|
}
|
|
1298
|
-
for (const a of Object.values(e))
|
|
1354
|
+
for (const a of Object.values(e)) $e(a, t);
|
|
1299
1355
|
}
|
|
1300
|
-
function
|
|
1356
|
+
function Le(e, t) {
|
|
1301
1357
|
if (e.analyzePath(t).exists) {
|
|
1302
1358
|
for (const n of e.readdir(t)) {
|
|
1303
1359
|
if (n === "." || n === "..") continue;
|
|
1304
1360
|
const a = `${t}/${n}`;
|
|
1305
|
-
e.isDir(e.stat(a).mode) ?
|
|
1361
|
+
e.isDir(e.stat(a).mode) ? Le(e, a) : e.unlink(a);
|
|
1306
1362
|
}
|
|
1307
1363
|
e.rmdir(t);
|
|
1308
1364
|
}
|
|
@@ -1313,55 +1369,55 @@ function de(e, t, n, a) {
|
|
|
1313
1369
|
function ue(e) {
|
|
1314
1370
|
return `${e.primPath}\0${e.setName}`;
|
|
1315
1371
|
}
|
|
1316
|
-
async function
|
|
1372
|
+
async function Ae(e) {
|
|
1317
1373
|
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());
|
|
1318
1374
|
}
|
|
1319
|
-
async function
|
|
1375
|
+
async function tn(e) {
|
|
1320
1376
|
if (!e) throw new Error("createSingleThreadUsd needs wasmUrl or wasmBinary.");
|
|
1321
1377
|
return (await fetch(e)).arrayBuffer();
|
|
1322
1378
|
}
|
|
1323
|
-
function
|
|
1379
|
+
function nn(e) {
|
|
1324
1380
|
if (e.length < 30) return null;
|
|
1325
1381
|
const t = new DataView(e.buffer, e.byteOffset, e.byteLength), n = (a, i) => {
|
|
1326
|
-
for (let
|
|
1327
|
-
if (e[a +
|
|
1382
|
+
for (let s = 0; s < i.length; s += 1)
|
|
1383
|
+
if (e[a + s] !== i.charCodeAt(s)) return !1;
|
|
1328
1384
|
return !0;
|
|
1329
1385
|
};
|
|
1330
1386
|
if (e[0] === 137 && n(1, "PNG") && n(12, "IHDR"))
|
|
1331
|
-
return
|
|
1387
|
+
return Z(t.getUint32(16), t.getUint32(20));
|
|
1332
1388
|
if (e[0] === 255 && e[1] === 216) {
|
|
1333
1389
|
let a = 2;
|
|
1334
1390
|
for (; a + 9 < e.length; ) {
|
|
1335
1391
|
if (e[a] !== 255) return null;
|
|
1336
|
-
const i = e[a + 1],
|
|
1392
|
+
const i = e[a + 1], s = e[a + 2] << 8 | e[a + 3];
|
|
1337
1393
|
if (i >= 192 && i <= 207 && i !== 196 && i !== 200 && i !== 204)
|
|
1338
|
-
return
|
|
1394
|
+
return Z(
|
|
1339
1395
|
e[a + 7] << 8 | e[a + 8],
|
|
1340
1396
|
e[a + 5] << 8 | e[a + 6]
|
|
1341
1397
|
);
|
|
1342
|
-
if (
|
|
1343
|
-
a += 2 +
|
|
1398
|
+
if (s < 2) return null;
|
|
1399
|
+
a += 2 + s;
|
|
1344
1400
|
}
|
|
1345
1401
|
return null;
|
|
1346
1402
|
}
|
|
1347
1403
|
if (n(0, "RIFF") && n(8, "WEBP")) {
|
|
1348
1404
|
if (n(12, "VP8 "))
|
|
1349
|
-
return
|
|
1405
|
+
return Z(
|
|
1350
1406
|
t.getUint16(26, !0) & 16383,
|
|
1351
1407
|
t.getUint16(28, !0) & 16383
|
|
1352
1408
|
);
|
|
1353
1409
|
if (n(12, "VP8L")) {
|
|
1354
1410
|
const a = t.getUint32(21, !0);
|
|
1355
|
-
return
|
|
1411
|
+
return Z((a & 16383) + 1, (a >>> 14 & 16383) + 1);
|
|
1356
1412
|
}
|
|
1357
1413
|
if (n(12, "VP8X")) {
|
|
1358
1414
|
const a = (i) => e[i] | e[i + 1] << 8 | e[i + 2] << 16;
|
|
1359
|
-
return
|
|
1415
|
+
return Z(a(24) + 1, a(27) + 1);
|
|
1360
1416
|
}
|
|
1361
1417
|
}
|
|
1362
1418
|
return null;
|
|
1363
1419
|
}
|
|
1364
|
-
function
|
|
1420
|
+
function rn(e, t) {
|
|
1365
1421
|
const n = Math.max(e.width, e.height);
|
|
1366
1422
|
if (t <= 0 || n <= t) return e;
|
|
1367
1423
|
const a = t / n;
|
|
@@ -1370,7 +1426,7 @@ function Zt(e, t) {
|
|
|
1370
1426
|
height: Math.max(1, Math.round(e.height * a))
|
|
1371
1427
|
};
|
|
1372
1428
|
}
|
|
1373
|
-
function
|
|
1429
|
+
function Z(e, t) {
|
|
1374
1430
|
return e > 0 && t > 0 ? { width: e, height: t } : null;
|
|
1375
1431
|
}
|
|
1376
1432
|
function X(e) {
|
|
@@ -1382,47 +1438,47 @@ function X(e) {
|
|
|
1382
1438
|
} : { name: "Error", message: String(e) };
|
|
1383
1439
|
}
|
|
1384
1440
|
const K = globalThis;
|
|
1385
|
-
let ee = null,
|
|
1441
|
+
let ee = null, Y = null, te = null, oe = null, le = !1, sn = 1;
|
|
1386
1442
|
const Q = /* @__PURE__ */ new Map();
|
|
1387
|
-
function
|
|
1443
|
+
function k(e, t) {
|
|
1388
1444
|
K.postMessage(e, t);
|
|
1389
1445
|
}
|
|
1390
|
-
function
|
|
1391
|
-
const n =
|
|
1446
|
+
function on(e, t) {
|
|
1447
|
+
const n = sn++;
|
|
1392
1448
|
return new Promise((a, i) => {
|
|
1393
|
-
Q.set(n, { resolve: a, reject: i }),
|
|
1449
|
+
Q.set(n, { resolve: a, reject: i }), k({ type: "resource-request", id: n, url: e.href, identifier: t });
|
|
1394
1450
|
});
|
|
1395
1451
|
}
|
|
1396
|
-
function
|
|
1397
|
-
return ee ?? (ee =
|
|
1452
|
+
function an(e) {
|
|
1453
|
+
return ee ?? (ee = Wt(e)), ee;
|
|
1398
1454
|
}
|
|
1399
|
-
function
|
|
1455
|
+
function cn(e) {
|
|
1400
1456
|
const t = /* @__PURE__ */ new Set();
|
|
1401
1457
|
for (const n of e.elements)
|
|
1402
1458
|
for (const a of Object.values(n.geometry ?? {}))
|
|
1403
1459
|
ArrayBuffer.isView(a) && t.add(a.buffer);
|
|
1404
1460
|
return [...t];
|
|
1405
1461
|
}
|
|
1406
|
-
async function
|
|
1462
|
+
async function un(e) {
|
|
1407
1463
|
if (!te) throw new Error("USD worker has no live stage");
|
|
1408
1464
|
const t = te[e.method];
|
|
1409
1465
|
return { type: "query-result", id: e.id, value: await t.apply(te, e.args) };
|
|
1410
1466
|
}
|
|
1411
|
-
async function
|
|
1467
|
+
async function ln(e, t) {
|
|
1412
1468
|
if (typeof createImageBitmap != "function")
|
|
1413
1469
|
throw new Error("This browser cannot decode USD textures in a worker.");
|
|
1414
1470
|
const n = await fetch(e);
|
|
1415
1471
|
if (!n.ok) throw new Error(`HTTP ${n.status} for ${e}`);
|
|
1416
|
-
const a = new Uint8Array(await n.arrayBuffer()), i =
|
|
1472
|
+
const a = new Uint8Array(await n.arrayBuffer()), i = nn(a), s = {
|
|
1417
1473
|
imageOrientation: "flipY",
|
|
1418
1474
|
premultiplyAlpha: "none",
|
|
1419
1475
|
colorSpaceConversion: "none"
|
|
1420
1476
|
};
|
|
1421
1477
|
if (i) {
|
|
1422
|
-
const
|
|
1423
|
-
(
|
|
1478
|
+
const r = t > 0 ? rn(i, t) : i;
|
|
1479
|
+
(r.width !== i.width || r.height !== i.height) && (s.resizeWidth = r.width, s.resizeHeight = r.height, s.resizeQuality = "high");
|
|
1424
1480
|
}
|
|
1425
|
-
return createImageBitmap(new Blob([a]),
|
|
1481
|
+
return createImageBitmap(new Blob([a]), s);
|
|
1426
1482
|
}
|
|
1427
1483
|
K.onmessage = async (e) => {
|
|
1428
1484
|
const t = e.data;
|
|
@@ -1437,16 +1493,16 @@ K.onmessage = async (e) => {
|
|
|
1437
1493
|
}
|
|
1438
1494
|
if (t.type === "query") {
|
|
1439
1495
|
try {
|
|
1440
|
-
|
|
1496
|
+
k(await un(t));
|
|
1441
1497
|
} catch (n) {
|
|
1442
|
-
|
|
1498
|
+
k({ type: "error", id: t.id, error: X(n) });
|
|
1443
1499
|
}
|
|
1444
1500
|
return;
|
|
1445
1501
|
}
|
|
1446
1502
|
if (t.type === "decode-texture") {
|
|
1447
1503
|
try {
|
|
1448
|
-
const n = await
|
|
1449
|
-
|
|
1504
|
+
const n = await ln(t.url, t.maxDimension);
|
|
1505
|
+
k({
|
|
1450
1506
|
type: "texture-decoded",
|
|
1451
1507
|
id: t.id,
|
|
1452
1508
|
bitmap: n,
|
|
@@ -1454,31 +1510,31 @@ K.onmessage = async (e) => {
|
|
|
1454
1510
|
height: n.height
|
|
1455
1511
|
}, [n]);
|
|
1456
1512
|
} catch (n) {
|
|
1457
|
-
|
|
1513
|
+
k({ type: "error", id: t.id, error: X(n) });
|
|
1458
1514
|
}
|
|
1459
1515
|
return;
|
|
1460
1516
|
}
|
|
1461
1517
|
if (t.type === "dispose") {
|
|
1462
1518
|
for (const n of Q.values()) n.reject(new Error("USD worker disposed"));
|
|
1463
|
-
Q.clear(),
|
|
1519
|
+
Q.clear(), Y == null || Y(), te = null, oe = null, le = !1, ee = null, Y = null, K.close();
|
|
1464
1520
|
return;
|
|
1465
1521
|
}
|
|
1466
1522
|
if (t.type === "extract-physics") {
|
|
1467
1523
|
if (le || !oe) return;
|
|
1468
1524
|
le = !0;
|
|
1469
1525
|
try {
|
|
1470
|
-
|
|
1526
|
+
k({ type: "physics-ready", phase: await oe() });
|
|
1471
1527
|
} catch (n) {
|
|
1472
|
-
|
|
1528
|
+
k({ type: "physics-failed", error: X(n) });
|
|
1473
1529
|
}
|
|
1474
1530
|
return;
|
|
1475
1531
|
}
|
|
1476
1532
|
if (t.type === "prepare") {
|
|
1477
1533
|
try {
|
|
1478
|
-
const n = await
|
|
1479
|
-
t.warmup && await n.warmup(),
|
|
1534
|
+
const n = await an(t.runtime);
|
|
1535
|
+
t.warmup && await n.warmup(), k({ type: "worker-ready" });
|
|
1480
1536
|
} catch (n) {
|
|
1481
|
-
|
|
1537
|
+
k({ type: "error", error: X(n) }), K.close();
|
|
1482
1538
|
}
|
|
1483
1539
|
return;
|
|
1484
1540
|
}
|
|
@@ -1491,18 +1547,18 @@ K.onmessage = async (e) => {
|
|
|
1491
1547
|
loadTextures: !1,
|
|
1492
1548
|
convertZUp: !1,
|
|
1493
1549
|
loadLights: !1,
|
|
1494
|
-
resolveBytes:
|
|
1495
|
-
onReferenceSkipped: (
|
|
1496
|
-
onResourceFailed: (
|
|
1550
|
+
resolveBytes: on,
|
|
1551
|
+
onReferenceSkipped: (r) => k({ type: "event", event: "reference-skipped", identifier: r }),
|
|
1552
|
+
onResourceFailed: (r, c) => k({ type: "event", event: "resource-failed", identifier: r, error: X(c) })
|
|
1497
1553
|
});
|
|
1498
|
-
|
|
1499
|
-
const i = a.data,
|
|
1500
|
-
|
|
1554
|
+
Y = a.release, te = ke(a.stage, a.pxr), oe = a.readPhysics;
|
|
1555
|
+
const i = a.data, s = cn(i);
|
|
1556
|
+
k({
|
|
1501
1557
|
type: "visual-ready",
|
|
1502
1558
|
data: i,
|
|
1503
1559
|
textureURLs: [...a.textureURLs ?? []]
|
|
1504
|
-
},
|
|
1560
|
+
}, s);
|
|
1505
1561
|
} catch (n) {
|
|
1506
|
-
|
|
1562
|
+
k({ type: "error", error: X(n) }), K.close();
|
|
1507
1563
|
}
|
|
1508
1564
|
};
|