@nebula-spatial/studio 0.0.0-stage → 0.1.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/README.md +206 -3
- package/dist/ai/contract.d.ts +73 -0
- package/dist/ai/host.d.ts +28 -0
- package/dist/asset/dependency-scan.d.ts +78 -0
- package/dist/asset/intake.d.ts +84 -0
- package/dist/asset/layout-detect.d.ts +40 -0
- package/dist/asset/media-type.d.ts +10 -0
- package/dist/asset/model-inspection.d.ts +127 -0
- package/dist/asset/record.d.ts +35 -0
- package/dist/asset/remote-asset-resolver.d.ts +36 -0
- package/dist/asset/repairs.d.ts +53 -0
- package/dist/asset/resource-locator.d.ts +15 -0
- package/dist/asset/revision-diff.d.ts +33 -0
- package/dist/asset/source-contracts.d.ts +21 -0
- package/dist/asset/source-paths.d.ts +15 -0
- package/dist/asset/usd-inspection.d.ts +39 -0
- package/dist/asset/usd-source-metadata.d.ts +142 -0
- package/dist/asset/visual-intake.d.ts +27 -0
- package/dist/asset/visual-record.d.ts +22 -0
- package/dist/asset/web-intake.d.ts +46 -0
- package/dist/asset-source-BExlEcRt.js +444 -0
- package/dist/assets/openusd_three_loader-DLiqJWUM.js +13769 -0
- package/dist/assets/usd-export-worker-BRxTLqer.js +182 -0
- package/dist/assets/usd-worker-DekqMsQv.js +1392 -0
- package/dist/builders-BAXRR5o5.js +1854 -0
- package/dist/core/asset-task.d.ts +105 -0
- package/dist/core/context.d.ts +23 -0
- package/dist/core/host.d.ts +432 -0
- package/dist/core/persistence-controller.d.ts +58 -0
- package/dist/core/plugins.d.ts +139 -0
- package/dist/core/scene-tree.d.ts +62 -0
- package/dist/core/versions.d.ts +2 -0
- package/dist/core/when.d.ts +13 -0
- package/dist/core/write-policy.d.ts +29 -0
- package/dist/delivery/build-plan.d.ts +2 -0
- package/dist/delivery/contracts.d.ts +362 -0
- package/dist/delivery/digest.d.ts +3 -0
- package/dist/delivery/evidence.d.ts +10 -0
- package/dist/delivery/export-evidence.d.ts +3 -0
- package/dist/delivery/index.d.ts +9 -0
- package/dist/delivery/prim-name.d.ts +17 -0
- package/dist/delivery/profile.d.ts +4 -0
- package/dist/doc/builders.d.ts +99 -0
- package/dist/doc/command.d.ts +195 -0
- package/dist/doc/domain-extensions.d.ts +34 -0
- package/dist/doc/node-facts.d.ts +87 -0
- package/dist/doc/physics-facts.d.ts +74 -0
- package/dist/doc/placement-policy.d.ts +71 -0
- package/dist/doc/random-placement.d.ts +30 -0
- package/dist/doc/scene-graph.d.ts +80 -0
- package/dist/doc/scene-regions.d.ts +29 -0
- package/dist/doc/schema.d.ts +452 -0
- package/dist/doc/task.d.ts +71 -0
- package/dist/doc/validate.d.ts +68 -0
- package/dist/editor/asset-source.d.ts +15 -0
- package/dist/editor/editor.d.ts +246 -0
- package/dist/editor/index.d.ts +22 -0
- package/dist/editor/shortcuts.d.ts +2 -0
- package/dist/editor/types.d.ts +143 -0
- package/dist/editor/ui-plugins.d.ts +64 -0
- package/dist/editor.js +1755 -0
- package/dist/editorial-BkAFWfbg.js +83 -0
- package/dist/export-evidence-DMNRhgL9.js +2705 -0
- package/dist/generalization/domain.d.ts +10 -0
- package/dist/generalization/generalization.d.ts +371 -0
- package/dist/generalization/index.d.ts +11 -0
- package/dist/generalization.js +1659 -0
- package/dist/history/undo-stack.d.ts +74 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.js +2840 -0
- package/dist/mjcf-visual-Bt4bUxd1.js +72 -0
- package/dist/mujoco-runtime-BYZnrvbR.js +467 -0
- package/dist/persist/content-addressed.d.ts +11 -0
- package/dist/persist/create-scene-package-from-host.d.ts +7 -0
- package/dist/persist/indexeddb-store.d.ts +69 -0
- package/dist/persist/scene-file.d.ts +52 -0
- package/dist/persist/scene-package.d.ts +8 -0
- package/dist/persist/snapshot.d.ts +5 -0
- package/dist/physics-facts-tfQYyNTD.js +337 -0
- package/dist/placement-policy-DY_FNRDu.js +405 -0
- package/dist/ports/asset-ingestor.d.ts +41 -0
- package/dist/ports/asset-source.d.ts +57 -0
- package/dist/ports/delivery.d.ts +13 -0
- package/dist/ports/persistence.d.ts +29 -0
- package/dist/project/asset-catalog.d.ts +21 -0
- package/dist/project/contracts.d.ts +272 -0
- package/dist/project/editorial.d.ts +16 -0
- package/dist/project/identity.d.ts +20 -0
- package/dist/project/index.d.ts +9 -0
- package/dist/project/scene-document.d.ts +5 -0
- package/dist/project/source-dependencies.d.ts +7 -0
- package/dist/remote-asset-resolver-Cb8cfNmw.js +136 -0
- package/dist/scene/index.d.ts +12 -0
- package/dist/scene-graph-DBLKAhxa.js +681 -0
- package/dist/scene-session-Cy6vDJ1l.js +21981 -0
- package/dist/scene.js +244 -0
- package/dist/session-BRBrCLdd.js +963 -0
- package/dist/session-DI5tPJxn.js +825 -0
- package/dist/session-q3uuG7OP.js +296 -0
- package/dist/studio/delivery-catalog.d.ts +28 -0
- package/dist/studio/in-memory-asset-source.d.ts +15 -0
- package/dist/studio/index.d.ts +31 -0
- package/dist/studio/indexeddb-asset-source.d.ts +32 -0
- package/dist/studio/indexeddb-persistence.d.ts +13 -0
- package/dist/studio/remote-asset-importer.d.ts +56 -0
- package/dist/studio/source-package.d.ts +9 -0
- package/dist/studio/usd-export-client.d.ts +13 -0
- package/dist/studio/usd-export-protocol.d.ts +98 -0
- package/dist/studio/usd-export-worker.d.ts +1 -0
- package/dist/studio/usd-zip-reader.d.ts +14 -0
- package/dist/studio/web-asset-ingestor.d.ts +10 -0
- package/dist/studio/web-host.d.ts +8 -0
- package/dist/studio.js +5545 -0
- package/dist/urdf-session-CQir2nb2.js +1230 -0
- package/dist/usd-session-DZJnEEOs.js +7385 -0
- package/dist/util/asset-facts.d.ts +3 -0
- package/dist/util/data.d.ts +17 -0
- package/dist/util/diagnostics.d.ts +38 -0
- package/dist/util/geometry.d.ts +11 -0
- package/dist/util/hash.d.ts +9 -0
- package/dist/util/ids.d.ts +20 -0
- package/dist/util/math.d.ts +47 -0
- package/dist/util/ply-metadata.d.ts +19 -0
- package/dist/util/studio-source.d.ts +23 -0
- package/dist/version.d.ts +5 -0
- package/dist/view/appearance.d.ts +13 -0
- package/dist/view/authoring-appearance.d.ts +25 -0
- package/dist/view/bounds-preview.d.ts +34 -0
- package/dist/view/bounds.d.ts +11 -0
- package/dist/view/camera-zoom.d.ts +3 -0
- package/dist/view/geometry-anchors.d.ts +20 -0
- package/dist/view/gizmo-appearance.d.ts +5 -0
- package/dist/view/gizmo.d.ts +81 -0
- package/dist/view/group-selection.d.ts +13 -0
- package/dist/view/node-features.d.ts +39 -0
- package/dist/view/picking.d.ts +49 -0
- package/dist/view/placement.d.ts +48 -0
- package/dist/view/region-editing.d.ts +25 -0
- package/dist/view/rotation-guide.d.ts +36 -0
- package/dist/view/runtime-capabilities.d.ts +22 -0
- package/dist/view/scene-session.d.ts +258 -0
- package/dist/view/screen-bounds.d.ts +17 -0
- package/dist/view/selection-transform.d.ts +20 -0
- package/dist/wasm-module-DZn2AM1W.js +13 -0
- package/dist/xacro-DLRXyk60.js +76 -0
- package/node_modules/@nebula-spatial/cad-loader/CHANGELOG.md +48 -0
- package/node_modules/@nebula-spatial/cad-loader/README.md +108 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/cad-types.d.ts +26 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/errors.d.ts +5 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/index.d.ts +24 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/index.js +2354 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/bin-group-reader.d.ts +9 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/bin-parser.d.ts +78 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/dxbs-sidecar.d.ts +24 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/geometry-segments.d.ts +20 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/text-roundtrip.d.ts +4 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/types.d.ts +81 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/runtime-text-decoder.d.ts +8 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/types.d.ts +153 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/utils/insert-bbox.d.ts +10 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/core/utils/viewport-rect.d.ts +21 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/index.d.ts +36 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/index.js +5829 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/geo-loader.d.ts +59 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/automatic-external-resources.d.ts +26 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/external-variant-sidecar-fetch.d.ts +13 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/flow-control.d.ts +29 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/frame-budget-scheduler.d.ts +21 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-compact-executor.d.ts +19 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-loader-local-adapter.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-loader-pipeline.d.ts +92 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-loader-worker-adapter.d.ts +13 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-node-builder.d.ts +34 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-node-load-sink.d.ts +28 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-node.d.ts +304 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-prepare-worker-types.d.ts +94 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-prepare.d.ts +38 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-prepare.worker.d.ts +1 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/insert-model-builder.d.ts +10 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/insert-runtime-geometry.d.ts +15 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/line-canonical.d.ts +37 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/line-quality.d.ts +9 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/prepare-credit-gate.d.ts +20 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/transport.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/render-resource/cad-render-node.d.ts +80 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/render-resource/geo-node-cad-render-node.d.ts +12 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/geo-cad-line-geometry.d.ts +28 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/geo-cad-line-material.d.ts +18 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/instancing/block-geometry-registry.d.ts +35 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/instancing/insert-instance-table.d.ts +23 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/scene/instancing/viewport-instance-presenter.d.ts +66 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/selection/cad-insert-selection.d.ts +35 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/selection/cad-text-selection.d.ts +31 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/annotation-idle-gate.d.ts +14 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-document-session.d.ts +187 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-font-runtime.d.ts +11 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-insert-id.d.ts +6 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-text-warmup.d.ts +38 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/create-cad-document-session.d.ts +5 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/load-session.d.ts +90 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/session/viewport-coverage.d.ts +32 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/abort.d.ts +3 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/cad-display-color.d.ts +55 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/cad-load-source.d.ts +8 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/color-buffer.d.ts +6 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/constants.d.ts +11 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/display-color-buffer.d.ts +27 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/errors.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/text-builder.d.ts +25 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/text-font.d.ts +12 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/types.d.ts +57 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/utils/insert-bbox.d.ts +1 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/utils/timing.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/utils/viewport-rect.d.ts +1 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/shared/viewer-theme.d.ts +2 -0
- package/node_modules/@nebula-spatial/cad-loader/dist/workers/geo-prepare.worker.js +2264 -0
- package/node_modules/@nebula-spatial/cad-loader/package.json +62 -0
- package/node_modules/@nebula-spatial/viewer/CHANGELOG.md +426 -0
- package/node_modules/@nebula-spatial/viewer/FBX-MATERIAL-CONVERSION.md +97 -0
- package/node_modules/@nebula-spatial/viewer/README.md +1056 -0
- package/node_modules/@nebula-spatial/viewer/USD-VISUAL-MATERIAL-SUPPORT.md +89 -0
- package/node_modules/@nebula-spatial/viewer/basis/basis_transcoder.js +19 -0
- package/node_modules/@nebula-spatial/viewer/basis/basis_transcoder.wasm +0 -0
- package/node_modules/@nebula-spatial/viewer/dist/asset-ir-DEOK9SqE.js +382 -0
- package/node_modules/@nebula-spatial/viewer/dist/assets/ground-grid.d.ts +6 -0
- package/node_modules/@nebula-spatial/viewer/dist/assets/source-types.d.ts +19 -0
- package/node_modules/@nebula-spatial/viewer/dist/assets/types.d.ts +393 -0
- package/node_modules/@nebula-spatial/viewer/dist/assets/usd-worker-Bom5cjz3.js +1392 -0
- package/node_modules/@nebula-spatial/viewer/dist/cad/text.d.ts +2 -0
- package/node_modules/@nebula-spatial/viewer/dist/cad/types.d.ts +368 -0
- package/node_modules/@nebula-spatial/viewer/dist/index-ByBlfVc0.js +12132 -0
- package/node_modules/@nebula-spatial/viewer/dist/index.d.ts +32 -0
- package/node_modules/@nebula-spatial/viewer/dist/index.js +26 -0
- package/node_modules/@nebula-spatial/viewer/dist/inspection/types.d.ts +112 -0
- package/node_modules/@nebula-spatial/viewer/dist/mjcf-visual-DVRa0w90.js +72 -0
- package/node_modules/@nebula-spatial/viewer/dist/mujoco-runtime-Dhx6Ua2u.js +463 -0
- package/node_modules/@nebula-spatial/viewer/dist/plugins.d.ts +179 -0
- package/node_modules/@nebula-spatial/viewer/dist/scene/instances.d.ts +36 -0
- package/node_modules/@nebula-spatial/viewer/dist/scene/types.d.ts +258 -0
- package/node_modules/@nebula-spatial/viewer/dist/session-B-j6KdA-.js +389 -0
- package/node_modules/@nebula-spatial/viewer/dist/session-B4AICTeJ.js +963 -0
- package/node_modules/@nebula-spatial/viewer/dist/session-BAG5cDYe.js +9153 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/mujoco-runtime.d.ts +118 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/mujoco-wasm-module.d.ts +11 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/openusd-wasm-module.d.ts +10 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/physics-runtime-state.d.ts +75 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/types.d.ts +129 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/usd-inspection.d.ts +66 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/usd-query.d.ts +50 -0
- package/node_modules/@nebula-spatial/viewer/dist/simulation/usd-resource-policy.d.ts +28 -0
- package/node_modules/@nebula-spatial/viewer/dist/types.d.ts +278 -0
- package/node_modules/@nebula-spatial/viewer/dist/ui/types.d.ts +48 -0
- package/node_modules/@nebula-spatial/viewer/dist/urdf-session-kemAnBn8.js +3231 -0
- package/node_modules/@nebula-spatial/viewer/dist/usd-session-QtwGKI7v.js +6771 -0
- package/node_modules/@nebula-spatial/viewer/dist/version.d.ts +5 -0
- package/node_modules/@nebula-spatial/viewer/dist/viewer.d.ts +2 -0
- package/node_modules/@nebula-spatial/viewer/dist/xacro-CYTPS7mh.js +1537 -0
- package/node_modules/@nebula-spatial/viewer/openusd/openusd-runtime-manifest.json +15 -0
- package/node_modules/@nebula-spatial/viewer/openusd/openusd_probe.js +14 -0
- package/node_modules/@nebula-spatial/viewer/openusd/openusd_probe.wasm +0 -0
- package/node_modules/@nebula-spatial/viewer/package.json +66 -0
- package/package.json +87 -6
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-asset scene sessions for the Viewer.
|
|
3
|
+
*
|
|
4
|
+
* The Viewer deliberately keeps **one** Renderer, Scene, Camera and RAF. What
|
|
5
|
+
* changes here is the unit of ownership: instead of one asset per session, a
|
|
6
|
+
* scene session owns several placed assets under a single root. Every asset is
|
|
7
|
+
* still resolved by its own format loader, so no parser is duplicated.
|
|
8
|
+
*
|
|
9
|
+
* Scope decision: this lives beside `assets/` rather than widening
|
|
10
|
+
* `AssetSource`, so the single-asset open path stays untouched.
|
|
11
|
+
*/
|
|
12
|
+
import type { AssetFormat, AssetResourceResolver, AssetSingleSource, AssetFileEntry, OpenAssetOptions } from '../assets/types';
|
|
13
|
+
import type { AssetPhysicsState, AssetPreviewCapabilities, AssetWarningSnapshot } from '../assets/types';
|
|
14
|
+
import type { CadLoadSource } from '../cad/types';
|
|
15
|
+
import type { PhysicsBodyMotionType, PhysicsRuntimeSnapshot } from '../simulation/physics-runtime-state';
|
|
16
|
+
/** Plain readonly tuple, kept local so this module imports no document types. */
|
|
17
|
+
export type Vec3Like = readonly [number, number, number];
|
|
18
|
+
/** Placement of one asset inside the scene, relative to the scene root. */
|
|
19
|
+
export interface ScenePlacement {
|
|
20
|
+
readonly position?: Vec3Like;
|
|
21
|
+
readonly rotation?: readonly [number, number, number, number];
|
|
22
|
+
readonly scale?: Vec3Like;
|
|
23
|
+
/**
|
|
24
|
+
* Transform pivot in source-content coordinates. The instance group is posed
|
|
25
|
+
* at this pivot and its content is translated by `-pivot`.
|
|
26
|
+
*/
|
|
27
|
+
readonly pivot?: Vec3Like;
|
|
28
|
+
readonly visible?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** One asset instance placed in the scene. */
|
|
31
|
+
export interface SceneEntry {
|
|
32
|
+
/** Stable caller-chosen id echoed back by instance-level commands. */
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly source: AssetSingleSource | Extract<CadLoadSource, {
|
|
35
|
+
readonly kind: 'packFile';
|
|
36
|
+
}> | {
|
|
37
|
+
readonly kind: 'files';
|
|
38
|
+
readonly files: readonly AssetFileEntry[];
|
|
39
|
+
readonly entry?: string;
|
|
40
|
+
};
|
|
41
|
+
/** Explicit format; defaults to per-entry automatic detection. */
|
|
42
|
+
readonly format?: AssetFormat;
|
|
43
|
+
readonly filename?: string;
|
|
44
|
+
readonly baseUrl?: string;
|
|
45
|
+
readonly resourceResolver?: AssetResourceResolver;
|
|
46
|
+
/** Format-specific options passed to the owning asset loader. */
|
|
47
|
+
readonly openOptions?: Partial<OpenAssetOptions>;
|
|
48
|
+
readonly placement?: ScenePlacement;
|
|
49
|
+
readonly physics?: SceneInstancePhysics;
|
|
50
|
+
}
|
|
51
|
+
export interface SceneOptions {
|
|
52
|
+
readonly signal?: AbortSignal;
|
|
53
|
+
readonly simulationTheme?: 'dark' | 'light';
|
|
54
|
+
readonly dracoDecoderPath?: string;
|
|
55
|
+
readonly ktx2TranscoderPath?: string;
|
|
56
|
+
readonly mujocoBaseUrl?: string;
|
|
57
|
+
readonly openUsdBaseUrl?: string;
|
|
58
|
+
readonly openUsdRuntimeId?: string;
|
|
59
|
+
readonly openUsdWasmModule?: WebAssembly.Module | Promise<WebAssembly.Module>;
|
|
60
|
+
readonly mujocoWasmModule?: WebAssembly.Module | Promise<WebAssembly.Module>;
|
|
61
|
+
}
|
|
62
|
+
/** `closed` means the scene shut down before the instance finished loading. */
|
|
63
|
+
export type SceneInstancePhase = 'pending' | 'loading' | 'ready' | 'failed' | 'closed';
|
|
64
|
+
export interface SceneInstanceSnapshot {
|
|
65
|
+
readonly id: string;
|
|
66
|
+
readonly assetId: string;
|
|
67
|
+
readonly phase: SceneInstancePhase;
|
|
68
|
+
/** Populated when `phase` is `failed`. */
|
|
69
|
+
readonly error: {
|
|
70
|
+
readonly code: string;
|
|
71
|
+
readonly message: string;
|
|
72
|
+
} | null;
|
|
73
|
+
/** Runtime capability report from the exact format session that loaded this instance. */
|
|
74
|
+
readonly capabilities?: AssetPreviewCapabilities;
|
|
75
|
+
/** Physics availability is independent from visual readiness. */
|
|
76
|
+
readonly physics?: AssetPhysicsState | null;
|
|
77
|
+
/** Loader-owned stage while `phase` is loading; terminal states use null. */
|
|
78
|
+
readonly stage?: string | null;
|
|
79
|
+
readonly message?: string | null;
|
|
80
|
+
readonly progress?: {
|
|
81
|
+
readonly completed: number;
|
|
82
|
+
readonly total: number | null;
|
|
83
|
+
readonly determinate: boolean;
|
|
84
|
+
} | null;
|
|
85
|
+
readonly warning?: AssetWarningSnapshot | null;
|
|
86
|
+
}
|
|
87
|
+
export interface SceneSnapshot {
|
|
88
|
+
readonly revision: number;
|
|
89
|
+
readonly phase: 'loading' | 'ready' | 'failed';
|
|
90
|
+
readonly instances: readonly SceneInstanceSnapshot[];
|
|
91
|
+
/** Aggregated capability view of every loaded instance. */
|
|
92
|
+
readonly capabilities: {
|
|
93
|
+
readonly hasPhysics: boolean;
|
|
94
|
+
readonly canPlay: boolean;
|
|
95
|
+
readonly canPause: boolean;
|
|
96
|
+
readonly canReset: boolean;
|
|
97
|
+
readonly canToggleCollision: boolean;
|
|
98
|
+
readonly canToggleGround: boolean;
|
|
99
|
+
};
|
|
100
|
+
readonly error: {
|
|
101
|
+
readonly code: string;
|
|
102
|
+
readonly message: string;
|
|
103
|
+
} | null;
|
|
104
|
+
}
|
|
105
|
+
export interface SceneInstanceRuntime {
|
|
106
|
+
readonly id: string;
|
|
107
|
+
readonly capabilities: AssetPreviewCapabilities | null;
|
|
108
|
+
readonly physics: AssetPhysicsState | null;
|
|
109
|
+
readonly visualDiagnostics: Readonly<Record<string, unknown>> | null;
|
|
110
|
+
readonly physicsProperties: Readonly<Record<string, unknown>> | null;
|
|
111
|
+
readonly physicsRuntime: PhysicsRuntimeSnapshot | null;
|
|
112
|
+
/**
|
|
113
|
+
* Viewport inspection overlays that the mounted format session can render.
|
|
114
|
+
* This is deliberately separate from authored data: a model may contain
|
|
115
|
+
* mass, inertia, or joint declarations while the current runtime cannot
|
|
116
|
+
* draw the corresponding guide.
|
|
117
|
+
*/
|
|
118
|
+
readonly inspectionOverlays?: Readonly<{
|
|
119
|
+
readonly jointAxis: boolean;
|
|
120
|
+
readonly centerOfMass: boolean;
|
|
121
|
+
readonly inertia: boolean;
|
|
122
|
+
}> | null;
|
|
123
|
+
}
|
|
124
|
+
export interface ScenePhysicsState {
|
|
125
|
+
readonly status: 'not-authored' | 'initializing' | 'ready' | 'unavailable';
|
|
126
|
+
readonly issue?: {
|
|
127
|
+
readonly code: string;
|
|
128
|
+
readonly message: string;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
export interface SceneInstanceBounds {
|
|
132
|
+
readonly min: Vec3Like;
|
|
133
|
+
readonly max: Vec3Like;
|
|
134
|
+
readonly size: Vec3Like;
|
|
135
|
+
}
|
|
136
|
+
export interface SceneDeterministicCheckOptions {
|
|
137
|
+
readonly steps?: number;
|
|
138
|
+
readonly timestep?: number;
|
|
139
|
+
}
|
|
140
|
+
export interface SceneDeterministicCheckResult {
|
|
141
|
+
readonly status: 'completed' | 'not-authored' | 'unavailable';
|
|
142
|
+
readonly reason: string | null;
|
|
143
|
+
readonly checkedAt: string;
|
|
144
|
+
readonly timestep: number | null;
|
|
145
|
+
readonly steps: number;
|
|
146
|
+
readonly initial: PhysicsRuntimeSnapshot | null;
|
|
147
|
+
readonly final: PhysicsRuntimeSnapshot | null;
|
|
148
|
+
readonly bounds: Readonly<Record<string, SceneInstanceBounds>>;
|
|
149
|
+
readonly overlaps: readonly {
|
|
150
|
+
readonly a: string;
|
|
151
|
+
readonly b: string;
|
|
152
|
+
readonly volume: number;
|
|
153
|
+
}[];
|
|
154
|
+
readonly bodyMotion: Readonly<Record<string, PhysicsBodyMotionType>>;
|
|
155
|
+
}
|
|
156
|
+
export type SceneInspectionOverlay = 'jointAxis' | 'centerOfMass' | 'inertia';
|
|
157
|
+
/** Operations available on a loaded scene session. */
|
|
158
|
+
export interface SceneControl {
|
|
159
|
+
readonly id: string;
|
|
160
|
+
/**
|
|
161
|
+
* Stage root handed to the host runtime exactly once. The host mounts it like
|
|
162
|
+
* any asset root, so the scene reuses the existing single Renderer/Scene/RAF.
|
|
163
|
+
*/
|
|
164
|
+
readonly root: import('three').Object3D;
|
|
165
|
+
readonly ready: Promise<void>;
|
|
166
|
+
getSnapshot(): SceneSnapshot;
|
|
167
|
+
subscribe(listener: (snapshot: SceneSnapshot) => void): () => void;
|
|
168
|
+
/**
|
|
169
|
+
* Replaces one loaded instance placement and resolves after the shared scene
|
|
170
|
+
* physics world has been rebuilt for the committed pose.
|
|
171
|
+
*/
|
|
172
|
+
setInstancePlacement(id: string, placement: ScenePlacement): Promise<boolean>;
|
|
173
|
+
/** Update the unified collision overlay for an uncommitted instance pose. */
|
|
174
|
+
previewInstancePlacement(id: string, placement: ScenePlacement): boolean;
|
|
175
|
+
/** Adds an instance at runtime; resolves once it is loaded or failed. */
|
|
176
|
+
addInstance(entry: SceneEntry): Promise<SceneInstanceSnapshot>;
|
|
177
|
+
/** Removes an instance and disposes its resources. */
|
|
178
|
+
removeInstance(id: string): Promise<boolean>;
|
|
179
|
+
/** Reads the real format-session report without exposing live renderer objects. */
|
|
180
|
+
getInstanceRuntime(id: string): SceneInstanceRuntime | null;
|
|
181
|
+
getInstanceBounds(id: string): SceneInstanceBounds | null;
|
|
182
|
+
/** Hidden collision geometry for placement probing; created lazily when authored. */
|
|
183
|
+
getInstanceCollisionRoot(id: string): import('three').Object3D | null;
|
|
184
|
+
setPhysicsConfiguration(configuration: ScenePhysicsConfiguration): Promise<void>;
|
|
185
|
+
getScenePhysicsState(): ScenePhysicsState;
|
|
186
|
+
getScenePhysicsRuntime(): PhysicsRuntimeSnapshot | null;
|
|
187
|
+
/**
|
|
188
|
+
* Resets, advances a fixed number of exact MuJoCo steps and resets again.
|
|
189
|
+
* This never toggles the interactive simulation state.
|
|
190
|
+
*/
|
|
191
|
+
runDeterministicCheck(options?: SceneDeterministicCheckOptions): SceneDeterministicCheckResult;
|
|
192
|
+
/** Plays an authored animation or physical runtime only when that session supports it. */
|
|
193
|
+
playInstance(id: string): boolean;
|
|
194
|
+
pauseInstance(id: string): boolean;
|
|
195
|
+
resetInstance(id: string): boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Runs every scene instance that has a real, playable physics runtime from
|
|
198
|
+
* the Viewer's single frame loop.
|
|
199
|
+
*/
|
|
200
|
+
playScene(): boolean;
|
|
201
|
+
pauseScene(): boolean;
|
|
202
|
+
/** Advances one exact physics step while the interactive scene is paused. */
|
|
203
|
+
stepScene(timestep?: number): boolean;
|
|
204
|
+
resetScene(): boolean;
|
|
205
|
+
isSimulationRunning(): boolean;
|
|
206
|
+
/** Advances all playing scene sessions and returns whether any pose changed. */
|
|
207
|
+
update(deltaSeconds: number): boolean;
|
|
208
|
+
/** Installs the one shared scene stage transaction for reflection and fog. */
|
|
209
|
+
beforeRender(renderer: import('three').WebGLRenderer, scene: import('three').Scene, camera: import('three').Camera): (() => void) | void;
|
|
210
|
+
/** Routes the Viewer's elastic-force grab to the hit scene instance. */
|
|
211
|
+
beginGrab(event: PointerEvent, camera: import('three').Camera, canvas: HTMLElement): boolean;
|
|
212
|
+
moveGrab(event: PointerEvent, camera: import('three').Camera, canvas: HTMLElement): void;
|
|
213
|
+
endGrab(): void;
|
|
214
|
+
/** Resolves the scene instance beneath a pointer through the unified physics body map. */
|
|
215
|
+
pickUnifiedInstance(clientX: number, clientY: number, camera: import('three').Camera, canvas: HTMLElement): string | null;
|
|
216
|
+
/** Controls elastic force grabbing while scene physics remains running. */
|
|
217
|
+
setGrabEnabled(enabled: boolean): void;
|
|
218
|
+
/** Sets one URDF inspection overlay when the target instance supports inspection. */
|
|
219
|
+
setInstanceInspectionOverlay(id: string, overlay: SceneInspectionOverlay, visible: boolean): boolean;
|
|
220
|
+
/** Overrides collision visibility for one instance; null inherits the scene-wide value. */
|
|
221
|
+
setInstanceCollisionVisible(id: string, visible: boolean | null): boolean;
|
|
222
|
+
setCollisionVisible(visible: boolean): void;
|
|
223
|
+
setGroundVisible(visible: boolean): void;
|
|
224
|
+
setTheme(theme: 'dark' | 'light'): void;
|
|
225
|
+
close(): Promise<void>;
|
|
226
|
+
}
|
|
227
|
+
export interface SceneInstancePhysics {
|
|
228
|
+
readonly override?: {
|
|
229
|
+
readonly kind: 'asset-authored' | 'static' | 'dynamic' | 'kinematic';
|
|
230
|
+
readonly massKg?: number;
|
|
231
|
+
readonly centerOfMassM?: Vec3Like;
|
|
232
|
+
readonly colliderPrimPaths?: readonly string[];
|
|
233
|
+
readonly physicsMaterial?: {
|
|
234
|
+
readonly densityKgPerM3?: number;
|
|
235
|
+
readonly staticFriction?: number;
|
|
236
|
+
readonly dynamicFriction?: number;
|
|
237
|
+
readonly restitution?: number;
|
|
238
|
+
};
|
|
239
|
+
readonly jointOverrides?: readonly {
|
|
240
|
+
readonly jointPrimPath: string;
|
|
241
|
+
readonly driveType?: 'position' | 'velocity';
|
|
242
|
+
readonly target?: number;
|
|
243
|
+
readonly stiffness?: number;
|
|
244
|
+
readonly damping?: number;
|
|
245
|
+
readonly maxForce?: number;
|
|
246
|
+
}[];
|
|
247
|
+
};
|
|
248
|
+
readonly initialJoints?: Readonly<Record<string, number>>;
|
|
249
|
+
}
|
|
250
|
+
export interface ScenePhysicsConfiguration {
|
|
251
|
+
readonly environment?: {
|
|
252
|
+
readonly gravity: Vec3Like;
|
|
253
|
+
readonly timeStepSeconds: number;
|
|
254
|
+
readonly integrator?: 'euler' | 'implicitfast' | 'rk4';
|
|
255
|
+
readonly solverIterations?: number;
|
|
256
|
+
};
|
|
257
|
+
readonly instances: Readonly<Record<string, SceneInstancePhysics>>;
|
|
258
|
+
}
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import { c as we, a as ve, S as Ae, w as ge, b as Se, p as B } from "./asset-ir-DEOK9SqE.js";
|
|
2
|
+
import { D as Pe, y as x, n as je, z as de, S as pe } from "./index-ByBlfVc0.js";
|
|
3
|
+
async function Me(o, e, d) {
|
|
4
|
+
var f;
|
|
5
|
+
const m = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), w = async (u, A) => {
|
|
6
|
+
if (a.has(u)) throw ee(`MJCF include cycle: ${u}`, "E_MJCF_INCLUDE_CYCLE");
|
|
7
|
+
a.add(u);
|
|
8
|
+
const c = De(A, u);
|
|
9
|
+
m.set(u, c);
|
|
10
|
+
for (const G of c.querySelectorAll("worldbody body[name]")) i.add(G.getAttribute("name"));
|
|
11
|
+
for (const G of c.querySelectorAll("include[file]")) {
|
|
12
|
+
const M = d.resolve(G.getAttribute("file"), u);
|
|
13
|
+
await w(M, await d.text(M));
|
|
14
|
+
}
|
|
15
|
+
a.delete(u);
|
|
16
|
+
};
|
|
17
|
+
await w(e, o);
|
|
18
|
+
const p = (f = m.get(e)) == null ? void 0 : f.querySelector("mujoco");
|
|
19
|
+
if (!p || i.size === 0) throw ee("MJCF requires a mujoco root and at least one named body.", "E_MJCF_PARSE");
|
|
20
|
+
return we({
|
|
21
|
+
id: p.getAttribute("model") || e,
|
|
22
|
+
name: p.getAttribute("model") || e,
|
|
23
|
+
source: { format: "mjcf", uri: e },
|
|
24
|
+
links: [...i].map((u) => ({ id: u, name: u, visuals: [], collisions: [] })),
|
|
25
|
+
joints: [],
|
|
26
|
+
diagnostics: ve(),
|
|
27
|
+
extension: { files: d, xml: o, documents: m }
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async function Ce(o) {
|
|
31
|
+
const e = o.extension.files, d = o.source.uri, m = d.split("/").slice(0, -1).join("/"), i = /* @__PURE__ */ new Map(), a = o.extension.documents;
|
|
32
|
+
for (const [f, u] of a) {
|
|
33
|
+
const A = u.querySelector("compiler");
|
|
34
|
+
for (const c of u.querySelectorAll("asset [file]")) {
|
|
35
|
+
const G = (A == null ? void 0 : A.getAttribute(c.tagName === "texture" ? "texturedir" : "meshdir")) ?? (A == null ? void 0 : A.getAttribute("assetdir")) ?? "", M = e.resolve(`${G}/${c.getAttribute("file")}`, f);
|
|
36
|
+
await e.bytes(M);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
for (const f of Ee(e.paths(), a)) {
|
|
40
|
+
if (f === d) continue;
|
|
41
|
+
const u = m && f.startsWith(`${m}/`) ? f.slice(m.length + 1) : f;
|
|
42
|
+
i.set(u, await e.bytes(f));
|
|
43
|
+
}
|
|
44
|
+
const w = o.extension.xml;
|
|
45
|
+
return { format: "mjcf", xml: Ge(a) ? _e(w) : w, files: i };
|
|
46
|
+
}
|
|
47
|
+
function Ge(o) {
|
|
48
|
+
return o.size === 0 || ![...o.values()].some((d) => d.querySelector("freejoint, actuator") ? !0 : [...d.querySelectorAll("joint")].some(
|
|
49
|
+
(m) => (m.getAttribute("type") ?? "hinge").toLowerCase() !== "fixed"
|
|
50
|
+
)) ? !1 : ![...o.values()].some(
|
|
51
|
+
(d) => [...d.querySelectorAll("worldbody geom")].some((m) => {
|
|
52
|
+
var i;
|
|
53
|
+
return ((i = m.getAttribute("type")) == null ? void 0 : i.toLowerCase()) === "plane";
|
|
54
|
+
})
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
function _e(o) {
|
|
58
|
+
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"/>';
|
|
59
|
+
return /<worldbody\b[^>]*>/i.test(o) ? o.replace(/(<worldbody\b[^>]*>)/i, `$1${e}`) : o.replace(/<\/mujoco\s*>/i, `<worldbody>${e}</worldbody></mujoco>`);
|
|
60
|
+
}
|
|
61
|
+
function Ee(o, e) {
|
|
62
|
+
const d = (p) => p.replaceAll("\\", "/").split("/").pop() ?? "", m = /* @__PURE__ */ new Map();
|
|
63
|
+
for (const p of o) {
|
|
64
|
+
const f = d(p), u = m.get(f) ?? [];
|
|
65
|
+
u.push(p), m.set(f, u);
|
|
66
|
+
}
|
|
67
|
+
const i = new Set(e.keys()), a = /* @__PURE__ */ new Set(["include", "mesh", "texture", "hfield", "skin"]), w = /* @__PURE__ */ new Set(["fileleft", "fileright", "fileup", "filedown", "filefront", "fileback"]);
|
|
68
|
+
for (const p of e.values()) {
|
|
69
|
+
if (p.querySelector("plugin, extension, model, attach")) return o;
|
|
70
|
+
for (const f of p.querySelectorAll("*"))
|
|
71
|
+
for (const u of f.attributes) {
|
|
72
|
+
if (!u.name.startsWith("file")) continue;
|
|
73
|
+
if (u.name === "file") {
|
|
74
|
+
if (!a.has(f.tagName)) return o;
|
|
75
|
+
} else if (!(f.tagName === "texture" && w.has(u.name)))
|
|
76
|
+
return o;
|
|
77
|
+
if (!u.value) continue;
|
|
78
|
+
const A = m.get(d(u.value));
|
|
79
|
+
if (!A) return o;
|
|
80
|
+
for (const c of A) i.add(c);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return o.filter((p) => i.has(p));
|
|
84
|
+
}
|
|
85
|
+
function De(o, e) {
|
|
86
|
+
const d = new DOMParser().parseFromString(o, "application/xml"), m = d.querySelector("parsererror");
|
|
87
|
+
if (m) throw ee(`MJCF XML parse failed (${e}): ${m.textContent ?? ""}`, "E_MJCF_PARSE");
|
|
88
|
+
return d;
|
|
89
|
+
}
|
|
90
|
+
function ee(o, e) {
|
|
91
|
+
return Object.assign(new Error(o), { code: e });
|
|
92
|
+
}
|
|
93
|
+
function $e(o, e) {
|
|
94
|
+
const d = new Ae(o), m = e.format === "usd" || e.format === "usda" || e.format === "usdc" || e.format === "usdz";
|
|
95
|
+
let i = null, a = null, w = null, p = null, f = null, u = null, A = null, c = null, G = null, M = null, F = null, y = !1, P = !1, v = !1, j = !1, S = null, D = null, re, g = null, k = null, s = null, l = null, $ = null, b = null, J = null, L = !1, O = null, W = "z", H = !1;
|
|
96
|
+
const T = () => {
|
|
97
|
+
s && (W = e.options.upAxis ?? "z", H = !0, s.setUpAxis(W) && (a == null || a.sync(), l == null || l.sync()));
|
|
98
|
+
}, U = (r, t) => {
|
|
99
|
+
var _;
|
|
100
|
+
const h = B(r, e.signal, `${e.format}:${t}`);
|
|
101
|
+
P = !1, v = !1, D = { ...h, stage: t };
|
|
102
|
+
try {
|
|
103
|
+
s == null || s.endGrab();
|
|
104
|
+
} catch {
|
|
105
|
+
}
|
|
106
|
+
(_ = e.reportSessionState) == null || _.call(e), e.reportError(r, { fatal: !1, stage: t, code: h.code });
|
|
107
|
+
}, me = (r) => {
|
|
108
|
+
var t;
|
|
109
|
+
if (y) {
|
|
110
|
+
r.dispose();
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
b = null, L = !1, g = r.asset, w = r.dispose, j = r.hasAnimation === !0, p = r.hasPhysics || j ? r.step : null, f = r.reset, P = !r.hasPhysics && r.hasAnimation === !0, v = r.hasPhysics, S = r.fallback ? { ...r.fallback, stage: "physics-fallback" } : r.visualWarning ? { ...r.visualWarning, stage: "visual-adaptation" } : null, a = r.binding, i = r.runtime ?? null, k = r.physics ?? null, O = r.inspect ?? null, l = r.collision ?? null, $ = r.createCollision ?? null, s == null || s.setRuntime(r.runtime), s == null || s.replaceModel(r.binding.root), l && (l.root.visible = !1, s == null || s.attachAuxiliary(l.root), l.sync()), T(), (t = e.reportSessionState) == null || t.call(e), e.requestRender();
|
|
114
|
+
}, ye = (r) => {
|
|
115
|
+
var h;
|
|
116
|
+
if (y) return;
|
|
117
|
+
const t = B(r, e.signal, "usd-physics");
|
|
118
|
+
L = !1, D = { ...t, stage: "usd-physics" }, v = !1, j = (b == null ? void 0 : b.visual.hasAnimation) ?? j, p = b != null && b.visual.hasAnimation ? b.visual.step : null, f = b != null && b.visual.hasAnimation ? b.visual.reset : null, P = !!(b != null && b.visual.hasAnimation), (h = e.reportSessionState) == null || h.call(e), e.reportError(r, { fatal: !1, stage: "usd-physics", code: t.code });
|
|
119
|
+
}, le = () => {
|
|
120
|
+
y = !0, P = !1;
|
|
121
|
+
}, te = () => {
|
|
122
|
+
if (l) return !0;
|
|
123
|
+
const r = $;
|
|
124
|
+
return $ = null, !r || !s || (l = r() ?? null, !l) ? !1 : (l.root.visible = !1, s.attachAuxiliary(l.root), l.sync(), !0);
|
|
125
|
+
};
|
|
126
|
+
let ie = () => {
|
|
127
|
+
}, ae = () => {
|
|
128
|
+
}, oe = !1;
|
|
129
|
+
const Q = new Promise((r, t) => {
|
|
130
|
+
ie = r, ae = t;
|
|
131
|
+
}), N = () => {
|
|
132
|
+
oe || (oe = !0, ie());
|
|
133
|
+
};
|
|
134
|
+
return (async () => {
|
|
135
|
+
var r, t, h, _, I, C, z, V, ne, ue;
|
|
136
|
+
try {
|
|
137
|
+
const R = e.format;
|
|
138
|
+
if (R === "usd" || R === "usda" || R === "usdc" || R === "usdz") {
|
|
139
|
+
(r = e.reportProgress) == null || r.call(e, "usd-visual", "正在解析 USD 视觉场景...");
|
|
140
|
+
const n = await (await import("./usd-session-QtwGKI7v.js")).loadUsdSimulation(o, e, d);
|
|
141
|
+
if (y || e.signal.aborted)
|
|
142
|
+
throw n.dispose(), se();
|
|
143
|
+
b = n, a = { root: n.visual.root, sync() {
|
|
144
|
+
}, dispose() {
|
|
145
|
+
} }, w = n.dispose, j = n.visual.hasAnimation, p = j ? n.visual.step : null, f = n.visual.reset, P = !1, L = !0, S = n.visual.warning ? { ...n.visual.warning, stage: "visual-adaptation" } : null, (t = e.reportProgress) == null || t.call(e, "stage", "正在构建三维场景与环境光影..."), s = new x(
|
|
146
|
+
n.visual.root,
|
|
147
|
+
e.options.simulationTheme,
|
|
148
|
+
void 0,
|
|
149
|
+
"simulation",
|
|
150
|
+
"visual"
|
|
151
|
+
), T(), N(), (h = e.reportProgress) == null || h.call(e, "usd-physics", "视觉场景已就绪,正在准备物理..."), J = n.completePhysics().then(me).catch(ye);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (R === "urdf" || R === "xacro") {
|
|
155
|
+
(_ = e.reportProgress) == null || _.call(e, "urdf", "正在解析 URDF 场景与运动学结构...");
|
|
156
|
+
const n = await (await import("./urdf-session-kemAnBn8.js")).loadUrdfSimulation(o, e, d);
|
|
157
|
+
if (y || e.signal.aborted)
|
|
158
|
+
throw n.dispose(), se();
|
|
159
|
+
g = n.asset, s = n.stage, G = n.inspection, w = n.dispose, p = n.step, f = n.reset, u = n.play, A = n.pause, c = n.isPlaying, M = () => n.capabilities, F = () => n.physics, P = !1, v = !1, S = n.warning ?? null, T(), N();
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
let X = o.entryPath ?? o.filename;
|
|
163
|
+
if (!X && R === "mjcf") {
|
|
164
|
+
const E = d.paths().filter((n) => n.toLowerCase().endsWith(".xml"));
|
|
165
|
+
for (const n of ["scene.xml", "model.xml", "main.xml"]) {
|
|
166
|
+
const Y = E.find((q) => q.toLowerCase().endsWith(`/${n}`) || q.toLowerCase() === n);
|
|
167
|
+
if (Y) {
|
|
168
|
+
X = Y;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
X ?? (X = "asset.xml"), (I = e.reportProgress) == null || I.call(e, "fetch", "正在读取模型描述与依赖资源...");
|
|
174
|
+
const he = await Se(o, d);
|
|
175
|
+
K(y, e.signal), (C = e.reportProgress) == null || C.call(e, "parse", "正在解析 MJCF 场景与连杆..."), g = await Me(he, X, d);
|
|
176
|
+
try {
|
|
177
|
+
(z = e.reportProgress) == null || z.call(e, "compile", "正在编译物理模型与参数...");
|
|
178
|
+
const E = await Ce(g);
|
|
179
|
+
k = E, K(y, e.signal), (V = e.reportProgress) == null || V.call(e, "runtime", "正在初始化物理内核...");
|
|
180
|
+
const { MujocoRuntime: n } = await import("./mujoco-runtime-Dhx6Ua2u.js");
|
|
181
|
+
i = new n(), await i.initialize(E, {
|
|
182
|
+
baseUrl: e.options.mujocoBaseUrl,
|
|
183
|
+
wasmModule: e.options.mujocoWasmModule
|
|
184
|
+
});
|
|
185
|
+
} catch (E) {
|
|
186
|
+
const n = B(E, e.signal, "mjcf-physics");
|
|
187
|
+
i == null || i.dispose(), i = null;
|
|
188
|
+
const { compileMjcfPreview: Y } = await import("./mjcf-visual-DVRa0w90.js");
|
|
189
|
+
let q;
|
|
190
|
+
try {
|
|
191
|
+
q = Y(g);
|
|
192
|
+
} catch (Z) {
|
|
193
|
+
throw new Error(`${n.message};独立视觉预览也不可用:${Z instanceof Error ? Z.message : String(Z)}`);
|
|
194
|
+
}
|
|
195
|
+
a = { root: q, sync() {
|
|
196
|
+
}, dispose() {
|
|
197
|
+
je(q);
|
|
198
|
+
} }, S = { ...n, stage: "physics-fallback" }, s = new x(q, e.options.simulationTheme, void 0, "simulation", "visual"), P = !1, T(), N();
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
v = !0, K(y, e.signal), (ne = e.reportProgress) == null || ne.call(e, "visual", "正在构建视觉渲染网格...");
|
|
202
|
+
const be = de(i, !1, g.diagnostics), fe = g.diagnostics.droppedFeatures.find((E) => E.code.startsWith("MJCF_"));
|
|
203
|
+
fe && (S = { ...fe, stage: "visual-material" }), K(y, e.signal), (ue = e.reportProgress) == null || ue.call(e, "stage", "正在构建三维场景与环境光影..."), a = new pe(i, be), s = new x(a.root, e.options.simulationTheme, i);
|
|
204
|
+
const ce = de(i, !0, g.diagnostics);
|
|
205
|
+
ce.root.children.length > 0 ? (l = new pe(i, ce), l.root.visible = !1) : l = null, l && s.attachAuxiliary(l.root), T(), N();
|
|
206
|
+
} catch (R) {
|
|
207
|
+
throw s == null || s.dispose(), s = null, w ? (w(), w = null) : (l == null || l.dispose(), a == null || a.dispose(), i == null || i.dispose()), l = null, a = null, i = null, d.dispose(), k = null, b = null, R;
|
|
208
|
+
}
|
|
209
|
+
})().catch(ae), Q.catch(() => {
|
|
210
|
+
}), {
|
|
211
|
+
id: `simulation-${Math.random().toString(36).slice(2)}`,
|
|
212
|
+
get autoPlay() {
|
|
213
|
+
return !L && !v && j;
|
|
214
|
+
},
|
|
215
|
+
get inspection() {
|
|
216
|
+
return G;
|
|
217
|
+
},
|
|
218
|
+
isPlaying() {
|
|
219
|
+
return (c == null ? void 0 : c()) ?? P;
|
|
220
|
+
},
|
|
221
|
+
opened: Q,
|
|
222
|
+
get root() {
|
|
223
|
+
return (s == null ? void 0 : s.root) ?? null;
|
|
224
|
+
},
|
|
225
|
+
getFitBounds() {
|
|
226
|
+
return (s == null ? void 0 : s.getModelBounds()) ?? null;
|
|
227
|
+
},
|
|
228
|
+
beforeRender(r, t, h) {
|
|
229
|
+
return s == null ? void 0 : s.beforeRender(r, t, h);
|
|
230
|
+
},
|
|
231
|
+
get capabilities() {
|
|
232
|
+
const r = l !== null || $ !== null;
|
|
233
|
+
return D ? { canPlay: !1, canPause: !1, canReset: !1, hasPhysics: !1, hasAnimation: !1, canToggleGround: !0, canToggleCollision: r, canReorientUpAxis: !0 } : (M == null ? void 0 : M()) ?? { canPlay: v || j, canPause: v || j, canReset: v || j, hasPhysics: v, hasAnimation: j, canToggleGround: !0, canToggleCollision: r, canReorientUpAxis: !0 };
|
|
234
|
+
},
|
|
235
|
+
get warning() {
|
|
236
|
+
return S && !S.notice ? ge(S, S.stage) : S;
|
|
237
|
+
},
|
|
238
|
+
get physics() {
|
|
239
|
+
return D ? { status: "unavailable", issue: D } : F ? F() : L ? { status: "initializing" } : v ? { status: "ready" } : (S == null ? void 0 : S.stage) === "physics-fallback" ? { status: "unavailable", issue: S } : { status: "not-authored" };
|
|
240
|
+
},
|
|
241
|
+
setTheme(r) {
|
|
242
|
+
s == null || s.setTheme(r);
|
|
243
|
+
},
|
|
244
|
+
setGroundVisible(r) {
|
|
245
|
+
s == null || s.setGroundVisible(r);
|
|
246
|
+
},
|
|
247
|
+
getGroundVisible() {
|
|
248
|
+
return (s == null ? void 0 : s.getGroundVisible()) ?? !0;
|
|
249
|
+
},
|
|
250
|
+
getGroundGridScale() {
|
|
251
|
+
return (s == null ? void 0 : s.getGroundGridScale()) ?? Pe;
|
|
252
|
+
},
|
|
253
|
+
getUpAxis() {
|
|
254
|
+
return s && H ? W : null;
|
|
255
|
+
},
|
|
256
|
+
setUpAxis(r) {
|
|
257
|
+
if (!(y || !s))
|
|
258
|
+
try {
|
|
259
|
+
if (!s.setUpAxis(r)) return;
|
|
260
|
+
W = r, a == null || a.sync(), l == null || l.sync(), e.requestRender();
|
|
261
|
+
} catch (t) {
|
|
262
|
+
U(t, "up-axis");
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
presentation: { preferredViewMode: "3d", interactionMode: "simulation", uiProfile: "simulation", fitPolicy: "fit-on-ready" },
|
|
266
|
+
beginDispose: le,
|
|
267
|
+
setCollisionVisible(r) {
|
|
268
|
+
if (!y) {
|
|
269
|
+
if (M) {
|
|
270
|
+
const t = G;
|
|
271
|
+
t == null || t.setOverlay("collision", r);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (r && !te()) throw new Error("This asset has no collision display.");
|
|
275
|
+
l && (l.root.visible = r), e.requestRender();
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
getCollisionRoot() {
|
|
279
|
+
return y || M || !te() ? null : (l == null || l.sync(), (l == null ? void 0 : l.root) ?? null);
|
|
280
|
+
},
|
|
281
|
+
getVisualDiagnostics() {
|
|
282
|
+
return y || !g || g.source.format !== "usd" ? null : structuredClone({
|
|
283
|
+
report: g.extension.visualAdaptation,
|
|
284
|
+
diagnostics: g.diagnostics,
|
|
285
|
+
usd: (O == null ? void 0 : O()) ?? null
|
|
286
|
+
});
|
|
287
|
+
},
|
|
288
|
+
getPhysicsProperties() {
|
|
289
|
+
const r = i;
|
|
290
|
+
if (y || !v || !(r != null && r.model) || !r.mujoco) return null;
|
|
291
|
+
const t = r.model, h = r.mujoco;
|
|
292
|
+
return structuredClone({
|
|
293
|
+
units: { length: "m", mass: "kg", time: "s" },
|
|
294
|
+
timestep: t.opt.timestep,
|
|
295
|
+
gravity: Array.from(t.opt.gravity),
|
|
296
|
+
bodyCount: t.nbody - 1,
|
|
297
|
+
jointCount: t.njnt,
|
|
298
|
+
geomCount: t.ngeom,
|
|
299
|
+
bodies: Array.from({ length: t.nbody - 1 }, (_, I) => {
|
|
300
|
+
var z, V;
|
|
301
|
+
const C = I + 1;
|
|
302
|
+
return {
|
|
303
|
+
id: C,
|
|
304
|
+
name: h.mj_id2name(t, h.mjtObj.mjOBJ_BODY.value, C),
|
|
305
|
+
mass: t.body_mass[C],
|
|
306
|
+
inertia: Array.from(t.body_inertia.slice(C * 3, C * 3 + 3)),
|
|
307
|
+
position: Array.from(((z = r.data) == null ? void 0 : z.xpos.slice(C * 3, C * 3 + 3)) ?? []),
|
|
308
|
+
quaternion: Array.from(((V = r.data) == null ? void 0 : V.xquat.slice(C * 4, C * 4 + 4)) ?? [])
|
|
309
|
+
};
|
|
310
|
+
}),
|
|
311
|
+
diagnostics: g == null ? void 0 : g.diagnostics
|
|
312
|
+
});
|
|
313
|
+
},
|
|
314
|
+
get update() {
|
|
315
|
+
return i != null && i.model || p || m ? (r) => {
|
|
316
|
+
if (D || y || !((c == null ? void 0 : c()) ?? P) || !a && !p || !p && !(i != null && i.model)) return !1;
|
|
317
|
+
try {
|
|
318
|
+
if (p) {
|
|
319
|
+
const h = p(r);
|
|
320
|
+
return h && (l == null || l.sync()), h;
|
|
321
|
+
}
|
|
322
|
+
const t = i.step(r);
|
|
323
|
+
return t && (a.sync(), l == null || l.sync(), s == null || s.updateForceLine()), t;
|
|
324
|
+
} catch (t) {
|
|
325
|
+
return U(t, "step"), !1;
|
|
326
|
+
}
|
|
327
|
+
} : void 0;
|
|
328
|
+
},
|
|
329
|
+
play() {
|
|
330
|
+
y || D || (u ? (u(), P = (c == null ? void 0 : c()) ?? !1) : (v || j) && (P = !0));
|
|
331
|
+
},
|
|
332
|
+
pause() {
|
|
333
|
+
D || (A && A(), P = !1);
|
|
334
|
+
},
|
|
335
|
+
reset() {
|
|
336
|
+
if (!(D || y || !a && !f))
|
|
337
|
+
try {
|
|
338
|
+
s == null || s.endGrab(), f ? f() : (i == null || i.reset(), a.sync()), l == null || l.sync(), s == null || s.resetGround(), s == null || s.updateForceLine();
|
|
339
|
+
} catch (r) {
|
|
340
|
+
U(r, "reset");
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
beginGrab(r, t, h) {
|
|
344
|
+
if (y || !((c == null ? void 0 : c()) ?? P) || !v && !F) return !1;
|
|
345
|
+
try {
|
|
346
|
+
return (s == null ? void 0 : s.beginGrab(r, t, h)) ?? !1;
|
|
347
|
+
} catch (_) {
|
|
348
|
+
return U(_, "grab"), !1;
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
moveGrab(r, t, h) {
|
|
352
|
+
if (!(y || !((c == null ? void 0 : c()) ?? P) || !v && !F))
|
|
353
|
+
try {
|
|
354
|
+
s == null || s.moveGrab(r, t, h);
|
|
355
|
+
} catch (_) {
|
|
356
|
+
U(_, "grab");
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
endGrab() {
|
|
360
|
+
s == null || s.endGrab();
|
|
361
|
+
},
|
|
362
|
+
getScenePhysics() {
|
|
363
|
+
if (y || !v || !k || !a) return null;
|
|
364
|
+
const r = /* @__PURE__ */ new Map();
|
|
365
|
+
return a.root.traverse((t) => {
|
|
366
|
+
typeof t.userData.bodyId == "number" && t.name && r.set(t.name, t);
|
|
367
|
+
}), {
|
|
368
|
+
...k,
|
|
369
|
+
visualBindings: r
|
|
370
|
+
};
|
|
371
|
+
},
|
|
372
|
+
dispose() {
|
|
373
|
+
return le(), re ?? (re = Q.catch(() => {
|
|
374
|
+
}).then(async () => {
|
|
375
|
+
s == null || s.dispose(), s = null, w ? (w(), w = null, s = null, a = null, l = null, $ = null) : (l == null || l.root.removeFromParent(), l == null || l.dispose(), l = null, $ = null, a == null || a.dispose(), a = null, i == null || i.dispose()), await (J == null ? void 0 : J.catch(() => {
|
|
376
|
+
})), b = null, d.dispose(), g = null, G = null, O = null, p = null, f = null, u = null, A = null, c = null, M = null, F = null, v = !1, j = !1, S = null, H = !1;
|
|
377
|
+
})), re;
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
function K(o, e) {
|
|
382
|
+
if (o || e.aborted) throw se();
|
|
383
|
+
}
|
|
384
|
+
function se() {
|
|
385
|
+
return Object.assign(new Error("Simulation load aborted."), { name: "AbortError", code: "E_ABORTED" });
|
|
386
|
+
}
|
|
387
|
+
export {
|
|
388
|
+
$e as createSimulationSession
|
|
389
|
+
};
|