@nebula-spatial/viewer 0.5.17 → 0.6.0
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 +63 -22
- package/USD-VISUAL-MATERIAL-SUPPORT.md +5 -1
- package/dist/asset-ir-BEDGD9CL.js +637 -0
- package/dist/assets/source-types.d.ts +10 -0
- package/dist/assets/types.d.ts +59 -6
- package/dist/index-DoxM1Msk.js +17223 -0
- package/dist/index.d.ts +20 -1
- package/dist/index.js +29 -18
- package/dist/{mjcf-visual-C0PWP0vB.js → mjcf-visual-CQEeWkL_.js} +12 -13
- package/dist/mujoco-runtime-BmuEJ_ST.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 +284 -0
- package/dist/session-BnNntPUE.js +9169 -0
- package/dist/{session-D44z2smp.js → session-Cz4tFSlO.js} +6 -8
- package/dist/session-sBOJEWpK.js +559 -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/types.d.ts +46 -1
- package/dist/ui/camera-axis-gizmo.d.ts +5 -0
- package/dist/urdf-session-HKelZnMM.js +1230 -0
- package/dist/usd-session-Cn6whyh4.js +10875 -0
- package/dist/version.d.ts +1 -1
- package/dist/visual/classification.d.ts +20 -0
- package/dist/{xacro-CjMp9HT5.js → xacro-Cl7vUCSC.js} +1 -1
- 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-CHPrPNT3.js +0 -2947
- package/dist/index-cM9KArXm.js +0 -11499
- package/dist/mujoco-runtime-BV2xR38M.js +0 -739
- package/dist/resources-CHhCm2f7.js +0 -27
- package/dist/session-CKva1mAh.js +0 -801
- package/dist/stage-pxmOnL0U.js +0 -592
- package/dist/urdf-session-ChpRmt69.js +0 -1264
- package/dist/usd-session-auH_xmOc.js +0 -10526
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export type PhysicsBodyMotionType = 'dynamic' | 'static' | 'kinematic' | 'visual-only' | 'unsupported';
|
|
2
|
+
export interface PhysicsRuntimeBodyState {
|
|
3
|
+
readonly id: number;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly sourcePath: string | null;
|
|
6
|
+
readonly instanceId: string | null;
|
|
7
|
+
readonly motionType: PhysicsBodyMotionType;
|
|
8
|
+
readonly mass: number;
|
|
9
|
+
readonly centerOfMass: readonly number[];
|
|
10
|
+
readonly inertia: readonly number[];
|
|
11
|
+
/** Row-major orientation of the principal inertia frame in world coordinates. */
|
|
12
|
+
readonly inertiaOrientationWorld?: readonly number[] | null;
|
|
13
|
+
readonly position: readonly number[];
|
|
14
|
+
readonly quaternion: readonly number[];
|
|
15
|
+
readonly linearVelocity: readonly number[];
|
|
16
|
+
readonly angularVelocity: readonly number[];
|
|
17
|
+
readonly awake: boolean | null;
|
|
18
|
+
}
|
|
19
|
+
export interface PhysicsRuntimeJointState {
|
|
20
|
+
readonly instanceId?: string | null;
|
|
21
|
+
readonly axisWorld?: readonly number[] | null;
|
|
22
|
+
readonly id: number;
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly type: string;
|
|
25
|
+
readonly position: number | null;
|
|
26
|
+
readonly velocity: number | null;
|
|
27
|
+
readonly range: readonly [number, number] | null;
|
|
28
|
+
}
|
|
29
|
+
export interface PhysicsRuntimeContactState {
|
|
30
|
+
readonly index: number;
|
|
31
|
+
readonly geom1: string;
|
|
32
|
+
readonly geom2: string;
|
|
33
|
+
readonly body1: number;
|
|
34
|
+
readonly body2: number;
|
|
35
|
+
readonly instance1: string | null;
|
|
36
|
+
readonly instance2: string | null;
|
|
37
|
+
readonly distance: number;
|
|
38
|
+
readonly penetration: number;
|
|
39
|
+
readonly position: readonly number[];
|
|
40
|
+
readonly friction: readonly number[];
|
|
41
|
+
}
|
|
42
|
+
export interface PhysicsRuntimeGrabState {
|
|
43
|
+
readonly bodyId: number;
|
|
44
|
+
readonly instanceId: string | null;
|
|
45
|
+
readonly force: readonly number[];
|
|
46
|
+
readonly forceMagnitude: number;
|
|
47
|
+
readonly maxForce: number;
|
|
48
|
+
readonly stiffness: number;
|
|
49
|
+
readonly damping: number;
|
|
50
|
+
readonly strength: number;
|
|
51
|
+
readonly target: readonly number[];
|
|
52
|
+
}
|
|
53
|
+
export interface PhysicsRuntimeSnapshot {
|
|
54
|
+
readonly status: 'running' | 'paused' | 'ready';
|
|
55
|
+
readonly worldKind: 'asset-session' | 'scene-unified';
|
|
56
|
+
readonly time: number;
|
|
57
|
+
readonly timestep: number;
|
|
58
|
+
readonly steps: number;
|
|
59
|
+
readonly qpos: readonly number[];
|
|
60
|
+
readonly qvel: readonly number[];
|
|
61
|
+
readonly bodies: readonly PhysicsRuntimeBodyState[];
|
|
62
|
+
readonly joints: readonly PhysicsRuntimeJointState[];
|
|
63
|
+
readonly contacts: readonly PhysicsRuntimeContactState[];
|
|
64
|
+
readonly contactCount: number;
|
|
65
|
+
readonly maxPenetration: number;
|
|
66
|
+
readonly grab: PhysicsRuntimeGrabState | null;
|
|
67
|
+
}
|
|
68
|
+
export interface PhysicsRuntimeCaptureOptions {
|
|
69
|
+
readonly worldKind: PhysicsRuntimeSnapshot['worldKind'];
|
|
70
|
+
readonly status?: PhysicsRuntimeSnapshot['status'];
|
|
71
|
+
readonly instanceIdForBody?: (bodyId: number, sourceName: string | null) => string | null;
|
|
72
|
+
readonly sourcePathForBody?: (bodyId: number, name: string) => string | null;
|
|
73
|
+
}
|
|
@@ -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;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Box3, ColorRepresentation, Object3D, Vector3 } from 'three';
|
|
2
2
|
import type { CadViewerCapability, CameraStateStore, ViewerUiOptions, ViewerUiTheme } from './cad/types';
|
|
3
3
|
import type { AssetChangeEvent, AssetControlChangeEvent, AssetErrorEvent, AssetPreview, AssetSource, OpenAssetOptions, ViewerAssetOptions } from './assets/types';
|
|
4
|
+
import type { SceneControl, SceneEntry, SceneOptions } from './scene/types';
|
|
4
5
|
export type { CadBlockModel, CadDocumentHandle, CadDocumentUnits, CadFontResolver, CadFontRequest, CadResolvedFont, CadResolvedTextFont, CadTextWarmupOptions, CadHudModel, CadHudSnapshot, CadInspectorModel, CadInspectorSnapshot, CadLayerModel, CadLayerRow, CadBlockUsageRow, CadSessionPhase, CadWorldBounds, CadScaleRulerState, CadInsertDetails, CadInsertSelection, CadInsertSelectionId, CadTextDetails, CadTextSelection, CadTextSelectionId, CadSelection, CadHit, CadViewerSnapshot, CadLoadProgress, CadViewerErrorCode, CadViewerErrorEvent, CadLoadSource, CadOpenOptions, CadSessionLoadTiming, RenderDebugBreakdownEntry, SplitBlockLayerDetail, CadViewerCapability, ResolveTextFont, CadViewerEventMap, CameraStateStore, ViewerCadUiKeyboardOptions, ViewerUiOptions, ViewerCadUiParts, ViewerCadUiOptions, ViewerUiPreset, ViewerCadUiStateStore, ViewerUiTheme, ViewerUiTokens, } from './cad/types';
|
|
5
6
|
export type ViewerViewMode = '2d' | '3d';
|
|
6
7
|
export type CadInteractionMode = 'managed' | 'manual' | 'disabled';
|
|
@@ -17,7 +18,7 @@ export type ViewerNavigationPolicy = 'legacy' | 'viewer' | 'preview';
|
|
|
17
18
|
* always dollies. Own union so the viewer surface does not re-export the
|
|
18
19
|
* runtime package's type.
|
|
19
20
|
*/
|
|
20
|
-
export type ViewerPreviewDragPreset = 'left-rotate' | 'left-pan';
|
|
21
|
+
export type ViewerPreviewDragPreset = 'left-rotate' | 'left-pan' | 'studio';
|
|
21
22
|
export type CameraChangeReason = 'pointer' | 'wheel' | 'fit' | 'restore' | 'api' | 'view-mode';
|
|
22
23
|
export type ViewerEnvironment = 'room' | {
|
|
23
24
|
/** Load an external equirectangular texture for image-based lighting. */
|
|
@@ -288,8 +289,52 @@ export interface Viewer {
|
|
|
288
289
|
setTransparentHdrBackdropBlurriness(value: number): boolean;
|
|
289
290
|
/** Switches the model/simulation preview pointer mapping at runtime. */
|
|
290
291
|
setPreviewDragPreset(preset: ViewerPreviewDragPreset): void;
|
|
292
|
+
/**
|
|
293
|
+
* Opens a multi-asset scene under the existing single Renderer/Scene/RAF.
|
|
294
|
+
*
|
|
295
|
+
* A scene owns one stage and one child group per placed asset; each asset is
|
|
296
|
+
* still loaded by its own format loader, so no parser is duplicated. Only one
|
|
297
|
+
* scene may be open at a time, and opening a scene closes any active single
|
|
298
|
+
* asset (and vice versa).
|
|
299
|
+
*/
|
|
300
|
+
openScene(entries: readonly SceneEntry[], options?: SceneOptions): SceneControl;
|
|
301
|
+
closeScene(): Promise<void>;
|
|
302
|
+
/** Renders one offscreen frame through this Viewer's Renderer/Scene/RAF. */
|
|
303
|
+
captureFrame(options: ViewerCaptureOptions): Promise<ViewerCaptureResult>;
|
|
291
304
|
dispose(): void;
|
|
292
305
|
use(plugins: readonly import('./plugins').ViewerPlugin[], options?: {
|
|
293
306
|
replace?: boolean;
|
|
294
307
|
}): void;
|
|
295
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* Offscreen frame capture. The capture renders through the same Renderer,
|
|
311
|
+
* Scene and loop hooks, against a cloned camera, so it neither opens a second
|
|
312
|
+
* WebGL context nor moves the camera the caller is looking through.
|
|
313
|
+
*/
|
|
314
|
+
export interface ViewerCaptureOptions {
|
|
315
|
+
readonly width: number;
|
|
316
|
+
readonly height: number;
|
|
317
|
+
readonly format?: 'image/png' | 'image/jpeg' | 'image/webp';
|
|
318
|
+
readonly quality?: number;
|
|
319
|
+
readonly background?: 'scene' | 'transparent' | {
|
|
320
|
+
readonly color: readonly [number, number, number];
|
|
321
|
+
};
|
|
322
|
+
readonly crop?: {
|
|
323
|
+
readonly x: number;
|
|
324
|
+
readonly y: number;
|
|
325
|
+
readonly width: number;
|
|
326
|
+
readonly height: number;
|
|
327
|
+
};
|
|
328
|
+
readonly signal?: AbortSignal;
|
|
329
|
+
readonly frameBounds?: {
|
|
330
|
+
readonly min: readonly [number, number, number];
|
|
331
|
+
readonly max: readonly [number, number, number];
|
|
332
|
+
};
|
|
333
|
+
readonly padding?: number;
|
|
334
|
+
}
|
|
335
|
+
export interface ViewerCaptureResult {
|
|
336
|
+
readonly blob: Blob;
|
|
337
|
+
readonly width: number;
|
|
338
|
+
readonly height: number;
|
|
339
|
+
readonly format: string;
|
|
340
|
+
}
|