@nebula-spatial/viewer 0.5.8 → 0.5.10
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 +53 -0
- package/README.md +59 -2
- package/USD-VISUAL-MATERIAL-SUPPORT.md +55 -4
- package/dist/assets/types.d.ts +2 -0
- package/dist/assets/{usd-worker-Cd5zDKyA.js → usd-worker-B9O1idq-.js} +64 -64
- package/dist/{collision-debug-B9HJ34H8.js → collision-debug-CuLOQ9D9.js} +1 -1
- package/dist/{index-CIMsZtyY.js → index-CZE0uuVY.js} +3932 -2687
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{mjcf-visual-DCfPUwyh.js → mjcf-visual-CjbHEm5l.js} +1 -1
- package/dist/{mujoco-runtime-B9AZiFiG.js → mujoco-runtime-C8WJifvE.js} +1 -1
- package/dist/{session-uIv9-Ok1.js → session-CGaImBKe.js} +186 -186
- package/dist/{session-C-yjpG8R.js → session-CyfXeZR2.js} +387 -387
- package/dist/{stage-C2FchK6h.js → stage-ivvjzCbR.js} +21 -14
- package/dist/types.d.ts +46 -3
- package/dist/ui/types.d.ts +2 -0
- package/dist/{urdf-session-CjGG32Zy.js → urdf-session-R5kUHZhf.js} +21 -21
- package/dist/usd-session-J732N5xB.js +7525 -0
- package/dist/version.d.ts +1 -1
- package/dist/{xacro-C2EgfvS8.js → xacro-C7BfYT0W.js} +1 -1
- package/package.json +1 -1
- package/dist/usd-session-Cb1e-Bx8.js +0 -6971
|
@@ -2,8 +2,8 @@ var R = Object.defineProperty;
|
|
|
2
2
|
var S = (a, t, e) => t in a ? R(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
3
|
var s = (a, t, e) => S(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import * as i from "three";
|
|
5
|
-
import { Quaternion as
|
|
6
|
-
import { V as b, D as A, w as W } from "./index-
|
|
5
|
+
import { Quaternion as P, Vector3 as V } from "three";
|
|
6
|
+
import { V as b, D as A, w as W } from "./index-CZE0uuVY.js";
|
|
7
7
|
import { disposeModelResources as T } from "./resources-CHhCm2f7.js";
|
|
8
8
|
const v = 1, B = (
|
|
9
9
|
/* glsl */
|
|
@@ -201,7 +201,7 @@ const G = {
|
|
|
201
201
|
}, E = {
|
|
202
202
|
simulation: 1.2,
|
|
203
203
|
model: 1.2
|
|
204
|
-
}, I = new
|
|
204
|
+
}, I = new P().setFromAxisAngle(new V(1, 0, 0), Math.PI / 2), D = new P();
|
|
205
205
|
function tt(a) {
|
|
206
206
|
return a === "glb" || a === "gltf" || a === "fbx" ? "y" : "z";
|
|
207
207
|
}
|
|
@@ -212,7 +212,7 @@ function et(a, t) {
|
|
|
212
212
|
const e = F(t);
|
|
213
213
|
return e.equals(a.quaternion) ? !1 : (a.quaternion.copy(e), a.updateMatrixWorld(!0), !0);
|
|
214
214
|
}
|
|
215
|
-
const m = 2213822, _ = 6000111, z = 6, x = 2e-3, U = 1e-4, N = 1e-4,
|
|
215
|
+
const m = 2213822, _ = 6000111, z = 6, x = 2e-3, U = 1e-4, N = 1e-4, k = 0.18, H = 0.35, q = 0.18, j = 0.75, Y = Math.PI / 3, y = new i.Vector3(), M = new i.Matrix4(), C = new i.Matrix4();
|
|
216
216
|
function Q(a, t, e) {
|
|
217
217
|
t.updateMatrixWorld();
|
|
218
218
|
const r = new i.Vector3();
|
|
@@ -239,12 +239,12 @@ function X(a, t) {
|
|
|
239
239
|
}
|
|
240
240
|
if (t instanceof i.InstancedMesh) {
|
|
241
241
|
for (let r = 0; r < t.count; r += 1)
|
|
242
|
-
t.getMatrixAt(r, M),
|
|
242
|
+
t.getMatrixAt(r, M), C.multiplyMatrices(t.matrixWorld, M), w(a, t, e.count, C);
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
w(a, t, e.count, t.matrixWorld);
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function w(a, t, e, r) {
|
|
248
248
|
for (let o = 0; o < e; o += 1)
|
|
249
249
|
t.getVertexPosition(o, y), y.applyMatrix4(r), a.expandByPoint(y);
|
|
250
250
|
}
|
|
@@ -298,12 +298,13 @@ class rt {
|
|
|
298
298
|
s(this, "groundGrabBlend", 0);
|
|
299
299
|
s(this, "groundCameraPoseValid", !1);
|
|
300
300
|
s(this, "disposed", !1);
|
|
301
|
+
s(this, "invalidationCallback");
|
|
301
302
|
this.model = t, this.runtime = r, this.presentation = o, this.groundPlacement = n ?? (o === "model" ? "visual" : "physics"), this.values = G[e];
|
|
302
303
|
const l = this.values, u = p(t), d = Math.max(...u.getSize(new i.Vector3()).toArray());
|
|
303
304
|
if (!Number.isFinite(d) || d <= 0) throw new Error("Empty simulation geometry.");
|
|
304
305
|
this.modelWrapper.name = "simulation-model-wrapper", this.root.add(this.modelWrapper), this.modelWrapper.add(t), this.forceLine = this.createForceLine(), this.root.add(this.forceLine), t.traverse((g) => {
|
|
305
306
|
g instanceof i.Mesh && g.layers.enable(v);
|
|
306
|
-
}), this.root.add(this.reflector);
|
|
307
|
+
}), this.reflector.userData.hdrTransparentBackdrop = !1, this.root.add(this.reflector);
|
|
307
308
|
const c = Math.max(u.getSize(new i.Vector3()).length() * 0.5, 0.02), h = this.reflector.material.uniforms;
|
|
308
309
|
h.fineGridColor.value.setHex(l.fineGrid), h.coarseGridColor.value.setHex(l.coarseGrid), h.gridOpacity.value = l.gridOpacity, h.reflectionMix.value = l.reflectionMix, this.layoutGround(u, c), this.groundVisible = !0, this.setGroundVisible(this.groundVisible);
|
|
309
310
|
const f = c / Math.sin(i.MathUtils.degToRad(38) / 2) * 1.25;
|
|
@@ -312,10 +313,14 @@ class rt {
|
|
|
312
313
|
setRuntime(t) {
|
|
313
314
|
this.disposed || this.runtime === t || (this.endGrab(), this.runtime = t, t && (this.groundPlacement = "physics"), this.bodyGroups.clear(), this.groundGrabFocusValid = !1, this.groundGrabBlend = 0, this.groundFollowDirty = !0, this.applyUpAxis());
|
|
314
315
|
}
|
|
316
|
+
setCacheInvalidationCallback(t) {
|
|
317
|
+
this.invalidationCallback = t;
|
|
318
|
+
}
|
|
315
319
|
replaceModel(t, e = !0) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
320
|
+
var r;
|
|
321
|
+
this.disposed || t === this.model || (this.endGrab(), this.bodyGroups.clear(), this.model.removeFromParent(), this.model = t, this.modelWrapper.add(t), t.traverse((o) => {
|
|
322
|
+
o instanceof i.Mesh && o.layers.enable(v);
|
|
323
|
+
}), e && this.reseatGround(), (r = this.invalidationCallback) == null || r.call(this));
|
|
319
324
|
}
|
|
320
325
|
/**
|
|
321
326
|
* Re-orients the scene to the given authored up axis. The rotation is a real
|
|
@@ -397,7 +402,7 @@ class rt {
|
|
|
397
402
|
if (r)
|
|
398
403
|
this.groundCenter.set(u, d);
|
|
399
404
|
else {
|
|
400
|
-
const g = this.groundInteractionActive ?
|
|
405
|
+
const g = this.groundInteractionActive ? H : k;
|
|
401
406
|
this.groundCenter.x += c * g, this.groundCenter.y += h * g;
|
|
402
407
|
}
|
|
403
408
|
this.reflector.setRadius(e, this.groundGridScale, this.groundCenter), this.reflector.updateMatrixWorld(!0);
|
|
@@ -557,10 +562,12 @@ class rt {
|
|
|
557
562
|
* anything the physics runtime drives is rotated inside the compiled model.
|
|
558
563
|
*/
|
|
559
564
|
attachAuxiliary(t) {
|
|
560
|
-
|
|
565
|
+
var e;
|
|
566
|
+
this.auxiliaries.add(t), this.modelWrapper.add(t), (e = this.invalidationCallback) == null || e.call(this);
|
|
561
567
|
}
|
|
562
568
|
detachAuxiliary(t) {
|
|
563
|
-
|
|
569
|
+
var e;
|
|
570
|
+
this.auxiliaries.delete(t) && (t.removeFromParent(), (e = this.invalidationCallback) == null || e.call(this));
|
|
564
571
|
}
|
|
565
572
|
getModelBounds() {
|
|
566
573
|
this.root.updateMatrixWorld(!0);
|
package/dist/types.d.ts
CHANGED
|
@@ -20,10 +20,26 @@ export type ViewerNavigationPolicy = 'legacy' | 'viewer' | 'preview';
|
|
|
20
20
|
export type ViewerPreviewDragPreset = 'left-rotate' | 'left-pan';
|
|
21
21
|
export type CameraChangeReason = 'pointer' | 'wheel' | 'fit' | 'restore' | 'api' | 'view-mode';
|
|
22
22
|
export type ViewerEnvironment = 'room' | {
|
|
23
|
-
/** Load an external equirectangular
|
|
24
|
-
readonly type: 'hdr';
|
|
23
|
+
/** Load an external equirectangular texture for image-based lighting. */
|
|
24
|
+
readonly type: 'hdr' | 'image';
|
|
25
25
|
readonly url: string;
|
|
26
26
|
};
|
|
27
|
+
export interface ViewerEnvironmentTexture {
|
|
28
|
+
readonly type: 'hdr' | 'image';
|
|
29
|
+
readonly url: string;
|
|
30
|
+
readonly name: string;
|
|
31
|
+
}
|
|
32
|
+
export interface ViewerEnvironmentState {
|
|
33
|
+
readonly available: boolean;
|
|
34
|
+
readonly active: 'default' | 'custom';
|
|
35
|
+
readonly backgroundVisible: boolean;
|
|
36
|
+
/** Shared environment/background yaw in degrees around Three.js' Y-up axis. */
|
|
37
|
+
readonly rotation: number;
|
|
38
|
+
readonly rotationAvailable: boolean;
|
|
39
|
+
readonly loading: boolean;
|
|
40
|
+
readonly defaultEnvironment: ViewerEnvironmentTexture | null;
|
|
41
|
+
readonly customEnvironment: ViewerEnvironmentTexture | null;
|
|
42
|
+
}
|
|
27
43
|
export interface ViewerDocumentRect {
|
|
28
44
|
readonly minX: number;
|
|
29
45
|
readonly minY: number;
|
|
@@ -63,8 +79,24 @@ export interface ViewerOptions {
|
|
|
63
79
|
alpha?: boolean;
|
|
64
80
|
powerPreference?: WebGLPowerPreference;
|
|
65
81
|
initialViewMode?: ViewerViewMode;
|
|
66
|
-
/**
|
|
82
|
+
/** Equirectangular HDR/image lighting environment. Defaults to the built-in room environment. */
|
|
67
83
|
environment?: ViewerEnvironment;
|
|
84
|
+
/** Shared environment/background yaw in degrees around Three.js' Y-up axis. */
|
|
85
|
+
environmentRotation?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Opt into the HDR backdrop used by transparent surfaces and Three.js
|
|
88
|
+
* transmission. The native Three.js path remains unchanged when disabled.
|
|
89
|
+
* Defaults to false.
|
|
90
|
+
*/
|
|
91
|
+
transparentHdrBackdrop?: boolean;
|
|
92
|
+
/** Blur applied while an HDR backdrop is enabled. Range 0..1, defaults to 0. */
|
|
93
|
+
transparentHdrBackdropBlurriness?: number;
|
|
94
|
+
/**
|
|
95
|
+
* `three` keeps the native Three.js transmission pipeline. Enabling
|
|
96
|
+
* `transparentHdrBackdrop` additionally injects the HDR behind transmission.
|
|
97
|
+
* `eevee-sphere-probe` always samples the scene environment through PMREM.
|
|
98
|
+
*/
|
|
99
|
+
transmissionMode?: 'three' | 'eevee-sphere-probe';
|
|
68
100
|
/** Pointer mapping for model/simulation previews. Defaults to `left-rotate`. */
|
|
69
101
|
previewDragPreset?: ViewerPreviewDragPreset;
|
|
70
102
|
autoSelectOnPick?: boolean;
|
|
@@ -183,6 +215,7 @@ export interface ViewerEventMap {
|
|
|
183
215
|
'asset-change': AssetChangeEvent;
|
|
184
216
|
'asset-error': AssetErrorEvent;
|
|
185
217
|
'asset-control-change': AssetControlChangeEvent;
|
|
218
|
+
'environment-change': ViewerEnvironmentState;
|
|
186
219
|
}
|
|
187
220
|
export interface Viewer {
|
|
188
221
|
readonly viewport: HTMLElement;
|
|
@@ -211,6 +244,14 @@ export interface Viewer {
|
|
|
211
244
|
execute(id: string, args?: unknown): boolean;
|
|
212
245
|
has(id: string): boolean;
|
|
213
246
|
};
|
|
247
|
+
readonly environment: {
|
|
248
|
+
getState(): ViewerEnvironmentState;
|
|
249
|
+
setBackgroundVisible(visible: boolean): boolean;
|
|
250
|
+
setRotation(degrees: number): boolean;
|
|
251
|
+
useDefault(): Promise<boolean>;
|
|
252
|
+
useCustom(): Promise<boolean>;
|
|
253
|
+
load(file: File): Promise<boolean>;
|
|
254
|
+
};
|
|
214
255
|
openAsset(source: AssetSource, options?: OpenAssetOptions): AssetPreview;
|
|
215
256
|
closeAsset(): Promise<void>;
|
|
216
257
|
addObject(object: Object3D, options?: ViewerObjectOptions): void;
|
|
@@ -232,6 +273,8 @@ export interface Viewer {
|
|
|
232
273
|
requestRender(): void;
|
|
233
274
|
getActiveCamera(): import('three').Camera;
|
|
234
275
|
setNavigationEnabled(enabled: boolean): void;
|
|
276
|
+
/** Changes HDR backdrop blur without rebuilding the scene. Values are clamped to 0..1. */
|
|
277
|
+
setTransparentHdrBackdropBlurriness(value: number): boolean;
|
|
235
278
|
/** Switches the model/simulation preview pointer mapping at runtime. */
|
|
236
279
|
setPreviewDragPreset(preset: ViewerPreviewDragPreset): void;
|
|
237
280
|
dispose(): void;
|
package/dist/ui/types.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export interface ViewerSceneUiParts {
|
|
|
16
16
|
scaleRuler?: boolean;
|
|
17
17
|
ground?: boolean;
|
|
18
18
|
collision?: boolean;
|
|
19
|
+
environment?: boolean;
|
|
20
|
+
background?: boolean;
|
|
19
21
|
theme?: boolean;
|
|
20
22
|
}
|
|
21
23
|
/** Shared UI configuration; asset-specific controls live in their named groups. */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var We = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var A = (i, e, n) =>
|
|
4
|
-
import { d as
|
|
5
|
-
import { S as Ze, m as ve } from "./stage-
|
|
2
|
+
var Ce = (i, e, n) => e in i ? We(i, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[e] = n;
|
|
3
|
+
var A = (i, e, n) => Ce(i, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { d as Ge, f as Te, c as Ve, a as Je, b as ye, M as Be, i as Qe, h as Xe, w as be, j as ge, S as we, p as Ke } from "./collision-debug-CuLOQ9D9.js";
|
|
5
|
+
import { S as Ze, m as ve } from "./stage-ivvjzCbR.js";
|
|
6
6
|
import { Quaternion as O, Euler as X, LoadingManager as Pe, Group as L, Mesh as U, MeshLambertMaterial as Ye, MeshPhongMaterial as Me, MeshStandardMaterial as oe, Matrix4 as I, TextureLoader as He, SRGBColorSpace as et, RepeatWrapping as tt, BoxGeometry as re, SphereGeometry as ae, CylinderGeometry as _e, CapsuleGeometry as De, Vector3 as z, MathUtils as it, Matrix3 as Re, Box3 as Ae, AxesHelper as nt, ArrowHelper as $e, Line as st, BufferGeometry as ot, LineBasicMaterial as Ee, Float32BufferAttribute as rt, MeshBasicMaterial as je, LineSegments as at, EdgesGeometry as lt } from "three";
|
|
7
|
-
import { c as Se } from "./session-
|
|
7
|
+
import { c as Se } from "./session-CGaImBKe.js";
|
|
8
8
|
import { GLTFLoader as ct } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
9
9
|
import { ColladaLoader as ut } from "three/examples/jsm/loaders/ColladaLoader.js";
|
|
10
10
|
import { disposeModelResources as N } from "./resources-CHhCm2f7.js";
|
|
@@ -247,7 +247,7 @@ function bt(i, e, n) {
|
|
|
247
247
|
...c ? { mimic: c } : {}
|
|
248
248
|
};
|
|
249
249
|
});
|
|
250
|
-
return ee(d), s.querySelector("transmission, gazebo") && l.droppedFeatures.push({ code: "UNSUPPORTED_URDF_EXTENSION", message: "URDF transmission/gazebo extensions are not compiled." }),
|
|
250
|
+
return ee(d), s.querySelector("transmission, gazebo") && l.droppedFeatures.push({ code: "UNSUPPORTED_URDF_EXTENSION", message: "URDF transmission/gazebo extensions are not compiled." }), Ge({ id: s.getAttribute("name") || e, name: s.getAttribute("name") || e, source: { format: "urdf", uri: e }, links: h, joints: d, diagnostics: l, extension: { files: n } }, { allowInvalidGraph: !0 });
|
|
251
251
|
}
|
|
252
252
|
function xe(i) {
|
|
253
253
|
const e = K(i);
|
|
@@ -347,8 +347,8 @@ async function vt(i) {
|
|
|
347
347
|
g || (M[2] += l);
|
|
348
348
|
const E = (g == null ? void 0 : g.origin) ?? { rotationRpy: [0, 0, 0] }, j = [`<body name="${T(p)}" pos="${M.join(" ")}" ${xe(E)}>`];
|
|
349
349
|
if (b.inertial) {
|
|
350
|
-
const { origin: x, mass: $, tensor: F } = b.inertial,
|
|
351
|
-
W.premultiply(
|
|
350
|
+
const { origin: x, mass: $, tensor: F } = b.inertial, C = new Re().setFromMatrix4(new I().makeRotationFromQuaternion(K(x))), W = new Re().set(F[0], F[3], F[4], F[3], F[1], F[5], F[4], F[5], F[2]);
|
|
351
|
+
W.premultiply(C).multiply(C.clone().transpose());
|
|
352
352
|
const q = W.elements;
|
|
353
353
|
j.push(`<inertial pos="${x.position.join(" ")}" mass="${$}" fullinertia="${[q[0], q[4], q[8], q[3], q[6], q[7]].join(" ")}"/>`);
|
|
354
354
|
}
|
|
@@ -358,8 +358,8 @@ async function vt(i) {
|
|
|
358
358
|
else {
|
|
359
359
|
const x = g.type === "prismatic" ? "slide" : "hinge", $ = g.type !== "continuous" && !!g.limits && Number.isFinite(g.limits.lower) && Number.isFinite(g.limits.upper), F = u[g.id];
|
|
360
360
|
r.push(F);
|
|
361
|
-
const
|
|
362
|
-
j.push(`<joint name="${T(g.id)}" type="${x}" axis="${g.axis.join(" ")}"${$ ? ` limited="true" range="${g.limits.lower} ${g.limits.upper}" ref="0"` : ""} damping="${
|
|
361
|
+
const C = ((R = g.dynamics) == null ? void 0 : R.damping) ?? 0, W = ((D = g.dynamics) == null ? void 0 : D.friction) ?? 0;
|
|
362
|
+
j.push(`<joint name="${T(g.id)}" type="${x}" axis="${g.axis.join(" ")}"${$ ? ` limited="true" range="${g.limits.lower} ${g.limits.upper}" ref="0"` : ""} damping="${C}" frictionloss="${W}"/>`);
|
|
363
363
|
}
|
|
364
364
|
for (const x of b.collisions) {
|
|
365
365
|
const $ = await w(x.geometry);
|
|
@@ -1124,7 +1124,7 @@ async function Jt(i, e, n) {
|
|
|
1124
1124
|
const l = e.format === "xacro";
|
|
1125
1125
|
if (l) {
|
|
1126
1126
|
(q = e.reportProgress) == null || q.call(e, "xacro", "正在展开 Xacro 宏与依赖文件...");
|
|
1127
|
-
const { expandXacro: v } = await import("./xacro-
|
|
1127
|
+
const { expandXacro: v } = await import("./xacro-C7BfYT0W.js");
|
|
1128
1128
|
s = await v(s, t, n, e.options.xacro, e.signal);
|
|
1129
1129
|
}
|
|
1130
1130
|
if (e.signal.aborted) throw Q();
|
|
@@ -1138,7 +1138,7 @@ async function Jt(i, e, n) {
|
|
|
1138
1138
|
"simulation",
|
|
1139
1139
|
c ? "physics" : "visual"
|
|
1140
1140
|
);
|
|
1141
|
-
r && (r.root.visible = !1, a.attachAuxiliary(r.root));
|
|
1141
|
+
a.setCacheInvalidationCallback(e.invalidateTransmissionCaches), r && (r.root.visible = !1, a.attachAuxiliary(r.root));
|
|
1142
1142
|
let f = null, m = null, y = null;
|
|
1143
1143
|
const p = o.diagnostics.warnings[0], g = p ? be(p, "visual-material") : null;
|
|
1144
1144
|
let b = u ? {
|
|
@@ -1166,26 +1166,26 @@ async function Jt(i, e, n) {
|
|
|
1166
1166
|
"dynamics-unavailable",
|
|
1167
1167
|
ge(u.code, u.source).summary
|
|
1168
1168
|
), a.attachAuxiliary($.overlayRoot);
|
|
1169
|
-
const F = () => !f || !m ? !1 : (a.endGrab(), f.reset(), $.resetPose(), a.resetGround(), f.setJointValues($.getSnapshot().jointValues), a.replaceModel(m.root, !1), a.setRuntime(f), m.sync(), y == null || y.sync(), d.root.visible = !1, m.root.visible = !0, r && (r.root.visible = !1), y && (y.root.visible = $.getSnapshot().overlays.collision), !0),
|
|
1169
|
+
const F = () => !f || !m ? !1 : (a.endGrab(), f.reset(), $.resetPose(), a.resetGround(), f.setJointValues($.getSnapshot().jointValues), a.replaceModel(m.root, !1), a.setRuntime(f), m.sync(), y == null || y.sync(), d.root.visible = !1, m.root.visible = !0, r && (r.root.visible = !1), y && (y.root.visible = $.getSnapshot().overlays.collision), !0), C = async () => {
|
|
1170
1170
|
var de, pe, fe, me;
|
|
1171
1171
|
if (f || R || !c) return;
|
|
1172
1172
|
$.setMode("dynamics-initializing"), M = { status: "initializing" }, (de = e.reportSessionState) == null || de.call(e);
|
|
1173
1173
|
let v = null, S = null, P = null;
|
|
1174
1174
|
try {
|
|
1175
|
-
const
|
|
1175
|
+
const G = await vt(o);
|
|
1176
1176
|
if (e.signal.aborted || R) throw Q();
|
|
1177
|
-
const Z = await import("./mujoco-runtime-
|
|
1178
|
-
if (v = new Z.MujocoRuntime(), await v.initialize(
|
|
1177
|
+
const Z = await import("./mujoco-runtime-C8WJifvE.js");
|
|
1178
|
+
if (v = new Z.MujocoRuntime(), await v.initialize(G, {
|
|
1179
1179
|
baseUrl: e.options.mujocoBaseUrl,
|
|
1180
1180
|
wasmModule: e.options.mujocoWasmModule
|
|
1181
1181
|
}), v.setWorldRotation(ve(a.getUpAxis())), e.signal.aborted || R || (S = new we(v, await Fe(o)), e.signal.aborted || R)) throw Q();
|
|
1182
1182
|
const he = await Ie(o);
|
|
1183
1183
|
if (P = he ? new we(v, he, { accelerateRaycast: !1 }) : null, e.signal.aborted || R) throw Q();
|
|
1184
1184
|
f = v, v = null, m = S, S = null, m.root.visible = !1, y = P, P = null, y && (y.root.visible = !1, a.attachAuxiliary(y.root)), M = { status: "ready" }, b = g, D ? (F(), E = !0, $.setMode("dynamics-running")) : $.setMode("kinematic"), (pe = e.reportSessionState) == null || pe.call(e), e.requestRender();
|
|
1185
|
-
} catch (
|
|
1186
|
-
if (D = !1, P == null || P.dispose(), S == null || S.dispose(), v == null || v.dispose(), R || e.signal.aborted ||
|
|
1187
|
-
const Z = Ke(
|
|
1188
|
-
a.setRuntime(void 0), a.setGroundPlacement("visual"), f == null || f.dispose(), f = null, m == null || m.dispose(), m = null, y && (a.detachAuxiliary(y.root), y.dispose(), y = null), x(), b = be(Z, "physics-fallback"), M = { status: "unavailable", issue: b }, $.setMode("dynamics-unavailable", ((fe = b.notice) == null ? void 0 : fe.summary) ?? b.message), (me = e.reportSessionState) == null || me.call(e), e.reportError(
|
|
1185
|
+
} catch (G) {
|
|
1186
|
+
if (D = !1, P == null || P.dispose(), S == null || S.dispose(), v == null || v.dispose(), R || e.signal.aborted || G instanceof Error && G.name === "AbortError") return;
|
|
1187
|
+
const Z = Ke(G, e.signal, "urdf-physics");
|
|
1188
|
+
a.setRuntime(void 0), a.setGroundPlacement("visual"), f == null || f.dispose(), f = null, m == null || m.dispose(), m = null, y && (a.detachAuxiliary(y.root), y.dispose(), y = null), x(), b = be(Z, "physics-fallback"), M = { status: "unavailable", issue: b }, $.setMode("dynamics-unavailable", ((fe = b.notice) == null ? void 0 : fe.summary) ?? b.message), (me = e.reportSessionState) == null || me.call(e), e.reportError(G, { fatal: !1, stage: "physics-start", code: Z.code });
|
|
1189
1189
|
}
|
|
1190
1190
|
};
|
|
1191
1191
|
return {
|
|
@@ -1209,7 +1209,7 @@ async function Jt(i, e, n) {
|
|
|
1209
1209
|
var v;
|
|
1210
1210
|
if (!(R || E || D || M.status === "unavailable" || M.status === "not-authored")) {
|
|
1211
1211
|
if (D = !0, $.select(null), !f) {
|
|
1212
|
-
a.endGrab(), $.resetPose(), a.resetGround(), j ?? (j =
|
|
1212
|
+
a.endGrab(), $.resetPose(), a.resetGround(), j ?? (j = C().finally(() => {
|
|
1213
1213
|
j = null;
|
|
1214
1214
|
}));
|
|
1215
1215
|
return;
|