@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.
Files changed (48) hide show
  1. package/CHANGELOG.md +83 -35
  2. package/README.md +5 -0
  3. package/dist/asset-ir-BXa1EdOy.js +637 -0
  4. package/dist/assets/source-types.d.ts +10 -0
  5. package/dist/assets/types.d.ts +61 -6
  6. package/dist/assets/{usd-worker-B6-1I5dT.js → usd-worker-r6Nuoxlk.js} +671 -584
  7. package/dist/index-CHf9y9eX.js +17406 -0
  8. package/dist/index.d.ts +21 -2
  9. package/dist/index.js +29 -18
  10. package/dist/{mjcf-visual-CtY2Wk3w.js → mjcf-visual-DxMXiBnu.js} +12 -13
  11. package/dist/mujoco-runtime-BA88JuDR.js +791 -0
  12. package/dist/physics-guide-size-CplAlsve.js +12 -0
  13. package/dist/scene/instances.d.ts +36 -0
  14. package/dist/scene/joints.d.ts +129 -0
  15. package/dist/scene/session.d.ts +26 -0
  16. package/dist/scene/types.d.ts +292 -0
  17. package/dist/session-DLi-MvLB.js +240 -0
  18. package/dist/{session-DxTeRKCd.js → session-DqEr1CxY.js} +581 -567
  19. package/dist/session-ZNb3ZYLq.js +562 -0
  20. package/dist/simulation/physics-runtime-state.d.ts +73 -0
  21. package/dist/simulation/types.d.ts +151 -0
  22. package/dist/simulation/usd-dependency-probe.d.ts +42 -0
  23. package/dist/simulation/usd-inspection.d.ts +66 -0
  24. package/dist/spark-renderer-BGF_AaI9.js +25 -0
  25. package/dist/spark.module-kM8pwA1o.js +9278 -0
  26. package/dist/types.d.ts +75 -1
  27. package/dist/ui/camera-axis-gizmo.d.ts +5 -0
  28. package/dist/urdf-session-CKlR-fOQ.js +1230 -0
  29. package/dist/usd-session-DyNMsD-v.js +11199 -0
  30. package/dist/version.d.ts +1 -1
  31. package/dist/visual/classification.d.ts +20 -0
  32. package/dist/{xacro-x2TeKQ7T.js → xacro-BCLnc3tY.js} +1 -1
  33. package/openusd/openusd-runtime-manifest.json +6 -6
  34. package/openusd/openusd_probe.js +1 -1
  35. package/openusd/openusd_probe.wasm +0 -0
  36. package/package.json +2 -1
  37. package/runtime-assets.d.mts +9 -9
  38. package/runtime-assets.mjs +11 -11
  39. package/vite.d.mts +7 -7
  40. package/vite.mjs +115 -115
  41. package/dist/collision-debug-BSJoz5J7.js +0 -2947
  42. package/dist/index-E8DHSeyT.js +0 -11499
  43. package/dist/mujoco-runtime-fDWdXNEc.js +0 -739
  44. package/dist/resources-CHhCm2f7.js +0 -27
  45. package/dist/session-DB-osaBL.js +0 -801
  46. package/dist/stage-BnRjc-Rp.js +0 -592
  47. package/dist/urdf-session-Q_c3Rd1M.js +0 -1264
  48. package/dist/usd-session-tW3LxVFs.js +0 -10647
@@ -0,0 +1,12 @@
1
+ import { Vector3 as c, Quaternion as p } from "three";
2
+ function l(t, i, r = 3e-3) {
3
+ const e = new c(), s = new p(), o = new c();
4
+ t.onBeforeRender = () => {
5
+ t.matrixWorld.decompose(e, s, o);
6
+ const m = r / i, n = (a) => Math.sign(a || 1) * Math.max(Math.abs(a), m);
7
+ o.set(n(o.x), n(o.y), n(o.z)), t.matrixWorld.compose(e, s, o);
8
+ };
9
+ }
10
+ export {
11
+ l as k
12
+ };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Builds a `THREE.Group` scene root holding one child group per placed asset.
3
+ *
4
+ * Each child keeps the asset's own session alive so format-specific behaviour
5
+ * (USD staging, MuJoCo step, animation mixers) is never reimplemented here. The
6
+ * scene only owns placement, readiness bookkeeping and disposal.
7
+ */
8
+ import { Group, Object3D } from 'three';
9
+ import type { AssetLoaderContext, AssetSession, NormalizedAssetSource } from '../assets/types';
10
+ import type { SceneEntry, SceneInstanceSnapshot, ScenePlacement } from './types';
11
+ /** Result of mounting one entry: the group plus the session that owns it. */
12
+ export interface MountedSceneInstance {
13
+ readonly entryId: string;
14
+ readonly assetId: string;
15
+ readonly group: Group;
16
+ readonly content: Group;
17
+ readonly session: AssetSession;
18
+ readonly source: NormalizedAssetSource;
19
+ }
20
+ export interface SceneAssetResolver {
21
+ /** Per-entry detection using the same loaders the single-asset path uses. */
22
+ detect(entry: SceneEntry, source: NormalizedAssetSource, signal: AbortSignal): Promise<{
23
+ readonly create: (context: AssetLoaderContext) => AssetSession | Promise<AssetSession>;
24
+ } | {
25
+ readonly error: Error;
26
+ }>;
27
+ }
28
+ export declare function applyPlacement(object: Object3D, placement: ScenePlacement | undefined): void;
29
+ /** Applies source-content pivot compensation below the posed instance root. */
30
+ export declare function applyContentPivot(object: Object3D, pivot: ScenePlacement['pivot']): void;
31
+ export declare function toPlacementSnapshot(group: Object3D, pivot?: ScenePlacement['pivot']): ScenePlacement;
32
+ export declare function instanceSnapshot(entry: Pick<SceneEntry, 'id'>, phase: SceneInstanceSnapshot['phase'], error?: SceneInstanceSnapshot['error']): SceneInstanceSnapshot;
33
+ /** Name used for the child group so host-side picking can map back to an id. */
34
+ export declare function instanceGroupName(entryId: string): string;
35
+ /** Reads the owning entry id from an object, walking up to the scene root. */
36
+ export declare function findInstanceId(object: Object3D | null): string | null;
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Scene-level joint authoring surface.
3
+ *
4
+ * A single-asset session exposes joint control through the paused joint
5
+ * inspection (`JointInspection`). A scene session cannot: the caller addresses
6
+ * assets by instance id, and an instance may be in one of three genuinely
7
+ * different states — no joint runtime, a paused kinematic/staged model that can
8
+ * be edited directly, or a live physics world that owns the coordinates.
9
+ *
10
+ * This module is the single place that turns those three states into one
11
+ * shape, so hosts (Studio, embedders) never branch on loader internals:
12
+ *
13
+ * - `editable` is `true` only when the caller may move the joint right now.
14
+ * Running physics is deliberately not editable; a drive that fights the
15
+ * solver is not an authoring gesture.
16
+ * - `value` is always the *actual* coordinate (radians or meters), never a
17
+ * pending target, so saving a pose and reading a pose agree.
18
+ * - Writing a value previews it. Persistence stays with the caller: the Viewer
19
+ * never rewrites the loaded asset, and `resetInstance`/`resetScene` fall back
20
+ * to the compiled initial pose.
21
+ */
22
+ import type { JointInspection, JointInspectionJoint } from '../inspection/types';
23
+ /** Mirrors `JointInspectionJoint` minus the loader-private fields. */
24
+ export interface SceneJointDescriptor {
25
+ readonly id: string;
26
+ readonly name: string;
27
+ readonly label?: string;
28
+ readonly type: string;
29
+ readonly parent: string | null;
30
+ readonly child: string | null;
31
+ readonly axis: readonly number[];
32
+ readonly unit: 'rad' | 'm';
33
+ /** Authored joint limits. */
34
+ readonly limits?: {
35
+ readonly lower: number;
36
+ readonly upper: number;
37
+ };
38
+ /**
39
+ * Range a driver may write. Intersected with every mimic follower, so a
40
+ * leader never commands a follower past its own limit. Absent for a joint
41
+ * with no finite range on both sides.
42
+ */
43
+ readonly controlLimits?: {
44
+ readonly lower: number;
45
+ readonly upper: number;
46
+ };
47
+ readonly defaultValue: number;
48
+ /** Slaved to another joint; read-only by construction. */
49
+ readonly mimic?: {
50
+ readonly joint: string;
51
+ readonly multiplier: number;
52
+ readonly offset: number;
53
+ };
54
+ }
55
+ export type SceneJointBlockReason =
56
+ /** No runtime in this instance can read or write joint coordinates. */
57
+ 'unsupported-format'
58
+ /** Signed-off physics is running; authoring waits for a pause. */
59
+ | 'simulation-running'
60
+ /** The instance is still loading. */
61
+ | 'not-ready'
62
+ /** A mimic follower; its leader owns the value. */
63
+ | 'mimic-follower'
64
+ /** No finite control range was authored for this joint. */
65
+ | 'no-control-range';
66
+ export interface SceneJointState {
67
+ readonly id: string;
68
+ readonly descriptor: SceneJointDescriptor;
69
+ /** Actual coordinate in the joint's own unit (rad or m). */
70
+ readonly value: number;
71
+ /** Pending servo/preview target while a drag is in flight. */
72
+ readonly target?: number;
73
+ readonly editable: boolean;
74
+ readonly blockedBy?: SceneJointBlockReason;
75
+ }
76
+ export interface SceneJointSnapshot {
77
+ readonly instanceId: string;
78
+ /** Coordinate space of every value below: `rad` for revolute, `m` for prismatic. */
79
+ readonly units: 'mixed';
80
+ readonly revision: number;
81
+ readonly joints: readonly SceneJointState[];
82
+ readonly values: Readonly<Record<string, number>>;
83
+ readonly playing: boolean;
84
+ /** `kinematic` edits are instantaneous; `physics` edits are driven servos. */
85
+ readonly controlMode?: 'kinematic' | 'physics';
86
+ }
87
+ /** One entry of a pose handed to the caller for persistence. */
88
+ export interface SceneJointPose {
89
+ readonly instanceId: string;
90
+ readonly joints: Readonly<Record<string, number>>;
91
+ }
92
+ export interface SceneInstanceJoints {
93
+ readonly instanceId: string;
94
+ getSnapshot(): SceneJointSnapshot;
95
+ subscribe(listener: (snapshot: SceneJointSnapshot) => void): () => void;
96
+ /** Writes one coordinate, clamped to its control range. Returns the applied value. */
97
+ setValue(jointId: string, value: number): number | null;
98
+ /** Writes several coordinates in one transaction; unknown ids are ignored. */
99
+ setValues(values: Readonly<Record<string, number>>): boolean;
100
+ /** Restores the compiled initial pose for every joint, or only the named ones. */
101
+ reset(jointIds?: readonly string[]): boolean;
102
+ /** True while any joint of this instance is editable. */
103
+ canEdit(): boolean;
104
+ /** Current committed values, ready to persist through the host's undo stack. */
105
+ capturePose(): Readonly<Record<string, number>>;
106
+ }
107
+ export type JointInspectionSource = Pick<JointInspection, 'getSnapshot' | 'subscribe' | 'setJointValue' | 'resetPose' | 'resetJoint'>;
108
+ export declare function isSceneScalarJoint(joint: JointInspectionJoint): boolean;
109
+ export declare function toSceneJointDescriptor(joint: JointInspectionJoint): SceneJointDescriptor;
110
+ /**
111
+ * Why this joint cannot be driven, or `null` when it can. `running` is checked
112
+ * first because a running solver invalidates every other answer.
113
+ */
114
+ export declare function jointBlockReason(joint: JointInspectionJoint, options: {
115
+ readonly running: boolean;
116
+ readonly ready: boolean;
117
+ }): SceneJointBlockReason | null;
118
+ export declare function clampJointValue(joint: JointInspectionJoint, value: number): number | null;
119
+ /**
120
+ * Builds the authoring surface over a live joint inspection. `isRunning` and
121
+ * `isReady` are read on every snapshot, so the same object stays valid across
122
+ * play/pause transitions without re-subscribing.
123
+ */
124
+ export declare function createSceneInstanceJoints(options: {
125
+ readonly instanceId: string;
126
+ readonly inspection: JointInspectionSource;
127
+ readonly isRunning: () => boolean;
128
+ readonly isReady?: () => boolean;
129
+ }): SceneInstanceJoints;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Scene session: several placed assets under one Viewer stage.
3
+ *
4
+ * Each entry is loaded by the format loader that already owns that format, so
5
+ * this module contains no parser. It is purely orchestration: resolve, place,
6
+ * track readiness, forward controls, dispose.
7
+ */
8
+ import { Box3 } from 'three';
9
+ import type { AssetLoaderContribution } from '../assets/types';
10
+ import { findInstanceId, toPlacementSnapshot } from './instances';
11
+ import type { SceneControl, SceneEntry, SceneOptions, ScenePlacement } from './types';
12
+ export interface SceneSessionDeps {
13
+ /** Loaders registered with the Viewer, same set the single-asset path uses. */
14
+ readonly loaders: readonly AssetLoaderContribution[];
15
+ readonly requestRender: () => void;
16
+ readonly fit: (root: import('three').Object3D | Box3, options?: {
17
+ readonly padding?: number;
18
+ }) => boolean;
19
+ readonly reportError: (error: unknown, options: {
20
+ readonly stage: string;
21
+ readonly fatal: boolean;
22
+ }) => void;
23
+ }
24
+ export declare function createSceneSession(entries: readonly SceneEntry[], options: SceneOptions, deps: SceneSessionDeps): SceneControl;
25
+ export { findInstanceId, toPlacementSnapshot };
26
+ export type { ScenePlacement };
@@ -0,0 +1,292 @@
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
+ import type { SceneInstanceJoints } from './joints';
17
+ /** Plain readonly tuple, kept local so this module imports no document types. */
18
+ export type Vec3Like = readonly [number, number, number];
19
+ /** Placement of one asset inside the scene, relative to the scene root. */
20
+ export interface ScenePlacement {
21
+ readonly position?: Vec3Like;
22
+ readonly rotation?: readonly [number, number, number, number];
23
+ readonly scale?: Vec3Like;
24
+ /**
25
+ * Transform pivot in source-content coordinates. The instance group is posed
26
+ * at this pivot and its content is translated by `-pivot`.
27
+ */
28
+ readonly pivot?: Vec3Like;
29
+ readonly visible?: boolean;
30
+ }
31
+ export interface ScenePlacementCommitOptions {
32
+ /**
33
+ * Updates the rendered pose immediately and rebuilds physics in the
34
+ * background. Authoring gestures use this so pointer release is not blocked
35
+ * by MuJoCo compilation.
36
+ */
37
+ readonly deferPhysics?: boolean;
38
+ }
39
+ /** One asset instance placed in the scene. */
40
+ export interface SceneEntry {
41
+ /** Stable caller-chosen id echoed back by instance-level commands. */
42
+ readonly id: string;
43
+ readonly source: AssetSingleSource | Extract<CadLoadSource, {
44
+ readonly kind: 'packFile';
45
+ }> | {
46
+ readonly kind: 'files';
47
+ readonly files: readonly AssetFileEntry[];
48
+ readonly entry?: string;
49
+ };
50
+ /** Explicit format; defaults to per-entry automatic detection. */
51
+ readonly format?: AssetFormat;
52
+ readonly filename?: string;
53
+ readonly baseUrl?: string;
54
+ readonly resourceResolver?: AssetResourceResolver;
55
+ /** Format-specific options passed to the owning asset loader. */
56
+ readonly openOptions?: Partial<OpenAssetOptions>;
57
+ readonly placement?: ScenePlacement;
58
+ readonly physics?: SceneInstancePhysics;
59
+ }
60
+ export interface SceneOptions {
61
+ readonly signal?: AbortSignal;
62
+ readonly simulationTheme?: 'dark' | 'light';
63
+ readonly dracoDecoderPath?: string;
64
+ readonly ktx2TranscoderPath?: string;
65
+ readonly mujocoBaseUrl?: string;
66
+ readonly openUsdBaseUrl?: string;
67
+ readonly openUsdRuntimeId?: string;
68
+ readonly openUsdWasmModule?: WebAssembly.Module | Promise<WebAssembly.Module>;
69
+ readonly mujocoWasmModule?: WebAssembly.Module | Promise<WebAssembly.Module>;
70
+ /**
71
+ * Play the one-shot joint demonstration when an instance is paused.
72
+ *
73
+ * Defaults to `false`, unlike the single-asset default. A scene is an
74
+ * authored arrangement: every instance would otherwise animate on load and
75
+ * the assembled pose would appear, then change, before the caller has said
76
+ * anything. Hosts that want the flourish opt in per scene.
77
+ */
78
+ readonly jointIntro?: boolean;
79
+ }
80
+ /** `closed` means the scene shut down before the instance finished loading. */
81
+ export type SceneInstancePhase = 'pending' | 'loading' | 'ready' | 'failed' | 'closed';
82
+ export interface SceneInstanceSnapshot {
83
+ readonly id: string;
84
+ readonly assetId: string;
85
+ readonly phase: SceneInstancePhase;
86
+ /** Populated when `phase` is `failed`. */
87
+ readonly error: {
88
+ readonly code: string;
89
+ readonly message: string;
90
+ } | null;
91
+ /** Runtime capability report from the exact format session that loaded this instance. */
92
+ readonly capabilities?: AssetPreviewCapabilities;
93
+ /** Physics availability is independent from visual readiness. */
94
+ readonly physics?: AssetPhysicsState | null;
95
+ /** Loader-owned stage while `phase` is loading; terminal states use null. */
96
+ readonly stage?: string | null;
97
+ readonly message?: string | null;
98
+ readonly progress?: {
99
+ readonly completed: number;
100
+ readonly total: number | null;
101
+ readonly determinate: boolean;
102
+ } | null;
103
+ readonly warning?: AssetWarningSnapshot | null;
104
+ }
105
+ export interface SceneSnapshot {
106
+ readonly revision: number;
107
+ readonly phase: 'loading' | 'ready' | 'failed';
108
+ readonly instances: readonly SceneInstanceSnapshot[];
109
+ /** Aggregated capability view of every loaded instance. */
110
+ readonly capabilities: {
111
+ readonly hasPhysics: boolean;
112
+ readonly canPlay: boolean;
113
+ readonly canPause: boolean;
114
+ readonly canReset: boolean;
115
+ readonly canToggleCollision: boolean;
116
+ readonly canToggleGround: boolean;
117
+ };
118
+ readonly error: {
119
+ readonly code: string;
120
+ readonly message: string;
121
+ } | null;
122
+ }
123
+ export interface SceneInstanceRuntime {
124
+ readonly id: string;
125
+ readonly capabilities: AssetPreviewCapabilities | null;
126
+ readonly physics: AssetPhysicsState | null;
127
+ readonly visualDiagnostics: Readonly<Record<string, unknown>> | null;
128
+ readonly physicsProperties: Readonly<Record<string, unknown>> | null;
129
+ readonly physicsRuntime: PhysicsRuntimeSnapshot | null;
130
+ /**
131
+ * Viewport inspection overlays that the mounted format session can render.
132
+ * This is deliberately separate from authored data: a model may contain
133
+ * mass, inertia, or joint declarations while the current runtime cannot
134
+ * draw the corresponding guide.
135
+ */
136
+ readonly inspectionOverlays?: Readonly<{
137
+ readonly jointAxis: boolean;
138
+ readonly centerOfMass: boolean;
139
+ readonly inertia: boolean;
140
+ }> | null;
141
+ }
142
+ export interface ScenePhysicsState {
143
+ readonly status: 'not-authored' | 'initializing' | 'ready' | 'unavailable';
144
+ readonly issue?: {
145
+ readonly code: string;
146
+ readonly message: string;
147
+ };
148
+ }
149
+ export interface SceneInstanceBounds {
150
+ readonly min: Vec3Like;
151
+ readonly max: Vec3Like;
152
+ readonly size: Vec3Like;
153
+ }
154
+ export interface SceneDeterministicCheckOptions {
155
+ readonly steps?: number;
156
+ readonly timestep?: number;
157
+ }
158
+ export interface SceneDeterministicCheckResult {
159
+ readonly status: 'completed' | 'not-authored' | 'unavailable';
160
+ readonly reason: string | null;
161
+ readonly checkedAt: string;
162
+ readonly timestep: number | null;
163
+ readonly steps: number;
164
+ readonly initial: PhysicsRuntimeSnapshot | null;
165
+ readonly final: PhysicsRuntimeSnapshot | null;
166
+ readonly bounds: Readonly<Record<string, SceneInstanceBounds>>;
167
+ readonly overlaps: readonly {
168
+ readonly a: string;
169
+ readonly b: string;
170
+ readonly volume: number;
171
+ }[];
172
+ readonly bodyMotion: Readonly<Record<string, PhysicsBodyMotionType>>;
173
+ }
174
+ export type SceneInspectionOverlay = 'jointAxis' | 'centerOfMass' | 'inertia';
175
+ /** Operations available on a loaded scene session. */
176
+ export interface SceneControl {
177
+ readonly id: string;
178
+ /**
179
+ * Stage root handed to the host runtime exactly once. The host mounts it like
180
+ * any asset root, so the scene reuses the existing single Renderer/Scene/RAF.
181
+ */
182
+ readonly root: import('three').Object3D;
183
+ readonly ready: Promise<void>;
184
+ getSnapshot(): SceneSnapshot;
185
+ subscribe(listener: (snapshot: SceneSnapshot) => void): () => void;
186
+ /**
187
+ * Replaces one loaded instance placement. By default it resolves after the
188
+ * shared scene physics world has been rebuilt for the committed pose.
189
+ */
190
+ setInstancePlacement(id: string, placement: ScenePlacement, options?: ScenePlacementCommitOptions): Promise<boolean>;
191
+ /** Update the unified collision overlay for an uncommitted instance pose. */
192
+ previewInstancePlacement(id: string, placement: ScenePlacement): boolean;
193
+ /** Adds an instance at runtime; resolves once it is loaded or failed. */
194
+ addInstance(entry: SceneEntry): Promise<SceneInstanceSnapshot>;
195
+ /** Removes an instance and disposes its resources. */
196
+ removeInstance(id: string): Promise<boolean>;
197
+ /** Reads the real format-session report without exposing live renderer objects. */
198
+ getInstanceRuntime(id: string): SceneInstanceRuntime | null;
199
+ getInstanceBounds(id: string): SceneInstanceBounds | null;
200
+ /** Hidden collision geometry for placement probing; created lazily when authored. */
201
+ getInstanceCollisionRoot(id: string): import('three').Object3D | null;
202
+ setPhysicsConfiguration(configuration: ScenePhysicsConfiguration): Promise<void>;
203
+ getScenePhysicsState(): ScenePhysicsState;
204
+ getScenePhysicsRuntime(): PhysicsRuntimeSnapshot | null;
205
+ /**
206
+ * Resets, advances a fixed number of exact MuJoCo steps and resets again.
207
+ * This never toggles the interactive simulation state.
208
+ */
209
+ runDeterministicCheck(options?: SceneDeterministicCheckOptions): SceneDeterministicCheckResult;
210
+ /** Plays an authored animation or physical runtime only when that session supports it. */
211
+ playInstance(id: string): boolean;
212
+ pauseInstance(id: string): boolean;
213
+ resetInstance(id: string): boolean;
214
+ /**
215
+ * Runs every scene instance that has a real, playable physics runtime from
216
+ * the Viewer's single frame loop.
217
+ */
218
+ playScene(): boolean;
219
+ pauseScene(): boolean;
220
+ /** Advances one exact physics step while the interactive scene is paused. */
221
+ stepScene(timestep?: number): boolean;
222
+ resetScene(): boolean;
223
+ isSimulationRunning(): boolean;
224
+ /** Advances all playing scene sessions and returns whether any pose changed. */
225
+ update(deltaSeconds: number): boolean;
226
+ /** Installs the one shared scene stage transaction for reflection and fog. */
227
+ beforeRender(renderer: import('three').WebGLRenderer, scene: import('three').Scene, camera: import('three').Camera): (() => void) | void;
228
+ /** Routes the Viewer's elastic-force grab to the hit scene instance. */
229
+ beginGrab(event: PointerEvent, camera: import('three').Camera, canvas: HTMLElement): boolean;
230
+ moveGrab(event: PointerEvent, camera: import('three').Camera, canvas: HTMLElement): void;
231
+ endGrab(): void;
232
+ /** Resolves the scene instance beneath a pointer through the unified physics body map. */
233
+ pickUnifiedInstance(clientX: number, clientY: number, camera: import('three').Camera, canvas: HTMLElement): string | null;
234
+ /** Controls elastic force grabbing while scene physics remains running. */
235
+ setGrabEnabled(enabled: boolean): void;
236
+ /**
237
+ * Joint authoring surface for one instance, or `null` when that instance has
238
+ * no joint runtime (CAD, mesh-only scenes) or the scene is closed.
239
+ *
240
+ * Edits preview the pose only. Persistence belongs to the caller: write the
241
+ * snapshot you want through `applyInstancePose`/`setValues`, then save it,
242
+ * and re-open the scene with the saved values when the pose must survive a
243
+ * reload. `resetInstance`/`resetScene` restore the compiled initial pose.
244
+ */
245
+ getInstanceJoints(id: string): SceneInstanceJoints | null;
246
+ /**
247
+ * Writes a saved joint pose back onto a loaded instance. Values are clamped
248
+ * to each joint's control range and silently skip joints that cannot be
249
+ * edited right now (mimic followers, running physics).
250
+ */
251
+ applyInstancePose(id: string, joints: Readonly<Record<string, number>>): boolean;
252
+ /** Sets one URDF inspection overlay when the target instance supports inspection. */
253
+ setInstanceInspectionOverlay(id: string, overlay: SceneInspectionOverlay, visible: boolean): boolean;
254
+ /** Overrides collision visibility for one instance; null inherits the scene-wide value. */
255
+ setInstanceCollisionVisible(id: string, visible: boolean | null): boolean;
256
+ setCollisionVisible(visible: boolean): void;
257
+ setGroundVisible(visible: boolean): void;
258
+ setTheme(theme: 'dark' | 'light'): void;
259
+ close(): Promise<void>;
260
+ }
261
+ export interface SceneInstancePhysics {
262
+ readonly override?: {
263
+ readonly kind: 'asset-authored' | 'static' | 'dynamic' | 'kinematic';
264
+ readonly massKg?: number;
265
+ readonly centerOfMassM?: Vec3Like;
266
+ readonly colliderPrimPaths?: readonly string[];
267
+ readonly physicsMaterial?: {
268
+ readonly densityKgPerM3?: number;
269
+ readonly staticFriction?: number;
270
+ readonly dynamicFriction?: number;
271
+ readonly restitution?: number;
272
+ };
273
+ readonly jointOverrides?: readonly {
274
+ readonly jointPrimPath: string;
275
+ readonly driveType?: 'position' | 'velocity';
276
+ readonly target?: number;
277
+ readonly stiffness?: number;
278
+ readonly damping?: number;
279
+ readonly maxForce?: number;
280
+ }[];
281
+ };
282
+ readonly initialJoints?: Readonly<Record<string, number>>;
283
+ }
284
+ export interface ScenePhysicsConfiguration {
285
+ readonly environment?: {
286
+ readonly gravity: Vec3Like;
287
+ readonly timeStepSeconds: number;
288
+ readonly integrator?: 'euler' | 'implicitfast' | 'rk4';
289
+ readonly solverIterations?: number;
290
+ };
291
+ readonly instances: Readonly<Record<string, SceneInstancePhysics>>;
292
+ }