@nebula-spatial/viewer 0.5.6 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/README.md +101 -7
- package/USD-VISUAL-MATERIAL-SUPPORT.md +10 -1
- package/dist/assets/types.d.ts +14 -2
- package/dist/assets/usd-worker-Cd5zDKyA.js +1508 -0
- package/dist/collision-debug-B9HJ34H8.js +2896 -0
- package/dist/{index-D6-ClMfm.js → index-CIMsZtyY.js} +4170 -2956
- package/dist/index.d.ts +5 -1
- package/dist/index.js +18 -16
- package/dist/inspection/types.d.ts +79 -2
- package/dist/{mjcf-visual-B8RE9CqV.js → mjcf-visual-DCfPUwyh.js} +1 -1
- package/dist/mujoco-runtime-B9AZiFiG.js +698 -0
- package/dist/session-C-yjpG8R.js +2519 -0
- package/dist/session-uIv9-Ok1.js +786 -0
- package/dist/simulation/mujoco-wasm-module.d.ts +11 -0
- package/dist/simulation/openusd-wasm-module.d.ts +10 -0
- package/dist/{stage-CSRMl8kx.js → stage-C2FchK6h.js} +2 -2
- package/dist/urdf-session-CjGG32Zy.js +1264 -0
- package/dist/usd-session-Cb1e-Bx8.js +6971 -0
- package/dist/version.d.ts +1 -1
- package/dist/{xacro-BpICdIYd.js → xacro-C2EgfvS8.js} +1 -1
- package/openusd/openusd-runtime-manifest.json +3 -3
- package/openusd/openusd_probe.js +14 -14
- package/package.json +2 -1
- package/dist/assets/usd-worker-CnpILBYh.js +0 -1352
- package/dist/collision-debug-CqRm6cC8.js +0 -479
- package/dist/mujoco-runtime-ZuEJSHnD.js +0 -396
- package/dist/session-CDrNB1J2.js +0 -965
- package/dist/session-DgvOdcLe.js +0 -632
- package/dist/urdf-session-DD3HOAib.js +0 -3263
- package/dist/usd-session-BCCp_YDr.js +0 -6217
package/dist/session-DgvOdcLe.js
DELETED
|
@@ -1,632 +0,0 @@
|
|
|
1
|
-
import { d as Re, e as Fe, c as Le, a as Te, b as Ue, f as De, w as Ne, g as qe, p as K, S as ye } from "./collision-debug-CqRm6cC8.js";
|
|
2
|
-
import { disposeModelResources as Z } from "./resources-CHhCm2f7.js";
|
|
3
|
-
import { D as ze } from "./index-D6-ClMfm.js";
|
|
4
|
-
import { S as Q } from "./stage-CSRMl8kx.js";
|
|
5
|
-
import { Color as Je, LinearSRGBColorSpace as $e, SRGBColorSpace as we, MeshPhysicalMaterial as Be, Float32BufferAttribute as H, DataTexture as Ve, RGBAFormat as Xe, UnsignedByteType as ke, NoColorSpace as He, RepeatWrapping as We, LinearFilter as Ie, LinearMipmapLinearFilter as Ye, BufferGeometry as re, Group as _e, Mesh as ge, PlaneGeometry as ve, BoxGeometry as Me, SphereGeometry as ee, Matrix4 as xe, CylinderGeometry as Ee, CapsuleGeometry as Se, BufferAttribute as te } from "three";
|
|
6
|
-
async function Ke(s, e, n) {
|
|
7
|
-
var a;
|
|
8
|
-
const t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), l = async (i, _) => {
|
|
9
|
-
if (u.has(i)) throw se(`MJCF include cycle: ${i}`, "E_MJCF_INCLUDE_CYCLE");
|
|
10
|
-
u.add(i);
|
|
11
|
-
const d = st(_, i);
|
|
12
|
-
t.set(i, d);
|
|
13
|
-
for (const G of d.querySelectorAll("worldbody body[name]")) o.add(G.getAttribute("name"));
|
|
14
|
-
for (const G of d.querySelectorAll("include[file]")) {
|
|
15
|
-
const v = n.resolve(G.getAttribute("file"), i);
|
|
16
|
-
await l(v, await n.text(v));
|
|
17
|
-
}
|
|
18
|
-
u.delete(i);
|
|
19
|
-
};
|
|
20
|
-
await l(e, s);
|
|
21
|
-
const p = (a = t.get(e)) == null ? void 0 : a.querySelector("mujoco");
|
|
22
|
-
if (!p || o.size === 0) throw se("MJCF requires a mujoco root and at least one named body.", "E_MJCF_PARSE");
|
|
23
|
-
return Re({
|
|
24
|
-
id: p.getAttribute("model") || e,
|
|
25
|
-
name: p.getAttribute("model") || e,
|
|
26
|
-
source: { format: "mjcf", uri: e },
|
|
27
|
-
links: [...o].map((i) => ({ id: i, name: i, visuals: [], collisions: [] })),
|
|
28
|
-
joints: [],
|
|
29
|
-
diagnostics: Fe(),
|
|
30
|
-
extension: { files: n, xml: s, documents: t }
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
async function Qe(s) {
|
|
34
|
-
const e = s.extension.files, n = s.source.uri, t = n.split("/").slice(0, -1).join("/"), o = /* @__PURE__ */ new Map(), u = s.extension.documents;
|
|
35
|
-
for (const [a, i] of u) {
|
|
36
|
-
const _ = i.querySelector("compiler");
|
|
37
|
-
for (const d of i.querySelectorAll("asset [file]")) {
|
|
38
|
-
const G = (_ == null ? void 0 : _.getAttribute(d.tagName === "texture" ? "texturedir" : "meshdir")) ?? (_ == null ? void 0 : _.getAttribute("assetdir")) ?? "", v = e.resolve(`${G}/${d.getAttribute("file")}`, a);
|
|
39
|
-
await e.bytes(v);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
for (const a of tt(e.paths(), u)) {
|
|
43
|
-
if (a === n) continue;
|
|
44
|
-
const i = t && a.startsWith(`${t}/`) ? a.slice(t.length + 1) : a;
|
|
45
|
-
o.set(i, await e.bytes(a));
|
|
46
|
-
}
|
|
47
|
-
const l = s.extension.xml;
|
|
48
|
-
return { format: "mjcf", xml: Ze(u) ? et(l) : l, files: o };
|
|
49
|
-
}
|
|
50
|
-
function Ze(s) {
|
|
51
|
-
return s.size === 0 || ![...s.values()].some((n) => n.querySelector("freejoint, actuator") ? !0 : [...n.querySelectorAll("joint")].some(
|
|
52
|
-
(t) => (t.getAttribute("type") ?? "hinge").toLowerCase() !== "fixed"
|
|
53
|
-
)) ? !1 : ![...s.values()].some(
|
|
54
|
-
(n) => [...n.querySelectorAll("worldbody geom")].some((t) => {
|
|
55
|
-
var o;
|
|
56
|
-
return ((o = t.getAttribute("type")) == null ? void 0 : o.toLowerCase()) === "plane";
|
|
57
|
-
})
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
function et(s) {
|
|
61
|
-
const e = '<geom name="__viewer_default_ground__" type="plane" size="5 5 0.1" contype="1" conaffinity="1" friction="0.8 0.01 0.0002"/>';
|
|
62
|
-
return /<worldbody\b[^>]*>/i.test(s) ? s.replace(/(<worldbody\b[^>]*>)/i, `$1${e}`) : s.replace(/<\/mujoco\s*>/i, `<worldbody>${e}</worldbody></mujoco>`);
|
|
63
|
-
}
|
|
64
|
-
function tt(s, e) {
|
|
65
|
-
const n = (p) => p.replaceAll("\\", "/").split("/").pop() ?? "", t = /* @__PURE__ */ new Map();
|
|
66
|
-
for (const p of s) {
|
|
67
|
-
const a = n(p), i = t.get(a) ?? [];
|
|
68
|
-
i.push(p), t.set(a, i);
|
|
69
|
-
}
|
|
70
|
-
const o = new Set(e.keys()), u = /* @__PURE__ */ new Set(["include", "mesh", "texture", "hfield", "skin"]), l = /* @__PURE__ */ new Set(["fileleft", "fileright", "fileup", "filedown", "filefront", "fileback"]);
|
|
71
|
-
for (const p of e.values()) {
|
|
72
|
-
if (p.querySelector("plugin, extension, model, attach")) return s;
|
|
73
|
-
for (const a of p.querySelectorAll("*"))
|
|
74
|
-
for (const i of a.attributes) {
|
|
75
|
-
if (!i.name.startsWith("file")) continue;
|
|
76
|
-
if (i.name === "file") {
|
|
77
|
-
if (!u.has(a.tagName)) return s;
|
|
78
|
-
} else if (!(a.tagName === "texture" && l.has(i.name)))
|
|
79
|
-
return s;
|
|
80
|
-
if (!i.value) continue;
|
|
81
|
-
const _ = t.get(n(i.value));
|
|
82
|
-
if (!_) return s;
|
|
83
|
-
for (const d of _) o.add(d);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return s.filter((p) => o.has(p));
|
|
87
|
-
}
|
|
88
|
-
function st(s, e) {
|
|
89
|
-
const n = new DOMParser().parseFromString(s, "application/xml"), t = n.querySelector("parsererror");
|
|
90
|
-
if (t) throw se(`MJCF XML parse failed (${e}): ${t.textContent ?? ""}`, "E_MJCF_PARSE");
|
|
91
|
-
return n;
|
|
92
|
-
}
|
|
93
|
-
function se(s, e) {
|
|
94
|
-
return Object.assign(new Error(s), { code: e });
|
|
95
|
-
}
|
|
96
|
-
const W = 0.5, z = (s, e) => Number.isFinite(s) ? Math.min(1, Math.max(0, s)) : e;
|
|
97
|
-
function be(s, e) {
|
|
98
|
-
return s !== void 0 && Number.isFinite(s) && s >= 0 ? z(s, W) : e !== void 0 && Number.isFinite(e) && e >= 0 ? 1 - z(e, 0.5) : W;
|
|
99
|
-
}
|
|
100
|
-
function ot(s = {}) {
|
|
101
|
-
const e = s.color ?? [0.68, 0.72, 0.7, 1], n = new Je().setRGB(e[0], e[1], e[2], s.colorSpace === "linear" ? $e : we), t = z(e[3] ?? 1, 1), o = z(s.specular ?? 0.5, 0.5), u = Math.sqrt(0.08 * o);
|
|
102
|
-
return new Be({
|
|
103
|
-
color: n,
|
|
104
|
-
opacity: t,
|
|
105
|
-
transparent: t < 1,
|
|
106
|
-
depthWrite: t === 1,
|
|
107
|
-
roughness: z(s.roughness ?? W, W),
|
|
108
|
-
metalness: z(s.metalness ?? 0, 0),
|
|
109
|
-
// Legacy specular 0.5 corresponds to the standard dielectric response.
|
|
110
|
-
specularIntensity: o <= 0.5 ? o * 2 : 1,
|
|
111
|
-
ior: o <= 0.5 ? 1.5 : (1 + u) / (1 - u),
|
|
112
|
-
emissive: n.clone().multiplyScalar(Math.max(0, s.emission ?? 0)),
|
|
113
|
-
map: s.map ?? null
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
function rt(s, e) {
|
|
117
|
-
var G, v;
|
|
118
|
-
const n = [], t = [], o = [], u = s.mesh_vertadr[e], l = s.mesh_faceadr[e], p = s.mesh_normaladr[e], a = s.mesh_texcoordadr[e];
|
|
119
|
-
let i = p >= 0, _ = a >= 0;
|
|
120
|
-
for (let M = 0; M < s.mesh_facenum[e]; M++) for (let g = 0; g < 3; g++) {
|
|
121
|
-
const f = (l + M) * 3 + g, y = (u + s.mesh_face[f]) * 3;
|
|
122
|
-
n.push(...s.mesh_vert.slice(y, y + 3));
|
|
123
|
-
const h = ((G = s.mesh_facenormal) == null ? void 0 : G[f]) ?? -1;
|
|
124
|
-
p >= 0 && h >= 0 ? t.push(...s.mesh_normal.slice((p + h) * 3, (p + h) * 3 + 3)) : i = !1;
|
|
125
|
-
const j = ((v = s.mesh_facetexcoord) == null ? void 0 : v[f]) ?? -1;
|
|
126
|
-
a >= 0 && j >= 0 ? o.push(...s.mesh_texcoord.slice((a + j) * 2, (a + j) * 2 + 2)) : _ = !1;
|
|
127
|
-
}
|
|
128
|
-
const d = new re();
|
|
129
|
-
return d.setAttribute("position", new H(n, 3)), i && t.length === n.length ? d.setAttribute("normal", new H(t, 3)) : d.computeVertexNormals(), _ && o.length === n.length / 3 * 2 && d.setAttribute("uv", new H(o, 2)), d;
|
|
130
|
-
}
|
|
131
|
-
function nt(s) {
|
|
132
|
-
const e = /* @__PURE__ */ new Map();
|
|
133
|
-
if (!s.model.ntex) return e;
|
|
134
|
-
const n = s.mujoco, t = s.model, o = new n.MjvScene(t, Math.max(1e3, t.ngeom * 2)), u = new n.MjvOption(), l = new n.MjvPerturb(), p = new n.MjvCamera();
|
|
135
|
-
try {
|
|
136
|
-
u.geomgroup.fill(1), n.mjv_updateScene(t, s.data, u, l, p, n.mjtCatBit.mjCAT_ALL.value, o);
|
|
137
|
-
for (let a = 0; a < o.ngeom; a++) {
|
|
138
|
-
const i = o.geoms.get(a);
|
|
139
|
-
try {
|
|
140
|
-
i.objtype === n.mjtObj.mjOBJ_GEOM.value && e.set(i.objid, i.texuniform !== 0);
|
|
141
|
-
} finally {
|
|
142
|
-
i.delete();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return e;
|
|
146
|
-
} finally {
|
|
147
|
-
o.delete(), u.delete(), l.delete(), p.delete();
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function at(s, e, n, t, o, u = /* @__PURE__ */ new Map()) {
|
|
151
|
-
var g;
|
|
152
|
-
const l = s.model, p = s.mujoco, a = l.geom_matid[e];
|
|
153
|
-
if (a < 0) return;
|
|
154
|
-
const i = (f, y) => {
|
|
155
|
-
o != null && o.droppedFeatures.some((h) => h.code === f && h.source === `material:${a}`) || o == null || o.droppedFeatures.push({ code: f, message: y, source: `material:${a}` });
|
|
156
|
-
};
|
|
157
|
-
l.mat_reflectance[a] > 0 && i("MJCF_REFLECTANCE_UNSUPPORTED", "Legacy planar reflection is not reproduced by the PBR material.");
|
|
158
|
-
const _ = p.mjtTextureRole.mjNTEXROLE.value;
|
|
159
|
-
if (!Array.from(l.mat_texid.slice(a * _, (a + 1) * _)).some((f) => Number(f) >= 0)) return;
|
|
160
|
-
const v = !(l.geom_type[e] === p.mjtGeom.mjGEOM_MESH.value) || !n.getAttribute("uv"), M = u.get(e);
|
|
161
|
-
if (M === void 0) throw new Error(`Missing compiled texture projection for geom ${e}`);
|
|
162
|
-
if (v) {
|
|
163
|
-
const f = n.getAttribute("position"), y = [], h = l.geom_size[e * 3] || 1, j = l.geom_size[e * 3 + 1] || h;
|
|
164
|
-
for (let S = 0; S < f.count; S++) y.push(f.getX(S) / (2 * (M ? 1 : h)), -f.getY(S) / (2 * (M ? 1 : j)));
|
|
165
|
-
n.setAttribute("uv", new H(y, 2));
|
|
166
|
-
}
|
|
167
|
-
for (let f = 0; f < _; f++) {
|
|
168
|
-
const y = l.mat_texid[a * _ + f];
|
|
169
|
-
if (y < 0) continue;
|
|
170
|
-
if (l.tex_type[y] !== p.mjtTexture.mjTEXTURE_2D.value) {
|
|
171
|
-
i("MJCF_TEXTURE_PROJECTION_UNSUPPORTED", "Cube/skybox surface textures require a dedicated projection and are not substituted with a 2D map.");
|
|
172
|
-
continue;
|
|
173
|
-
}
|
|
174
|
-
if (f === 0) {
|
|
175
|
-
i("MJCF_USER_TEXTURE_UNSUPPORTED", "User texture role has no defined PBR material slot.");
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
const h = l.tex_width[y], j = l.tex_height[y], S = l.tex_nchannel[y];
|
|
179
|
-
if (![1, 2, 3, 4].includes(S)) {
|
|
180
|
-
i("MJCF_TEXTURE_CHANNELS_UNSUPPORTED", "Unsupported texture channel count.");
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
const D = Number(l.tex_adr[y]), A = new Uint8Array(h * j * 4);
|
|
184
|
-
for (let E = 0; E < h * j; E++) {
|
|
185
|
-
const R = D + E * S, O = E * 4, F = l.tex_data[R];
|
|
186
|
-
A[O] = F, A[O + 1] = S >= 3 ? l.tex_data[R + 1] : F, A[O + 2] = S >= 3 ? l.tex_data[R + 2] : F, A[O + 3] = S === 4 ? l.tex_data[R + 3] : S === 2 ? l.tex_data[R + 1] : 255, [2, 3, 4, 6].includes(f) && (A[O] = A[O + 1] = A[O + 2] = F);
|
|
187
|
-
}
|
|
188
|
-
const r = new Ve(A, h, j, Xe, ke);
|
|
189
|
-
r.colorSpace = [1, 7, 8].includes(f) && l.tex_colorspace[y] === p.mjtColorSpace.mjCOLORSPACE_SRGB.value ? we : He, r.wrapS = r.wrapT = We, r.magFilter = Ie, r.minFilter = Ye, r.generateMipmaps = !0;
|
|
190
|
-
const m = l.mat_texrepeat[a * 2], C = l.mat_texrepeat[a * 2 + 1];
|
|
191
|
-
if (r.repeat.set(m, C), v ? r.offset.set(-0.5, -0.5) : M && r.repeat.set(m * (l.geom_size[e * 3] || 1), C * (l.geom_size[e * 3 + 1] || 1)), r.needsUpdate = !0, f === 1 || f === 8)
|
|
192
|
-
(g = t.map) == null || g.dispose(), t.map = r, f === 8 && (t.transparent = !0, t.depthWrite = !1);
|
|
193
|
-
else if (f === 2) t.aoMap = r;
|
|
194
|
-
else if (f === 3)
|
|
195
|
-
t.roughnessMap = r, t.roughness = l.mat_roughness[a] >= 0 ? t.roughness : 1;
|
|
196
|
-
else if (f === 4)
|
|
197
|
-
t.metalnessMap = r, t.metalness = l.mat_metallic[a] >= 0 ? t.metalness : 1;
|
|
198
|
-
else if (f === 5) t.normalMap = r;
|
|
199
|
-
else if (f === 6)
|
|
200
|
-
t.alphaMap = r, t.transparent = !0, t.depthWrite = !1;
|
|
201
|
-
else if (f === 7)
|
|
202
|
-
t.emissiveMap = r, t.emissive.setRGB(1, 1, 1), S === 4 && i("MJCF_EMISSIVE_EXPOSURE_UNSUPPORTED", "Emissive RGB is preserved; per-pixel exposure weight is not supported.");
|
|
203
|
-
else if (f === 9) {
|
|
204
|
-
for (const E of /* @__PURE__ */ new Set([t.aoMap, t.roughnessMap, t.metalnessMap])) E == null || E.dispose();
|
|
205
|
-
t.aoMap = t.roughnessMap = t.metalnessMap = r, t.roughness = l.mat_roughness[a] >= 0 ? t.roughness : 1, t.metalness = l.mat_metallic[a] >= 0 ? t.metalness : 1;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
function it(s, e) {
|
|
210
|
-
return e < 0 ? be() : be(s.mat_roughness[e], s.mat_shininess[e]);
|
|
211
|
-
}
|
|
212
|
-
function lt(s, e) {
|
|
213
|
-
if (e < 0) return 0;
|
|
214
|
-
const n = s.mat_metallic[e];
|
|
215
|
-
return Number.isFinite(n) && n >= 0 ? n : 0;
|
|
216
|
-
}
|
|
217
|
-
function je(s, e = !1, n) {
|
|
218
|
-
const t = s.model, o = s.mujoco, u = new _e();
|
|
219
|
-
u.name = "MuJoCo scene";
|
|
220
|
-
const l = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
221
|
-
for (let a = 1; a < t.nbody; a += 1) {
|
|
222
|
-
const i = o.mj_id2name(t, o.mjtObj.mjOBJ_BODY.value, a);
|
|
223
|
-
if (!i) continue;
|
|
224
|
-
const _ = new _e();
|
|
225
|
-
_.name = i, _.userData.bodyId = a, l.set(a, _), p.set(i, _), u.add(_);
|
|
226
|
-
}
|
|
227
|
-
try {
|
|
228
|
-
if (l.set(0, u), e) {
|
|
229
|
-
const a = Le(), i = Te();
|
|
230
|
-
let _ = 0;
|
|
231
|
-
for (let d = 0; d < t.ngeom; d += 1) {
|
|
232
|
-
const G = o.mj_id2name(t, o.mjtObj.mjOBJ_GEOM.value, d);
|
|
233
|
-
if (G === "__viewer_default_ground__" || !ft(t, d)) continue;
|
|
234
|
-
const v = l.get(t.geom_bodyid[d]), M = ut(s, d);
|
|
235
|
-
if (!v) continue;
|
|
236
|
-
if (!M) {
|
|
237
|
-
n == null || n.droppedFeatures.push({
|
|
238
|
-
code: "E_MJCF_COLLISION_DEBUG_GEOMETRY_UNAVAILABLE",
|
|
239
|
-
message: `MJCF geom ${G ?? `#${d}`} 的 compiled type=${t.geom_type[d]} 无法准确还原为碰撞线框。`,
|
|
240
|
-
source: "mjcf-collision-debug"
|
|
241
|
-
});
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
const g = ct(s, d) ? "mesh" : "feature", f = Ue(M, a, g, i);
|
|
245
|
-
M.dispose(), f.userData.geomId = d, _ += 1;
|
|
246
|
-
const y = d * 3, h = d * 4;
|
|
247
|
-
f.position.fromArray(t.geom_pos, y), f.quaternion.set(t.geom_quat[h + 1], t.geom_quat[h + 2], t.geom_quat[h + 3], t.geom_quat[h]), v.add(f);
|
|
248
|
-
}
|
|
249
|
-
_ === 0 && (a.dispose(), i.dispose());
|
|
250
|
-
} else {
|
|
251
|
-
const a = nt(s);
|
|
252
|
-
for (let i = 0; i < t.ngeom; i += 1) {
|
|
253
|
-
if (t.geom_group[i] > 2 || o.mj_id2name(t, o.mjtObj.mjOBJ_GEOM.value, i) === "__viewer_default_ground__") continue;
|
|
254
|
-
const _ = l.get(t.geom_bodyid[i]), d = dt(s, i);
|
|
255
|
-
if (!_ || !d) continue;
|
|
256
|
-
const G = i * 4, v = t.geom_matid[i], M = Array.from(t.geom_rgba.slice(G, G + 4));
|
|
257
|
-
v >= 0 && [0.5, 0.5, 0.5, 1].every((j, S) => M[S] === j) && M.splice(0, 4, ...Array.from(t.mat_rgba.slice(v * 4, v * 4 + 4)));
|
|
258
|
-
const g = ot({
|
|
259
|
-
color: M,
|
|
260
|
-
roughness: it(t, v),
|
|
261
|
-
metalness: lt(t, v),
|
|
262
|
-
specular: v >= 0 ? t.mat_specular[v] : void 0,
|
|
263
|
-
emission: v >= 0 ? t.mat_emission[v] : void 0
|
|
264
|
-
});
|
|
265
|
-
try {
|
|
266
|
-
at(s, i, d, g, n, a);
|
|
267
|
-
} catch (j) {
|
|
268
|
-
throw Z(new ge(d, g)), j;
|
|
269
|
-
}
|
|
270
|
-
const f = new ge(d, g), y = i * 3, h = i * 4;
|
|
271
|
-
t.geom_bodyid[i] === 0 && t.geom_type[i] === o.mjtGeom.mjGEOM_PLANE.value && (f.userData.excludeFromSimulationFit = !0), f.position.fromArray(t.geom_pos, y), f.quaternion.set(t.geom_quat[h + 1], t.geom_quat[h + 2], t.geom_quat[h + 3], t.geom_quat[h]), _.add(f);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
return { root: u, bindings: p, expectedLinkCount: p.size };
|
|
275
|
-
} catch (a) {
|
|
276
|
-
throw Z(u), a;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
function ut(s, e) {
|
|
280
|
-
const n = s.model, t = s.mujoco, o = e * 3, u = n.geom_size[o], l = n.geom_size[o + 1], p = n.geom_size[o + 2], a = n.geom_type[e];
|
|
281
|
-
if (a === t.mjtGeom.mjGEOM_PLANE.value) return new ve(Math.max(u * 2, 2), Math.max(l * 2, 2), 10, 10);
|
|
282
|
-
if (a === t.mjtGeom.mjGEOM_BOX.value) return new Me(u * 2, l * 2, p * 2);
|
|
283
|
-
if (a === t.mjtGeom.mjGEOM_SPHERE.value) return new ee(u, 20, 12);
|
|
284
|
-
if (a === t.mjtGeom.mjGEOM_ELLIPSOID.value) {
|
|
285
|
-
const i = new ee(1, 24, 16);
|
|
286
|
-
return i.applyMatrix4(new xe().makeScale(u, l, p)), i;
|
|
287
|
-
}
|
|
288
|
-
if (a === t.mjtGeom.mjGEOM_CYLINDER.value) {
|
|
289
|
-
const i = new Ee(u, u, l * 2, 24);
|
|
290
|
-
return i.rotateX(Math.PI / 2), i;
|
|
291
|
-
}
|
|
292
|
-
if (a === t.mjtGeom.mjGEOM_CAPSULE.value) {
|
|
293
|
-
const i = new Se(u, l * 2, 6, 16);
|
|
294
|
-
return i.rotateX(Math.PI / 2), i;
|
|
295
|
-
}
|
|
296
|
-
return a === t.mjtGeom.mjGEOM_MESH.value ? mt(s, n.geom_dataid[e]) : a === t.mjtGeom.mjGEOM_HFIELD.value ? pt(s, n.geom_dataid[e]) : null;
|
|
297
|
-
}
|
|
298
|
-
function ct(s, e) {
|
|
299
|
-
const n = s.model.geom_type[e];
|
|
300
|
-
return n === s.mujoco.mjtGeom.mjGEOM_MESH.value || n === s.mujoco.mjtGeom.mjGEOM_HFIELD.value;
|
|
301
|
-
}
|
|
302
|
-
function ft(s, e) {
|
|
303
|
-
if (s.geom_contype[e] !== 0 || s.geom_conaffinity[e] !== 0) return !0;
|
|
304
|
-
for (let n = 0; n < s.npair; n += 1) if (s.pair_geom1[n] === e || s.pair_geom2[n] === e) return !0;
|
|
305
|
-
return !1;
|
|
306
|
-
}
|
|
307
|
-
function mt(s, e) {
|
|
308
|
-
const n = s.model, t = n.mesh_graphadr[e];
|
|
309
|
-
if (t < 0) return null;
|
|
310
|
-
const o = n.mesh_vertadr[e], u = n.mesh_vertnum[e], l = n.mesh_graph[t], p = n.mesh_graph[t + 1];
|
|
311
|
-
if (l < 4 || p < 4) return null;
|
|
312
|
-
const a = t + 2 + 3 * l + 3 * p, i = new re();
|
|
313
|
-
return i.setAttribute("position", new te(Float32Array.from(n.mesh_vert.subarray(o * 3, (o + u) * 3)), 3)), i.setIndex(new te(Uint32Array.from(n.mesh_graph.subarray(a, a + p * 3)), 1)), i.computeVertexNormals(), i;
|
|
314
|
-
}
|
|
315
|
-
function pt(s, e) {
|
|
316
|
-
const n = s.model, t = n.hfield_nrow[e], o = n.hfield_ncol[e];
|
|
317
|
-
if (t < 2 || o < 2) return null;
|
|
318
|
-
const u = n.hfield_adr[e], l = e * 4, p = n.hfield_size[l], a = n.hfield_size[l + 1], i = n.hfield_size[l + 2], _ = n.hfield_size[l + 3], d = t * o, G = [];
|
|
319
|
-
for (let m = 0; m < t; m += 1) for (let C = 0; C < o; C += 1)
|
|
320
|
-
G.push(
|
|
321
|
-
-p + 2 * p * C / (o - 1),
|
|
322
|
-
-a + 2 * a * m / (t - 1),
|
|
323
|
-
n.hfield_data[u + m * o + C] * i
|
|
324
|
-
);
|
|
325
|
-
const v = [
|
|
326
|
-
[-p, -a, -_],
|
|
327
|
-
[p, -a, -_],
|
|
328
|
-
[-p, a, -_],
|
|
329
|
-
[p, a, -_]
|
|
330
|
-
];
|
|
331
|
-
for (const m of v) G.push(...m);
|
|
332
|
-
const M = [];
|
|
333
|
-
for (let m = 0; m < t - 1; m += 1) for (let C = 0; C < o - 1; C += 1) {
|
|
334
|
-
const E = m * o + C, R = E + 1, O = E + o, F = O + 1;
|
|
335
|
-
M.push(E, O, R, R, O, F);
|
|
336
|
-
}
|
|
337
|
-
const g = d, f = d + 1, y = d + 2, h = d + 3;
|
|
338
|
-
M.push(g, f, y, f, h, y);
|
|
339
|
-
const j = 0, S = o - 1, D = (t - 1) * o, A = t * o - 1;
|
|
340
|
-
M.push(g, j, f, f, j, S), M.push(y, h, D, h, A, D), M.push(g, y, j, y, D, j), M.push(f, S, h, h, S, A);
|
|
341
|
-
const r = new re();
|
|
342
|
-
return r.setAttribute("position", new te(Float32Array.from(G), 3)), r.setIndex(M), r.computeVertexNormals(), r;
|
|
343
|
-
}
|
|
344
|
-
function dt(s, e) {
|
|
345
|
-
const n = s.model, t = s.mujoco, o = e * 3, u = n.geom_size[o], l = n.geom_size[o + 1], p = n.geom_size[o + 2], a = n.geom_type[e];
|
|
346
|
-
if (a === t.mjtGeom.mjGEOM_PLANE.value) return new ve((u || 5) * 2, (l || 5) * 2);
|
|
347
|
-
if (a === t.mjtGeom.mjGEOM_BOX.value) return new Me(u * 2, l * 2, p * 2);
|
|
348
|
-
if (a === t.mjtGeom.mjGEOM_SPHERE.value) return new ee(u, 24, 16);
|
|
349
|
-
if (a === t.mjtGeom.mjGEOM_CYLINDER.value) {
|
|
350
|
-
const i = new Ee(u, u, l * 2, 24);
|
|
351
|
-
return i.rotateX(Math.PI / 2), i;
|
|
352
|
-
}
|
|
353
|
-
if (a === t.mjtGeom.mjGEOM_CAPSULE.value) {
|
|
354
|
-
const i = new Se(u, l * 2, 6, 16);
|
|
355
|
-
return i.rotateX(Math.PI / 2), i;
|
|
356
|
-
}
|
|
357
|
-
return a !== t.mjtGeom.mjGEOM_MESH.value ? null : rt(n, n.geom_dataid[e]);
|
|
358
|
-
}
|
|
359
|
-
function ht(s, e) {
|
|
360
|
-
const n = new De(s), t = e.format === "usd" || e.format === "usda" || e.format === "usdc" || e.format === "usdz";
|
|
361
|
-
let o = null, u = null, l = null, p = null, a = null, i = null, _ = null, d = null, G = null, v = null, M = null, g = !1, f = !1, y = !1, h = !1, j = null, S = null, D, A = null, r = null, m = null, C = null, E = null, R = null, O = !1, F = "z", I = !1;
|
|
362
|
-
const J = () => {
|
|
363
|
-
r && (F = e.options.upAxis ?? "z", I = !0, r.setUpAxis(F) && (u == null || u.sync(), m == null || m.sync()));
|
|
364
|
-
}, $ = (c, w) => {
|
|
365
|
-
var L;
|
|
366
|
-
const P = K(c, e.signal, `${e.format}:${w}`);
|
|
367
|
-
f = !1, y = !1, S = { ...P, stage: w };
|
|
368
|
-
try {
|
|
369
|
-
r == null || r.endGrab();
|
|
370
|
-
} catch {
|
|
371
|
-
}
|
|
372
|
-
(L = e.reportSessionState) == null || L.call(e), e.reportError(c, { fatal: !1, stage: w, code: P.code });
|
|
373
|
-
}, Ae = (c) => {
|
|
374
|
-
var w;
|
|
375
|
-
if (g) {
|
|
376
|
-
c.dispose();
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
E = null, O = !1, A = c.asset, l = c.dispose, h = c.hasAnimation === !0, p = c.hasPhysics || h ? c.step : null, a = c.reset, f = !c.hasPhysics && c.hasAnimation === !0, y = c.hasPhysics, j = c.fallback ? { ...c.fallback, stage: "physics-fallback" } : c.visualWarning ? { ...c.visualWarning, stage: "visual-adaptation" } : null, u = c.binding, o = c.runtime ?? null, m = c.collision ?? null, C = c.createCollision ?? null, r == null || r.setRuntime(c.runtime), r == null || r.replaceModel(c.binding.root), m && (m.root.visible = !1, r == null || r.attachAuxiliary(m.root), m.sync()), J(), (w = e.reportSessionState) == null || w.call(e), e.requestRender();
|
|
380
|
-
}, Ge = (c) => {
|
|
381
|
-
var P;
|
|
382
|
-
if (g) return;
|
|
383
|
-
const w = K(c, e.signal, "usd-physics");
|
|
384
|
-
O = !1, S = { ...w, stage: "usd-physics" }, y = !1, h = (E == null ? void 0 : E.visual.hasAnimation) ?? h, p = E != null && E.visual.hasAnimation ? E.visual.step : null, a = E != null && E.visual.hasAnimation ? E.visual.reset : null, f = !!(E != null && E.visual.hasAnimation), (P = e.reportSessionState) == null || P.call(e), e.reportError(c, { fatal: !1, stage: "usd-physics", code: w.code });
|
|
385
|
-
}, ne = () => {
|
|
386
|
-
g = !0, f = !1;
|
|
387
|
-
}, Ce = () => {
|
|
388
|
-
if (m) return !0;
|
|
389
|
-
const c = C;
|
|
390
|
-
return C = null, !c || !r || (m = c() ?? null, !m) ? !1 : (m.root.visible = !1, r.attachAuxiliary(m.root), m.sync(), !0);
|
|
391
|
-
};
|
|
392
|
-
let ae = () => {
|
|
393
|
-
}, ie = () => {
|
|
394
|
-
}, le = !1;
|
|
395
|
-
const Y = new Promise((c, w) => {
|
|
396
|
-
ae = c, ie = w;
|
|
397
|
-
}), B = () => {
|
|
398
|
-
le || (le = !0, ae());
|
|
399
|
-
};
|
|
400
|
-
return (async () => {
|
|
401
|
-
var c, w, P, L, N, ue, ce, fe, me, pe;
|
|
402
|
-
try {
|
|
403
|
-
const T = e.format;
|
|
404
|
-
if (T === "usd" || T === "usda" || T === "usdc" || T === "usdz") {
|
|
405
|
-
(c = e.reportProgress) == null || c.call(e, "usd-visual", "正在解析 USD 视觉场景...");
|
|
406
|
-
const b = await (await import("./usd-session-BCCp_YDr.js")).loadUsdSimulation(s, e, n);
|
|
407
|
-
if (g || e.signal.aborted)
|
|
408
|
-
throw b.dispose(), oe();
|
|
409
|
-
E = b, u = { root: b.visual.root, sync() {
|
|
410
|
-
}, dispose() {
|
|
411
|
-
} }, l = b.dispose, h = b.visual.hasAnimation, p = h ? b.visual.step : null, a = b.visual.reset, f = !1, O = !0, j = b.visual.warning ? { ...b.visual.warning, stage: "visual-adaptation" } : null, (w = e.reportProgress) == null || w.call(e, "stage", "正在构建三维场景与环境光影..."), r = new Q(
|
|
412
|
-
b.visual.root,
|
|
413
|
-
e.options.simulationTheme,
|
|
414
|
-
void 0,
|
|
415
|
-
"simulation",
|
|
416
|
-
"visual"
|
|
417
|
-
), J(), B(), (P = e.reportProgress) == null || P.call(e, "usd-physics", "视觉场景已就绪,正在准备物理..."), R = b.completePhysics().then(Ae).catch(Ge);
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
if (T === "urdf" || T === "xacro") {
|
|
421
|
-
(L = e.reportProgress) == null || L.call(e, "urdf", "正在解析 URDF 场景与运动学结构...");
|
|
422
|
-
const b = await (await import("./urdf-session-DD3HOAib.js")).loadUrdfSimulation(s, e, n);
|
|
423
|
-
if (g || e.signal.aborted)
|
|
424
|
-
throw b.dispose(), oe();
|
|
425
|
-
A = b.asset, r = b.stage, G = b.inspection, l = b.dispose, p = b.step, a = b.reset, i = b.play, _ = b.pause, d = b.isPlaying, v = () => b.capabilities, M = () => b.physics, f = !1, y = !1, j = b.warning ?? null, J(), B();
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
let V = s.entryPath ?? s.filename;
|
|
429
|
-
if (!V && T === "mjcf") {
|
|
430
|
-
const U = n.paths().filter((b) => b.toLowerCase().endsWith(".xml"));
|
|
431
|
-
for (const b of ["scene.xml", "model.xml", "main.xml"]) {
|
|
432
|
-
const X = U.find((q) => q.toLowerCase().endsWith(`/${b}`) || q.toLowerCase() === b);
|
|
433
|
-
if (X) {
|
|
434
|
-
V = X;
|
|
435
|
-
break;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
V ?? (V = "asset.xml"), (N = e.reportProgress) == null || N.call(e, "fetch", "正在读取模型描述与依赖资源...");
|
|
440
|
-
const Pe = await qe(s, n);
|
|
441
|
-
k(g, e.signal), (ue = e.reportProgress) == null || ue.call(e, "parse", "正在解析 MJCF 场景与连杆..."), A = await Ke(Pe, V, n);
|
|
442
|
-
try {
|
|
443
|
-
(ce = e.reportProgress) == null || ce.call(e, "compile", "正在编译物理模型与参数...");
|
|
444
|
-
const U = await Qe(A);
|
|
445
|
-
k(g, e.signal), (fe = e.reportProgress) == null || fe.call(e, "runtime", "正在初始化物理内核...");
|
|
446
|
-
const { MujocoRuntime: b } = await import("./mujoco-runtime-ZuEJSHnD.js");
|
|
447
|
-
o = new b(), await o.initialize(U, e.options.mujocoBaseUrl);
|
|
448
|
-
} catch (U) {
|
|
449
|
-
const b = K(U, e.signal, "mjcf-physics");
|
|
450
|
-
o == null || o.dispose(), o = null;
|
|
451
|
-
const { compileMjcfPreview: X } = await import("./mjcf-visual-B8RE9CqV.js");
|
|
452
|
-
let q;
|
|
453
|
-
try {
|
|
454
|
-
q = X(A);
|
|
455
|
-
} catch (x) {
|
|
456
|
-
throw new Error(`${b.message};独立视觉预览也不可用:${x instanceof Error ? x.message : String(x)}`);
|
|
457
|
-
}
|
|
458
|
-
u = { root: q, sync() {
|
|
459
|
-
}, dispose() {
|
|
460
|
-
Z(q);
|
|
461
|
-
} }, j = { ...b, stage: "physics-fallback" }, r = new Q(q, e.options.simulationTheme, void 0, "simulation", "visual"), f = !1, J(), B();
|
|
462
|
-
return;
|
|
463
|
-
}
|
|
464
|
-
y = !0, k(g, e.signal), (me = e.reportProgress) == null || me.call(e, "visual", "正在构建视觉渲染网格...");
|
|
465
|
-
const Oe = je(o, !1, A.diagnostics), de = A.diagnostics.droppedFeatures.find((U) => U.code.startsWith("MJCF_"));
|
|
466
|
-
de && (j = { ...de, stage: "visual-material" }), k(g, e.signal), (pe = e.reportProgress) == null || pe.call(e, "stage", "正在构建三维场景与环境光影..."), u = new ye(o, Oe), r = new Q(u.root, e.options.simulationTheme, o);
|
|
467
|
-
const he = je(o, !0, A.diagnostics);
|
|
468
|
-
he.root.children.length > 0 ? (m = new ye(o, he), m.root.visible = !1) : m = null, m && r.attachAuxiliary(m.root), J(), B();
|
|
469
|
-
} catch (T) {
|
|
470
|
-
throw r == null || r.dispose(), r = null, l ? (l(), l = null) : (m == null || m.dispose(), u == null || u.dispose(), o == null || o.dispose()), m = null, u = null, o = null, n.dispose(), E = null, T;
|
|
471
|
-
}
|
|
472
|
-
})().catch(ie), Y.catch(() => {
|
|
473
|
-
}), {
|
|
474
|
-
id: `simulation-${Math.random().toString(36).slice(2)}`,
|
|
475
|
-
get autoPlay() {
|
|
476
|
-
return !O && !y && h;
|
|
477
|
-
},
|
|
478
|
-
get inspection() {
|
|
479
|
-
return G;
|
|
480
|
-
},
|
|
481
|
-
isPlaying() {
|
|
482
|
-
return (d == null ? void 0 : d()) ?? f;
|
|
483
|
-
},
|
|
484
|
-
opened: Y,
|
|
485
|
-
get root() {
|
|
486
|
-
return (r == null ? void 0 : r.root) ?? null;
|
|
487
|
-
},
|
|
488
|
-
getFitBounds() {
|
|
489
|
-
return (r == null ? void 0 : r.getModelBounds()) ?? null;
|
|
490
|
-
},
|
|
491
|
-
beforeRender(c, w, P) {
|
|
492
|
-
return r == null ? void 0 : r.beforeRender(c, w, P);
|
|
493
|
-
},
|
|
494
|
-
get capabilities() {
|
|
495
|
-
const c = m !== null || C !== null;
|
|
496
|
-
return S ? { canPlay: !1, canPause: !1, canReset: !1, hasPhysics: !1, hasAnimation: !1, canToggleGround: !0, canToggleCollision: c, canReorientUpAxis: !0 } : (v == null ? void 0 : v()) ?? { canPlay: y || h, canPause: y || h, canReset: y || h, hasPhysics: y, hasAnimation: h, canToggleGround: !0, canToggleCollision: c, canReorientUpAxis: !0 };
|
|
497
|
-
},
|
|
498
|
-
get warning() {
|
|
499
|
-
return j && !j.notice ? Ne(j, j.stage) : j;
|
|
500
|
-
},
|
|
501
|
-
get physics() {
|
|
502
|
-
return S ? { status: "unavailable", issue: S } : M ? M() : O ? { status: "initializing" } : y ? { status: "ready" } : (j == null ? void 0 : j.stage) === "physics-fallback" ? { status: "unavailable", issue: j } : { status: "not-authored" };
|
|
503
|
-
},
|
|
504
|
-
setTheme(c) {
|
|
505
|
-
r == null || r.setTheme(c);
|
|
506
|
-
},
|
|
507
|
-
setGroundVisible(c) {
|
|
508
|
-
r == null || r.setGroundVisible(c);
|
|
509
|
-
},
|
|
510
|
-
getGroundVisible() {
|
|
511
|
-
return (r == null ? void 0 : r.getGroundVisible()) ?? !0;
|
|
512
|
-
},
|
|
513
|
-
getGroundGridScale() {
|
|
514
|
-
return (r == null ? void 0 : r.getGroundGridScale()) ?? ze;
|
|
515
|
-
},
|
|
516
|
-
getUpAxis() {
|
|
517
|
-
return r && I ? F : null;
|
|
518
|
-
},
|
|
519
|
-
setUpAxis(c) {
|
|
520
|
-
if (!(g || !r))
|
|
521
|
-
try {
|
|
522
|
-
if (!r.setUpAxis(c)) return;
|
|
523
|
-
F = c, u == null || u.sync(), m == null || m.sync(), e.requestRender();
|
|
524
|
-
} catch (w) {
|
|
525
|
-
$(w, "up-axis");
|
|
526
|
-
}
|
|
527
|
-
},
|
|
528
|
-
presentation: { preferredViewMode: "3d", interactionMode: "simulation", uiProfile: "simulation", fitPolicy: "fit-on-ready" },
|
|
529
|
-
beginDispose: ne,
|
|
530
|
-
setCollisionVisible(c) {
|
|
531
|
-
if (!g) {
|
|
532
|
-
if (v) {
|
|
533
|
-
const w = G;
|
|
534
|
-
w == null || w.setOverlay("collision", c);
|
|
535
|
-
return;
|
|
536
|
-
}
|
|
537
|
-
if (c && !Ce()) throw new Error("This asset has no collision display.");
|
|
538
|
-
m && (m.root.visible = c), e.requestRender();
|
|
539
|
-
}
|
|
540
|
-
},
|
|
541
|
-
getVisualDiagnostics() {
|
|
542
|
-
return g || !A || A.source.format !== "usd" ? null : structuredClone({ report: A.extension.visualAdaptation, diagnostics: A.diagnostics });
|
|
543
|
-
},
|
|
544
|
-
getPhysicsProperties() {
|
|
545
|
-
if (g || !y || !(o != null && o.model) || !o.mujoco) return null;
|
|
546
|
-
const c = o.model, w = o.mujoco;
|
|
547
|
-
return structuredClone({
|
|
548
|
-
units: { length: "m", mass: "kg", time: "s" },
|
|
549
|
-
timestep: c.opt.timestep,
|
|
550
|
-
gravity: Array.from(c.opt.gravity),
|
|
551
|
-
bodyCount: c.nbody - 1,
|
|
552
|
-
jointCount: c.njnt,
|
|
553
|
-
geomCount: c.ngeom,
|
|
554
|
-
bodies: Array.from({ length: c.nbody - 1 }, (P, L) => {
|
|
555
|
-
const N = L + 1;
|
|
556
|
-
return { id: N, name: w.mj_id2name(c, w.mjtObj.mjOBJ_BODY.value, N), mass: c.body_mass[N], inertia: Array.from(c.body_inertia.slice(N * 3, N * 3 + 3)) };
|
|
557
|
-
}),
|
|
558
|
-
diagnostics: A == null ? void 0 : A.diagnostics
|
|
559
|
-
});
|
|
560
|
-
},
|
|
561
|
-
get update() {
|
|
562
|
-
return o != null && o.model || p || t ? (c) => {
|
|
563
|
-
if (S || g || !((d == null ? void 0 : d()) ?? f) || !u && !p || !p && !(o != null && o.model)) return !1;
|
|
564
|
-
try {
|
|
565
|
-
if (p) {
|
|
566
|
-
const P = p(c);
|
|
567
|
-
return P && (m == null || m.sync()), P;
|
|
568
|
-
}
|
|
569
|
-
const w = o.step(c);
|
|
570
|
-
return w && (u.sync(), m == null || m.sync(), r == null || r.updateForceLine()), w;
|
|
571
|
-
} catch (w) {
|
|
572
|
-
return $(w, "step"), !1;
|
|
573
|
-
}
|
|
574
|
-
} : void 0;
|
|
575
|
-
},
|
|
576
|
-
play() {
|
|
577
|
-
g || S || (i ? (i(), f = (d == null ? void 0 : d()) ?? !1) : (y || h) && (f = !0));
|
|
578
|
-
},
|
|
579
|
-
pause() {
|
|
580
|
-
S || (_ && _(), f = !1);
|
|
581
|
-
},
|
|
582
|
-
reset() {
|
|
583
|
-
if (!(S || g || !u && !a))
|
|
584
|
-
try {
|
|
585
|
-
r == null || r.endGrab(), a ? a() : (o == null || o.reset(), u.sync()), m == null || m.sync(), r == null || r.resetGround(), r == null || r.updateForceLine();
|
|
586
|
-
} catch (c) {
|
|
587
|
-
$(c, "reset");
|
|
588
|
-
}
|
|
589
|
-
},
|
|
590
|
-
beginGrab(c, w, P) {
|
|
591
|
-
if (g || !((d == null ? void 0 : d()) ?? f) || !y && !M) return !1;
|
|
592
|
-
try {
|
|
593
|
-
return (r == null ? void 0 : r.beginGrab(c, w, P)) ?? !1;
|
|
594
|
-
} catch (L) {
|
|
595
|
-
return $(L, "grab"), !1;
|
|
596
|
-
}
|
|
597
|
-
},
|
|
598
|
-
moveGrab(c, w, P) {
|
|
599
|
-
if (!(g || !((d == null ? void 0 : d()) ?? f) || !y && !M))
|
|
600
|
-
try {
|
|
601
|
-
r == null || r.moveGrab(c, w, P);
|
|
602
|
-
} catch (L) {
|
|
603
|
-
$(L, "grab");
|
|
604
|
-
}
|
|
605
|
-
},
|
|
606
|
-
endGrab() {
|
|
607
|
-
r == null || r.endGrab();
|
|
608
|
-
},
|
|
609
|
-
dispose() {
|
|
610
|
-
return ne(), D ?? (D = Y.catch(() => {
|
|
611
|
-
}).then(async () => {
|
|
612
|
-
r == null || r.dispose(), r = null, l ? (l(), l = null, r = null, u = null, m = null, C = null) : (m == null || m.root.removeFromParent(), m == null || m.dispose(), m = null, C = null, u == null || u.dispose(), u = null, o == null || o.dispose()), await (R == null ? void 0 : R.catch(() => {
|
|
613
|
-
})), E = null, n.dispose(), A = null, G = null, p = null, a = null, i = null, _ = null, d = null, v = null, M = null, y = !1, h = !1, j = null, I = !1;
|
|
614
|
-
})), D;
|
|
615
|
-
}
|
|
616
|
-
};
|
|
617
|
-
}
|
|
618
|
-
function k(s, e) {
|
|
619
|
-
if (s || e.aborted) throw oe();
|
|
620
|
-
}
|
|
621
|
-
function oe() {
|
|
622
|
-
return Object.assign(new Error("Simulation load aborted."), { name: "AbortError", code: "E_ABORTED" });
|
|
623
|
-
}
|
|
624
|
-
const vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
625
|
-
__proto__: null,
|
|
626
|
-
createSimulationSession: ht
|
|
627
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
628
|
-
export {
|
|
629
|
-
vt as a,
|
|
630
|
-
ot as c,
|
|
631
|
-
be as s
|
|
632
|
-
};
|