@nebula-spatial/viewer 0.5.18 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +83 -35
- package/README.md +5 -0
- package/dist/asset-ir-BXa1EdOy.js +637 -0
- package/dist/assets/source-types.d.ts +10 -0
- package/dist/assets/types.d.ts +61 -6
- package/dist/assets/{usd-worker-B6-1I5dT.js → usd-worker-r6Nuoxlk.js} +671 -584
- package/dist/index-CHf9y9eX.js +17406 -0
- package/dist/index.d.ts +21 -2
- package/dist/index.js +29 -18
- package/dist/{mjcf-visual-CtY2Wk3w.js → mjcf-visual-DxMXiBnu.js} +12 -13
- package/dist/mujoco-runtime-BA88JuDR.js +791 -0
- package/dist/physics-guide-size-CplAlsve.js +12 -0
- package/dist/scene/instances.d.ts +36 -0
- package/dist/scene/joints.d.ts +129 -0
- package/dist/scene/session.d.ts +26 -0
- package/dist/scene/types.d.ts +292 -0
- package/dist/session-DLi-MvLB.js +240 -0
- package/dist/{session-DxTeRKCd.js → session-DqEr1CxY.js} +581 -567
- package/dist/session-ZNb3ZYLq.js +562 -0
- package/dist/simulation/physics-runtime-state.d.ts +73 -0
- package/dist/simulation/types.d.ts +151 -0
- package/dist/simulation/usd-dependency-probe.d.ts +42 -0
- package/dist/simulation/usd-inspection.d.ts +66 -0
- package/dist/spark-renderer-BGF_AaI9.js +25 -0
- package/dist/spark.module-kM8pwA1o.js +9278 -0
- package/dist/types.d.ts +75 -1
- package/dist/ui/camera-axis-gizmo.d.ts +5 -0
- package/dist/urdf-session-CKlR-fOQ.js +1230 -0
- package/dist/usd-session-DyNMsD-v.js +11199 -0
- package/dist/version.d.ts +1 -1
- package/dist/visual/classification.d.ts +20 -0
- package/dist/{xacro-x2TeKQ7T.js → xacro-BCLnc3tY.js} +1 -1
- package/openusd/openusd-runtime-manifest.json +6 -6
- package/openusd/openusd_probe.js +1 -1
- package/openusd/openusd_probe.wasm +0 -0
- package/package.json +2 -1
- package/runtime-assets.d.mts +9 -9
- package/runtime-assets.mjs +11 -11
- package/vite.d.mts +7 -7
- package/vite.mjs +115 -115
- package/dist/collision-debug-BSJoz5J7.js +0 -2947
- package/dist/index-E8DHSeyT.js +0 -11499
- package/dist/mujoco-runtime-fDWdXNEc.js +0 -739
- package/dist/resources-CHhCm2f7.js +0 -27
- package/dist/session-DB-osaBL.js +0 -801
- package/dist/stage-BnRjc-Rp.js +0 -592
- package/dist/urdf-session-Q_c3Rd1M.js +0 -1264
- package/dist/usd-session-tW3LxVFs.js +0 -10647
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { AnimationClip, Group, Object3D } from 'three';
|
|
2
|
+
import type { AssetNoticeSnapshot } from '../assets/types';
|
|
3
|
+
export interface SimulationDiagnostic {
|
|
4
|
+
readonly code: string;
|
|
5
|
+
readonly message: string;
|
|
6
|
+
readonly source?: string;
|
|
7
|
+
readonly notice?: AssetNoticeSnapshot;
|
|
8
|
+
}
|
|
9
|
+
export interface SimulationDiagnostics {
|
|
10
|
+
readonly errors: SimulationDiagnostic[];
|
|
11
|
+
readonly warnings: SimulationDiagnostic[];
|
|
12
|
+
readonly approximations: SimulationDiagnostic[];
|
|
13
|
+
readonly droppedFeatures: SimulationDiagnostic[];
|
|
14
|
+
}
|
|
15
|
+
export interface TransformSpec {
|
|
16
|
+
readonly position: readonly number[];
|
|
17
|
+
readonly rotationRpy: readonly number[];
|
|
18
|
+
/** URDF 1.1 origin quaternion in xyzw order. */
|
|
19
|
+
readonly rotationQuaternion?: readonly number[];
|
|
20
|
+
}
|
|
21
|
+
export type GeometrySpec = {
|
|
22
|
+
readonly type: 'box';
|
|
23
|
+
readonly size: readonly number[];
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: 'sphere';
|
|
26
|
+
readonly radius: number;
|
|
27
|
+
} | {
|
|
28
|
+
readonly type: 'cylinder';
|
|
29
|
+
readonly radius: number;
|
|
30
|
+
readonly length: number;
|
|
31
|
+
} | {
|
|
32
|
+
readonly type: 'capsule';
|
|
33
|
+
readonly radius: number;
|
|
34
|
+
readonly length: number;
|
|
35
|
+
} | {
|
|
36
|
+
readonly type: 'mesh';
|
|
37
|
+
readonly resourcePath: string;
|
|
38
|
+
readonly scale: readonly number[];
|
|
39
|
+
};
|
|
40
|
+
export interface VisualSpec {
|
|
41
|
+
readonly origin: TransformSpec;
|
|
42
|
+
readonly geometry: GeometrySpec;
|
|
43
|
+
readonly color?: readonly number[];
|
|
44
|
+
readonly texturePath?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface CollisionSpec {
|
|
47
|
+
readonly origin: TransformSpec;
|
|
48
|
+
readonly geometry: GeometrySpec;
|
|
49
|
+
}
|
|
50
|
+
export interface LinkSpec {
|
|
51
|
+
readonly inertial?: {
|
|
52
|
+
readonly origin: TransformSpec;
|
|
53
|
+
readonly mass: number;
|
|
54
|
+
readonly tensor: readonly number[];
|
|
55
|
+
};
|
|
56
|
+
readonly id: string;
|
|
57
|
+
readonly name: string;
|
|
58
|
+
readonly visuals: readonly VisualSpec[];
|
|
59
|
+
readonly collisions: readonly CollisionSpec[];
|
|
60
|
+
}
|
|
61
|
+
export interface JointMimicSpec {
|
|
62
|
+
readonly joint: string;
|
|
63
|
+
readonly multiplier: number;
|
|
64
|
+
readonly offset: number;
|
|
65
|
+
}
|
|
66
|
+
export interface JointSpec {
|
|
67
|
+
readonly id: string;
|
|
68
|
+
readonly type: string;
|
|
69
|
+
readonly parent: string;
|
|
70
|
+
readonly child: string;
|
|
71
|
+
readonly origin: TransformSpec;
|
|
72
|
+
readonly axis: readonly number[];
|
|
73
|
+
readonly limits?: {
|
|
74
|
+
readonly lower: number;
|
|
75
|
+
readonly upper: number;
|
|
76
|
+
};
|
|
77
|
+
readonly effort?: number;
|
|
78
|
+
readonly velocity?: number;
|
|
79
|
+
readonly dynamics?: {
|
|
80
|
+
readonly damping?: number;
|
|
81
|
+
readonly friction?: number;
|
|
82
|
+
};
|
|
83
|
+
readonly mimic?: JointMimicSpec;
|
|
84
|
+
}
|
|
85
|
+
export interface AssetIr {
|
|
86
|
+
readonly schemaVersion: 1;
|
|
87
|
+
readonly id: string;
|
|
88
|
+
readonly name: string;
|
|
89
|
+
readonly source: {
|
|
90
|
+
readonly format: 'urdf' | 'mjcf' | 'usd';
|
|
91
|
+
readonly uri: string;
|
|
92
|
+
};
|
|
93
|
+
readonly links: readonly LinkSpec[];
|
|
94
|
+
readonly joints: readonly JointSpec[];
|
|
95
|
+
readonly diagnostics: SimulationDiagnostics;
|
|
96
|
+
readonly extension: Record<string, unknown>;
|
|
97
|
+
}
|
|
98
|
+
export interface PhysicsAsset {
|
|
99
|
+
readonly format: 'mjcf';
|
|
100
|
+
readonly xml: string;
|
|
101
|
+
readonly files: ReadonlyMap<string, Uint8Array>;
|
|
102
|
+
/** Initial actuator controls in MJCF actuator declaration order. */
|
|
103
|
+
readonly initialControls?: readonly number[];
|
|
104
|
+
/**
|
|
105
|
+
* USD acceleration drives whose gains must be converted to MuJoCo force
|
|
106
|
+
* units after the generalized mass matrix is available.
|
|
107
|
+
*/
|
|
108
|
+
readonly accelerationDrives?: readonly {
|
|
109
|
+
readonly actuator: number;
|
|
110
|
+
readonly joint: string;
|
|
111
|
+
readonly stiffness: number;
|
|
112
|
+
readonly damping: number;
|
|
113
|
+
readonly targetPosition: number;
|
|
114
|
+
readonly targetVelocity: number;
|
|
115
|
+
}[];
|
|
116
|
+
/** Preserve authored mass, scaling geom-inferred inertia at fixed density distribution. */
|
|
117
|
+
readonly massOverrides?: readonly {
|
|
118
|
+
readonly body: string;
|
|
119
|
+
readonly mass: number;
|
|
120
|
+
}[];
|
|
121
|
+
/** Authored body-frame center of mass, written into `body_ipos` before seating. */
|
|
122
|
+
readonly centerOfMassOverrides?: readonly {
|
|
123
|
+
readonly body: string;
|
|
124
|
+
readonly position: readonly number[];
|
|
125
|
+
}[];
|
|
126
|
+
/**
|
|
127
|
+
* Authored scalar-joint values applied after `mj_resetData`, so every reset and
|
|
128
|
+
* a scene rebuild start from the saved pose instead of the XML defaults.
|
|
129
|
+
*/
|
|
130
|
+
readonly initialJoints?: Readonly<Record<string, number>>;
|
|
131
|
+
/** Free-joint qvel: world linear m/s followed by body-local angular rad/s. */
|
|
132
|
+
readonly initialVelocities?: readonly {
|
|
133
|
+
readonly body: string;
|
|
134
|
+
readonly velocity: readonly number[];
|
|
135
|
+
}[];
|
|
136
|
+
/** Additional compiled USD body exclusions available to paused joint previews. */
|
|
137
|
+
readonly jointPreviewCollisionExcludes?: readonly {
|
|
138
|
+
readonly body1: string;
|
|
139
|
+
readonly body2: string;
|
|
140
|
+
}[];
|
|
141
|
+
/** Lossy adaptations made while lowering USD geometry into MJCF. */
|
|
142
|
+
readonly approximations?: readonly SimulationDiagnostic[];
|
|
143
|
+
}
|
|
144
|
+
export interface VisualAsset {
|
|
145
|
+
readonly root: Group;
|
|
146
|
+
readonly bindings: ReadonlyMap<string, Object3D>;
|
|
147
|
+
readonly expectedLinkCount: number;
|
|
148
|
+
/** USD/Three animation clips retained for a future playback controller. */
|
|
149
|
+
readonly animations?: readonly AnimationClip[];
|
|
150
|
+
readonly disposeSource?: () => void;
|
|
151
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { UsdVariantSelection } from '../assets/types';
|
|
2
|
+
export interface UsdDependencyProbeRequest {
|
|
3
|
+
readonly entry: Blob;
|
|
4
|
+
readonly entryPath: string;
|
|
5
|
+
readonly entryUrl: string;
|
|
6
|
+
readonly signal?: AbortSignal;
|
|
7
|
+
readonly variantSelections?: readonly UsdVariantSelection[];
|
|
8
|
+
readonly openUsdBaseUrl?: string;
|
|
9
|
+
readonly openUsdRuntimeId?: string;
|
|
10
|
+
readonly openUsdWasmModule?: WebAssembly.Module | Promise<WebAssembly.Module>;
|
|
11
|
+
readonly resolveResource: (identifier: string, url: string) => Promise<Blob>;
|
|
12
|
+
readonly onProgress?: (completed: number, identifier: string) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface UsdDependencyProbeResult {
|
|
15
|
+
readonly resources: readonly {
|
|
16
|
+
readonly identifier: string;
|
|
17
|
+
readonly url: string;
|
|
18
|
+
readonly blob: Blob;
|
|
19
|
+
}[];
|
|
20
|
+
readonly variantSets: readonly {
|
|
21
|
+
readonly primPath: string;
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly options: readonly string[];
|
|
24
|
+
}[];
|
|
25
|
+
readonly capability: {
|
|
26
|
+
readonly hasPhysics: boolean;
|
|
27
|
+
readonly hasArticulation: boolean;
|
|
28
|
+
readonly hasColliderGeometry: boolean;
|
|
29
|
+
readonly hasRigidBody: boolean;
|
|
30
|
+
readonly source: 'usd-authored' | 'none' | 'unknown';
|
|
31
|
+
};
|
|
32
|
+
readonly measured: {
|
|
33
|
+
readonly bounds?: {
|
|
34
|
+
readonly min: readonly [number, number, number];
|
|
35
|
+
readonly max: readonly [number, number, number];
|
|
36
|
+
};
|
|
37
|
+
readonly jointCount?: number;
|
|
38
|
+
readonly meshCount?: number;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Browser probe used by remote import; only prefers work to the bundled Worker. */
|
|
42
|
+
export declare function probeUsdDependencies(request: UsdDependencyProbeRequest): Promise<UsdDependencyProbeResult>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { USDJointInfo, USDLoadedModel, USDPhysicsInfo, USDVariantSetInfo } from '@openusd-wasm/three-loader';
|
|
2
|
+
import type { SimulationDiagnostics } from './types';
|
|
3
|
+
export interface UsdInspectionStage {
|
|
4
|
+
readonly sourcePath: string;
|
|
5
|
+
readonly rootLayerIdentifier: string;
|
|
6
|
+
readonly defaultPrim: string | null;
|
|
7
|
+
readonly upAxis: string;
|
|
8
|
+
readonly metersPerUnit: number;
|
|
9
|
+
readonly kilogramsPerUnit: number;
|
|
10
|
+
readonly startTimeCode: number;
|
|
11
|
+
readonly endTimeCode: number;
|
|
12
|
+
readonly timeCodesPerSecond: number;
|
|
13
|
+
}
|
|
14
|
+
export interface UsdInspectionPrim {
|
|
15
|
+
readonly path: string;
|
|
16
|
+
readonly parentPath: string | null;
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly typeName: string;
|
|
19
|
+
readonly visibility: string;
|
|
20
|
+
readonly resetsXformStack: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface UsdInspectionMesh {
|
|
23
|
+
readonly path: string;
|
|
24
|
+
readonly vertexCount: number;
|
|
25
|
+
readonly triangleCount: number;
|
|
26
|
+
readonly normalCount: number;
|
|
27
|
+
readonly uvCount: number;
|
|
28
|
+
readonly doubleSided: boolean;
|
|
29
|
+
readonly materialPath: string | null;
|
|
30
|
+
readonly bounds: {
|
|
31
|
+
readonly min: readonly [number, number, number];
|
|
32
|
+
readonly max: readonly [number, number, number];
|
|
33
|
+
readonly size: readonly [number, number, number];
|
|
34
|
+
} | null;
|
|
35
|
+
readonly degenerateTriangles: number;
|
|
36
|
+
readonly nonFinitePositions: number;
|
|
37
|
+
}
|
|
38
|
+
export interface UsdInspectionMaterial {
|
|
39
|
+
readonly path: string;
|
|
40
|
+
readonly shaderIds: readonly string[];
|
|
41
|
+
readonly texturePaths: readonly string[];
|
|
42
|
+
readonly inputs: Readonly<Record<string, unknown>>;
|
|
43
|
+
}
|
|
44
|
+
export type UsdInspectionJoint = USDJointInfo;
|
|
45
|
+
export type UsdInspectionVariantSet = USDVariantSetInfo;
|
|
46
|
+
export interface UsdInspectionSnapshot {
|
|
47
|
+
readonly schemaVersion: 1;
|
|
48
|
+
readonly stage: UsdInspectionStage;
|
|
49
|
+
readonly prims: readonly UsdInspectionPrim[];
|
|
50
|
+
readonly meshes: readonly UsdInspectionMesh[];
|
|
51
|
+
readonly materials: readonly UsdInspectionMaterial[];
|
|
52
|
+
readonly physics: {
|
|
53
|
+
readonly scenes: USDPhysicsInfo['scenes'];
|
|
54
|
+
readonly rigidBodies: USDPhysicsInfo['rigidBodies'];
|
|
55
|
+
readonly colliders: USDPhysicsInfo['colliders'];
|
|
56
|
+
readonly materials: USDPhysicsInfo['materials'];
|
|
57
|
+
readonly articulationRoots: USDPhysicsInfo['articulationRoots'];
|
|
58
|
+
readonly joints: readonly UsdInspectionJoint[];
|
|
59
|
+
};
|
|
60
|
+
readonly variants: readonly UsdInspectionVariantSet[];
|
|
61
|
+
readonly diagnostics: SimulationDiagnostics;
|
|
62
|
+
}
|
|
63
|
+
export declare function createUsdInspectionSnapshot(model: USDLoadedModel, units: {
|
|
64
|
+
readonly metersPerUnit: number;
|
|
65
|
+
readonly kilogramsPerUnit: number;
|
|
66
|
+
}, diagnostics: SimulationDiagnostics): UsdInspectionSnapshot;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { b as d } from "./spark.module-kM8pwA1o.js";
|
|
2
|
+
import { R as p } from "./index-CHf9y9eX.js";
|
|
3
|
+
const a = /* @__PURE__ */ new WeakMap();
|
|
4
|
+
function o(r, e, s) {
|
|
5
|
+
let n = a.get(e);
|
|
6
|
+
if (!n) {
|
|
7
|
+
const t = new d({
|
|
8
|
+
renderer: r,
|
|
9
|
+
onDirty: s,
|
|
10
|
+
transparent: !0,
|
|
11
|
+
depthTest: !0,
|
|
12
|
+
depthWrite: !1
|
|
13
|
+
});
|
|
14
|
+
t.name = "viewer-spark-renderer", t.layers.enable(p), e.add(t), n = { renderer: t, references: 0 }, a.set(e, n);
|
|
15
|
+
}
|
|
16
|
+
return n.references += 1, { renderer: n.renderer, scene: e };
|
|
17
|
+
}
|
|
18
|
+
function i(r) {
|
|
19
|
+
const e = a.get(r.scene);
|
|
20
|
+
!e || e.renderer !== r.renderer || (e.references = Math.max(0, e.references - 1), !(e.references > 0) && (r.scene.remove(e.renderer), e.renderer.dispose(), a.delete(r.scene)));
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
o as a,
|
|
24
|
+
i as r
|
|
25
|
+
};
|