vim-web 0.3.23 → 0.3.24
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/dist/types/react-viewer/bim/bimInfoBody.d.ts +9 -0
- package/dist/types/react-viewer/bim/bimInfoData.d.ts +77 -0
- package/dist/types/react-viewer/bim/bimInfoHeader.d.ts +6 -0
- package/dist/types/react-viewer/bim/bimInfoObject.d.ts +12 -0
- package/dist/types/react-viewer/bim/bimInfoPanel.d.ts +10 -0
- package/dist/types/react-viewer/bim/bimInfoVim.d.ts +5 -0
- package/dist/types/react-viewer/bim/bimPanel.d.ts +40 -0
- package/dist/types/react-viewer/bim/bimSearch.d.ts +17 -0
- package/dist/types/react-viewer/bim/bimTree.d.ts +31 -0
- package/dist/types/react-viewer/bim/bimTreeData.d.ts +43 -0
- package/dist/types/react-viewer/bim/bimUtils.d.ts +13 -0
- package/dist/types/react-viewer/bim/openState.d.ts +5 -0
- package/dist/types/react-viewer/container.d.ts +27 -0
- package/dist/types/react-viewer/controlbar/controlBar.d.ts +57 -0
- package/dist/types/react-viewer/controlbar/controlBarButton.d.ts +17 -0
- package/dist/types/react-viewer/controlbar/controlBarCommands.d.ts +4 -0
- package/dist/types/react-viewer/controlbar/controlBarSection.d.ts +10 -0
- package/dist/types/react-viewer/controlbar/fullScreenState.d.ts +4 -0
- package/dist/types/react-viewer/controlbar/measureState.d.ts +7 -0
- package/dist/types/react-viewer/controlbar/pointerState.d.ts +6 -0
- package/dist/types/react-viewer/controlbar/restOfScreen.d.ts +5 -0
- package/dist/types/react-viewer/controlbar/sectionBoxState.d.ts +15 -0
- package/dist/types/react-viewer/errors/errorStyle.d.ts +15 -0
- package/dist/types/react-viewer/errors/errorUtils.d.ts +2 -0
- package/dist/types/react-viewer/errors/errors.d.ts +5 -0
- package/dist/types/react-viewer/errors/fileDownloadingError.d.ts +2 -0
- package/dist/types/react-viewer/errors/fileLoadingError.d.ts +2 -0
- package/dist/types/react-viewer/errors/fileOpeningError.d.ts +2 -0
- package/dist/types/react-viewer/errors/serverCompatibilityError.d.ts +2 -0
- package/dist/types/react-viewer/errors/serverConnectionError.d.ts +2 -0
- package/dist/types/react-viewer/helpers/camera.d.ts +37 -0
- package/dist/types/react-viewer/helpers/cameraObserver.d.ts +8 -0
- package/dist/types/react-viewer/helpers/cursor.d.ts +35 -0
- package/dist/types/react-viewer/helpers/data.d.ts +27 -0
- package/dist/types/react-viewer/helpers/deferredPromise.d.ts +8 -0
- package/dist/types/react-viewer/helpers/element.d.ts +13 -0
- package/dist/types/react-viewer/helpers/fullScreenObserver.d.ts +9 -0
- package/dist/types/react-viewer/helpers/inputs.d.ts +23 -0
- package/dist/types/react-viewer/helpers/isolation.d.ts +87 -0
- package/dist/types/react-viewer/helpers/loadRequest.d.ts +29 -0
- package/dist/types/react-viewer/helpers/requestResult.d.ts +13 -0
- package/dist/types/react-viewer/helpers/utils.d.ts +7 -0
- package/dist/types/react-viewer/panels/axesPanel.d.ts +20 -0
- package/dist/types/react-viewer/panels/contextMenu.d.ts +75 -0
- package/dist/types/react-viewer/panels/help.d.ts +15 -0
- package/dist/types/react-viewer/panels/icons.d.ts +46 -0
- package/dist/types/react-viewer/panels/loadingBox.d.ts +26 -0
- package/dist/types/react-viewer/panels/logo.d.ts +5 -0
- package/dist/types/react-viewer/panels/messageBox.d.ts +14 -0
- package/dist/types/react-viewer/panels/modal.d.ts +18 -0
- package/dist/types/react-viewer/panels/overlay.d.ts +10 -0
- package/dist/types/react-viewer/panels/performance.d.ts +7 -0
- package/dist/types/react-viewer/panels/toast.d.ts +22 -0
- package/dist/types/react-viewer/reactViewerIndex.d.ts +8 -0
- package/dist/types/react-viewer/settings/menuSettings.d.ts +17 -0
- package/dist/types/react-viewer/settings/settings.d.ts +65 -0
- package/dist/types/react-viewer/settings/settingsState.d.ts +18 -0
- package/dist/types/react-viewer/settings/settingsStorage.d.ts +6 -0
- package/dist/types/react-viewer/sidePanel/sidePanel.d.ts +20 -0
- package/dist/types/react-viewer/sidePanel/sideState.d.ts +22 -0
- package/dist/types/react-viewer/ultra/ultraComponent.d.ts +30 -0
- package/dist/types/react-viewer/ultra/ultraErrors.d.ts +3 -0
- package/dist/types/react-viewer/urls.d.ts +2 -0
- package/dist/types/react-viewer/webgl/viewerState.d.ts +11 -0
- package/dist/types/react-viewer/webgl/webglComponent.d.ts +41 -0
- package/dist/types/react-viewer/webgl/webglComponentRef.d.ts +99 -0
- package/dist/types/react-viewer/webgl/webglLoading.d.ts +67 -0
- package/dist/types/ultra-viewer/ultraViewerIndex.d.ts +8 -0
- package/dist/types/ultra-viewer/utils/array.d.ts +18 -0
- package/dist/types/ultra-viewer/utils/debounce.d.ts +1 -0
- package/dist/types/ultra-viewer/utils/deferredPromise.d.ts +8 -0
- package/dist/types/ultra-viewer/utils/math3d.d.ts +106 -0
- package/dist/types/ultra-viewer/utils/promise.d.ts +21 -0
- package/dist/types/ultra-viewer/utils/result.d.ts +11 -0
- package/dist/types/ultra-viewer/utils/url.d.ts +8 -0
- package/dist/types/ultra-viewer/utils/validation.d.ts +28 -0
- package/dist/types/ultra-viewer/viewer/camera.d.ts +118 -0
- package/dist/types/ultra-viewer/viewer/color.d.ts +57 -0
- package/dist/types/ultra-viewer/viewer/colorManager.d.ts +73 -0
- package/dist/types/ultra-viewer/viewer/decoder.d.ts +116 -0
- package/dist/types/ultra-viewer/viewer/decoderWithWorker.d.ts +80 -0
- package/dist/types/ultra-viewer/viewer/inputs/InputTouch.d.ts +25 -0
- package/dist/types/ultra-viewer/viewer/inputs/inputHandler.d.ts +7 -0
- package/dist/types/ultra-viewer/viewer/inputs/inputKeyboard.d.ts +20 -0
- package/dist/types/ultra-viewer/viewer/inputs/inputMouse.d.ts +21 -0
- package/dist/types/ultra-viewer/viewer/inputs/inputs.d.ts +27 -0
- package/dist/types/ultra-viewer/viewer/loadRequest.d.ts +36 -0
- package/dist/types/ultra-viewer/viewer/logger.d.ts +9 -0
- package/dist/types/ultra-viewer/viewer/marshal.d.ts +72 -0
- package/dist/types/ultra-viewer/viewer/protocol.d.ts +13 -0
- package/dist/types/ultra-viewer/viewer/renderer.d.ts +142 -0
- package/dist/types/ultra-viewer/viewer/rpcClient.d.ts +72 -0
- package/dist/types/ultra-viewer/viewer/rpcSafeClient.d.ts +382 -0
- package/dist/types/ultra-viewer/viewer/selection.d.ts +94 -0
- package/dist/types/ultra-viewer/viewer/socketClient.d.ts +141 -0
- package/dist/types/ultra-viewer/viewer/streamLogger.d.ts +19 -0
- package/dist/types/ultra-viewer/viewer/streamRenderer.d.ts +7 -0
- package/dist/types/ultra-viewer/viewer/viewer.d.ts +123 -0
- package/dist/types/ultra-viewer/viewer/viewport.d.ts +39 -0
- package/dist/types/ultra-viewer/viewer/vim.d.ts +111 -0
- package/dist/types/ultra-viewer/viewer/vimCollection.d.ts +43 -0
- package/dist/types/vimWebIndex.d.ts +4 -0
- package/dist/types/webgl-viewer/images.d.ts +4 -0
- package/dist/types/webgl-viewer/index.d.ts +26 -0
- package/dist/types/webgl-viewer/utils/boxes.d.ts +5 -0
- package/dist/types/webgl-viewer/utils/deferredPromise.d.ts +8 -0
- package/dist/types/webgl-viewer/utils/requestResult.d.ts +13 -0
- package/dist/types/webgl-viewer/vim-loader/averageBoundingBox.d.ts +6 -0
- package/dist/types/webgl-viewer/vim-loader/colorAttributes.d.ts +34 -0
- package/dist/types/webgl-viewer/vim-loader/elementMapping.d.ts +113 -0
- package/dist/types/webgl-viewer/vim-loader/geometry.d.ts +105 -0
- package/dist/types/webgl-viewer/vim-loader/materials/isolationMaterial.d.ts +12 -0
- package/dist/types/webgl-viewer/vim-loader/materials/maskMaterial.d.ts +8 -0
- package/dist/types/webgl-viewer/vim-loader/materials/mergeMaterial.d.ts +18 -0
- package/dist/types/webgl-viewer/vim-loader/materials/outlineMaterial.d.ts +36 -0
- package/dist/types/webgl-viewer/vim-loader/materials/simpleMaterial.d.ts +12 -0
- package/dist/types/webgl-viewer/vim-loader/materials/skyboxMaterial.d.ts +16 -0
- package/dist/types/webgl-viewer/vim-loader/materials/standardMaterial.d.ts +57 -0
- package/dist/types/webgl-viewer/vim-loader/materials/transferMaterial.d.ts +8 -0
- package/dist/types/webgl-viewer/vim-loader/materials/viewerMaterials.d.ts +158 -0
- package/dist/types/webgl-viewer/vim-loader/mesh.d.ts +115 -0
- package/dist/types/webgl-viewer/vim-loader/object3D.d.ts +105 -0
- package/dist/types/webgl-viewer/vim-loader/objectAttributes.d.ts +19 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/g3dOffsets.d.ts +53 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/g3dSubset.d.ts +115 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/insertableGeometry.d.ts +40 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/insertableMesh.d.ts +59 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/insertableSubmesh.d.ts +43 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/instancedMesh.d.ts +32 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/instancedMeshFactory.d.ts +20 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/instancedSubmesh.d.ts +31 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/legacyMeshFactory.d.ts +23 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/loadingSynchronizer.d.ts +27 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/open.d.ts +12 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/subsetBuilder.d.ts +73 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/subsetRequest.d.ts +37 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/vimRequest.d.ts +44 -0
- package/dist/types/webgl-viewer/vim-loader/progressive/vimx.d.ts +17 -0
- package/dist/types/webgl-viewer/vim-loader/scene.d.ts +92 -0
- package/dist/types/webgl-viewer/vim-loader/vim.d.ts +157 -0
- package/dist/types/webgl-viewer/vim-loader/vimSettings.d.ts +62 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/camera/camera.d.ts +255 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/camera/cameraMovement.d.ts +77 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/camera/cameraMovementLerp.d.ts +28 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/camera/cameraMovementSnap.d.ts +24 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/camera/orthographic.d.ts +12 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/camera/perspective.d.ts +12 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/environment/cameraLight.d.ts +43 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/environment/environment.d.ts +44 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/environment/groundPlane.d.ts +25 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/environment/skybox.d.ts +39 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/axes/axes.d.ts +14 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/axes/axesSettings.d.ts +19 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/axes/gizmoAxes.d.ts +60 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/gizmoLoading.d.ts +23 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/gizmoOrbit.d.ts +71 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/gizmoRectangle.d.ts +51 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/gizmos.d.ts +50 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/markers/gizmoMarker.d.ts +64 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/markers/gizmoMarkers.d.ts +29 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/measure/measure.d.ts +103 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/measure/measureFlow.d.ts +36 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/measure/measureGizmo.d.ts +44 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/measure/measureHtml.d.ts +26 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/sectionBox/sectionBox.d.ts +70 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/sectionBox/sectionBoxGizmo.d.ts +47 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/gizmos/sectionBox/sectionBoxInputs.d.ts +39 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/inputs/input.d.ts +128 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/inputs/inputHandler.d.ts +29 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/inputs/keyboard.d.ts +113 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/inputs/mouse.d.ts +66 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/inputs/touch.d.ts +45 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/raycaster.d.ts +89 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/rendering/mergePass.d.ts +16 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/rendering/outlinePass.d.ts +19 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/rendering/renderScene.d.ts +49 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/rendering/renderer.d.ts +125 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/rendering/renderingComposer.d.ts +46 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/rendering/renderingSection.d.ts +36 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/rendering/transferPass.d.ts +15 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/selection.d.ts +90 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/settings/defaultViewerSettings.d.ts +5 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/settings/viewerSettings.d.ts +342 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/settings/viewerSettingsParsing.d.ts +9 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/viewer.d.ts +100 -0
- package/dist/types/webgl-viewer/vim-webgl-viewer/viewport.d.ts +73 -0
- package/dist/vim-web.css +2029 -0
- package/dist/vim-web.iife.js +72763 -0
- package/dist/vim-web.iife.js.map +1 -0
- package/dist/vim-web.mjs +72746 -0
- package/dist/vim-web.mjs.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import { Box3, RGBA, RGBA32, Segment, Vector2, Vector3 } from "../utils/math3d";
|
|
2
|
+
import { HitCheckResult } from "./marshal";
|
|
3
|
+
import { MaterialHandle, RpcClient } from "./rpcClient";
|
|
4
|
+
export type VimLoadingState = {
|
|
5
|
+
status: VimLoadingStatus;
|
|
6
|
+
progress: number;
|
|
7
|
+
};
|
|
8
|
+
export declare enum InputMode {
|
|
9
|
+
Orbit = "orbit",
|
|
10
|
+
Free = "free"
|
|
11
|
+
}
|
|
12
|
+
export type SceneSettings = {
|
|
13
|
+
toneMappingWhitePoint: number;
|
|
14
|
+
hdrScale: number;
|
|
15
|
+
hdrBackgroundScale: number;
|
|
16
|
+
hdrBackgroundSaturation: number;
|
|
17
|
+
backGroundBlur: number;
|
|
18
|
+
backgroundColor: RGBA;
|
|
19
|
+
};
|
|
20
|
+
export declare const defaultSceneSettings: SceneSettings;
|
|
21
|
+
export declare enum VimLoadingStatus {
|
|
22
|
+
Unknown = 0,
|
|
23
|
+
Loading = 1,
|
|
24
|
+
Downloading = 2,
|
|
25
|
+
Done = 3,
|
|
26
|
+
FailedToDownload = 4,
|
|
27
|
+
FailedToLoad = 5
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Provides safe, validated methods to interact with the RpcClient.
|
|
31
|
+
* This class wraps the raw RPC methods with input validation and batching support for large operations.
|
|
32
|
+
*/
|
|
33
|
+
export declare class RpcSafeClient {
|
|
34
|
+
private readonly rpc;
|
|
35
|
+
private readonly batchSize;
|
|
36
|
+
constructor(rpc: RpcClient, batchSize?: number);
|
|
37
|
+
/*******************************************************************************
|
|
38
|
+
* SCENE MANAGEMENT METHODS
|
|
39
|
+
* Methods for managing the overall scene, including initialization, lighting,
|
|
40
|
+
* and scene-wide settings.
|
|
41
|
+
******************************************************************************/
|
|
42
|
+
/**
|
|
43
|
+
* Initializes and starts the scene with specified settings.
|
|
44
|
+
* @param settings - Optional partial scene settings to override defaults
|
|
45
|
+
* @remarks If no settings are provided, default values will be used
|
|
46
|
+
*/
|
|
47
|
+
RPCStartScene(settings?: Partial<SceneSettings>): void;
|
|
48
|
+
/**
|
|
49
|
+
* Sets the lighting settings for the scene.
|
|
50
|
+
* @param settings - The lighting settings to apply
|
|
51
|
+
*/
|
|
52
|
+
RPCSetLighting(settings: SceneSettings): void;
|
|
53
|
+
RPCLockIblRotation(lock: boolean): void;
|
|
54
|
+
/*******************************************************************************
|
|
55
|
+
* NODE VISIBILITY METHODS
|
|
56
|
+
* Methods for controlling node visibility, including show/hide, ghosting,
|
|
57
|
+
* and highlighting functionality.
|
|
58
|
+
******************************************************************************/
|
|
59
|
+
/**
|
|
60
|
+
* Hides all nodes in a component, making the entire component invisible.
|
|
61
|
+
* @param componentHandle - The component to hide entirely
|
|
62
|
+
* @throws {Error} If the component handle is invalid
|
|
63
|
+
*/
|
|
64
|
+
RPCHideAll(componentHandle: number): void;
|
|
65
|
+
/**
|
|
66
|
+
* Shows all nodes in a component, making the entire component visible.
|
|
67
|
+
* @param componentHandle - The component to show entirely
|
|
68
|
+
* @throws {Error} If the component handle is invalid
|
|
69
|
+
*/
|
|
70
|
+
RPCShowAll(componentHandle: number): void;
|
|
71
|
+
/**
|
|
72
|
+
* Makes all nodes in a component semi-transparent (ghosted).
|
|
73
|
+
* @param componentHandle - The component to ghost entirely
|
|
74
|
+
* @throws {Error} If the component handle is invalid
|
|
75
|
+
*/
|
|
76
|
+
RPCGhostAll(componentHandle: number): void;
|
|
77
|
+
/**
|
|
78
|
+
* Highlights all nodes in a component.
|
|
79
|
+
* @param componentHandle - The component to highlight entirely
|
|
80
|
+
* @throws {Error} If the component handle is invalid
|
|
81
|
+
*/
|
|
82
|
+
RPCHighlightAll(componentHandle: number): void;
|
|
83
|
+
/**
|
|
84
|
+
* Hides specified nodes in a component, making them invisible.
|
|
85
|
+
* Large node arrays are automatically processed in batches.
|
|
86
|
+
* @param componentHandle - The component containing the nodes
|
|
87
|
+
* @param nodes - Array of node indices to hide
|
|
88
|
+
* @throws {Error} If the component handle is invalid or nodes array is invalid
|
|
89
|
+
*/
|
|
90
|
+
RPCHide(componentHandle: number, nodes: number[]): void;
|
|
91
|
+
/**
|
|
92
|
+
* Shows specified nodes in a component, making them visible.
|
|
93
|
+
* Large node arrays are automatically processed in batches.
|
|
94
|
+
* @param componentHandle - The component containing the nodes
|
|
95
|
+
* @param nodes - Array of node indices to show
|
|
96
|
+
* @throws {Error} If the component handle is invalid or nodes array is invalid
|
|
97
|
+
*/
|
|
98
|
+
RPCShow(componentHandle: number, nodes: number[]): void;
|
|
99
|
+
/**
|
|
100
|
+
* Makes specified nodes semi-transparent (ghosted) in a component.
|
|
101
|
+
* Large node arrays are automatically processed in batches.
|
|
102
|
+
* @param componentHandle - The component containing the nodes
|
|
103
|
+
* @param nodes - Array of node indices to ghost
|
|
104
|
+
* @throws {Error} If the component handle is invalid or nodes array is invalid
|
|
105
|
+
*/
|
|
106
|
+
RPCGhost(componentHandle: number, nodes: number[]): void;
|
|
107
|
+
/**
|
|
108
|
+
* Highlights specified nodes in a component.
|
|
109
|
+
* Large node arrays are automatically processed in batches.
|
|
110
|
+
* @param componentHandle - The component containing the nodes
|
|
111
|
+
* @param nodes - Array of node indices to highlight
|
|
112
|
+
* @throws {Error} If the component handle is invalid or nodes array is invalid
|
|
113
|
+
*/
|
|
114
|
+
RPCHighlight(componentHandle: number, nodes: number[]): void;
|
|
115
|
+
/*******************************************************************************
|
|
116
|
+
* TEXT AND UI METHODS
|
|
117
|
+
* Methods for creating and managing 3D text elements in the scene.
|
|
118
|
+
******************************************************************************/
|
|
119
|
+
/**
|
|
120
|
+
* Creates a 3D text element in the scene.
|
|
121
|
+
* @param position - The world-space position for the text
|
|
122
|
+
* @param color - The color of the text
|
|
123
|
+
* @param text - The content to display
|
|
124
|
+
* @returns Promise resolving to the handle of the created text component
|
|
125
|
+
* @throws {Error} If the text is empty
|
|
126
|
+
*/
|
|
127
|
+
RPCCreateText(position: Vector3, color: RGBA32, text: string): Promise<number>;
|
|
128
|
+
/**
|
|
129
|
+
* Destroys a text component, removing it from the scene.
|
|
130
|
+
* @param componentHandle - The handle of the text component to destroy
|
|
131
|
+
* @throws {Error} If the component handle is invalid
|
|
132
|
+
*/
|
|
133
|
+
RPCDestroyText(componentHandle: number): void;
|
|
134
|
+
/*******************************************************************************
|
|
135
|
+
* CAMERA AND VIEW METHODS
|
|
136
|
+
* Methods for controlling camera position, movement, framing, and view settings.
|
|
137
|
+
******************************************************************************/
|
|
138
|
+
/**
|
|
139
|
+
* Retrieves the current camera position and orientation.
|
|
140
|
+
* @returns Promise resolving to a segment representing the camera's current position and target
|
|
141
|
+
*/
|
|
142
|
+
RPCGetCameraPosition(): Promise<Segment | undefined>;
|
|
143
|
+
/**
|
|
144
|
+
* Sets the camera position and orientation.
|
|
145
|
+
* @param segment - The desired camera position and target
|
|
146
|
+
* @param blendTime - Duration of the camera transition in seconds (non-negative)
|
|
147
|
+
* @throws {Error} If segment is invalid or blendTime is negative
|
|
148
|
+
*/
|
|
149
|
+
RPCSetCameraPosition(segment: Segment, blendTime: number): void;
|
|
150
|
+
/**
|
|
151
|
+
* Calculates the bounding box for specified nodes in a component.
|
|
152
|
+
* Large node arrays are automatically processed in batches for better performance.
|
|
153
|
+
* @param componentHandle - The component containing the nodes
|
|
154
|
+
* @param nodes - Array of node indices to calculate bounds for
|
|
155
|
+
* @returns Promise resolving to the combined bounding box
|
|
156
|
+
* @throws {Error} If the component handle is invalid or nodes array is invalid
|
|
157
|
+
*/
|
|
158
|
+
RPCGetBoundingBox(componentHandle: number, nodes: number[]): Promise<Box3 | undefined>;
|
|
159
|
+
private getBoundingBoxBatched;
|
|
160
|
+
/**
|
|
161
|
+
* Frames the camera to show all components in the scene.
|
|
162
|
+
* @param blendTime - Duration of the camera transition in seconds (non-negative)
|
|
163
|
+
* @returns Promise resolving to camera segment representing the final position
|
|
164
|
+
*/
|
|
165
|
+
RPCFrameAll(blendTime: number): Promise<Segment | undefined>;
|
|
166
|
+
/**
|
|
167
|
+
* Frames a specific VIM component in the scene.
|
|
168
|
+
* @param componentHandle - The handle of the VIM component to frame
|
|
169
|
+
* @param blendTime - Duration of the camera transition in seconds (non-negative)
|
|
170
|
+
* @returns Promise resolving to camera segment representing the final position
|
|
171
|
+
* @throws {Error} If the component handle is invalid
|
|
172
|
+
*/
|
|
173
|
+
RPCFrameVim(componentHandle: number, blendTime: number): Promise<Segment | undefined>;
|
|
174
|
+
/**
|
|
175
|
+
* Frames specific instances within a component. For large numbers of instances,
|
|
176
|
+
* automatically switches to bounding box framing for better performance.
|
|
177
|
+
* @param componentHandle - The component containing the instances
|
|
178
|
+
* @param nodes - Array of node indices to frame
|
|
179
|
+
* @param blendTime - Duration of the camera transition in seconds (non-negative)
|
|
180
|
+
* @returns Promise resolving to camera segment representing the final position
|
|
181
|
+
* @throws {Error} If the component handle is invalid or nodes array is empty
|
|
182
|
+
*/
|
|
183
|
+
RPCFrameInstances(componentHandle: number, nodes: number[], blendTime: number): Promise<Segment | undefined>;
|
|
184
|
+
/**
|
|
185
|
+
* Frames the camera to show a specific bounding box.
|
|
186
|
+
* @param box - The bounding box to frame
|
|
187
|
+
* @param blendTime - Duration of the camera transition in seconds (non-negative)
|
|
188
|
+
* @throws {Error} If the box is invalid (min values must be less than max values)
|
|
189
|
+
*/
|
|
190
|
+
RPCFrameBox(box: Box3, blendTime: number): Promise<Segment | undefined>;
|
|
191
|
+
/*******************************************************************************
|
|
192
|
+
* INPUT HANDLING METHODS
|
|
193
|
+
* Methods for handling user input including mouse, keyboard, and camera controls.
|
|
194
|
+
******************************************************************************/
|
|
195
|
+
/**
|
|
196
|
+
* Sets the camera movement speed.
|
|
197
|
+
* @param speed - The desired movement speed (must be positive)
|
|
198
|
+
* @throws {Error} If speed is not positive
|
|
199
|
+
*/
|
|
200
|
+
RPCSetMoveSpeed(speed: number): void;
|
|
201
|
+
RPCSetCameraMode(mode: InputMode): void;
|
|
202
|
+
/**
|
|
203
|
+
* Sets the viewer's aspect ratio.
|
|
204
|
+
* @param width - The width component of the aspect ratio
|
|
205
|
+
* @param height - The height component of the aspect ratio
|
|
206
|
+
* @throws {Error} If width or height are not positive integers
|
|
207
|
+
*/
|
|
208
|
+
RPCSetAspectRatio(width: number, height: number): void;
|
|
209
|
+
/*******************************************************************************
|
|
210
|
+
* VIM FILE MANAGEMENT METHODS
|
|
211
|
+
* Methods for loading, unloading, and managing VIM files and components.
|
|
212
|
+
******************************************************************************/
|
|
213
|
+
/**
|
|
214
|
+
* Loads a VIM file from the local filesystem.
|
|
215
|
+
* @param fileName - The path to the VIM file (supports file:// protocol)
|
|
216
|
+
* @returns Promise resolving to the handle of the loaded VIM component
|
|
217
|
+
* @throws {Error} If the filename is invalid or empty
|
|
218
|
+
*/
|
|
219
|
+
RPCLoadVim(fileName: string): Promise<number>;
|
|
220
|
+
/**
|
|
221
|
+
* Loads a VIM file from a remote URL.
|
|
222
|
+
* @param url - The URL of the VIM file to load
|
|
223
|
+
* @returns Promise resolving to the handle of the loaded VIM component
|
|
224
|
+
* @throws {Error} If the URL is invalid
|
|
225
|
+
*/
|
|
226
|
+
RPCLoadVimURL(url: string): Promise<number>;
|
|
227
|
+
/**
|
|
228
|
+
* Retrieves the current loading state and progress of a VIM component.
|
|
229
|
+
* @param componentHandle - The handle of the VIM component
|
|
230
|
+
* @returns Promise resolving to the current loading state and progress
|
|
231
|
+
* @throws {Error} If the component handle is invalid
|
|
232
|
+
*/
|
|
233
|
+
RPCGetVimLoadingState(componentHandle: number): Promise<VimLoadingState>;
|
|
234
|
+
/**
|
|
235
|
+
* Unloads a VIM component and frees associated resources.
|
|
236
|
+
* @param componentHandle - The handle of the component to unload
|
|
237
|
+
* @throws {Error} If the component handle is invalid
|
|
238
|
+
*/
|
|
239
|
+
RPCUnloadVim(componentHandle: number): void;
|
|
240
|
+
/**
|
|
241
|
+
* Clears the entire scene, removing all components and resetting to initial state.
|
|
242
|
+
*/
|
|
243
|
+
RPCClearScene(): void;
|
|
244
|
+
/**
|
|
245
|
+
* Sets the color used for ghosted geometry.
|
|
246
|
+
* @param ghostColor - The RGBA color to use for ghosted elements
|
|
247
|
+
*/
|
|
248
|
+
RPCSetGhostColor(ghostColor: RGBA): void;
|
|
249
|
+
/**
|
|
250
|
+
* Performs hit testing at a specified screen position.
|
|
251
|
+
* @param pos - Normalized screen coordinates (0-1, 0-1)
|
|
252
|
+
* @returns Promise resolving to hit test result if something was hit, undefined otherwise
|
|
253
|
+
*/
|
|
254
|
+
RPCPerformHitTest(pos: Vector2): Promise<HitCheckResult | undefined>;
|
|
255
|
+
/**
|
|
256
|
+
* Sends a mouse button event to the viewer.
|
|
257
|
+
* @param position - The normalized screen coordinates (0-1, 0-1)
|
|
258
|
+
* @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
|
|
259
|
+
* @param down - True if button is pressed down, false if released
|
|
260
|
+
* @throws {Error} If mouseButton is not a valid positive integer
|
|
261
|
+
*/
|
|
262
|
+
RPCMouseButtonEvent(position: Vector2, mouseButton: number, down: boolean): void;
|
|
263
|
+
/**
|
|
264
|
+
* Sends a mouse double-click event to the viewer.
|
|
265
|
+
* @param position - The normalized screen coordinates (0-1, 0-1)
|
|
266
|
+
* @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
|
|
267
|
+
* @throws {Error} If mouseButton is not a valid positive integer
|
|
268
|
+
*/
|
|
269
|
+
RPCMouseDoubleClickEvent(position: Vector2, mouseButton: number): void;
|
|
270
|
+
/**
|
|
271
|
+
* Sends a mouse movement event to the viewer.
|
|
272
|
+
* @param position - The normalized screen coordinates (0-1, 0-1)
|
|
273
|
+
*/
|
|
274
|
+
RPCMouseMoveEvent(position: Vector2): void;
|
|
275
|
+
/**
|
|
276
|
+
* Sends a mouse scroll wheel event to the viewer.
|
|
277
|
+
* @param scrollValue - The scroll amount (-1 to 1)
|
|
278
|
+
*/
|
|
279
|
+
RPCMouseScrollEvent(scrollValue: number): void;
|
|
280
|
+
/**
|
|
281
|
+
* Sends a mouse selection event to the viewer.
|
|
282
|
+
* @param position - The normalized screen coordinates (0-1, 0-1)
|
|
283
|
+
* @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
|
|
284
|
+
* @throws {Error} If mouseButton is not a valid positive integer
|
|
285
|
+
*/
|
|
286
|
+
RPCMouseSelectEvent(position: Vector2, mouseButton: number): void;
|
|
287
|
+
/**
|
|
288
|
+
* Sends a keyboard event to the viewer.
|
|
289
|
+
* @param keyCode - The key code of the event
|
|
290
|
+
* @param down - True if key is pressed down, false if released
|
|
291
|
+
*/
|
|
292
|
+
RPCKeyEvent(keyCode: number, down: boolean): void;
|
|
293
|
+
/*******************************************************************************
|
|
294
|
+
* MATERIAL MANAGEMENT METHODS
|
|
295
|
+
* Methods for creating and managing materials and material instances.
|
|
296
|
+
******************************************************************************/
|
|
297
|
+
/**
|
|
298
|
+
* Creates multiple material instances with the same smoothness but different colors.
|
|
299
|
+
* Large color arrays are automatically processed in batches for better performance.
|
|
300
|
+
* @param materialHandle - The base material to create instances from
|
|
301
|
+
* @param smoothness - The smoothness value to apply (clamped between 0 and 1)
|
|
302
|
+
* @param colors - Array of colors for each material instance
|
|
303
|
+
* @returns Array of handles for the created material instances
|
|
304
|
+
* @throws {Error} If the material handle is invalid or smoothness is out of range
|
|
305
|
+
*/
|
|
306
|
+
RPCCreateMaterialInstances(materialHandle: MaterialHandle, smoothness: number, colors: RGBA32[]): Promise<number[] | undefined>;
|
|
307
|
+
private createMaterialInstancesBatched;
|
|
308
|
+
/**
|
|
309
|
+
* Destroys multiple material instances, freeing associated resources.
|
|
310
|
+
* @param materialInstanceHandle - Array of handles for material instances to destroy
|
|
311
|
+
* @throws {Error} If any handle in the array is invalid
|
|
312
|
+
*/
|
|
313
|
+
RPCDestroyMaterialInstances(materialInstanceHandle: number[]): void;
|
|
314
|
+
/**
|
|
315
|
+
* Sets material overrides for specific nodes in a component.
|
|
316
|
+
* Large arrays are automatically processed in batches for better performance.
|
|
317
|
+
* @param componentHandle - The component containing the nodes
|
|
318
|
+
* @param nodes - Array of node indices to override
|
|
319
|
+
* @param materialInstanceHandles - Array of material instance handles to apply (must match nodes length)
|
|
320
|
+
* @throws {Error} If arrays have different lengths or any handle is invalid
|
|
321
|
+
*/
|
|
322
|
+
RPCSetMaterialOverrides(componentHandle: number, nodes: number[], materialInstanceHandles: number[]): void;
|
|
323
|
+
private setMaterialOverridesBatched;
|
|
324
|
+
/**
|
|
325
|
+
* Clears all material overrides for the specified component, restoring default materials.
|
|
326
|
+
* @param componentHandle - The unique identifier of the component
|
|
327
|
+
* @throws {Error} If the component handle is invalid or INVALID_HANDLE
|
|
328
|
+
*/
|
|
329
|
+
RPCClearMaterialOverrides(componentHandle: number): void;
|
|
330
|
+
/*******************************************************************************
|
|
331
|
+
* DEBUG AND UTILITY METHODS
|
|
332
|
+
* Utility methods for debugging, error handling, and misc functionality.
|
|
333
|
+
******************************************************************************/
|
|
334
|
+
/**
|
|
335
|
+
* Retrieves the current API version from the RPC client.
|
|
336
|
+
* @returns Promise resolving to the API version string
|
|
337
|
+
*/
|
|
338
|
+
RPCGetAPIVersion(): Promise<string>;
|
|
339
|
+
/**
|
|
340
|
+
* Gets the API version of the underlying RPC client.
|
|
341
|
+
* @returns The API version string.
|
|
342
|
+
*/
|
|
343
|
+
get API_VERSION(): string;
|
|
344
|
+
/**
|
|
345
|
+
* Retrieves the last error message from the RPC client.
|
|
346
|
+
* @returns Promise resolving to the last error message string
|
|
347
|
+
*/
|
|
348
|
+
RPCGetLastError(): Promise<string>;
|
|
349
|
+
/**
|
|
350
|
+
* Pauses or resumes the rendering loop.
|
|
351
|
+
* @param pause - True to pause rendering, false to resume
|
|
352
|
+
*/
|
|
353
|
+
RPCPauseRendering(pause: boolean): void;
|
|
354
|
+
/**
|
|
355
|
+
* Triggers a RenderDoc frame capture if RenderDoc is attached.
|
|
356
|
+
*/
|
|
357
|
+
RPCTriggerRenderDocCapture(): void;
|
|
358
|
+
/**
|
|
359
|
+
* Shows axis-aligned bounding boxes (AABBs) for specified nodes with custom colors.
|
|
360
|
+
* Large arrays are automatically processed in batches for better performance.
|
|
361
|
+
* @param componentHandle - The component containing the nodes
|
|
362
|
+
* @param nodes - Array of node indices to show AABBs for
|
|
363
|
+
* @param colors - Array of colors for each AABB (must match nodes length)
|
|
364
|
+
* @throws {Error} If arrays have different lengths or component handle is invalid
|
|
365
|
+
*/
|
|
366
|
+
RPCShowAABBs(componentHandle: number, nodes: number[], colors: RGBA32[]): void;
|
|
367
|
+
/**
|
|
368
|
+
* Hides the axis-aligned bounding boxes (AABBs) for specified nodes.
|
|
369
|
+
* Large node arrays are automatically processed in batches.
|
|
370
|
+
* @param componentHandle - The component containing the nodes
|
|
371
|
+
* @param nodes - Array of node indices whose AABBs should be hidden
|
|
372
|
+
* @throws {Error} If the component handle is invalid or nodes array is invalid
|
|
373
|
+
*/
|
|
374
|
+
RPCHideAABBs(componentHandle: number, nodes: number[]): void;
|
|
375
|
+
/**
|
|
376
|
+
* Hides all axis-aligned bounding boxes (AABBs) in a component.
|
|
377
|
+
* @param componentHandle - The component whose AABBs should be hidden
|
|
378
|
+
* @throws {Error} If the component handle is invalid
|
|
379
|
+
*/
|
|
380
|
+
RPCHideAllAABBs(componentHandle: number): void;
|
|
381
|
+
private safeCall;
|
|
382
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Box3, Vector2, Vector3 } from "../utils/math3d";
|
|
2
|
+
import { RpcSafeClient } from "./rpcSafeClient";
|
|
3
|
+
import { Vim } from "./vim";
|
|
4
|
+
import { IReadonlyVimCollection } from "./vimCollection";
|
|
5
|
+
export interface IViewerSelection {
|
|
6
|
+
hitTest(pos: Vector2): Promise<HitTestResult | undefined>;
|
|
7
|
+
select(vim: Vim, node: number | number[]): void;
|
|
8
|
+
toggle(vim: Vim, node: number | number[]): void;
|
|
9
|
+
add(vim: Vim, node: number | number[]): void;
|
|
10
|
+
remove(vim: Vim, node: number | number[]): void;
|
|
11
|
+
clear(vim?: Vim): void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Represents the result of a hit test operation.
|
|
15
|
+
*/
|
|
16
|
+
export type HitTestResult = {
|
|
17
|
+
/** The Vim instance that was hit */
|
|
18
|
+
vim: Vim;
|
|
19
|
+
/** The index of the node that was hit */
|
|
20
|
+
nodeIndex: number;
|
|
21
|
+
/** The 3D world position of the hit point */
|
|
22
|
+
worldPosition: Vector3;
|
|
23
|
+
/** The surface normal at the hit point */
|
|
24
|
+
worldNormal: Vector3;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Manages selection state of nodes across multiple VIM instances.
|
|
28
|
+
*/
|
|
29
|
+
export declare class ViewerSelection implements IViewerSelection {
|
|
30
|
+
private _rpc;
|
|
31
|
+
private _vims;
|
|
32
|
+
private _selectedNodes;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new ViewerSelection instance.
|
|
35
|
+
* @param rpc - RPC client for communication with the viewer.
|
|
36
|
+
* @param vims - Collection of VIM instances to manage.
|
|
37
|
+
*/
|
|
38
|
+
constructor(rpc: RpcSafeClient, vims: IReadonlyVimCollection);
|
|
39
|
+
/**
|
|
40
|
+
* Gets the total number of selected nodes across all VIMs.
|
|
41
|
+
* @returns The total count of selected nodes.
|
|
42
|
+
*/
|
|
43
|
+
get count(): number;
|
|
44
|
+
/**
|
|
45
|
+
* Performs a hit test at the specified screen position.
|
|
46
|
+
* @param pos - The screen position in 2D coordinates.
|
|
47
|
+
* @returns Promise resolving to hit test result or undefined if no hit.
|
|
48
|
+
*/
|
|
49
|
+
hitTest(pos: Vector2): Promise<HitTestResult | undefined>;
|
|
50
|
+
/**
|
|
51
|
+
* Replaces the current selection with the specified node(s).
|
|
52
|
+
* Clears all previous selections across all VIMs.
|
|
53
|
+
* @param vim - The Vim instance to select nodes from.
|
|
54
|
+
* @param node - A single node index or array of node indices to select.
|
|
55
|
+
*/
|
|
56
|
+
select(vim: Vim, node: number | number[]): void;
|
|
57
|
+
/**
|
|
58
|
+
* Toggles the selection state of the specified node(s).
|
|
59
|
+
* If a node is currently selected, it will be deselected, and vice versa.
|
|
60
|
+
* @param vim - The Vim instance containing the nodes.
|
|
61
|
+
* @param node - A single node index or array of node indices to toggle.
|
|
62
|
+
*/
|
|
63
|
+
toggle(vim: Vim, node: number | number[]): void;
|
|
64
|
+
/**
|
|
65
|
+
* Adds the specified node(s) to the current selection.
|
|
66
|
+
* If a node is already selected, it remains selected.
|
|
67
|
+
* @param vim - The Vim instance containing the nodes.
|
|
68
|
+
* @param node - A single node index or array of node indices to add.
|
|
69
|
+
*/
|
|
70
|
+
add(vim: Vim, node: number | number[]): void;
|
|
71
|
+
/**
|
|
72
|
+
* Removes the specified node(s) from the current selection.
|
|
73
|
+
* If a node is not selected, no action is taken for that node.
|
|
74
|
+
* @param vim - The Vim instance containing the nodes.
|
|
75
|
+
* @param node - A single node index or array of node indices to remove.
|
|
76
|
+
*/
|
|
77
|
+
remove(vim: Vim, node: number | number[]): void;
|
|
78
|
+
/**
|
|
79
|
+
* Clears all selections across all VIMs or for a specific VIM.
|
|
80
|
+
* @param vim - Optional. If provided, only clears selections for the specified VIM.
|
|
81
|
+
*/
|
|
82
|
+
clear(vim?: Vim): void;
|
|
83
|
+
/**
|
|
84
|
+
* Calculates the bounding box encompassing all selected nodes.
|
|
85
|
+
* @returns Promise resolving to a Box3 representing the bounds of all selected nodes,
|
|
86
|
+
* or undefined if no nodes are selected or bounds cannot be calculated.
|
|
87
|
+
*/
|
|
88
|
+
getBoundingBox(): Promise<Box3 | undefined>;
|
|
89
|
+
/**
|
|
90
|
+
* Cleans up resources and releases memory.
|
|
91
|
+
* Should be called when the selection manager is no longer needed.
|
|
92
|
+
*/
|
|
93
|
+
dispose(): void;
|
|
94
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import * as Protocol from './protocol';
|
|
2
|
+
import { Marshal } from './marshal';
|
|
3
|
+
import { ILogger } from './logger';
|
|
4
|
+
export type ClientState = ClientStateConnecting | ClientStateConnected | ClientStateDisconnected | ClientError;
|
|
5
|
+
export type ClientError = ClientStateCompatibilityError | ClientStateConnectionError;
|
|
6
|
+
export type ClientStateConnecting = {
|
|
7
|
+
status: 'connecting';
|
|
8
|
+
};
|
|
9
|
+
export type ClientStateConnected = {
|
|
10
|
+
status: 'connected';
|
|
11
|
+
};
|
|
12
|
+
export type ClientStateDisconnected = {
|
|
13
|
+
status: 'disconnected';
|
|
14
|
+
};
|
|
15
|
+
export type ClientStateCompatibilityError = {
|
|
16
|
+
status: 'error';
|
|
17
|
+
error: 'compatibility';
|
|
18
|
+
serverUrl: string;
|
|
19
|
+
serverVersion: string;
|
|
20
|
+
clientVersion: string;
|
|
21
|
+
};
|
|
22
|
+
export type ClientStateConnectionError = {
|
|
23
|
+
status: 'error';
|
|
24
|
+
error: 'connection';
|
|
25
|
+
serverUrl: string;
|
|
26
|
+
};
|
|
27
|
+
export declare enum FrameType {
|
|
28
|
+
VideoKeyFrame = 0,
|
|
29
|
+
VideoDeltaFrame = 1,
|
|
30
|
+
Disconnection = 2,
|
|
31
|
+
RPCResponse = 255,
|
|
32
|
+
CameraPose = 254
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Messenger class responsible for handling WebSocket communication,
|
|
36
|
+
* including sending and receiving messages, managing connection state,
|
|
37
|
+
* and dispatching events.
|
|
38
|
+
*/
|
|
39
|
+
export declare class SocketClient {
|
|
40
|
+
private readonly _streamLogger;
|
|
41
|
+
private readonly _logger;
|
|
42
|
+
private _socket;
|
|
43
|
+
private readonly _queue;
|
|
44
|
+
private readonly _pendingRPCs;
|
|
45
|
+
private _rpcCallId;
|
|
46
|
+
private _reconnectTimeout;
|
|
47
|
+
private _connectionTimeout;
|
|
48
|
+
/**
|
|
49
|
+
* Callback function to handle incoming video frames.
|
|
50
|
+
* @param msg - The video frame message received from the server.
|
|
51
|
+
*/
|
|
52
|
+
onVideoFrame: (msg: Protocol.VideoFrameMessage) => void;
|
|
53
|
+
private _state;
|
|
54
|
+
private _onStatusUpdate;
|
|
55
|
+
/**
|
|
56
|
+
* Event that is triggered when the connection status updates.
|
|
57
|
+
* @returns An event dispatcher for connection status updates.
|
|
58
|
+
*/
|
|
59
|
+
get onStatusUpdate(): import("ste-simple-events").ISimpleEvent<ClientState>;
|
|
60
|
+
/**
|
|
61
|
+
* Gets the current connection status.
|
|
62
|
+
* @returns The current ClientStatus.
|
|
63
|
+
*/
|
|
64
|
+
get state(): ClientState;
|
|
65
|
+
/**
|
|
66
|
+
* Updates the connection state and dispatches the status update event.
|
|
67
|
+
* @param state - The new connection state.
|
|
68
|
+
*/
|
|
69
|
+
private updateState;
|
|
70
|
+
private _connectPromise;
|
|
71
|
+
private _connectingUrl;
|
|
72
|
+
/**
|
|
73
|
+
* Gets the URL to which the messenger is currently connecting or connected.
|
|
74
|
+
* @returns The WebSocket URL as a string, or undefined if not set.
|
|
75
|
+
*/
|
|
76
|
+
get url(): string | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Constructs a new Messenger instance.
|
|
79
|
+
* @param logger - The logger for logging messages.
|
|
80
|
+
*/
|
|
81
|
+
constructor(logger: ILogger);
|
|
82
|
+
/**
|
|
83
|
+
* Connects to a WebSocket server at the specified URL.
|
|
84
|
+
* @param url - The WebSocket URL to connect to.
|
|
85
|
+
* @returns A promise that resolves when the connection is established.
|
|
86
|
+
*/
|
|
87
|
+
connect(url: string): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Disconnects from the current WebSocket server.
|
|
90
|
+
*/
|
|
91
|
+
disconnect(error?: ClientError): void;
|
|
92
|
+
/**
|
|
93
|
+
* Handles the disconnection logic, stopping logging and clearing the socket.
|
|
94
|
+
*/
|
|
95
|
+
private _disconnect;
|
|
96
|
+
/**
|
|
97
|
+
* Clears the WebSocket event handlers and closes the connection if open.
|
|
98
|
+
*/
|
|
99
|
+
private _clearSocket;
|
|
100
|
+
/**
|
|
101
|
+
* Handles incoming messages from the WebSocket server.
|
|
102
|
+
* @param event - The message event containing the data.
|
|
103
|
+
*/
|
|
104
|
+
onMessage(event: MessageEvent): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Handles RPC responses received from the server.
|
|
107
|
+
* @param buffer - The ArrayBuffer containing the response data.
|
|
108
|
+
*/
|
|
109
|
+
private handleRPCResponse;
|
|
110
|
+
/**
|
|
111
|
+
* Handler for WebSocket 'open' event.
|
|
112
|
+
* @param _ - The event object (unused).
|
|
113
|
+
*/
|
|
114
|
+
private _onOpen;
|
|
115
|
+
/**
|
|
116
|
+
* Handler for WebSocket 'close' event.
|
|
117
|
+
* @param _event - The event object.
|
|
118
|
+
*/
|
|
119
|
+
private _onClose;
|
|
120
|
+
/**
|
|
121
|
+
* Sends binary data over the WebSocket connection.
|
|
122
|
+
* @param data - The ArrayBuffer containing the binary data to send.
|
|
123
|
+
*/
|
|
124
|
+
sendBinary(data: ArrayBuffer): void;
|
|
125
|
+
/**
|
|
126
|
+
* Sends an RPC request and waits for a response.
|
|
127
|
+
* @param marshal - The Marshal containing the request data.
|
|
128
|
+
* @returns A promise that resolves with the response data.
|
|
129
|
+
*/
|
|
130
|
+
sendRPCWithReturn(marshal: Marshal): Promise<Marshal>;
|
|
131
|
+
/**
|
|
132
|
+
* Sends an RPC request without expecting a response.
|
|
133
|
+
* @param marshal - The Marshal containing the request data.
|
|
134
|
+
*/
|
|
135
|
+
sendRPC(marshal: Marshal): void;
|
|
136
|
+
private _clearPendingRPCs;
|
|
137
|
+
/**
|
|
138
|
+
* Disposes of the messenger, cleaning up resources and event handlers.
|
|
139
|
+
*/
|
|
140
|
+
dispose(): void;
|
|
141
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { VideoFrameMessage } from './protocol';
|
|
2
|
+
import { ILogger } from './logger';
|
|
3
|
+
export declare class StreamLogger {
|
|
4
|
+
private readonly _logger;
|
|
5
|
+
private _frameCount;
|
|
6
|
+
private _dataLengthSum;
|
|
7
|
+
private _id;
|
|
8
|
+
constructor(logger: ILogger);
|
|
9
|
+
/**
|
|
10
|
+
* Starts logging the stream metrics.
|
|
11
|
+
*/
|
|
12
|
+
startLoggging(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Stops logging the stream metrics.
|
|
15
|
+
*/
|
|
16
|
+
stopLogging(): void;
|
|
17
|
+
onFrame(frameMsg: VideoFrameMessage): void;
|
|
18
|
+
private logMetrics;
|
|
19
|
+
}
|