@nebula-spatial/viewer 0.5.18 → 0.6.1
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 +83 -35
- package/README.md +5 -0
- package/dist/asset-ir-BXa1EdOy.js +637 -0
- package/dist/assets/source-types.d.ts +10 -0
- package/dist/assets/types.d.ts +61 -6
- package/dist/assets/{usd-worker-B6-1I5dT.js → usd-worker-r6Nuoxlk.js} +671 -584
- package/dist/index-CHf9y9eX.js +17406 -0
- package/dist/index.d.ts +21 -2
- package/dist/index.js +29 -18
- package/dist/{mjcf-visual-CtY2Wk3w.js → mjcf-visual-DxMXiBnu.js} +12 -13
- package/dist/mujoco-runtime-BA88JuDR.js +791 -0
- package/dist/physics-guide-size-CplAlsve.js +12 -0
- package/dist/scene/instances.d.ts +36 -0
- package/dist/scene/joints.d.ts +129 -0
- package/dist/scene/session.d.ts +26 -0
- package/dist/scene/types.d.ts +292 -0
- package/dist/session-DLi-MvLB.js +240 -0
- package/dist/{session-DxTeRKCd.js → session-DqEr1CxY.js} +581 -567
- package/dist/session-ZNb3ZYLq.js +562 -0
- package/dist/simulation/physics-runtime-state.d.ts +73 -0
- package/dist/simulation/types.d.ts +151 -0
- package/dist/simulation/usd-dependency-probe.d.ts +42 -0
- package/dist/simulation/usd-inspection.d.ts +66 -0
- package/dist/spark-renderer-BGF_AaI9.js +25 -0
- package/dist/spark.module-kM8pwA1o.js +9278 -0
- package/dist/types.d.ts +75 -1
- package/dist/ui/camera-axis-gizmo.d.ts +5 -0
- package/dist/urdf-session-CKlR-fOQ.js +1230 -0
- package/dist/usd-session-DyNMsD-v.js +11199 -0
- package/dist/version.d.ts +1 -1
- package/dist/visual/classification.d.ts +20 -0
- package/dist/{xacro-x2TeKQ7T.js → xacro-BCLnc3tY.js} +1 -1
- package/openusd/openusd-runtime-manifest.json +6 -6
- package/openusd/openusd_probe.js +1 -1
- package/openusd/openusd_probe.wasm +0 -0
- package/package.json +2 -1
- package/runtime-assets.d.mts +9 -9
- package/runtime-assets.mjs +11 -11
- package/vite.d.mts +7 -7
- package/vite.mjs +115 -115
- package/dist/collision-debug-BSJoz5J7.js +0 -2947
- package/dist/index-E8DHSeyT.js +0 -11499
- package/dist/mujoco-runtime-fDWdXNEc.js +0 -739
- package/dist/resources-CHhCm2f7.js +0 -27
- package/dist/session-DB-osaBL.js +0 -801
- package/dist/stage-BnRjc-Rp.js +0 -592
- package/dist/urdf-session-Q_c3Rd1M.js +0 -1264
- package/dist/usd-session-tW3LxVFs.js +0 -10647
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
function
|
|
2
|
-
return /^https?:$/.test(t.protocol) && e.origin === t.origin && !e.username && !e.password &&
|
|
1
|
+
function Re(e, t) {
|
|
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
|
-
function
|
|
4
|
+
function ye(e) {
|
|
5
5
|
return e.endsWith("/") ? e : e.slice(0, e.lastIndexOf("/") + 1);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function ze(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 We(e, t, n) {
|
|
15
15
|
const s = [];
|
|
16
16
|
try {
|
|
17
|
-
return
|
|
17
|
+
return ze(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 Fe(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 He = "E_ASSET_RESOURCE_NOT_FOUND", Ne = "E_ASSET_RESOURCE_INVALID", Je = "E_ASSET_FETCH", Xe = "E_ASSET_EXTERNAL_DENIED", qe = "E_ASSET_AUTH", Ze = /* @__PURE__ */ new Set([
|
|
29
29
|
"png",
|
|
30
30
|
"jpg",
|
|
31
31
|
"jpeg",
|
|
@@ -38,72 +38,72 @@ const ze = "E_ASSET_RESOURCE_NOT_FOUND", Ae = "E_ASSET_RESOURCE_INVALID", We = "
|
|
|
38
38
|
"hdr",
|
|
39
39
|
"exr",
|
|
40
40
|
"ktx2"
|
|
41
|
-
]),
|
|
42
|
-
function
|
|
41
|
+
]), Ye = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
|
|
42
|
+
function Ke(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 = Ke(e);
|
|
48
|
+
return Ze.has(t) && !Ye.has(t);
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function et(e, t) {
|
|
51
51
|
return Object.assign(new Error(e), { code: t });
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function tt(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 === He) return "missing";
|
|
58
|
+
if (t === Ne) return "invalid";
|
|
59
|
+
if (t === Je) return "unavailable";
|
|
60
|
+
if (t === qe || t === Xe) 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 nt(e) {
|
|
65
|
+
const t = tt(e);
|
|
66
66
|
return t === "missing" || t === "invalid" || t === "unavailable";
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function rt(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 nt(e, t) {
|
|
72
|
-
return t.byteLength ? tt(e, new TextDecoder().decode(t.subarray(0, 512))) : "响应内容为空";
|
|
73
|
-
}
|
|
74
|
-
const rt = /<UDIM>/i;
|
|
75
71
|
function st(e, t) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
return t.byteLength ? rt(e, new TextDecoder().decode(t.subarray(0, 512))) : "响应内容为空";
|
|
73
|
+
}
|
|
74
|
+
const ot = /<UDIM>/i;
|
|
75
|
+
function at(e, t) {
|
|
76
|
+
const n = we(e).replaceAll("\\", "/");
|
|
77
|
+
if (!ot.test(n)) return null;
|
|
78
|
+
const s = _e(n), a = s.split("/").at(-1);
|
|
79
79
|
if (!a) return { paths: [], tiles: [] };
|
|
80
|
-
const o =
|
|
80
|
+
const o = it(a);
|
|
81
81
|
if (!o) return { paths: [], tiles: [] };
|
|
82
82
|
const r = [];
|
|
83
|
-
for (const
|
|
84
|
-
const p =
|
|
83
|
+
for (const f of new Set(t)) {
|
|
84
|
+
const p = we(f).replaceAll("\\", "/"), y = _e(p), l = y.split("/").at(-1);
|
|
85
|
+
if (!l) continue;
|
|
86
|
+
const u = o.exec(l);
|
|
85
87
|
if (!u) continue;
|
|
86
|
-
const
|
|
87
|
-
if (!f) continue;
|
|
88
|
-
const h = Number(f[1]);
|
|
88
|
+
const h = Number(u[1]);
|
|
89
89
|
!Number.isInteger(h) || h < 1001 || h > 9999 || r.push({
|
|
90
|
-
path:
|
|
90
|
+
path: f,
|
|
91
91
|
tile: h,
|
|
92
|
-
score:
|
|
92
|
+
score: ct(s, y)
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
if (!r.length) return { paths: [], tiles: [] };
|
|
96
|
-
const c = Math.max(...r.map((
|
|
96
|
+
const c = Math.max(...r.map((f) => f.score)), i = r.filter((f) => f.score === c).sort((f, p) => f.tile - p.tile || f.path.localeCompare(p.path));
|
|
97
97
|
return {
|
|
98
|
-
paths: i.map((
|
|
99
|
-
tiles: i.map((
|
|
98
|
+
paths: i.map((f) => f.path),
|
|
99
|
+
tiles: i.map((f) => f.tile)
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function it(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(`^${be(t[0])}(\\d{4})${be(t[1])}$`, "i");
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function ct(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; ) {
|
|
@@ -113,7 +113,7 @@ function at(e, t) {
|
|
|
113
113
|
}
|
|
114
114
|
return a;
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function we(e) {
|
|
117
117
|
const t = e.replace(/%3CUDIM%3E/gi, "<UDIM>");
|
|
118
118
|
try {
|
|
119
119
|
return decodeURIComponent(t);
|
|
@@ -121,39 +121,39 @@ function me(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 be(e) {
|
|
129
129
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
130
130
|
}
|
|
131
|
-
const
|
|
132
|
-
function
|
|
131
|
+
const lt = 67324752, ut = 33639248, ft = 101010256, ce = 4294967295, dt = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "webp"]);
|
|
132
|
+
function ht(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 pt(e, t = {}) {
|
|
136
|
+
const n = new DataView(e.buffer, e.byteOffset, e.byteLength), s = bt(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
|
-
if (a === 65535 || o ===
|
|
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) !== ut)
|
|
144
144
|
throw new Error(`Corrupt zip central directory at entry ${i}.`);
|
|
145
|
-
const
|
|
146
|
-
if (p ===
|
|
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
|
+
if (p === ce || h === ce)
|
|
147
147
|
throw new Error("ZIP64 usdz packages are not supported.");
|
|
148
|
-
const
|
|
149
|
-
o += 46 +
|
|
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(mt(e, n, h, p, f).then((g) => ({ name: w, data: g }))));
|
|
150
150
|
}
|
|
151
|
-
for (const { name: i, data:
|
|
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 gt(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]) => De(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,18 +164,18 @@ function ht(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: _t(r) })), s.set(r, c);
|
|
168
168
|
}
|
|
169
169
|
return c;
|
|
170
170
|
}, o = (r) => {
|
|
171
171
|
if (!r) return null;
|
|
172
|
-
const c =
|
|
172
|
+
const c = wt(yt(r));
|
|
173
173
|
if (!c) return null;
|
|
174
174
|
if (t.has(c)) return a(c);
|
|
175
|
-
const i = [...t.keys()].filter((
|
|
175
|
+
const i = [...t.keys()].filter((y) => y.endsWith(`/${c}`));
|
|
176
176
|
if (i.length === 1) return a(i[0]);
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
177
|
+
const f = [...t.keys()].filter((y) => c.endsWith(`/${y}`));
|
|
178
|
+
if (f.length === 1) return a(f[0]);
|
|
179
179
|
const p = n.get(c.split("/").pop() ?? "");
|
|
180
180
|
return p ? a(p) : null;
|
|
181
181
|
};
|
|
@@ -189,22 +189,22 @@ function ht(e) {
|
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
|
-
function
|
|
193
|
-
return
|
|
192
|
+
function De(e) {
|
|
193
|
+
return dt.has(Me(e));
|
|
194
194
|
}
|
|
195
|
-
async function
|
|
196
|
-
if (t.getUint32(n, !0) !==
|
|
195
|
+
async function mt(e, t, n, s, a) {
|
|
196
|
+
if (t.getUint32(n, !0) !== lt) 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
|
-
const
|
|
201
|
-
return new Uint8Array(await new Response(
|
|
200
|
+
const f = new Blob([new Uint8Array(i)]).stream().pipeThrough(new DecompressionStream("deflate-raw"));
|
|
201
|
+
return new Uint8Array(await new Response(f).arrayBuffer());
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function yt(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 wt(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 Me(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 _t(e) {
|
|
218
218
|
switch (Me(e)) {
|
|
219
219
|
case "png":
|
|
220
220
|
return "image/png";
|
|
@@ -227,30 +227,30 @@ function wt(e) {
|
|
|
227
227
|
return "application/octet-stream";
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function bt(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) === ft) return n;
|
|
234
234
|
return -1;
|
|
235
235
|
}
|
|
236
|
-
const
|
|
236
|
+
const St = 1, Et = 7, Ut = "868b234d991a15dc6e48", vt = {
|
|
237
237
|
file: "openusd_probe.js",
|
|
238
|
-
sha256: "
|
|
239
|
-
bytes:
|
|
240
|
-
},
|
|
238
|
+
sha256: "729ce6e77c5c1f81a1c95597800de55d902d46b4f86bc04474c43f411ab520c7",
|
|
239
|
+
bytes: 98305
|
|
240
|
+
}, At = {
|
|
241
241
|
file: "openusd_probe.wasm",
|
|
242
|
-
sha256: "
|
|
243
|
-
bytes:
|
|
242
|
+
sha256: "997f529d700c0461fa65e27b89af31af0dac7a83e2e70c9dbaa631e556b0679b",
|
|
243
|
+
bytes: 10861768
|
|
244
244
|
};
|
|
245
|
-
var
|
|
246
|
-
schemaVersion:
|
|
247
|
-
apiVersion:
|
|
248
|
-
runtimeId:
|
|
249
|
-
js:
|
|
250
|
-
wasm:
|
|
245
|
+
var It = {
|
|
246
|
+
schemaVersion: St,
|
|
247
|
+
apiVersion: Et,
|
|
248
|
+
runtimeId: Ut,
|
|
249
|
+
js: vt,
|
|
250
|
+
wasm: At
|
|
251
251
|
};
|
|
252
|
-
const Pt = It
|
|
253
|
-
function
|
|
252
|
+
const Pt = Rt(It);
|
|
253
|
+
function Rt(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 It(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 _e(e, t) {
|
|
|
274
274
|
bytes: Number(n.bytes)
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function Nt(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 At(e, t, n) {
|
|
|
284
284
|
}
|
|
285
285
|
), {};
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function xe(e, t) {
|
|
288
288
|
const n = async (o, r) => {
|
|
289
289
|
var i;
|
|
290
290
|
const c = e.GetPrimAtPath(o);
|
|
@@ -294,18 +294,18 @@ function Ne(e, t) {
|
|
|
294
294
|
(i = c == null ? void 0 : c.delete) == null || i.call(c);
|
|
295
295
|
}
|
|
296
296
|
}, s = (o, r) => {
|
|
297
|
-
var i,
|
|
297
|
+
var i, f, p, y;
|
|
298
298
|
const c = (i = o == null ? void 0 : o.GetAttribute) == null ? void 0 : i.call(o, r);
|
|
299
299
|
if (!c) return [];
|
|
300
300
|
try {
|
|
301
|
-
return ((
|
|
302
|
-
var h,
|
|
303
|
-
if (typeof
|
|
304
|
-
const
|
|
305
|
-
return (
|
|
301
|
+
return ((f = c.IsValid) == null ? void 0 : f.call(c)) !== !0 ? [] : (((p = c.GetConnections) == null ? void 0 : p.call(c)) ?? []).map((l) => {
|
|
302
|
+
var h, w;
|
|
303
|
+
if (typeof l == "string") return l;
|
|
304
|
+
const u = String(((h = l.GetString) == null ? void 0 : h.call(l)) ?? l.path ?? "");
|
|
305
|
+
return (w = l.delete) == null || w.call(l), u;
|
|
306
306
|
}).filter(Boolean);
|
|
307
307
|
} finally {
|
|
308
|
-
(
|
|
308
|
+
(y = c.delete) == null || y.call(c);
|
|
309
309
|
}
|
|
310
310
|
}, a = (o) => {
|
|
311
311
|
var c;
|
|
@@ -330,12 +330,12 @@ function Ne(e, t) {
|
|
|
330
330
|
},
|
|
331
331
|
async primInfo(o) {
|
|
332
332
|
return n(o, (r) => {
|
|
333
|
-
var c, i,
|
|
333
|
+
var c, i, f, p;
|
|
334
334
|
return {
|
|
335
335
|
valid: !!r && ((c = r.IsValid) == null ? void 0 : c.call(r)) !== !1,
|
|
336
336
|
name: String(((i = r.GetName) == null ? void 0 : i.call(r)) ?? o.split("/").pop() ?? ""),
|
|
337
337
|
path: o,
|
|
338
|
-
typeName: String(((
|
|
338
|
+
typeName: String(((f = r.GetTypeName) == null ? void 0 : f.call(r)) ?? ""),
|
|
339
339
|
instance: ((p = r.IsInstance) == null ? void 0 : p.call(r)) === !0
|
|
340
340
|
};
|
|
341
341
|
});
|
|
@@ -344,9 +344,9 @@ function Ne(e, t) {
|
|
|
344
344
|
return n(o, (r) => {
|
|
345
345
|
var c;
|
|
346
346
|
return (((c = r.GetChildren) == null ? void 0 : c.call(r)) ?? []).map((i) => {
|
|
347
|
-
var p,
|
|
348
|
-
const
|
|
349
|
-
return (
|
|
347
|
+
var p, y;
|
|
348
|
+
const f = String(i.__path ?? ((p = i.GetPath) == null ? void 0 : p.call(i)) ?? "");
|
|
349
|
+
return (y = i.delete) == null || y.call(i), f;
|
|
350
350
|
});
|
|
351
351
|
});
|
|
352
352
|
},
|
|
@@ -358,53 +358,53 @@ function Ne(e, t) {
|
|
|
358
358
|
return n(o, (r) => {
|
|
359
359
|
var c;
|
|
360
360
|
return (((c = r.GetAttributes) == null ? void 0 : c.call(r)) ?? []).map((i) => {
|
|
361
|
-
var p,
|
|
362
|
-
const
|
|
363
|
-
return (
|
|
361
|
+
var p, y;
|
|
362
|
+
const f = String(((p = i.GetName) == null ? void 0 : p.call(i)) ?? "");
|
|
363
|
+
return (y = i.delete) == null || y.call(i), f;
|
|
364
364
|
});
|
|
365
365
|
});
|
|
366
366
|
},
|
|
367
367
|
async primMetadata(o, r) {
|
|
368
368
|
return n(o, (c) => {
|
|
369
369
|
var p;
|
|
370
|
-
const i = (p = c == null ? void 0 : c.GetMetadata) == null ? void 0 : p.call(c, r),
|
|
370
|
+
const i = (p = c == null ? void 0 : c.GetMetadata) == null ? void 0 : p.call(c, r), f = typeof i == "string" ? i : i && typeof i == "object" && typeof i.string == "string" ? String(i.string) : void 0;
|
|
371
371
|
return {
|
|
372
372
|
valid: !0,
|
|
373
373
|
found: i != null,
|
|
374
374
|
...i != null ? { value: i } : {},
|
|
375
|
-
...
|
|
375
|
+
...f !== void 0 ? { text: f } : {}
|
|
376
376
|
};
|
|
377
377
|
});
|
|
378
378
|
},
|
|
379
379
|
async relationshipTargets(o, r) {
|
|
380
380
|
return n(o, (c) => {
|
|
381
|
-
var
|
|
382
|
-
const i = (
|
|
381
|
+
var f, p, y;
|
|
382
|
+
const i = (f = c == null ? void 0 : c.GetRelationship) == null ? void 0 : f.call(c, r);
|
|
383
383
|
if (!i) return [];
|
|
384
384
|
try {
|
|
385
|
-
return (((p = i.GetTargets) == null ? void 0 : p.call(i)) ?? []).map((
|
|
386
|
-
var
|
|
387
|
-
return typeof
|
|
385
|
+
return (((p = i.GetTargets) == null ? void 0 : p.call(i)) ?? []).map((l) => {
|
|
386
|
+
var u;
|
|
387
|
+
return typeof l == "string" ? l : String(((u = l.GetString) == null ? void 0 : u.call(l)) ?? l.path ?? "");
|
|
388
388
|
}).filter(Boolean);
|
|
389
389
|
} finally {
|
|
390
|
-
(
|
|
390
|
+
(y = i.delete) == null || y.call(i);
|
|
391
391
|
}
|
|
392
392
|
});
|
|
393
393
|
},
|
|
394
394
|
async attributeValue(o, r) {
|
|
395
395
|
return n(o, (c) => {
|
|
396
|
-
var
|
|
397
|
-
const i = (
|
|
396
|
+
var f, p, y, l;
|
|
397
|
+
const i = (f = c == null ? void 0 : c.GetAttribute) == null ? void 0 : f.call(c, r);
|
|
398
398
|
if (!i) return { valid: !1, authored: !1, value: null };
|
|
399
399
|
try {
|
|
400
|
-
const
|
|
400
|
+
const u = ((p = i.IsValid) == null ? void 0 : p.call(i)) === !0;
|
|
401
401
|
return {
|
|
402
|
-
valid:
|
|
403
|
-
authored:
|
|
404
|
-
value:
|
|
402
|
+
valid: u,
|
|
403
|
+
authored: u && ((y = i.HasAuthoredValue) == null ? void 0 : y.call(i)) === !0,
|
|
404
|
+
value: u ? i.Get() : null
|
|
405
405
|
};
|
|
406
406
|
} finally {
|
|
407
|
-
(
|
|
407
|
+
(l = i.delete) == null || l.call(i);
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
410
|
},
|
|
@@ -412,16 +412,16 @@ function Ne(e, t) {
|
|
|
412
412
|
const r = {};
|
|
413
413
|
for (const c of o)
|
|
414
414
|
r[c.path] = await n(c.path, (i) => Object.fromEntries(
|
|
415
|
-
c.names.map((
|
|
416
|
-
var
|
|
417
|
-
const p = (
|
|
418
|
-
if (!p) return [
|
|
415
|
+
c.names.map((f) => {
|
|
416
|
+
var y, l, u, h;
|
|
417
|
+
const p = (y = i == null ? void 0 : i.GetAttribute) == null ? void 0 : y.call(i, f);
|
|
418
|
+
if (!p) return [f, { valid: !1, authored: !1, value: null }];
|
|
419
419
|
try {
|
|
420
|
-
const
|
|
421
|
-
return [
|
|
422
|
-
valid:
|
|
423
|
-
authored:
|
|
424
|
-
value:
|
|
420
|
+
const w = ((l = p.IsValid) == null ? void 0 : l.call(p)) === !0;
|
|
421
|
+
return [f, {
|
|
422
|
+
valid: w,
|
|
423
|
+
authored: w && ((u = p.HasAuthoredValue) == null ? void 0 : u.call(p)) === !0,
|
|
424
|
+
value: w ? p.Get() : null
|
|
425
425
|
}];
|
|
426
426
|
} finally {
|
|
427
427
|
(h = p.delete) == null || h.call(p);
|
|
@@ -432,19 +432,19 @@ function Ne(e, t) {
|
|
|
432
432
|
},
|
|
433
433
|
async attributeMetadata(o, r, c) {
|
|
434
434
|
return n(o, (i) => {
|
|
435
|
-
var p,
|
|
436
|
-
const
|
|
437
|
-
if (!
|
|
435
|
+
var p, y, l;
|
|
436
|
+
const f = (p = i == null ? void 0 : i.GetAttribute) == null ? void 0 : p.call(i, r);
|
|
437
|
+
if (!f) return { valid: !1, found: !1 };
|
|
438
438
|
try {
|
|
439
|
-
if (((
|
|
440
|
-
const
|
|
439
|
+
if (((y = f.IsValid) == null ? void 0 : y.call(f)) !== !0) return { valid: !1, found: !1 };
|
|
440
|
+
const u = f.GetMetadata(c);
|
|
441
441
|
return {
|
|
442
442
|
valid: !0,
|
|
443
|
-
found:
|
|
444
|
-
...
|
|
443
|
+
found: u != null,
|
|
444
|
+
...u != null ? { value: u } : {}
|
|
445
445
|
};
|
|
446
446
|
} finally {
|
|
447
|
-
(
|
|
447
|
+
(l = f.delete) == null || l.call(f);
|
|
448
448
|
}
|
|
449
449
|
});
|
|
450
450
|
},
|
|
@@ -456,16 +456,16 @@ function Ne(e, t) {
|
|
|
456
456
|
}
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
|
-
const
|
|
460
|
-
function
|
|
461
|
-
const n = new Set(t.map(
|
|
459
|
+
const Dt = /^physics$/i, Mt = /^(newton|mjc|mujoco)(?:[_-]|$)/i, xt = /^(physx|newton|mjc|mujoco)(?:[_-]|)/i;
|
|
460
|
+
function kt(e, t = []) {
|
|
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,
|
|
463
|
+
if (!Dt.test(a.setName) || n.has(Ee(a))) continue;
|
|
464
|
+
const o = a.variantNames.map((i, f) => ({ selection: i, index: f, rank: Ot(i) })).filter((i) => i.rank !== null);
|
|
465
465
|
if (o.length === 0 || a.selection && Mt.test(a.selection)) continue;
|
|
466
|
-
const r =
|
|
467
|
-
const p = r !== null &&
|
|
468
|
-
return Number(
|
|
466
|
+
const r = le(a.selection), c = [...o].sort((i, f) => {
|
|
467
|
+
const p = r !== null && le(i.selection) === r, y = r !== null && le(f.selection) === r;
|
|
468
|
+
return Number(y) - Number(p) || i.rank - f.rank || i.index - f.index;
|
|
469
469
|
})[0];
|
|
470
470
|
s.push({
|
|
471
471
|
primPath: a.primPath,
|
|
@@ -475,16 +475,16 @@ function Dt(e, t = []) {
|
|
|
475
475
|
}
|
|
476
476
|
return s;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function Ot(e) {
|
|
479
479
|
return /^newton(?:[_-]|$)/i.test(e) ? 0 : /^mjc(?:[_-]|$)/i.test(e) ? 1 : /^mujoco(?:[_-]|$)/i.test(e) ? 2 : null;
|
|
480
480
|
}
|
|
481
|
-
function
|
|
482
|
-
return e && e.replace(
|
|
481
|
+
function le(e) {
|
|
482
|
+
return e && e.replace(xt, "").toLowerCase() || null;
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function Ee(e) {
|
|
485
485
|
return `${e.primPath}\0${e.setName}`;
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function Tt(e) {
|
|
488
488
|
let t = 0;
|
|
489
489
|
const n = () => {
|
|
490
490
|
for (; t < e.length; ) {
|
|
@@ -499,17 +499,17 @@ function xt(e) {
|
|
|
499
499
|
continue;
|
|
500
500
|
}
|
|
501
501
|
if (i === '"' || i === "@" || i === "<") {
|
|
502
|
-
const p = i === "<" ? ">" : i,
|
|
503
|
-
t +=
|
|
504
|
-
const
|
|
502
|
+
const p = i === "<" ? ">" : i, y = i === '"' && e.slice(t, t + 3) === '"""';
|
|
503
|
+
t += y ? 3 : 1;
|
|
504
|
+
const l = t;
|
|
505
505
|
for (; t < e.length; ) {
|
|
506
506
|
if (e[t] === "\\") {
|
|
507
507
|
t += 2;
|
|
508
508
|
continue;
|
|
509
509
|
}
|
|
510
|
-
if (
|
|
511
|
-
const
|
|
512
|
-
return t +=
|
|
510
|
+
if (y ? e.slice(t, t + 3) === '"""' : e[t] === p) {
|
|
511
|
+
const u = e.slice(l, t);
|
|
512
|
+
return t += y ? 3 : 1, { kind: i === "<" ? "path" : "string", value: u };
|
|
513
513
|
}
|
|
514
514
|
t++;
|
|
515
515
|
}
|
|
@@ -517,23 +517,23 @@ function xt(e) {
|
|
|
517
517
|
}
|
|
518
518
|
if ("{}()[]=,".includes(i))
|
|
519
519
|
return t++, { kind: "symbol", value: i };
|
|
520
|
-
const
|
|
520
|
+
const f = t;
|
|
521
521
|
for (; t < e.length && !/[\s{}()\[\]=,<>"@#]/.test(e[t]); ) t++;
|
|
522
|
-
if (
|
|
522
|
+
if (f === t) {
|
|
523
523
|
t++;
|
|
524
524
|
continue;
|
|
525
525
|
}
|
|
526
|
-
return { kind: "word", value: e.slice(
|
|
526
|
+
return { kind: "word", value: e.slice(f, t) };
|
|
527
527
|
}
|
|
528
528
|
}, s = () => {
|
|
529
|
-
let i = 1,
|
|
530
|
-
for (; i && (
|
|
531
|
-
|
|
529
|
+
let i = 1, f;
|
|
530
|
+
for (; i && (f = n()); )
|
|
531
|
+
f.value === "[" && f.kind === "symbol" ? i++ : f.value === "]" && f.kind === "symbol" && i--;
|
|
532
532
|
if (i) throw new Error("Unterminated USDA list");
|
|
533
533
|
}, a = () => {
|
|
534
|
-
let i = 1,
|
|
535
|
-
for (; i && (
|
|
536
|
-
|
|
534
|
+
let i = 1, f;
|
|
535
|
+
for (; i && (f = n()); )
|
|
536
|
+
f.value === "{" && f.kind === "symbol" ? i++ : f.value === "}" && f.kind === "symbol" && i--;
|
|
537
537
|
if (i) throw new Error("Unterminated USDA dictionary");
|
|
538
538
|
}, o = /* @__PURE__ */ new Map(), r = [];
|
|
539
539
|
let c;
|
|
@@ -543,9 +543,9 @@ function xt(e) {
|
|
|
543
543
|
continue;
|
|
544
544
|
}
|
|
545
545
|
if (["def", "over", "class"].includes(c.value)) {
|
|
546
|
-
const
|
|
547
|
-
if (!
|
|
548
|
-
const h = [...r].reverse().find(Boolean),
|
|
546
|
+
const l = n(), u = (l == null ? void 0 : l.kind) === "string" ? l : n();
|
|
547
|
+
if (!u || u.kind !== "string") throw new Error("Invalid USDA prim header");
|
|
548
|
+
const h = [...r].reverse().find(Boolean), w = `${(h == null ? void 0 : h.path) ?? ""}/${u.value}`, g = { 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,36 +555,36 @@ function xt(e) {
|
|
|
555
555
|
continue;
|
|
556
556
|
}
|
|
557
557
|
if (d.kind === "word" && d.value === "apiSchemas") {
|
|
558
|
-
const
|
|
559
|
-
if ((
|
|
558
|
+
const b = n(), _ = n();
|
|
559
|
+
if ((b == null ? void 0 : b.value) !== "=") throw new Error("Invalid USDA apiSchemas");
|
|
560
560
|
if ((_ == null ? void 0 : _.kind) === "word" && _.value === "None") continue;
|
|
561
|
-
if ((_ == null ? void 0 : _.value) !== "[") throw new Error(`Invalid USDA apiSchemas at ${
|
|
561
|
+
if ((_ == null ? void 0 : _.value) !== "[") throw new Error(`Invalid USDA apiSchemas at ${w}: ${_ == null ? void 0 : _.value}`);
|
|
562
562
|
for (; (d = n()) && d.value !== "]"; )
|
|
563
|
-
d.kind === "string" && d.value.startsWith("PhysxMimicJointAPI:") &&
|
|
563
|
+
d.kind === "string" && d.value.startsWith("PhysxMimicJointAPI:") && g.schemas.push(d.value);
|
|
564
564
|
if (!d) throw new Error("Unterminated USDA apiSchemas");
|
|
565
565
|
} else d.value === "[" && d.kind === "symbol" && s();
|
|
566
566
|
}
|
|
567
567
|
if (!d) throw new Error("Unterminated USDA prim header");
|
|
568
|
-
o.set(
|
|
568
|
+
o.set(w, g), r.push({ path: w, prim: g });
|
|
569
569
|
continue;
|
|
570
570
|
}
|
|
571
571
|
if (c.value !== "rel" || !r.at(-1)) continue;
|
|
572
572
|
const i = n();
|
|
573
573
|
if (!i || i.kind !== "word" || !/^physxMimicJoint:[^:]+:referenceJoint$/.test(i.value)) continue;
|
|
574
|
-
const
|
|
575
|
-
if ((
|
|
576
|
-
const
|
|
577
|
-
if (p.kind === "path")
|
|
574
|
+
const f = n(), p = n();
|
|
575
|
+
if ((f == null ? void 0 : f.value) !== "=" || !p) continue;
|
|
576
|
+
const y = [];
|
|
577
|
+
if (p.kind === "path") y.push(p.value);
|
|
578
578
|
else if (p.value === "[") {
|
|
579
|
-
let
|
|
580
|
-
for (; (
|
|
581
|
-
if (!
|
|
579
|
+
let l;
|
|
580
|
+
for (; (l = n()) && l.value !== "]"; ) l.kind === "path" && y.push(l.value);
|
|
581
|
+
if (!l) throw new Error("Unterminated USDA relationship");
|
|
582
582
|
}
|
|
583
|
-
r.at(-1).prim.relationships.set(i.value,
|
|
583
|
+
r.at(-1).prim.relationships.set(i.value, y);
|
|
584
584
|
}
|
|
585
585
|
return new Map([...o].filter(([, i]) => i.schemas.length || i.relationships.size));
|
|
586
586
|
}
|
|
587
|
-
const
|
|
587
|
+
const $t = [
|
|
588
588
|
1,
|
|
589
589
|
0,
|
|
590
590
|
0,
|
|
@@ -602,33 +602,33 @@ const Ot = [
|
|
|
602
602
|
0,
|
|
603
603
|
1
|
|
604
604
|
];
|
|
605
|
-
function
|
|
605
|
+
function Ct(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;
|
|
609
|
-
if (s.has(o.path)) return
|
|
609
|
+
if (s.has(o.path)) return Ue(o.localMatrix);
|
|
610
610
|
s.add(o.path);
|
|
611
|
-
const c =
|
|
612
|
-
return s.delete(o.path), n.set(o.path,
|
|
611
|
+
const c = Ue(o.localMatrix), i = o.parentPath ? t.get(o.parentPath) : void 0, f = !i || o.resetsXformStack ? c : ve(c, a(i));
|
|
612
|
+
return s.delete(o.path), n.set(o.path, f), f;
|
|
613
613
|
};
|
|
614
614
|
return e.map((o) => {
|
|
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 = Ft(c);
|
|
619
619
|
return i ? {
|
|
620
620
|
...o,
|
|
621
|
-
localMatrix:
|
|
621
|
+
localMatrix: ve(a(o), i)
|
|
622
622
|
} : o;
|
|
623
623
|
});
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
return
|
|
625
|
+
function Ue(e) {
|
|
626
|
+
return Lt(e) ? e : $t;
|
|
627
627
|
}
|
|
628
|
-
function
|
|
628
|
+
function Lt(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 s = 0; s < 4; s++)
|
|
634
634
|
for (let a = 0; a < 4; a++) {
|
|
@@ -639,7 +639,7 @@ function Ee(e, t) {
|
|
|
639
639
|
}
|
|
640
640
|
return n;
|
|
641
641
|
}
|
|
642
|
-
function
|
|
642
|
+
function Ft(e) {
|
|
643
643
|
const [
|
|
644
644
|
t,
|
|
645
645
|
n,
|
|
@@ -651,53 +651,55 @@ function Lt(e) {
|
|
|
651
651
|
,
|
|
652
652
|
c,
|
|
653
653
|
i,
|
|
654
|
-
|
|
654
|
+
f,
|
|
655
655
|
,
|
|
656
656
|
p,
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
] = e,
|
|
660
|
-
Math.abs(t * o *
|
|
657
|
+
y,
|
|
658
|
+
l
|
|
659
|
+
] = e, u = o * f - r * i, h = s * i - n * f, w = n * r - s * o, g = t * u + a * h + c * w, d = Math.max(
|
|
660
|
+
Math.abs(t * o * f),
|
|
661
661
|
Math.abs(t * r * i),
|
|
662
|
-
Math.abs(n * a *
|
|
662
|
+
Math.abs(n * a * f),
|
|
663
663
|
Math.abs(n * r * c),
|
|
664
664
|
Math.abs(s * a * i),
|
|
665
665
|
Math.abs(s * o * c),
|
|
666
666
|
1
|
|
667
667
|
);
|
|
668
|
-
if (!Number.isFinite(
|
|
668
|
+
if (!Number.isFinite(g) || Math.abs(g) <= Number.EPSILON * d * 16)
|
|
669
669
|
return null;
|
|
670
|
-
const m = 1 /
|
|
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, F = (s * a - t * r) * m, j = (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
|
_,
|
|
674
|
-
|
|
674
|
+
R,
|
|
675
675
|
0,
|
|
676
|
-
|
|
677
|
-
|
|
676
|
+
x,
|
|
677
|
+
O,
|
|
678
678
|
F,
|
|
679
679
|
0,
|
|
680
|
+
j,
|
|
680
681
|
H,
|
|
681
|
-
|
|
682
|
-
V,
|
|
682
|
+
z,
|
|
683
683
|
0,
|
|
684
|
-
-(p *
|
|
685
|
-
-(p * _ +
|
|
686
|
-
-(p *
|
|
684
|
+
-(p * b + y * x + l * j),
|
|
685
|
+
-(p * _ + y * O + l * H),
|
|
686
|
+
-(p * R + y * F + l * z),
|
|
687
687
|
1
|
|
688
688
|
];
|
|
689
689
|
}
|
|
690
|
-
function
|
|
690
|
+
function jt(e, t = []) {
|
|
691
691
|
return {
|
|
692
692
|
stage: e.stage,
|
|
693
693
|
view: {
|
|
694
694
|
...e.view,
|
|
695
|
-
prims:
|
|
695
|
+
prims: Ct(e.view.prims)
|
|
696
696
|
},
|
|
697
697
|
elements: e.elements,
|
|
698
|
+
pointClouds: e.pointClouds,
|
|
699
|
+
gaussianSplats: e.gaussianSplats,
|
|
698
700
|
materials: e.materials,
|
|
699
701
|
materialAliases: e.materialAliases,
|
|
700
|
-
physics:
|
|
702
|
+
physics: Gt(),
|
|
701
703
|
joints: [],
|
|
702
704
|
cameras: [],
|
|
703
705
|
lights: [],
|
|
@@ -706,10 +708,10 @@ function Ct(e, t = []) {
|
|
|
706
708
|
variants: t
|
|
707
709
|
};
|
|
708
710
|
}
|
|
709
|
-
function
|
|
711
|
+
function Vt(e, t) {
|
|
710
712
|
e.physics = t.physics, e.joints = t.joints;
|
|
711
713
|
}
|
|
712
|
-
function
|
|
714
|
+
function Gt() {
|
|
713
715
|
return {
|
|
714
716
|
scenes: [],
|
|
715
717
|
rigidBodies: [],
|
|
@@ -718,17 +720,17 @@ function Vt() {
|
|
|
718
720
|
articulationRoots: []
|
|
719
721
|
};
|
|
720
722
|
}
|
|
721
|
-
const
|
|
723
|
+
const Bt = /^(Warning|Error|Fatal|Info|Runtime Error|Coding Error):\s+in\s+(\S+)\s+at line \d+ of .*?\s+--\s+([\s\S]*)$/s, zt = /(^|[\s(\[])(?:[A-Za-z]:[\\/]|\/)(?:[^ \t\r\n()'"]+[\\/])*[^ \t\r\n()'"]+\.(?:cpp|cxx|cc|hpp|c|h|mjs|js|ts)(?::\d+)*/gi, Wt = /<0x[0-9a-f]+>/gi, Ht = /* @__PURE__ */ new Set([
|
|
722
724
|
"USD_MATERIAL_BINDING_API_MISSING",
|
|
723
725
|
"USD_EXTERNAL_REFERENCE_UNRESOLVED"
|
|
724
726
|
]);
|
|
725
|
-
function
|
|
726
|
-
const t =
|
|
727
|
-
return (t ? `${t[1]}: ${t[2]} -- ${t[3]}` : e).replace(
|
|
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();
|
|
728
730
|
}
|
|
729
|
-
function
|
|
731
|
+
function Xt(e) {
|
|
730
732
|
if (!e || /^(?:Info|Status):/.test(e)) return null;
|
|
731
|
-
const t =
|
|
733
|
+
const t = Jt(e);
|
|
732
734
|
if (!t) return null;
|
|
733
735
|
if (/Found material bindings on prim at path .* but MaterialBindingAPI is not applied/.test(t))
|
|
734
736
|
return { severity: "warning", code: "USD_MATERIAL_BINDING_API_MISSING", message: t };
|
|
@@ -748,7 +750,7 @@ function Ht(e) {
|
|
|
748
750
|
message: t
|
|
749
751
|
};
|
|
750
752
|
}
|
|
751
|
-
function
|
|
753
|
+
function Ae(e = {}) {
|
|
752
754
|
const t = e.console ?? console, n = /* @__PURE__ */ new Set(), s = Math.max(1, e.maxUniqueDiagnostics ?? 64);
|
|
753
755
|
let a = !1;
|
|
754
756
|
const o = (r) => {
|
|
@@ -761,19 +763,19 @@ function Ue(e = {}) {
|
|
|
761
763
|
));
|
|
762
764
|
return;
|
|
763
765
|
}
|
|
764
|
-
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 && (Ht.has(r.code) || (r.severity === "error" ? t.error(r.message) : t.warn(r.message)));
|
|
765
767
|
}
|
|
766
768
|
};
|
|
767
769
|
return (r) => {
|
|
768
770
|
const c = String(r ?? "");
|
|
769
771
|
for (const i of c.split(/\r?\n/)) {
|
|
770
|
-
const
|
|
771
|
-
|
|
772
|
+
const f = Xt(i.trim());
|
|
773
|
+
f && o(f);
|
|
772
774
|
}
|
|
773
775
|
};
|
|
774
776
|
}
|
|
775
|
-
const ue = "[USD material] ",
|
|
776
|
-
function
|
|
777
|
+
const ue = "[USD material] ", qt = /* @__PURE__ */ new WeakMap();
|
|
778
|
+
function Zt(e) {
|
|
777
779
|
const t = [], n = console.warn;
|
|
778
780
|
console.warn = (...s) => {
|
|
779
781
|
const a = s.length === 1 && typeof s[0] == "string" && s[0].startsWith(ue) ? s[0].slice(ue.length) : null;
|
|
@@ -793,21 +795,21 @@ function Jt(e) {
|
|
|
793
795
|
console.warn = n;
|
|
794
796
|
}
|
|
795
797
|
}
|
|
796
|
-
function
|
|
797
|
-
t.length &&
|
|
798
|
+
function Yt(e, t) {
|
|
799
|
+
t.length && qt.set(e, Object.freeze([...t]));
|
|
798
800
|
}
|
|
799
|
-
const
|
|
800
|
-
async function
|
|
801
|
+
const Kt = /* @__PURE__ */ new Set(["usd", "usda", "usdc", "usdz"]);
|
|
802
|
+
async function Qt(e) {
|
|
801
803
|
const t = await import(
|
|
802
804
|
/* @vite-ignore */
|
|
803
805
|
e.moduleUrl
|
|
804
806
|
), n = t.default ?? t.createOpenUsdProbe, s = e.wasmModule ? {
|
|
805
|
-
printErr:
|
|
806
|
-
instantiateWasm(
|
|
807
|
-
return
|
|
807
|
+
printErr: Ae({ onDiagnostic: e.onRuntimeDiagnostic }),
|
|
808
|
+
instantiateWasm(g, d) {
|
|
809
|
+
return Nt(e.wasmModule, g, d);
|
|
808
810
|
}
|
|
809
811
|
} : {
|
|
810
|
-
printErr:
|
|
812
|
+
printErr: Ae({ onDiagnostic: e.onRuntimeDiagnostic }),
|
|
811
813
|
wasmBinary: await (typeof e.wasmBinary == "function" ? e.wasmBinary() : e.wasmBinary ?? an(e.wasmUrl))
|
|
812
814
|
}, a = await n(s), o = e.apiVersion ?? Pt.apiVersion, r = Number(a.ccall("usd_probe_api_version", "number", [], []));
|
|
813
815
|
if (r !== o)
|
|
@@ -815,108 +817,108 @@ async function Yt(e) {
|
|
|
815
817
|
new Error(`OpenUSD runtime API mismatch: expected ${o}, received ${r}.`),
|
|
816
818
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
817
819
|
);
|
|
818
|
-
const c = e.memfsRoot ?? "/asset", i = e.fetchBytes ?? (async (
|
|
819
|
-
const d = await fetch(
|
|
820
|
-
if (!d.ok) throw Object.assign(new Error(`USD resource request failed (${d.status}): ${
|
|
820
|
+
const c = e.memfsRoot ?? "/asset", i = e.fetchBytes ?? (async (g) => {
|
|
821
|
+
const d = await fetch(g);
|
|
822
|
+
if (!d.ok) throw Object.assign(new Error(`USD resource request failed (${d.status}): ${g}`), {
|
|
821
823
|
code: d.status === 401 || d.status === 403 ? "E_ASSET_AUTH" : "E_ASSET_FETCH"
|
|
822
824
|
});
|
|
823
|
-
const m = new Uint8Array(await d.arrayBuffer()),
|
|
824
|
-
if (
|
|
825
|
+
const m = new Uint8Array(await d.arrayBuffer()), b = st(d.headers.get("content-type"), m);
|
|
826
|
+
if (b) throw et(`USD resource is not usable (${b}): ${g}`, Ne);
|
|
825
827
|
return m;
|
|
826
|
-
}),
|
|
827
|
-
let
|
|
828
|
+
}), f = (g, d, m) => JSON.parse(a.ccall(g, "string", d, m)), p = /* @__PURE__ */ new Set(), y = Ie(a);
|
|
829
|
+
let l = 0, u = null;
|
|
828
830
|
async function h() {
|
|
829
|
-
return
|
|
830
|
-
const
|
|
831
|
-
a.FS.mkdirTree(
|
|
831
|
+
return u || (u = (async () => {
|
|
832
|
+
const g = `${c}/__viewer_warmup__`, d = `${g}/empty.usda`;
|
|
833
|
+
a.FS.mkdirTree(g), a.FS.writeFile(d, new TextEncoder().encode(`#usda 1.0
|
|
832
834
|
`));
|
|
833
835
|
let m;
|
|
834
836
|
try {
|
|
835
|
-
const
|
|
836
|
-
if (
|
|
837
|
-
throw new Error(
|
|
838
|
-
m =
|
|
837
|
+
const b = f("usd_probe_stage_open", ["string"], [d]);
|
|
838
|
+
if (b.ok !== !0 || b.stageId === void 0)
|
|
839
|
+
throw new Error(b.error ?? "Failed to initialize the USD Stage runtime.");
|
|
840
|
+
m = b.stageId;
|
|
839
841
|
} finally {
|
|
840
|
-
m !== void 0 &&
|
|
842
|
+
m !== void 0 && f("usd_probe_stage_release", ["number"], [m]), a.FS.analyzePath(d, !0).exists && a.FS.unlink(d);
|
|
841
843
|
}
|
|
842
|
-
})(),
|
|
844
|
+
})(), u);
|
|
843
845
|
}
|
|
844
|
-
async function
|
|
845
|
-
const m = new URL(d.sourcePath, "file:///"),
|
|
846
|
-
let
|
|
847
|
-
const
|
|
848
|
-
|
|
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(), F = d.readTextureBytes ?? !0, j = d.collectTextureUrls ?? !F, H = j || F ? Oe : sn, z = /* @__PURE__ */ new Map();
|
|
848
|
+
let S, D = null, U = null;
|
|
849
|
+
const N = () => {
|
|
850
|
+
S !== void 0 && p.delete(S) && f("usd_probe_stage_release", ["number"], [S]), D == null || D.dispose(), je(a.FS, b);
|
|
849
851
|
};
|
|
850
852
|
try {
|
|
851
|
-
const
|
|
852
|
-
|
|
853
|
-
for (const [E,
|
|
854
|
-
const
|
|
855
|
-
|
|
853
|
+
const P = await Pe(g);
|
|
854
|
+
he(a, _, P, R), x.set(_, H(P));
|
|
855
|
+
for (const [E, L] of Object.entries(d.files ?? {})) {
|
|
856
|
+
const q = Z(new URL(E, m).href, b), X = await Pe(L);
|
|
857
|
+
R.has(q) || x.set(q, H(X)), he(a, q, X, R);
|
|
856
858
|
}
|
|
857
|
-
const
|
|
859
|
+
const T = new Set(R);
|
|
858
860
|
for (const E of d.packagePaths ?? [])
|
|
859
|
-
|
|
860
|
-
const v = d.externalReferenceMode ?? "complete", I =
|
|
861
|
-
let
|
|
861
|
+
T.add(Z(new URL(E, m).href, b));
|
|
862
|
+
const v = d.externalReferenceMode ?? "complete", I = ht(P) ? await pt(P, { include: De }) : null;
|
|
863
|
+
let A = {}, k, M;
|
|
862
864
|
if (!I && d.autoResolveAssets !== !1) {
|
|
863
|
-
const E = d.resolveBytes ?? ((
|
|
865
|
+
const E = d.resolveBytes ?? ((q) => i(q)), L = await tn(
|
|
864
866
|
a,
|
|
865
867
|
m,
|
|
866
|
-
|
|
868
|
+
b,
|
|
867
869
|
E,
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
870
|
+
f,
|
|
871
|
+
R,
|
|
872
|
+
z,
|
|
873
|
+
j ? O : null,
|
|
874
|
+
x,
|
|
873
875
|
d.maxFiles ?? 1024,
|
|
874
876
|
d.maxDepth ?? 8,
|
|
875
877
|
d.maxConcurrency ?? 1,
|
|
876
878
|
v,
|
|
877
|
-
|
|
879
|
+
T,
|
|
878
880
|
F,
|
|
879
881
|
d,
|
|
880
882
|
d.onReferenceSkipped,
|
|
881
883
|
d.onResourceFailed
|
|
882
884
|
);
|
|
883
|
-
|
|
885
|
+
A = L.mappings, k = L.opened, M = L.variantConfiguration;
|
|
884
886
|
} else {
|
|
885
|
-
if (
|
|
886
|
-
|
|
887
|
+
if (k = Object.keys(A).length > 0 ? f("usd_probe_stage_open_mapped", ["string", "string"], [_, JSON.stringify(A)]) : f("usd_probe_stage_open", ["string"], [_]), !k.ok) throw new Error(k.error ?? `Failed to open ${_}`);
|
|
888
|
+
M = ke(a, k, d, !0);
|
|
887
889
|
}
|
|
888
|
-
|
|
889
|
-
const
|
|
890
|
-
var
|
|
891
|
-
return ((
|
|
890
|
+
D = I ? gt(I) : null;
|
|
891
|
+
const $ = d.textureResolver || D ? (E) => {
|
|
892
|
+
var L;
|
|
893
|
+
return ((L = d.textureResolver) == null ? void 0 : L.call(d, E)) ?? (D == null ? void 0 : D.resolve(E)) ?? null;
|
|
892
894
|
} : void 0;
|
|
893
|
-
|
|
894
|
-
const { discoveredVariants:
|
|
895
|
+
S = k.stageId, p.add(k.stageId);
|
|
896
|
+
const { discoveredVariants: C, selections: J } = M, W = Ie(a, z, _), V = W.openStage(k.stageId), ae = await en(a, k.stageId, _, {
|
|
895
897
|
batchSize: d.geometryBatchSize,
|
|
896
898
|
onProgress: d.onGeometryProgress
|
|
897
899
|
});
|
|
898
|
-
|
|
899
|
-
const
|
|
900
|
+
Fe(ae.materials, z, m), Le(ae.materials, z);
|
|
901
|
+
const Ve = new Map(J.map((E) => [
|
|
900
902
|
`${E.primPath}\0${E.setName}`,
|
|
901
903
|
E.selection
|
|
902
|
-
])),
|
|
904
|
+
])), Ge = C.map((E) => ({
|
|
903
905
|
...E,
|
|
904
|
-
selection:
|
|
905
|
-
})),
|
|
906
|
-
const
|
|
907
|
-
return
|
|
908
|
-
} : void 0),
|
|
906
|
+
selection: Ve.get(`${E.primPath}\0${E.setName}`) ?? E.selection
|
|
907
|
+
})), ie = jt(ae, Ge), pe = d.isTextureAllowed ?? (v === "package" ? (E) => {
|
|
908
|
+
const L = new URL(E, m);
|
|
909
|
+
return T.has(Z(L.href, b)) || Re(L, m);
|
|
910
|
+
} : void 0), ge = I ? void 0 : pe ? (E) => O.has(E) || pe(E) : O.size > 0 ? (E) => O.has(E) : void 0;
|
|
909
911
|
return {
|
|
910
|
-
data:
|
|
911
|
-
pxr:
|
|
912
|
-
stage:
|
|
912
|
+
data: ie,
|
|
913
|
+
pxr: W,
|
|
914
|
+
stage: V,
|
|
913
915
|
entryPath: _,
|
|
914
|
-
textureURLs:
|
|
915
|
-
...
|
|
916
|
+
textureURLs: O,
|
|
917
|
+
...D ? { packageTextures: D } : {},
|
|
916
918
|
buildModel: async () => {
|
|
917
|
-
const { createUSDLoadedModel: E } = await import("@openusd-wasm/three-loader"),
|
|
918
|
-
|
|
919
|
-
|
|
919
|
+
const { createUSDLoadedModel: E } = await import("@openusd-wasm/three-loader"), L = () => E(
|
|
920
|
+
ie,
|
|
921
|
+
W,
|
|
920
922
|
_,
|
|
921
923
|
{
|
|
922
924
|
sourcePath: d.sourcePath,
|
|
@@ -928,24 +930,24 @@ async function Yt(e) {
|
|
|
928
930
|
loadTextures: d.loadTextures ?? !0,
|
|
929
931
|
...d.textureLoader ? { textureLoader: d.textureLoader } : {},
|
|
930
932
|
...d.textureCache ? { textureCache: d.textureCache } : {},
|
|
931
|
-
|
|
933
|
+
...$ ? { textureResolver: $ } : {}
|
|
932
934
|
},
|
|
933
|
-
|
|
935
|
+
V,
|
|
934
936
|
{
|
|
935
937
|
// Keep package texture identities on the model so the visual adapter
|
|
936
938
|
// can resolve textures referenced by unsupported-but-known MDL nodes.
|
|
937
|
-
usdzTextureURLs: (
|
|
939
|
+
usdzTextureURLs: (D == null ? void 0 : D.urls) ?? /* @__PURE__ */ new Map(),
|
|
938
940
|
autoTextureURLs: /* @__PURE__ */ new Map()
|
|
939
941
|
}
|
|
940
|
-
),
|
|
941
|
-
() =>
|
|
942
|
-
),
|
|
943
|
-
|
|
944
|
-
const
|
|
945
|
-
let
|
|
946
|
-
return
|
|
947
|
-
|
|
948
|
-
},
|
|
942
|
+
), q = Zt(
|
|
943
|
+
() => ge ? We(ie.materials, ge, L) : L()
|
|
944
|
+
), X = q.value;
|
|
945
|
+
Yt(X, q.warnings), X.usdQuery = xe(V, W);
|
|
946
|
+
const Be = X.dispose.bind(X);
|
|
947
|
+
let me = !1;
|
|
948
|
+
return X.dispose = () => {
|
|
949
|
+
me || (me = !0, Be(), N());
|
|
950
|
+
}, X;
|
|
949
951
|
},
|
|
950
952
|
readPhysics() {
|
|
951
953
|
return U || (U = (async () => {
|
|
@@ -954,39 +956,39 @@ async function Yt(e) {
|
|
|
954
956
|
new Error("USD physics phase requires the matching packaged openusd_probe runtime."),
|
|
955
957
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
956
958
|
);
|
|
957
|
-
const E =
|
|
959
|
+
const E = f("usd_probe_scene_physics", ["number"], [k.stageId]);
|
|
958
960
|
if (E.ok !== !0) throw new Error(String(E.error ?? "Failed to extract USD physics."));
|
|
959
961
|
return E;
|
|
960
962
|
})(), U);
|
|
961
963
|
},
|
|
962
|
-
release:
|
|
964
|
+
release: N
|
|
963
965
|
};
|
|
964
|
-
} catch (
|
|
965
|
-
throw
|
|
966
|
+
} catch (P) {
|
|
967
|
+
throw N(), P;
|
|
966
968
|
}
|
|
967
969
|
}
|
|
968
970
|
return {
|
|
969
971
|
runtime: a,
|
|
970
|
-
pxr:
|
|
972
|
+
pxr: y,
|
|
971
973
|
warmup: h,
|
|
972
|
-
async parseAsync(
|
|
973
|
-
const m = await
|
|
974
|
+
async parseAsync(g, d) {
|
|
975
|
+
const m = await w(g, d);
|
|
974
976
|
try {
|
|
975
|
-
return
|
|
976
|
-
} catch (
|
|
977
|
-
throw m.release(),
|
|
977
|
+
return Vt(m.data, await m.readPhysics()), await m.buildModel();
|
|
978
|
+
} catch (b) {
|
|
979
|
+
throw m.release(), b;
|
|
978
980
|
}
|
|
979
981
|
},
|
|
980
|
-
async parseVisualSceneAsync(
|
|
981
|
-
return await
|
|
982
|
+
async parseVisualSceneAsync(g, d) {
|
|
983
|
+
return await w(g, d);
|
|
982
984
|
}
|
|
983
985
|
};
|
|
984
986
|
}
|
|
985
|
-
function
|
|
986
|
-
const s = (
|
|
987
|
+
function Ie(e, t = /* @__PURE__ */ new Map(), n) {
|
|
988
|
+
const s = (l, u, h) => JSON.parse(e.ccall(l, "string", u, h));
|
|
987
989
|
class a {
|
|
988
|
-
constructor(
|
|
989
|
-
this.path =
|
|
990
|
+
constructor(u) {
|
|
991
|
+
this.path = u;
|
|
990
992
|
}
|
|
991
993
|
GetString() {
|
|
992
994
|
return this.path;
|
|
@@ -995,146 +997,146 @@ function ve(e, t = /* @__PURE__ */ new Map(), n) {
|
|
|
995
997
|
}
|
|
996
998
|
}
|
|
997
999
|
let o;
|
|
998
|
-
const r = /* @__PURE__ */ new Map(), c = (
|
|
1000
|
+
const r = /* @__PURE__ */ new Map(), c = (l, u) => {
|
|
999
1001
|
if (!o) {
|
|
1000
|
-
const
|
|
1001
|
-
if (n && typeof
|
|
1002
|
+
const b = e._usd_probe_flatten_stage;
|
|
1003
|
+
if (n && typeof b == "function") {
|
|
1002
1004
|
const _ = e.ccall("usd_probe_flatten_stage", "string", ["string"], [n]);
|
|
1003
1005
|
if (typeof _ != "string" || !_.startsWith("#usda")) throw new Error("Unable to read flattened USD joint metadata");
|
|
1004
|
-
o =
|
|
1006
|
+
o = Tt(_);
|
|
1005
1007
|
} else
|
|
1006
1008
|
o = /* @__PURE__ */ new Map();
|
|
1007
1009
|
}
|
|
1008
|
-
const h = o.get(
|
|
1009
|
-
if (h || r.has(
|
|
1010
|
-
const
|
|
1011
|
-
for (const
|
|
1012
|
-
const _ = `physxMimicJoint:${
|
|
1013
|
-
|
|
1010
|
+
const h = o.get(u);
|
|
1011
|
+
if (h || r.has(u)) return h ?? r.get(u);
|
|
1012
|
+
const w = ["rotX", "rotY", "rotZ", "transX", "transY", "transZ", "X", "Y", "Z"], g = [], d = /* @__PURE__ */ new Map();
|
|
1013
|
+
for (const b of w) {
|
|
1014
|
+
const _ = `physxMimicJoint:${b}:referenceJoint`, R = s("usd_probe_relationship_targets", ["number", "string", "string"], [l, u, _]).paths ?? [];
|
|
1015
|
+
R.length && (g.push(`PhysxMimicJointAPI:${b}`), d.set(_, R));
|
|
1014
1016
|
}
|
|
1015
|
-
const m =
|
|
1016
|
-
return m && r.set(
|
|
1017
|
-
}, i = (
|
|
1018
|
-
let
|
|
1019
|
-
const
|
|
1017
|
+
const m = g.length ? { schemas: g, relationships: d } : void 0;
|
|
1018
|
+
return m && r.set(u, m), m;
|
|
1019
|
+
}, i = (l, u, h) => {
|
|
1020
|
+
let w = null;
|
|
1021
|
+
const g = () => w ?? (w = s(
|
|
1020
1022
|
"usd_probe_attribute_value",
|
|
1021
1023
|
["number", "string", "string"],
|
|
1022
|
-
[
|
|
1024
|
+
[l, u, h]
|
|
1023
1025
|
));
|
|
1024
1026
|
return {
|
|
1025
|
-
IsValid: () =>
|
|
1027
|
+
IsValid: () => g().valid === !0,
|
|
1026
1028
|
Get: () => {
|
|
1027
|
-
const d =
|
|
1029
|
+
const d = g();
|
|
1028
1030
|
return d.valid === !0 ? typeof d.value == "string" ? t.get(d.value) ?? d.value : d.value : null;
|
|
1029
1031
|
},
|
|
1030
|
-
HasAuthoredValue: () =>
|
|
1032
|
+
HasAuthoredValue: () => g().authored === !0,
|
|
1031
1033
|
GetName: () => h,
|
|
1032
1034
|
GetMetadata: (d) => {
|
|
1033
|
-
const m = s("usd_probe_attribute_metadata", ["number", "string", "string", "string"], [
|
|
1035
|
+
const m = s("usd_probe_attribute_metadata", ["number", "string", "string", "string"], [l, u, h, d]);
|
|
1034
1036
|
return m.valid === !0 && m.found === !0 ? m.value ?? null : null;
|
|
1035
1037
|
},
|
|
1036
1038
|
// The viewer accepts either plain strings or objects with GetString().
|
|
1037
|
-
GetConnections: () => s("usd_probe_attribute_connections", ["number", "string", "string"], [
|
|
1039
|
+
GetConnections: () => s("usd_probe_attribute_connections", ["number", "string", "string"], [l, u, h]).paths ?? [],
|
|
1038
1040
|
delete: () => {
|
|
1039
1041
|
}
|
|
1040
1042
|
};
|
|
1041
|
-
},
|
|
1042
|
-
__path:
|
|
1043
|
-
__stageId:
|
|
1044
|
-
IsValid: () => s("usd_probe_prim_info", ["number", "string"], [
|
|
1045
|
-
GetName: () => String(
|
|
1046
|
-
GetPath: () => new a(
|
|
1047
|
-
GetTypeName: () => String(s("usd_probe_prim_info", ["number", "string"], [
|
|
1048
|
-
IsInstance: () => s("usd_probe_prim_info", ["number", "string"], [
|
|
1043
|
+
}, f = (l, u) => ({
|
|
1044
|
+
__path: u,
|
|
1045
|
+
__stageId: l,
|
|
1046
|
+
IsValid: () => s("usd_probe_prim_info", ["number", "string"], [l, u]).valid === !0,
|
|
1047
|
+
GetName: () => String(u.split("/").pop() ?? ""),
|
|
1048
|
+
GetPath: () => new a(u),
|
|
1049
|
+
GetTypeName: () => String(s("usd_probe_prim_info", ["number", "string"], [l, u]).typeName ?? ""),
|
|
1050
|
+
IsInstance: () => s("usd_probe_prim_info", ["number", "string"], [l, u]).instance === !0,
|
|
1049
1051
|
GetAppliedSchemas: () => {
|
|
1050
1052
|
var h;
|
|
1051
|
-
return ((h = c(
|
|
1053
|
+
return ((h = c(l, u)) == null ? void 0 : h.schemas) ?? [];
|
|
1052
1054
|
},
|
|
1053
1055
|
GetRelationships: () => {
|
|
1054
1056
|
var h;
|
|
1055
|
-
return [...((h = c(
|
|
1056
|
-
GetName: () =>
|
|
1057
|
-
GetTargets: () =>
|
|
1057
|
+
return [...((h = c(l, u)) == null ? void 0 : h.relationships) ?? []].map(([w, g]) => ({
|
|
1058
|
+
GetName: () => w,
|
|
1059
|
+
GetTargets: () => g.map((d) => new a(d)),
|
|
1058
1060
|
delete: () => {
|
|
1059
1061
|
}
|
|
1060
1062
|
}));
|
|
1061
1063
|
},
|
|
1062
|
-
GetAttribute: (h) => i(
|
|
1063
|
-
GetAttributes: () => (s("usd_probe_prim_attributes", ["number", "string"], [
|
|
1064
|
-
GetChildren: () => (s("usd_probe_prim_children", ["number", "string"], [
|
|
1064
|
+
GetAttribute: (h) => i(l, u, h),
|
|
1065
|
+
GetAttributes: () => (s("usd_probe_prim_attributes", ["number", "string"], [l, u]).names ?? []).map((h) => i(l, u, h)),
|
|
1066
|
+
GetChildren: () => (s("usd_probe_prim_children", ["number", "string"], [l, u]).paths ?? []).map((h) => f(l, h)),
|
|
1065
1067
|
GetRelationship: (h) => {
|
|
1066
|
-
const
|
|
1068
|
+
const w = s(
|
|
1067
1069
|
"usd_probe_relationship_targets",
|
|
1068
1070
|
["number", "string", "string"],
|
|
1069
|
-
[
|
|
1071
|
+
[l, u, h]
|
|
1070
1072
|
).paths ?? [];
|
|
1071
1073
|
return {
|
|
1072
1074
|
GetName: () => h,
|
|
1073
|
-
GetTargets: () =>
|
|
1075
|
+
GetTargets: () => w.map((g) => new a(g)),
|
|
1074
1076
|
delete: () => {
|
|
1075
1077
|
}
|
|
1076
1078
|
};
|
|
1077
1079
|
},
|
|
1078
1080
|
GetMetadata: (h) => {
|
|
1079
|
-
const
|
|
1080
|
-
return
|
|
1081
|
+
const w = s("usd_probe_prim_metadata", ["number", "string", "string"], [l, u, h]);
|
|
1082
|
+
return w.valid !== !0 ? null : typeof w.text == "string" ? w.text : w.found === !0 ? w.value : null;
|
|
1081
1083
|
},
|
|
1082
1084
|
delete: () => {
|
|
1083
1085
|
}
|
|
1084
|
-
}), p = (
|
|
1085
|
-
GetPrimAtPath: (
|
|
1086
|
-
GetPseudoRoot: () => Object.assign(l
|
|
1086
|
+
}), p = (l) => ({
|
|
1087
|
+
GetPrimAtPath: (u) => f(l, typeof u == "string" ? u : u.path),
|
|
1088
|
+
GetPseudoRoot: () => Object.assign(f(l, "/"), {
|
|
1087
1089
|
// Stage-level metadata (metersPerUnit, upAxis, defaultPrim) is authored on
|
|
1088
1090
|
// the layer, not composed onto the pseudo-root prim.
|
|
1089
|
-
GetMetadata: (
|
|
1090
|
-
const h = s("usd_probe_stage_metadata", ["number", "string"], [
|
|
1091
|
+
GetMetadata: (u) => {
|
|
1092
|
+
const h = s("usd_probe_stage_metadata", ["number", "string"], [l, u]);
|
|
1091
1093
|
return h.found === !0 ? h.value : null;
|
|
1092
1094
|
},
|
|
1093
1095
|
GetName: () => "",
|
|
1094
1096
|
IsValid: () => !0
|
|
1095
1097
|
}),
|
|
1096
|
-
GetDescendants: (
|
|
1098
|
+
GetDescendants: (u, h = "") => s(
|
|
1097
1099
|
"usd_probe_prim_descendants",
|
|
1098
1100
|
["number", "string", "string"],
|
|
1099
|
-
[
|
|
1101
|
+
[l, u, h]
|
|
1100
1102
|
).paths ?? [],
|
|
1101
1103
|
delete: () => {
|
|
1102
1104
|
}
|
|
1103
|
-
}), { FS:
|
|
1105
|
+
}), { FS: y } = e;
|
|
1104
1106
|
return {
|
|
1105
1107
|
FS: {
|
|
1106
|
-
createDir: (
|
|
1107
|
-
writeFile: (
|
|
1108
|
-
exists: (
|
|
1109
|
-
listDir: (
|
|
1110
|
-
const h = `${
|
|
1111
|
-
return { path: h, name:
|
|
1108
|
+
createDir: (l) => y.mkdirTree(l),
|
|
1109
|
+
writeFile: (l, u) => y.writeFile(l, u),
|
|
1110
|
+
exists: (l) => y.analyzePath(l, !0).exists,
|
|
1111
|
+
listDir: (l) => y.readdir(l).filter((u) => u !== "." && u !== "..").map((u) => {
|
|
1112
|
+
const h = `${l.replace(/\/+$/, "")}/${u}`;
|
|
1113
|
+
return { path: h, name: u, isDir: y.isDir(y.stat(h).mode) };
|
|
1112
1114
|
}),
|
|
1113
|
-
deleteFile: (
|
|
1114
|
-
deleteDir: (
|
|
1115
|
+
deleteFile: (l) => y.unlink(l),
|
|
1116
|
+
deleteDir: (l) => y.rmdir(l)
|
|
1115
1117
|
},
|
|
1116
1118
|
Sdf: { Path: a },
|
|
1117
1119
|
Usd: { TimeCode: { Default: () => ({ delete: () => {
|
|
1118
1120
|
} }) } },
|
|
1119
1121
|
UsdShade: {
|
|
1120
|
-
ComputeBoundMaterialPath: (
|
|
1121
|
-
const
|
|
1122
|
-
return
|
|
1123
|
-
materialPath: String(
|
|
1124
|
-
resolvedTargetPath: String(
|
|
1125
|
-
bindingRelationshipPath: String(
|
|
1122
|
+
ComputeBoundMaterialPath: (l) => {
|
|
1123
|
+
const u = s("usd_probe_bound_material", ["number", "string"], [l.__stageId, l.__path]);
|
|
1124
|
+
return u.found !== !0 ? null : {
|
|
1125
|
+
materialPath: String(u.materialPath ?? ""),
|
|
1126
|
+
resolvedTargetPath: String(u.resolvedTargetPath ?? ""),
|
|
1127
|
+
bindingRelationshipPath: String(u.bindingRelationshipPath ?? "")
|
|
1126
1128
|
};
|
|
1127
1129
|
}
|
|
1128
1130
|
},
|
|
1129
1131
|
UsdUtils: {
|
|
1130
|
-
ExtractSanitizedExternalReferences: (
|
|
1132
|
+
ExtractSanitizedExternalReferences: (l) => s("usd_probe_external_references", ["string"], [l]).paths ?? []
|
|
1131
1133
|
},
|
|
1132
1134
|
openStage: p
|
|
1133
1135
|
};
|
|
1134
1136
|
}
|
|
1135
|
-
async function
|
|
1136
|
-
var
|
|
1137
|
-
if (typeof e._usd_probe_scene_visual != "function" || typeof e._usd_probe_scene_geometry != "function" || typeof e._usd_probe_scene_geometry_end != "function")
|
|
1137
|
+
async function en(e, t, n, s = {}) {
|
|
1138
|
+
var f, p, y;
|
|
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")
|
|
1138
1140
|
throw Object.assign(
|
|
1139
1141
|
new Error("USD visual phases require the matching packaged openusd_probe runtime."),
|
|
1140
1142
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
@@ -1148,36 +1150,101 @@ async function Kt(e, t, n, s = {}) {
|
|
|
1148
1150
|
if (a.error) throw new Error(a.error);
|
|
1149
1151
|
const o = a, r = Math.max(1, Math.floor(s.batchSize ?? 8));
|
|
1150
1152
|
try {
|
|
1151
|
-
for (const [
|
|
1152
|
-
const
|
|
1153
|
-
if (!Number.isInteger(
|
|
1154
|
-
throw new Error(`USD scene geometry is missing a stream index for ${
|
|
1155
|
-
const
|
|
1153
|
+
for (const [l, u] of o.elements.entries()) {
|
|
1154
|
+
const w = u.geometry.streamIndex;
|
|
1155
|
+
if (!Number.isInteger(w))
|
|
1156
|
+
throw new Error(`USD scene geometry is missing a stream index for ${u.path}`);
|
|
1157
|
+
const g = JSON.parse(e.ccall(
|
|
1156
1158
|
"usd_probe_scene_geometry",
|
|
1157
1159
|
"string",
|
|
1158
1160
|
["number", "number"],
|
|
1159
|
-
[t,
|
|
1161
|
+
[t, w]
|
|
1160
1162
|
));
|
|
1161
|
-
if (!
|
|
1162
|
-
|
|
1163
|
-
Object.entries(
|
|
1164
|
-
), (
|
|
1163
|
+
if (!g.ok) throw new Error(g.error ?? `Failed to stream USD geometry for ${u.path}`);
|
|
1164
|
+
u.geometry = Object.fromEntries(
|
|
1165
|
+
Object.entries(g.geometry ?? {}).map(([d, m]) => [d, G(e, m)])
|
|
1166
|
+
), (f = s.onProgress) == null || f.call(s, l + 1, o.elements.length, u.path), (l + 1) % r === 0 && await fe();
|
|
1165
1167
|
}
|
|
1166
1168
|
} finally {
|
|
1167
1169
|
e.ccall("usd_probe_scene_geometry_end", "string", ["number"], [t]);
|
|
1168
1170
|
}
|
|
1169
|
-
|
|
1171
|
+
const c = [];
|
|
1172
|
+
try {
|
|
1173
|
+
for (const [l, u] of o.pointClouds.entries()) {
|
|
1174
|
+
const h = u.geometry.streamIndex;
|
|
1175
|
+
if (!Number.isInteger(h))
|
|
1176
|
+
throw new Error(`USD point-cloud geometry is missing a stream index for ${u.path}`);
|
|
1177
|
+
const w = JSON.parse(e.ccall(
|
|
1178
|
+
"usd_probe_scene_point_cloud",
|
|
1179
|
+
"string",
|
|
1180
|
+
["number", "number"],
|
|
1181
|
+
[t, h]
|
|
1182
|
+
));
|
|
1183
|
+
if (!w.ok)
|
|
1184
|
+
throw new Error(w.error ?? `Failed to stream USD point-cloud geometry for ${u.path}`);
|
|
1185
|
+
const g = w.geometry ?? {}, d = G(e, g.positions), m = G(e, g.widths), b = G(e, g.normals), _ = G(e, g.intensities), R = G(e, g.displayColor), x = G(e, g.displayOpacity);
|
|
1186
|
+
if (!(d instanceof Float32Array) || !(m instanceof Float32Array) || b !== null && !(b instanceof Float32Array) || _ !== null && !(_ instanceof Float32Array) || x !== null && !(x instanceof Float32Array) || R !== null && !(R instanceof Float32Array))
|
|
1187
|
+
throw new Error(`USD point-cloud geometry has invalid typed buffers: ${u.path}`);
|
|
1188
|
+
c.push({ path: u.path, positions: d, widths: m, normals: b, intensities: _, displayColor: R, displayOpacity: x }), (p = s.onProgress) == null || p.call(
|
|
1189
|
+
s,
|
|
1190
|
+
o.elements.length + l + 1,
|
|
1191
|
+
o.elements.length + o.pointClouds.length,
|
|
1192
|
+
u.path
|
|
1193
|
+
), (l + 1) % r === 0 && await fe();
|
|
1194
|
+
}
|
|
1195
|
+
} finally {
|
|
1196
|
+
e.ccall("usd_probe_scene_point_clouds_end", "string", ["number"], [t]);
|
|
1197
|
+
}
|
|
1198
|
+
const i = [];
|
|
1199
|
+
try {
|
|
1200
|
+
for (const [l, u] of o.gaussianSplats.entries()) {
|
|
1201
|
+
const h = u.geometry.streamIndex;
|
|
1202
|
+
if (!Number.isInteger(h))
|
|
1203
|
+
throw new Error(`USD Gaussian geometry is missing a stream index for ${u.path}`);
|
|
1204
|
+
const w = JSON.parse(e.ccall(
|
|
1205
|
+
"usd_probe_scene_gaussian",
|
|
1206
|
+
"string",
|
|
1207
|
+
["number", "number"],
|
|
1208
|
+
[t, h]
|
|
1209
|
+
));
|
|
1210
|
+
if (!w.ok)
|
|
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), F = Number(g.shDegree), j = g.worldMatrix;
|
|
1213
|
+
if (!Number.isSafeInteger(O) || O <= 0 || ![0, 1, 2, 3].includes(F) || !(d instanceof Float32Array) || !(m instanceof Float32Array) || !(b instanceof Float32Array) || !(_ instanceof Float32Array) || !(R instanceof Float32Array) || x !== null && !(x instanceof Float32Array) || !Array.isArray(j) || j.length !== 16 || j.some((H) => typeof H != "number" || !Number.isFinite(H)))
|
|
1214
|
+
throw new Error(`USD Gaussian geometry has invalid typed buffers: ${u.path}`);
|
|
1215
|
+
i.push({
|
|
1216
|
+
path: u.path,
|
|
1217
|
+
splatCount: O,
|
|
1218
|
+
shDegree: F,
|
|
1219
|
+
positions: d,
|
|
1220
|
+
scales: m,
|
|
1221
|
+
orientations: b,
|
|
1222
|
+
opacities: _,
|
|
1223
|
+
sphericalHarmonics: R,
|
|
1224
|
+
displayColor: x,
|
|
1225
|
+
worldMatrix: j
|
|
1226
|
+
}), (y = s.onProgress) == null || y.call(
|
|
1227
|
+
s,
|
|
1228
|
+
o.elements.length + o.pointClouds.length + l + 1,
|
|
1229
|
+
o.elements.length + o.pointClouds.length + o.gaussianSplats.length,
|
|
1230
|
+
u.path
|
|
1231
|
+
), (l + 1) % r === 0 && await fe();
|
|
1232
|
+
}
|
|
1233
|
+
} finally {
|
|
1234
|
+
e.ccall("usd_probe_scene_gaussians_end", "string", ["number"], [t]);
|
|
1235
|
+
}
|
|
1236
|
+
return { ...o, pointClouds: c, gaussianSplats: i };
|
|
1170
1237
|
}
|
|
1171
|
-
function
|
|
1238
|
+
function fe() {
|
|
1172
1239
|
return new Promise((e) => setTimeout(e, 0));
|
|
1173
1240
|
}
|
|
1174
|
-
function
|
|
1241
|
+
function G(e, t) {
|
|
1175
1242
|
if (!t || typeof t != "object") return t ?? null;
|
|
1176
1243
|
const { ptr: n, length: s, kind: a } = t;
|
|
1177
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();
|
|
1178
1245
|
}
|
|
1179
|
-
function
|
|
1180
|
-
const a = (
|
|
1246
|
+
function ke(e, t, n, s) {
|
|
1247
|
+
const a = (l, u, h) => JSON.parse(e.ccall(l, "string", u, h)), o = [...n.variantSelections ?? []];
|
|
1181
1248
|
let r = [];
|
|
1182
1249
|
if (n.selectMuJoCoPhysicsVariant !== !1) {
|
|
1183
1250
|
if (typeof e._usd_probe_stage_variants != "function")
|
|
@@ -1185,33 +1252,33 @@ function De(e, t, n, s) {
|
|
|
1185
1252
|
new Error("USD variant discovery requires the matching packaged openusd_probe runtime."),
|
|
1186
1253
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
1187
1254
|
);
|
|
1188
|
-
const
|
|
1189
|
-
if (
|
|
1190
|
-
throw new Error(String(
|
|
1191
|
-
r =
|
|
1255
|
+
const l = a("usd_probe_stage_variants", ["number"], [t.stageId]);
|
|
1256
|
+
if (l.ok !== !0)
|
|
1257
|
+
throw new Error(String(l.error ?? "Failed to enumerate USD variants."));
|
|
1258
|
+
r = l.variants ?? [];
|
|
1192
1259
|
}
|
|
1193
|
-
const c = new Set(r.map(
|
|
1194
|
-
for (const
|
|
1195
|
-
p.set(
|
|
1196
|
-
let
|
|
1197
|
-
for (const
|
|
1198
|
-
const
|
|
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 ? [] : kt(r, i), p = /* @__PURE__ */ new Map();
|
|
1261
|
+
for (const l of [...i, ...f])
|
|
1262
|
+
p.set(Y(l), l);
|
|
1263
|
+
let y = [];
|
|
1264
|
+
for (const l of p.values()) {
|
|
1265
|
+
const u = a(
|
|
1199
1266
|
"usd_probe_stage_set_variant",
|
|
1200
1267
|
["number", "string", "string", "string"],
|
|
1201
|
-
[t.stageId,
|
|
1268
|
+
[t.stageId, l.primPath, l.setName, l.selection]
|
|
1202
1269
|
);
|
|
1203
|
-
if (
|
|
1204
|
-
|
|
1270
|
+
if (u.ok === !0)
|
|
1271
|
+
y.push(l);
|
|
1205
1272
|
else if (s)
|
|
1206
|
-
throw new Error(String(
|
|
1273
|
+
throw new Error(String(u.error ?? `Failed to select USD variant ${l.primPath}:${l.setName}=${l.selection}`));
|
|
1207
1274
|
}
|
|
1208
1275
|
if (n.selectMuJoCoPhysicsVariant !== !1) {
|
|
1209
|
-
const
|
|
1210
|
-
for (const h of
|
|
1211
|
-
const
|
|
1212
|
-
if (
|
|
1213
|
-
const
|
|
1214
|
-
if (!(
|
|
1276
|
+
const l = new Set(i.map(Y)), u = /* @__PURE__ */ new Set();
|
|
1277
|
+
for (const h of y) {
|
|
1278
|
+
const w = Y(h);
|
|
1279
|
+
if (l.has(w)) continue;
|
|
1280
|
+
const g = r.find((b) => b.primPath === h.primPath && b.setName === h.setName);
|
|
1281
|
+
if (!(g != null && g.selection) || g.selection === h.selection) continue;
|
|
1215
1282
|
const d = a(
|
|
1216
1283
|
"usd_probe_prim_descendants",
|
|
1217
1284
|
["number", "string", "string"],
|
|
@@ -1225,146 +1292,146 @@ function De(e, t, n, s) {
|
|
|
1225
1292
|
const m = a(
|
|
1226
1293
|
"usd_probe_stage_set_variant",
|
|
1227
1294
|
["number", "string", "string", "string"],
|
|
1228
|
-
[t.stageId, h.primPath, h.setName,
|
|
1295
|
+
[t.stageId, h.primPath, h.setName, g.selection]
|
|
1229
1296
|
);
|
|
1230
1297
|
if (m.ok !== !0)
|
|
1231
|
-
throw new Error(String(m.error ?? `Failed to restore authored USD variant ${h.primPath}:${h.setName}=${
|
|
1232
|
-
|
|
1298
|
+
throw new Error(String(m.error ?? `Failed to restore authored USD variant ${h.primPath}:${h.setName}=${g.selection}`));
|
|
1299
|
+
u.add(w);
|
|
1233
1300
|
}
|
|
1234
|
-
|
|
1301
|
+
u.size > 0 && (y = y.filter((h) => !u.has(Y(h))));
|
|
1235
1302
|
}
|
|
1236
|
-
return { discoveredVariants: r, selections:
|
|
1237
|
-
}
|
|
1238
|
-
async function tn(e, t, n, s, a, o, r, c, i,
|
|
1239
|
-
const m = {},
|
|
1240
|
-
r.set(_,
|
|
1241
|
-
const
|
|
1242
|
-
const
|
|
1243
|
-
if (
|
|
1303
|
+
return { discoveredVariants: r, selections: y };
|
|
1304
|
+
}
|
|
1305
|
+
async function tn(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 = $e(t.href, t), x = /* @__PURE__ */ new Set([R]), O = /* @__PURE__ */ new Map([[_, 0]]), F = /* @__PURE__ */ new Set([_]);
|
|
1307
|
+
r.set(_, R);
|
|
1308
|
+
const j = /* @__PURE__ */ new Set(), H = () => {
|
|
1309
|
+
const S = Object.keys(m).length > 0;
|
|
1310
|
+
if (S && typeof e._usd_probe_stage_open_mapped != "function")
|
|
1244
1311
|
throw Object.assign(
|
|
1245
1312
|
new Error("USD dependency mapping requires the matching packaged openusd_probe.js and .wasm runtime."),
|
|
1246
1313
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
1247
1314
|
);
|
|
1248
|
-
return
|
|
1249
|
-
},
|
|
1250
|
-
var
|
|
1251
|
-
const
|
|
1252
|
-
if (
|
|
1253
|
-
throw new Error(`Missing USD layer identity for ${
|
|
1254
|
-
const U = ((
|
|
1315
|
+
return S ? a("usd_probe_stage_open_mapped", ["string", "string"], [_, JSON.stringify(m)]) : a("usd_probe_stage_open", ["string"], [_]);
|
|
1316
|
+
}, z = (S) => {
|
|
1317
|
+
var J, W;
|
|
1318
|
+
const D = r.get(S.layer);
|
|
1319
|
+
if (D === void 0)
|
|
1320
|
+
throw new Error(`Missing USD layer identity for ${S.layer}`);
|
|
1321
|
+
const U = ((J = Object.entries(m[S.layer] ?? {}).find(([, V]) => V === S.path)) == null ? void 0 : J[0]) ?? S.path;
|
|
1255
1322
|
if (!U || /^(?:data|blob):/i.test(U) || /\.mdl(?:[?#].*)?$/i.test(U))
|
|
1256
1323
|
return null;
|
|
1257
|
-
const
|
|
1258
|
-
if (!
|
|
1259
|
-
const { resolved:
|
|
1260
|
-
if (
|
|
1261
|
-
const
|
|
1262
|
-
return m[
|
|
1324
|
+
const N = Ce(U, D, t);
|
|
1325
|
+
if (!N) return null;
|
|
1326
|
+
const { resolved: P, absolute: T, childIdentifier: v } = N, I = Z(P.href, n), A = at(I, b), k = (A == null ? void 0 : A.paths.length) === 1 ? A.paths[0] : null, M = k ?? I, $ = S.kind !== "resource" || rn(P.pathname), C = (O.get(S.layer) ?? 0) + 1;
|
|
1327
|
+
if (k && r.set(k, v), m[W = S.layer] ?? (m[W] = {}), S.kind === "resource" && l === "package" && A && A.paths.length > 1) {
|
|
1328
|
+
const V = `${n}/__deferred_udim__/${encodeURIComponent(v)}`;
|
|
1329
|
+
return m[S.layer][U] = V, r.set(V, v), null;
|
|
1263
1330
|
}
|
|
1264
|
-
if (
|
|
1265
|
-
const
|
|
1266
|
-
return m[
|
|
1331
|
+
if (l === "package" && !u.has(M) && !Re(P, t)) {
|
|
1332
|
+
const V = `${n}/__skipped__/${encodeURIComponent(v)}`;
|
|
1333
|
+
return m[S.layer][U] = V, r.set(V, v), j.has(v) || (j.add(v), g == null || g(v)), null;
|
|
1267
1334
|
}
|
|
1268
|
-
if (
|
|
1269
|
-
return m[
|
|
1270
|
-
if (m[
|
|
1271
|
-
return r.set(
|
|
1272
|
-
if (
|
|
1273
|
-
if (
|
|
1335
|
+
if (!$ && c && (c.set(v, P.href), c.set(U, P.href)), !$ && !h)
|
|
1336
|
+
return m[S.layer][U] = M, r.set(M, v), null;
|
|
1337
|
+
if (m[S.layer][U] = M, o.has(M))
|
|
1338
|
+
return r.set(M, v), O.set(M, C), $ && F.add(M), null;
|
|
1339
|
+
if (x.has(v)) return null;
|
|
1340
|
+
if (C > p)
|
|
1274
1341
|
throw new Error(`USD dependency depth limit exceeded (${p}): ${v}`);
|
|
1275
|
-
if (
|
|
1276
|
-
throw new Error(`USD dependency limit exceeded (${
|
|
1277
|
-
return
|
|
1342
|
+
if (x.size >= f)
|
|
1343
|
+
throw new Error(`USD dependency limit exceeded (${f}).`);
|
|
1344
|
+
return x.add(v), O.set(M, C), {
|
|
1278
1345
|
item: {
|
|
1279
|
-
url:
|
|
1280
|
-
depth:
|
|
1281
|
-
recurse:
|
|
1282
|
-
absolute:
|
|
1283
|
-
resource:
|
|
1284
|
-
owner: { path:
|
|
1346
|
+
url: P,
|
|
1347
|
+
depth: C,
|
|
1348
|
+
recurse: $,
|
|
1349
|
+
absolute: T,
|
|
1350
|
+
resource: S.kind === "resource",
|
|
1351
|
+
owner: { path: S.layer, reference: U }
|
|
1285
1352
|
},
|
|
1286
1353
|
identifier: v
|
|
1287
1354
|
};
|
|
1288
1355
|
};
|
|
1289
1356
|
for (; ; ) {
|
|
1290
|
-
const
|
|
1291
|
-
if (!
|
|
1292
|
-
let
|
|
1357
|
+
const S = H();
|
|
1358
|
+
if (!S.ok) throw new Error(S.error ?? `Failed to open ${_}`);
|
|
1359
|
+
let D, U = [];
|
|
1293
1360
|
try {
|
|
1294
|
-
if (
|
|
1361
|
+
if (D = ke(e, S, w, !1), typeof e._usd_probe_stage_external_references != "function")
|
|
1295
1362
|
throw Object.assign(
|
|
1296
1363
|
new Error("Variant-aware USD dependency discovery requires the matching packaged openusd_probe runtime."),
|
|
1297
1364
|
{ code: "E_USD_RUNTIME_VERSION" }
|
|
1298
1365
|
);
|
|
1299
|
-
const
|
|
1300
|
-
if (
|
|
1301
|
-
throw new Error(String(
|
|
1302
|
-
const
|
|
1303
|
-
for (const v of
|
|
1304
|
-
const I =
|
|
1366
|
+
const N = a("usd_probe_stage_external_references", ["number"], [S.stageId]);
|
|
1367
|
+
if (N.ok !== !0)
|
|
1368
|
+
throw new Error(String(N.error ?? "Failed to enumerate active USD dependencies."));
|
|
1369
|
+
const P = N.dependencies ?? [], T = /* @__PURE__ */ new Set();
|
|
1370
|
+
for (const v of P) {
|
|
1371
|
+
const I = z(v);
|
|
1305
1372
|
if (!I) continue;
|
|
1306
|
-
const
|
|
1307
|
-
|
|
1373
|
+
const A = `${I.item.url.href}\0${I.identifier}`;
|
|
1374
|
+
T.has(A) || (T.add(A), U.push(I));
|
|
1308
1375
|
}
|
|
1309
1376
|
if (U.length === 0) {
|
|
1310
1377
|
const v = /* @__PURE__ */ new Map();
|
|
1311
1378
|
for (const I of F) {
|
|
1312
1379
|
if (i.get(I) === !1) continue;
|
|
1313
|
-
const
|
|
1314
|
-
if (v.set(I,
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1380
|
+
const A = a("usd_probe_external_references", ["string"], [I]);
|
|
1381
|
+
if (v.set(I, A), A.hasVariantSets !== !1) continue;
|
|
1382
|
+
const k = new Set(
|
|
1383
|
+
A.compositionPaths ?? []
|
|
1317
1384
|
);
|
|
1318
|
-
for (const
|
|
1319
|
-
if (
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1385
|
+
for (const $ of A.subLayers ?? []) {
|
|
1386
|
+
if (!$) continue;
|
|
1387
|
+
const C = z({ kind: "sublayer", layer: I, path: $ });
|
|
1388
|
+
C && !U.some((J) => J.identifier === C.identifier) && U.push(C);
|
|
1322
1389
|
}
|
|
1323
|
-
const
|
|
1324
|
-
["reference",
|
|
1325
|
-
["payload",
|
|
1390
|
+
const M = [
|
|
1391
|
+
["reference", A.references],
|
|
1392
|
+
["payload", A.payloads]
|
|
1326
1393
|
];
|
|
1327
|
-
for (const [
|
|
1328
|
-
for (const
|
|
1329
|
-
if (!
|
|
1330
|
-
const
|
|
1331
|
-
|
|
1394
|
+
for (const [$, C] of M)
|
|
1395
|
+
for (const J of C ?? []) {
|
|
1396
|
+
if (!J || !k.has(J)) continue;
|
|
1397
|
+
const W = z({ kind: $, layer: I, path: J });
|
|
1398
|
+
W && !U.some((V) => V.identifier === W.identifier) && U.push(W);
|
|
1332
1399
|
}
|
|
1333
1400
|
}
|
|
1334
1401
|
if (U.length === 0)
|
|
1335
|
-
for (const [I,
|
|
1336
|
-
const
|
|
1337
|
-
|
|
1402
|
+
for (const [I, A] of v) {
|
|
1403
|
+
const k = new Set(
|
|
1404
|
+
A.compositionPaths ?? []
|
|
1338
1405
|
);
|
|
1339
|
-
for (const
|
|
1340
|
-
if (!
|
|
1341
|
-
const
|
|
1342
|
-
|
|
1406
|
+
for (const M of A.paths ?? []) {
|
|
1407
|
+
if (!M || k.has(M)) continue;
|
|
1408
|
+
const $ = z({ kind: "resource", layer: I, path: M });
|
|
1409
|
+
$ && !U.some((C) => C.identifier === $.identifier) && U.push($);
|
|
1343
1410
|
}
|
|
1344
1411
|
}
|
|
1345
1412
|
}
|
|
1346
|
-
} catch (
|
|
1347
|
-
throw a("usd_probe_stage_release", ["number"], [
|
|
1413
|
+
} catch (N) {
|
|
1414
|
+
throw a("usd_probe_stage_release", ["number"], [S.stageId]), N;
|
|
1348
1415
|
}
|
|
1349
1416
|
if (U.length === 0)
|
|
1350
|
-
return { mappings: m, opened:
|
|
1351
|
-
a("usd_probe_stage_release", ["number"], [
|
|
1417
|
+
return { mappings: m, opened: S, variantConfiguration: D };
|
|
1418
|
+
a("usd_probe_stage_release", ["number"], [S.stageId]), await nn(
|
|
1352
1419
|
U,
|
|
1353
|
-
Math.max(1,
|
|
1354
|
-
async ({ item:
|
|
1355
|
-
if (!
|
|
1356
|
-
const
|
|
1420
|
+
Math.max(1, y),
|
|
1421
|
+
async ({ item: N, identifier: P }) => {
|
|
1422
|
+
if (!N.recurse && !h) return;
|
|
1423
|
+
const T = Z(N.url.href, n);
|
|
1357
1424
|
let v;
|
|
1358
1425
|
try {
|
|
1359
|
-
v = await s(
|
|
1426
|
+
v = await s(N.url, P);
|
|
1360
1427
|
} catch (I) {
|
|
1361
|
-
if (!
|
|
1428
|
+
if (!N.resource || !Qe(P) || !nt(I))
|
|
1362
1429
|
throw I;
|
|
1363
|
-
const
|
|
1364
|
-
|
|
1430
|
+
const A = `${n}/__unavailable__/${encodeURIComponent(P)}`;
|
|
1431
|
+
N.owner && (m[N.owner.path][N.owner.reference] = A), r.set(A, P), d == null || d(P, I);
|
|
1365
1432
|
return;
|
|
1366
1433
|
}
|
|
1367
|
-
i.set(
|
|
1434
|
+
i.set(T, Oe(v)), he(e, T, v, o), r.set(T, P), N.recurse && (m[T] ?? (m[T] = {}), F.add(T));
|
|
1368
1435
|
}
|
|
1369
1436
|
);
|
|
1370
1437
|
}
|
|
@@ -1383,13 +1450,13 @@ async function nn(e, t, n) {
|
|
|
1383
1450
|
function rn(e) {
|
|
1384
1451
|
var n, s;
|
|
1385
1452
|
const t = (s = (n = e.split(/[?#]/, 1)[0]) == null ? void 0 : n.split(".").pop()) == null ? void 0 : s.toLowerCase();
|
|
1386
|
-
return t != null &&
|
|
1453
|
+
return t != null && Kt.has(t);
|
|
1387
1454
|
}
|
|
1388
|
-
function
|
|
1389
|
-
return
|
|
1455
|
+
function Oe(e) {
|
|
1456
|
+
return Te(e) ? e.includes(64) : !0;
|
|
1390
1457
|
}
|
|
1391
1458
|
function sn(e) {
|
|
1392
|
-
return
|
|
1459
|
+
return Te(e) ? on(e, [
|
|
1393
1460
|
"subLayers",
|
|
1394
1461
|
"references",
|
|
1395
1462
|
"payload",
|
|
@@ -1397,7 +1464,7 @@ function sn(e) {
|
|
|
1397
1464
|
"clipAssetPaths"
|
|
1398
1465
|
]) : !0;
|
|
1399
1466
|
}
|
|
1400
|
-
function
|
|
1467
|
+
function Te(e) {
|
|
1401
1468
|
let t = e[0] === 239 && e[1] === 187 && e[2] === 191 ? 3 : 0;
|
|
1402
1469
|
for (; t < e.length && t < 64 && /\s/.test(String.fromCharCode(e[t])); ) t += 1;
|
|
1403
1470
|
return e[t] === 35 && e[t + 1] === 117 && e[t + 2] === 115 && e[t + 3] === 100 && e[t + 4] === 97;
|
|
@@ -1415,8 +1482,8 @@ function on(e, t) {
|
|
|
1415
1482
|
if (r)
|
|
1416
1483
|
for (const c of r) {
|
|
1417
1484
|
let i = !0;
|
|
1418
|
-
for (let
|
|
1419
|
-
if (e[o +
|
|
1485
|
+
for (let f = 1; f < c.length; ++f)
|
|
1486
|
+
if (e[o + f] !== c.charCodeAt(f)) {
|
|
1420
1487
|
i = !1;
|
|
1421
1488
|
break;
|
|
1422
1489
|
}
|
|
@@ -1425,7 +1492,7 @@ function on(e, t) {
|
|
|
1425
1492
|
}
|
|
1426
1493
|
return !1;
|
|
1427
1494
|
}
|
|
1428
|
-
function
|
|
1495
|
+
function $e(e, t) {
|
|
1429
1496
|
const n = new URL(e);
|
|
1430
1497
|
if (n.protocol !== t.protocol || n.host !== t.host) return n.href;
|
|
1431
1498
|
const s = new URL(".", t).pathname.split("/").filter(Boolean), a = n.pathname.split("/").filter(Boolean);
|
|
@@ -1434,7 +1501,7 @@ function Oe(e, t) {
|
|
|
1434
1501
|
const r = [...s.slice(o).map(() => ".."), ...a.slice(o)].join("/");
|
|
1435
1502
|
return decodeURIComponent(r) + n.search + n.hash;
|
|
1436
1503
|
}
|
|
1437
|
-
function
|
|
1504
|
+
function Ce(e, t, n) {
|
|
1438
1505
|
let s;
|
|
1439
1506
|
try {
|
|
1440
1507
|
s = new URL(e, new URL(t, n));
|
|
@@ -1445,10 +1512,10 @@ function Te(e, t, n) {
|
|
|
1445
1512
|
return {
|
|
1446
1513
|
resolved: s,
|
|
1447
1514
|
absolute: r,
|
|
1448
|
-
childIdentifier: r ? s.href :
|
|
1515
|
+
childIdentifier: r ? s.href : $e(s.href, n)
|
|
1449
1516
|
};
|
|
1450
1517
|
}
|
|
1451
|
-
function
|
|
1518
|
+
function Z(e, t) {
|
|
1452
1519
|
const n = new URL(e), s = encodeURIComponent(`${n.protocol}//${n.host}`);
|
|
1453
1520
|
let a = n.pathname.split("/").map((o) => decodeURIComponent(o).replaceAll("/", "%2F").replaceAll("\\", "%5C")).join("/");
|
|
1454
1521
|
if (n.search || n.hash) {
|
|
@@ -1457,7 +1524,7 @@ function q(e, t) {
|
|
|
1457
1524
|
}
|
|
1458
1525
|
return `${t}/${s}${a}`;
|
|
1459
1526
|
}
|
|
1460
|
-
function
|
|
1527
|
+
function Le(e, t) {
|
|
1461
1528
|
if (!e || typeof e != "object" || ArrayBuffer.isView(e)) return;
|
|
1462
1529
|
const n = e;
|
|
1463
1530
|
if (typeof n.path == "string" && typeof n.resolvedPath == "string") {
|
|
@@ -1467,9 +1534,9 @@ function $e(e, t) {
|
|
|
1467
1534
|
}
|
|
1468
1535
|
return;
|
|
1469
1536
|
}
|
|
1470
|
-
for (const s of Object.values(e))
|
|
1537
|
+
for (const s of Object.values(e)) Le(s, t);
|
|
1471
1538
|
}
|
|
1472
|
-
function
|
|
1539
|
+
function Fe(e, t, n) {
|
|
1473
1540
|
if (!e || typeof e != "object" || ArrayBuffer.isView(e)) return;
|
|
1474
1541
|
const s = e;
|
|
1475
1542
|
if (typeof s.path == "string" && typeof s.ownerLayer == "string") {
|
|
@@ -1479,29 +1546,29 @@ function Le(e, t, n) {
|
|
|
1479
1546
|
else {
|
|
1480
1547
|
const o = t.get(s.ownerLayer);
|
|
1481
1548
|
if (o) {
|
|
1482
|
-
const r =
|
|
1549
|
+
const r = Ce(s.path, o, n);
|
|
1483
1550
|
r && (s.path = r.childIdentifier, s.resolvedPath = r.childIdentifier);
|
|
1484
1551
|
}
|
|
1485
1552
|
}
|
|
1486
1553
|
delete s.ownerLayer;
|
|
1487
1554
|
return;
|
|
1488
1555
|
}
|
|
1489
|
-
for (const a of Object.values(e))
|
|
1556
|
+
for (const a of Object.values(e)) Fe(a, t, n);
|
|
1490
1557
|
}
|
|
1491
|
-
function
|
|
1558
|
+
function je(e, t) {
|
|
1492
1559
|
if (e.analyzePath(t).exists) {
|
|
1493
1560
|
for (const n of e.readdir(t)) {
|
|
1494
1561
|
if (n === "." || n === "..") continue;
|
|
1495
1562
|
const s = `${t}/${n}`;
|
|
1496
|
-
e.isDir(e.stat(s).mode) ?
|
|
1563
|
+
e.isDir(e.stat(s).mode) ? je(e, s) : e.unlink(s);
|
|
1497
1564
|
}
|
|
1498
1565
|
e.rmdir(t);
|
|
1499
1566
|
}
|
|
1500
1567
|
}
|
|
1501
|
-
function
|
|
1568
|
+
function he(e, t, n, s) {
|
|
1502
1569
|
s.has(t) || (e.FS.mkdirTree(t.split("/").slice(0, -1).join("/") || "/"), e.FS.writeFile(t, n), s.add(t));
|
|
1503
1570
|
}
|
|
1504
|
-
function
|
|
1571
|
+
function Y(e) {
|
|
1505
1572
|
return `${e.primPath}\0${e.setName}`;
|
|
1506
1573
|
}
|
|
1507
1574
|
async function Pe(e) {
|
|
@@ -1519,14 +1586,14 @@ function cn(e) {
|
|
|
1519
1586
|
return !0;
|
|
1520
1587
|
};
|
|
1521
1588
|
if (e[0] === 137 && n(1, "PNG") && n(12, "IHDR"))
|
|
1522
|
-
return
|
|
1589
|
+
return Q(t.getUint32(16), t.getUint32(20));
|
|
1523
1590
|
if (e[0] === 255 && e[1] === 216) {
|
|
1524
1591
|
let s = 2;
|
|
1525
1592
|
for (; s + 9 < e.length; ) {
|
|
1526
1593
|
if (e[s] !== 255) return null;
|
|
1527
1594
|
const a = e[s + 1], o = e[s + 2] << 8 | e[s + 3];
|
|
1528
1595
|
if (a >= 192 && a <= 207 && a !== 196 && a !== 200 && a !== 204)
|
|
1529
|
-
return
|
|
1596
|
+
return Q(
|
|
1530
1597
|
e[s + 7] << 8 | e[s + 8],
|
|
1531
1598
|
e[s + 5] << 8 | e[s + 6]
|
|
1532
1599
|
);
|
|
@@ -1537,22 +1604,22 @@ function cn(e) {
|
|
|
1537
1604
|
}
|
|
1538
1605
|
if (n(0, "RIFF") && n(8, "WEBP")) {
|
|
1539
1606
|
if (n(12, "VP8 "))
|
|
1540
|
-
return
|
|
1607
|
+
return Q(
|
|
1541
1608
|
t.getUint16(26, !0) & 16383,
|
|
1542
1609
|
t.getUint16(28, !0) & 16383
|
|
1543
1610
|
);
|
|
1544
1611
|
if (n(12, "VP8L")) {
|
|
1545
1612
|
const s = t.getUint32(21, !0);
|
|
1546
|
-
return
|
|
1613
|
+
return Q((s & 16383) + 1, (s >>> 14 & 16383) + 1);
|
|
1547
1614
|
}
|
|
1548
1615
|
if (n(12, "VP8X")) {
|
|
1549
1616
|
const s = (a) => e[a] | e[a + 1] << 8 | e[a + 2] << 16;
|
|
1550
|
-
return
|
|
1617
|
+
return Q(s(24) + 1, s(27) + 1);
|
|
1551
1618
|
}
|
|
1552
1619
|
}
|
|
1553
1620
|
return null;
|
|
1554
1621
|
}
|
|
1555
|
-
function
|
|
1622
|
+
function ln(e, t) {
|
|
1556
1623
|
const n = Math.max(e.width, e.height);
|
|
1557
1624
|
if (t <= 0 || n <= t) return e;
|
|
1558
1625
|
const s = t / n;
|
|
@@ -1561,10 +1628,10 @@ function un(e, t) {
|
|
|
1561
1628
|
height: Math.max(1, Math.round(e.height * s))
|
|
1562
1629
|
};
|
|
1563
1630
|
}
|
|
1564
|
-
function
|
|
1631
|
+
function Q(e, t) {
|
|
1565
1632
|
return e > 0 && t > 0 ? { width: e, height: t } : null;
|
|
1566
1633
|
}
|
|
1567
|
-
function
|
|
1634
|
+
function K(e) {
|
|
1568
1635
|
return e instanceof Error ? {
|
|
1569
1636
|
name: e.name,
|
|
1570
1637
|
message: e.message,
|
|
@@ -1572,32 +1639,52 @@ function Y(e) {
|
|
|
1572
1639
|
...e.stack ? { stack: e.stack } : {}
|
|
1573
1640
|
} : { name: "Error", message: String(e) };
|
|
1574
1641
|
}
|
|
1575
|
-
const
|
|
1576
|
-
let
|
|
1577
|
-
const
|
|
1578
|
-
function
|
|
1579
|
-
|
|
1642
|
+
const te = globalThis;
|
|
1643
|
+
let re = null, ee = null, se = null, oe = null, de = !1, un = 1;
|
|
1644
|
+
const ne = /* @__PURE__ */ new Map();
|
|
1645
|
+
function B(e, t) {
|
|
1646
|
+
te.postMessage(e, t);
|
|
1580
1647
|
}
|
|
1581
1648
|
function fn(e, t) {
|
|
1582
|
-
const n =
|
|
1649
|
+
const n = un++;
|
|
1583
1650
|
return new Promise((s, a) => {
|
|
1584
|
-
|
|
1651
|
+
ne.set(n, { resolve: s, reject: a }), B({ type: "resource-request", id: n, url: e.href, identifier: t });
|
|
1585
1652
|
});
|
|
1586
1653
|
}
|
|
1587
1654
|
function dn(e) {
|
|
1588
|
-
return
|
|
1655
|
+
return re ?? (re = Qt(e)), re;
|
|
1589
1656
|
}
|
|
1590
1657
|
function hn(e) {
|
|
1591
1658
|
const t = /* @__PURE__ */ new Set();
|
|
1592
1659
|
for (const n of e.elements)
|
|
1593
1660
|
for (const s of Object.values(n.geometry ?? {}))
|
|
1594
1661
|
ArrayBuffer.isView(s) && t.add(s.buffer);
|
|
1662
|
+
for (const n of e.pointClouds)
|
|
1663
|
+
for (const s of [
|
|
1664
|
+
n.positions,
|
|
1665
|
+
n.widths,
|
|
1666
|
+
n.normals,
|
|
1667
|
+
n.intensities,
|
|
1668
|
+
n.displayColor,
|
|
1669
|
+
n.displayOpacity
|
|
1670
|
+
])
|
|
1671
|
+
s && t.add(s.buffer);
|
|
1672
|
+
for (const n of e.gaussianSplats)
|
|
1673
|
+
for (const s of [
|
|
1674
|
+
n.positions,
|
|
1675
|
+
n.scales,
|
|
1676
|
+
n.orientations,
|
|
1677
|
+
n.opacities,
|
|
1678
|
+
n.sphericalHarmonics,
|
|
1679
|
+
n.displayColor
|
|
1680
|
+
])
|
|
1681
|
+
s && t.add(s.buffer);
|
|
1595
1682
|
return [...t];
|
|
1596
1683
|
}
|
|
1597
1684
|
async function pn(e) {
|
|
1598
|
-
if (!
|
|
1599
|
-
const t =
|
|
1600
|
-
return { type: "query-result", id: e.id, value: await t.apply(
|
|
1685
|
+
if (!se) throw new Error("USD worker has no live stage");
|
|
1686
|
+
const t = se[e.method];
|
|
1687
|
+
return { type: "query-result", id: e.id, value: await t.apply(se, e.args) };
|
|
1601
1688
|
}
|
|
1602
1689
|
async function gn(e, t) {
|
|
1603
1690
|
if (typeof createImageBitmap != "function")
|
|
@@ -1610,17 +1697,17 @@ async function gn(e, t) {
|
|
|
1610
1697
|
colorSpaceConversion: "none"
|
|
1611
1698
|
};
|
|
1612
1699
|
if (a) {
|
|
1613
|
-
const r = t > 0 ?
|
|
1700
|
+
const r = t > 0 ? ln(a, t) : a;
|
|
1614
1701
|
(r.width !== a.width || r.height !== a.height) && (o.resizeWidth = r.width, o.resizeHeight = r.height, o.resizeQuality = "high");
|
|
1615
1702
|
}
|
|
1616
1703
|
return createImageBitmap(new Blob([s]), o);
|
|
1617
1704
|
}
|
|
1618
|
-
|
|
1705
|
+
te.onmessage = async (e) => {
|
|
1619
1706
|
const t = e.data;
|
|
1620
1707
|
if (t.type === "resource-result") {
|
|
1621
|
-
const n =
|
|
1708
|
+
const n = ne.get(t.id);
|
|
1622
1709
|
if (!n) return;
|
|
1623
|
-
|
|
1710
|
+
ne.delete(t.id), t.error ? n.reject(Object.assign(new Error(t.error.message), {
|
|
1624
1711
|
name: t.error.name,
|
|
1625
1712
|
...t.error.code ? { code: t.error.code } : {}
|
|
1626
1713
|
})) : n.resolve(t.bytes ?? new Uint8Array());
|
|
@@ -1628,16 +1715,16 @@ ee.onmessage = async (e) => {
|
|
|
1628
1715
|
}
|
|
1629
1716
|
if (t.type === "query") {
|
|
1630
1717
|
try {
|
|
1631
|
-
|
|
1718
|
+
B(await pn(t));
|
|
1632
1719
|
} catch (n) {
|
|
1633
|
-
|
|
1720
|
+
B({ type: "error", id: t.id, error: K(n) });
|
|
1634
1721
|
}
|
|
1635
1722
|
return;
|
|
1636
1723
|
}
|
|
1637
1724
|
if (t.type === "decode-texture") {
|
|
1638
1725
|
try {
|
|
1639
1726
|
const n = await gn(t.url, t.maxDimension);
|
|
1640
|
-
|
|
1727
|
+
B({
|
|
1641
1728
|
type: "texture-decoded",
|
|
1642
1729
|
id: t.id,
|
|
1643
1730
|
bitmap: n,
|
|
@@ -1645,37 +1732,37 @@ ee.onmessage = async (e) => {
|
|
|
1645
1732
|
height: n.height
|
|
1646
1733
|
}, [n]);
|
|
1647
1734
|
} catch (n) {
|
|
1648
|
-
|
|
1735
|
+
B({ type: "error", id: t.id, error: K(n) });
|
|
1649
1736
|
}
|
|
1650
1737
|
return;
|
|
1651
1738
|
}
|
|
1652
1739
|
if (t.type === "dispose") {
|
|
1653
|
-
for (const n of
|
|
1654
|
-
|
|
1740
|
+
for (const n of ne.values()) n.reject(new Error("USD worker disposed"));
|
|
1741
|
+
ne.clear(), ee == null || ee(), se = null, oe = null, de = !1, re = null, ee = null, te.close();
|
|
1655
1742
|
return;
|
|
1656
1743
|
}
|
|
1657
1744
|
if (t.type === "extract-physics") {
|
|
1658
|
-
if (
|
|
1659
|
-
|
|
1745
|
+
if (de || !oe) return;
|
|
1746
|
+
de = !0;
|
|
1660
1747
|
try {
|
|
1661
|
-
|
|
1748
|
+
B({ type: "physics-ready", phase: await oe() });
|
|
1662
1749
|
} catch (n) {
|
|
1663
|
-
|
|
1750
|
+
B({ type: "physics-failed", error: K(n) });
|
|
1664
1751
|
}
|
|
1665
1752
|
return;
|
|
1666
1753
|
}
|
|
1667
1754
|
if (t.type === "prepare") {
|
|
1668
1755
|
try {
|
|
1669
1756
|
const n = await dn(t.runtime);
|
|
1670
|
-
t.warmup && await n.warmup(),
|
|
1757
|
+
t.warmup && await n.warmup(), B({ type: "worker-ready" });
|
|
1671
1758
|
} catch (n) {
|
|
1672
|
-
|
|
1759
|
+
B({ type: "error", error: K(n) }), te.close();
|
|
1673
1760
|
}
|
|
1674
1761
|
return;
|
|
1675
1762
|
}
|
|
1676
1763
|
try {
|
|
1677
|
-
if (!
|
|
1678
|
-
const s = await (await
|
|
1764
|
+
if (!re) throw new Error("USD worker was not prepared before load");
|
|
1765
|
+
const s = await (await re).parseVisualSceneAsync(t.input, {
|
|
1679
1766
|
...t.options,
|
|
1680
1767
|
packagePaths: t.options.packagePaths,
|
|
1681
1768
|
readTextureBytes: t.options.readTextureBytes ?? !1,
|
|
@@ -1683,17 +1770,17 @@ ee.onmessage = async (e) => {
|
|
|
1683
1770
|
convertZUp: !1,
|
|
1684
1771
|
loadLights: !1,
|
|
1685
1772
|
resolveBytes: fn,
|
|
1686
|
-
onReferenceSkipped: (r) =>
|
|
1687
|
-
onResourceFailed: (r, c) =>
|
|
1773
|
+
onReferenceSkipped: (r) => B({ type: "event", event: "reference-skipped", identifier: r }),
|
|
1774
|
+
onResourceFailed: (r, c) => B({ type: "event", event: "resource-failed", identifier: r, error: K(c) })
|
|
1688
1775
|
});
|
|
1689
|
-
|
|
1776
|
+
ee = s.release, se = xe(s.stage, s.pxr), oe = s.readPhysics;
|
|
1690
1777
|
const a = s.data, o = hn(a);
|
|
1691
|
-
|
|
1778
|
+
B({
|
|
1692
1779
|
type: "visual-ready",
|
|
1693
1780
|
data: a,
|
|
1694
1781
|
textureURLs: [...s.textureURLs ?? []]
|
|
1695
1782
|
}, o);
|
|
1696
1783
|
} catch (n) {
|
|
1697
|
-
|
|
1784
|
+
B({ type: "error", error: K(n) }), te.close();
|
|
1698
1785
|
}
|
|
1699
1786
|
};
|