vim-web 0.5.0-dev.3 → 0.5.0-dev.5
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/core-viewers/ultra/rpcClient.d.ts +16 -17
- package/dist/types/core-viewers/ultra/rpcSafeClient.d.ts +188 -86
- package/dist/types/core-viewers/ultra/sectionBox.d.ts +1 -1
- package/dist/types/core-viewers/ultra/vim.d.ts +2 -2
- package/dist/types/core-viewers/ultra/visibility.d.ts +2 -2
- package/dist/types/utils/validation.d.ts +2 -2
- package/dist/vim-web.iife.js +224 -205
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +224 -205
- package/dist/vim-web.js.map +1 -1
- package/package.json +2 -2
|
@@ -35,25 +35,25 @@ export declare class RpcClient {
|
|
|
35
35
|
RPCClearMaterialOverrides(): void;
|
|
36
36
|
RPCCreateMaterialInstances(materialHandle: number, smoothness: number, colors: RpcTypes.RGBA32[]): Promise<number>;
|
|
37
37
|
RPCCreateText(position: RpcTypes.Vector3, color: RpcTypes.RGBA32, text: string): Promise<number>;
|
|
38
|
-
RPCDestroyMaterialInstances(
|
|
38
|
+
RPCDestroyMaterialInstances(materialInstanceHandles: number[]): void;
|
|
39
39
|
RPCDestroyText(componentHandle: number): void;
|
|
40
40
|
RPCEnableSectionBox(value: boolean): void;
|
|
41
41
|
RPCFrameAABB(box: RpcTypes.Box3, blendTime: number): Promise<RpcTypes.Segment>;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
RPCFrameVim(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
RPCGetAABBForVim(
|
|
42
|
+
RPCFrameElements(vimIndex: number, elementIndices: number[], blendTime: number): Promise<RpcTypes.Segment>;
|
|
43
|
+
RPCFrameScene(blendTime: number): Promise<RpcTypes.Segment>;
|
|
44
|
+
RPCFrameVim(vimIndex: number, blendTime: number): Promise<RpcTypes.Segment>;
|
|
45
|
+
RPCGetAABBForElements(vimIndex: number, elementIndices: number[]): Promise<RpcTypes.Box3>;
|
|
46
|
+
RPCGetAABBForScene(): Promise<RpcTypes.Box3>;
|
|
47
|
+
RPCGetAABBForVim(vimIndex: number): Promise<RpcTypes.Box3>;
|
|
48
48
|
RPCGetAPIVersion(): Promise<string>;
|
|
49
49
|
RPCGetCameraView(): Promise<RpcTypes.Segment>;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
RPCGetElementIds(
|
|
50
|
+
RPCGetElementCountForScene(): Promise<number>;
|
|
51
|
+
RPCGetElementCountForVim(vimIndex: number): Promise<number>;
|
|
52
|
+
RPCGetElementIds(vimIndex: number): Promise<bigint[]>;
|
|
53
53
|
RPCGetLastError(): Promise<string>;
|
|
54
|
-
RPCGetRoomElements(
|
|
54
|
+
RPCGetRoomElements(vimIndex: number): Promise<number[]>;
|
|
55
55
|
RPCGetSectionBox(): Promise<RpcTypes.SectionBoxState>;
|
|
56
|
-
RPCGetVimLoadingState(
|
|
56
|
+
RPCGetVimLoadingState(vimIndex: number): Promise<RpcTypes.VimStatus>;
|
|
57
57
|
RPCKeyEvent(keyCode: number, down: boolean): void;
|
|
58
58
|
RPCLoadVim(fileName: string): Promise<number>;
|
|
59
59
|
RPCLoadVimURL(url: string, authToken: string): Promise<number>;
|
|
@@ -72,14 +72,13 @@ export declare class RpcClient {
|
|
|
72
72
|
RPCSetCameraView(state: RpcTypes.Segment, blendTime: number): void;
|
|
73
73
|
RPCSetGhostColor(ghostColor: RpcTypes.RGBA): void;
|
|
74
74
|
RPCSetLighting(toneMappingWhitePoint: number, hdrScale: number, hdrBackgroundScale: number, hdrBackgroundSaturation: number, backgroundBlur: number, backgroundColor: RpcTypes.RGBA): void;
|
|
75
|
-
|
|
75
|
+
RPCSetMaterialOverridesForElements(vimIndex: number, elementIndices: number[], materialInstanceHandles: number[]): void;
|
|
76
76
|
RPCSetSectionBox(state: RpcTypes.SectionBoxState): void;
|
|
77
|
-
RPCSetStateElements(
|
|
77
|
+
RPCSetStateElements(vimIndex: number, elementIndices: number[], state: number): void;
|
|
78
78
|
RPCSetStateScene(state: number): void;
|
|
79
|
-
RPCSetStateVim(
|
|
80
|
-
RPCSetStatesElements(
|
|
79
|
+
RPCSetStateVim(vimIndex: number, state: number): void;
|
|
80
|
+
RPCSetStatesElements(vimIndex: number, elementIndices: number[], states: number[]): void;
|
|
81
81
|
RPCStartScene(toneMappingWhitePoint: number, hdrScale: number, hdrBackgroundScale: number, hdrBackgroundSaturation: number, backgroundBlur: number, backgroundColor: RpcTypes.RGBA): Promise<boolean>;
|
|
82
82
|
RPCTriggerRenderDocCapture(): void;
|
|
83
83
|
RPCUnloadAll(): void;
|
|
84
|
-
RPCUnloadVim(componentHandle: number): void;
|
|
85
84
|
}
|
|
@@ -1,44 +1,129 @@
|
|
|
1
1
|
import * as RpcTypes from "./rpcTypes";
|
|
2
2
|
import { MaterialHandle, RpcClient } from "./rpcClient";
|
|
3
3
|
import { VisibilityState } from "./visibility";
|
|
4
|
+
/**
|
|
5
|
+
* Describes the source location and optional authentication for loading a VIM file.
|
|
6
|
+
*/
|
|
4
7
|
export type VimSource = {
|
|
8
|
+
/**
|
|
9
|
+
* URL to the VIM file.
|
|
10
|
+
* Can be a local path (file://) or remote URL (http:// or https://).
|
|
11
|
+
*/
|
|
5
12
|
url: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional authentication token for accessing protected resources.
|
|
15
|
+
*/
|
|
6
16
|
authToken?: string;
|
|
7
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Represents the loading state and progress for a single vim.
|
|
20
|
+
*/
|
|
8
21
|
export type VimLoadingState = {
|
|
22
|
+
/**
|
|
23
|
+
* Current loading status.
|
|
24
|
+
*/
|
|
9
25
|
status: VimLoadingStatus;
|
|
26
|
+
/**
|
|
27
|
+
* Loading progress as a percentage from 0 to 100.
|
|
28
|
+
*/
|
|
10
29
|
progress: number;
|
|
11
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* Defines supported input modes for camera control in the viewer.
|
|
33
|
+
*/
|
|
12
34
|
export declare enum InputMode {
|
|
35
|
+
/**
|
|
36
|
+
* Orbit mode — rotates around a fixed point.
|
|
37
|
+
*/
|
|
13
38
|
Orbit = "orbit",
|
|
39
|
+
/**
|
|
40
|
+
* Free mode — allows unrestricted movement.
|
|
41
|
+
*/
|
|
14
42
|
Free = "free"
|
|
15
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Scene-wide rendering and lighting configuration options.
|
|
46
|
+
*/
|
|
16
47
|
export type SceneSettings = {
|
|
48
|
+
/**
|
|
49
|
+
* White point for tone mapping (clamped between 0 and 1).
|
|
50
|
+
*/
|
|
17
51
|
toneMappingWhitePoint: number;
|
|
52
|
+
/**
|
|
53
|
+
* Global HDR intensity multiplier (floored to 0).
|
|
54
|
+
*/
|
|
18
55
|
hdrScale: number;
|
|
56
|
+
/**
|
|
57
|
+
* HDR scale for the background (clamped between 0 and 1).
|
|
58
|
+
*/
|
|
19
59
|
hdrBackgroundScale: number;
|
|
60
|
+
/**
|
|
61
|
+
* Background saturation (clamped between 0 and 1).
|
|
62
|
+
*/
|
|
20
63
|
hdrBackgroundSaturation: number;
|
|
21
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Background blur strength (clamped between 0 and 1).
|
|
66
|
+
*/
|
|
67
|
+
backgroundBlur: number;
|
|
68
|
+
/**
|
|
69
|
+
* Background color in linear RGBA format.
|
|
70
|
+
*/
|
|
22
71
|
backgroundColor: RpcTypes.RGBA;
|
|
23
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* Default scene settings used when none are explicitly provided.
|
|
75
|
+
*/
|
|
24
76
|
export declare const defaultSceneSettings: SceneSettings;
|
|
77
|
+
/**
|
|
78
|
+
* Enumerates the possible states of VIM file loading.
|
|
79
|
+
*/
|
|
25
80
|
export declare enum VimLoadingStatus {
|
|
81
|
+
/**
|
|
82
|
+
* No known loading activity.
|
|
83
|
+
*/
|
|
26
84
|
Unknown = 0,
|
|
85
|
+
/**
|
|
86
|
+
* Actively loading VIM data.
|
|
87
|
+
*/
|
|
27
88
|
Loading = 1,
|
|
89
|
+
/**
|
|
90
|
+
* Downloading VIM file from a remote source.
|
|
91
|
+
*/
|
|
28
92
|
Downloading = 2,
|
|
93
|
+
/**
|
|
94
|
+
* Load completed successfully.
|
|
95
|
+
*/
|
|
29
96
|
Done = 3,
|
|
97
|
+
/**
|
|
98
|
+
* Download failed (e.g., due to network or permission issues).
|
|
99
|
+
*/
|
|
30
100
|
FailedToDownload = 4,
|
|
101
|
+
/**
|
|
102
|
+
* VIM file could not be parsed or initialized correctly.
|
|
103
|
+
*/
|
|
31
104
|
FailedToLoad = 5
|
|
32
105
|
}
|
|
33
106
|
/**
|
|
34
107
|
* Provides safe, validated methods to interact with the RpcClient.
|
|
35
|
-
* This class wraps
|
|
108
|
+
* This class wraps low-level RPC calls with input validation, error handling,
|
|
109
|
+
* and batching support to ensure robustness and performance when dealing with large data.
|
|
36
110
|
*/
|
|
37
111
|
export declare class RpcSafeClient {
|
|
38
112
|
private readonly rpc;
|
|
39
113
|
private readonly batchSize;
|
|
114
|
+
/**
|
|
115
|
+
* The URL used by the underlying RPC connection.
|
|
116
|
+
*/
|
|
40
117
|
get url(): string;
|
|
118
|
+
/**
|
|
119
|
+
* Indicates whether the RPC client is currently connected.
|
|
120
|
+
*/
|
|
41
121
|
get connected(): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Creates a new RpcSafeClient instance.
|
|
124
|
+
* @param rpc - The underlying RpcClient used for communication
|
|
125
|
+
* @param batchSize - Maximum size of batched data for operations (default: 10000)
|
|
126
|
+
*/
|
|
42
127
|
constructor(rpc: RpcClient, batchSize?: number);
|
|
43
128
|
/*******************************************************************************
|
|
44
129
|
* SCENE MANAGEMENT METHODS
|
|
@@ -46,33 +131,59 @@ export declare class RpcSafeClient {
|
|
|
46
131
|
* and scene-wide settings.
|
|
47
132
|
******************************************************************************/
|
|
48
133
|
/**
|
|
49
|
-
* Initializes and starts the scene with
|
|
134
|
+
* Initializes and starts the scene with the given settings.
|
|
50
135
|
* @param settings - Optional partial scene settings to override defaults
|
|
51
|
-
* @
|
|
136
|
+
* @returns Promise resolving to true if the scene started successfully, false otherwise
|
|
137
|
+
* @remarks Missing values will be filled from {@link defaultSceneSettings}
|
|
52
138
|
*/
|
|
53
139
|
RPCStartScene(settings?: Partial<SceneSettings>): Promise<boolean>;
|
|
54
140
|
/**
|
|
55
|
-
*
|
|
56
|
-
* @param settings - The lighting settings to apply
|
|
141
|
+
* Updates the scene’s lighting configuration.
|
|
142
|
+
* @param settings - The complete lighting and background settings to apply
|
|
57
143
|
*/
|
|
58
144
|
RPCSetLighting(settings: SceneSettings): void;
|
|
59
|
-
|
|
60
|
-
|
|
145
|
+
/**
|
|
146
|
+
* Retrieves the total number of elements across the entire scene.
|
|
147
|
+
* @returns Promise resolving to the total number of elements (0 on failure).
|
|
148
|
+
*/
|
|
149
|
+
RPCGetElementCountForScene(): Promise<number>;
|
|
150
|
+
/**
|
|
151
|
+
* Retrieves the number of elements within a specific loaded vim.
|
|
152
|
+
* @param vimIndex - Index of the loaded vim to query
|
|
153
|
+
* @returns Promise resolving to the element count (0 on failure)
|
|
154
|
+
*/
|
|
155
|
+
RPCGetElementCountForVim(vimIndex: number): Promise<number>;
|
|
61
156
|
/*******************************************************************************
|
|
62
|
-
*
|
|
63
|
-
* Methods for controlling
|
|
157
|
+
* ELEMENTS VISIBILITY METHODS
|
|
158
|
+
* Methods for controlling element visibility, including show/hide, ghosting,
|
|
64
159
|
* and highlighting functionality.
|
|
65
160
|
******************************************************************************/
|
|
66
161
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* @param
|
|
71
|
-
* @
|
|
162
|
+
* Sets a single visibility state for given elements within a loaded vim.
|
|
163
|
+
* The operation is automatically split into batches if the array is large.
|
|
164
|
+
*
|
|
165
|
+
* @param vimIndex - The index of the loaded vim containing the elements
|
|
166
|
+
* @param vimElementIndices - Array of vim-based element indices to apply the state to
|
|
167
|
+
* @param state - The visibility state to apply (e.g., VISIBLE, HIDDEN)
|
|
168
|
+
*/
|
|
169
|
+
RPCSetStateElements(vimIndex: number, vimElementIndices: number[], state: VisibilityState): void;
|
|
170
|
+
/**
|
|
171
|
+
* Sets individual visibility states for multiple elements in a vim.
|
|
172
|
+
* Each element receives a corresponding visibility state from the input array.
|
|
173
|
+
* The operation is automatically split into batches if the array is large.
|
|
174
|
+
*
|
|
175
|
+
* @param vimIndex - The index of the loaded vim
|
|
176
|
+
* @param vimElementIndices - Array of vim-based element indices
|
|
177
|
+
* @param states - Array of visibility states to apply, one per element
|
|
72
178
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
179
|
+
RPCSetStatesElements(vimIndex: number, vimElementIndices: number[], states: VisibilityState[]): void;
|
|
180
|
+
/**
|
|
181
|
+
* Applies a single visibility state to all elements of a loaded vim.
|
|
182
|
+
*
|
|
183
|
+
* @param vimIndex - The index of the loaded vim
|
|
184
|
+
* @param state - The visibility state to apply (e.g., VISIBLE, HIDDEN)
|
|
185
|
+
*/
|
|
186
|
+
RPCSetStateVim(vimIndex: number, state: VisibilityState): void;
|
|
76
187
|
/*******************************************************************************
|
|
77
188
|
* TEXT AND UI METHODS
|
|
78
189
|
* Methods for creating and managing 3D text elements in the scene.
|
|
@@ -83,21 +194,31 @@ export declare class RpcSafeClient {
|
|
|
83
194
|
* @param color - The color of the text
|
|
84
195
|
* @param text - The content to display
|
|
85
196
|
* @returns Promise resolving to the handle of the created text component
|
|
86
|
-
* @throws {Error} If the text is empty
|
|
87
197
|
*/
|
|
88
198
|
RPCCreateText(position: RpcTypes.Vector3, color: RpcTypes.RGBA32, text: string): Promise<number>;
|
|
89
199
|
/**
|
|
90
200
|
* Destroys a text component, removing it from the scene.
|
|
91
201
|
* @param componentHandle - The handle of the text component to destroy
|
|
92
|
-
* @throws {Error} If the component handle is invalid
|
|
93
202
|
*/
|
|
94
203
|
RPCDestroyText(componentHandle: number): void;
|
|
95
204
|
/*******************************************************************************
|
|
96
205
|
* SECTION BOX METHODS
|
|
97
206
|
* Methods for controlling section box visibility and position.
|
|
98
207
|
******************************************************************************/
|
|
208
|
+
/**
|
|
209
|
+
* Enables or disables the section box.
|
|
210
|
+
* @param enable - True to enable the section box, false to disable it
|
|
211
|
+
*/
|
|
99
212
|
RPCEnableSectionBox(enable: boolean): void;
|
|
213
|
+
/**
|
|
214
|
+
* Sets the parameters of the section box.
|
|
215
|
+
* @param state - The new section box state, including visibility and bounding box
|
|
216
|
+
*/
|
|
100
217
|
RPCSetSectionBox(state: RpcTypes.SectionBoxState): void;
|
|
218
|
+
/**
|
|
219
|
+
* Retrieves the current section box state.
|
|
220
|
+
* @returns Promise resolving to the section box state or undefined on failure
|
|
221
|
+
*/
|
|
101
222
|
RPCGetSectionBox(): Promise<RpcTypes.SectionBoxState | undefined>;
|
|
102
223
|
/*******************************************************************************
|
|
103
224
|
* CAMERA AND VIEW METHODS
|
|
@@ -132,58 +253,54 @@ export declare class RpcSafeClient {
|
|
|
132
253
|
RPCSetCameraTarget(target: RpcTypes.Vector3, blendTime: number): void;
|
|
133
254
|
/**
|
|
134
255
|
* Retrieves the axis-aligned bounding box (AABB) that encompasses the entire scene.
|
|
135
|
-
* This includes all loaded geometry across all
|
|
256
|
+
* This includes all loaded geometry across all loaded vims.
|
|
136
257
|
*
|
|
137
258
|
* @returns Promise resolving to the global AABB of the scene, or undefined on failure
|
|
138
259
|
*/
|
|
139
|
-
|
|
260
|
+
RPCGetAABBForScene(): Promise<RpcTypes.Box3 | undefined>;
|
|
140
261
|
/**
|
|
141
|
-
* Retrieves the axis-aligned bounding box (AABB) for a specific
|
|
142
|
-
* This bounding box represents the spatial bounds of all geometry within the given
|
|
262
|
+
* Retrieves the axis-aligned bounding box (AABB) for a specific loaded vim.
|
|
263
|
+
* This bounding box represents the spatial bounds of all geometry within the given loaded vim.
|
|
143
264
|
*
|
|
144
|
-
* @param
|
|
145
|
-
* @returns Promise resolving to the
|
|
265
|
+
* @param vimIndex - The index of the loaded vim to query
|
|
266
|
+
* @returns Promise resolving to the vim bounding box, or undefined on failure
|
|
146
267
|
*/
|
|
147
|
-
RPCGetAABBForVim(
|
|
268
|
+
RPCGetAABBForVim(vimIndex: number): Promise<RpcTypes.Box3 | undefined>;
|
|
148
269
|
/**
|
|
149
|
-
* Calculates the bounding box for specified
|
|
150
|
-
* Large
|
|
151
|
-
* @param
|
|
152
|
-
* @param
|
|
153
|
-
* @returns Promise resolving to the combined bounding box
|
|
154
|
-
* @throws {Error} If the component handle is invalid or nodes array is invalid
|
|
270
|
+
* Calculates the bounding box for specified elements of a loaded vim.
|
|
271
|
+
* Large element arrays are automatically processed in batches.
|
|
272
|
+
* @param vimIndex - The index of the loaded vim
|
|
273
|
+
* @param vimElementIndices - Array of vim-based element indices to calculate bounds for
|
|
274
|
+
* @returns Promise resolving to the combined bounding box or undefined on failure
|
|
155
275
|
*/
|
|
156
|
-
RPCGetAABBForElements(
|
|
276
|
+
RPCGetAABBForElements(vimIndex: number, vimElementIndices: number[]): Promise<RpcTypes.Box3 | undefined>;
|
|
157
277
|
private RPCGetAABBForElementsBatched;
|
|
158
278
|
/**
|
|
159
|
-
* Frames the camera to show all
|
|
279
|
+
* Frames the camera to show all elements in the scene.
|
|
160
280
|
* @param blendTime - Duration of the camera transition in seconds (non-negative)
|
|
161
281
|
* @returns Promise resolving to camera segment representing the final position
|
|
162
282
|
*/
|
|
163
|
-
|
|
283
|
+
RPCFrameScene(blendTime: number): Promise<RpcTypes.Segment | undefined>;
|
|
164
284
|
/**
|
|
165
|
-
* Frames a specific
|
|
166
|
-
* @param
|
|
285
|
+
* Frames a specific vim in the scene.
|
|
286
|
+
* @param vimIndex - The index of the loaded vim to frame
|
|
167
287
|
* @param blendTime - Duration of the camera transition in seconds (non-negative)
|
|
168
288
|
* @returns Promise resolving to camera segment representing the final position
|
|
169
|
-
* @throws {Error} If the component handle is invalid
|
|
170
289
|
*/
|
|
171
|
-
RPCFrameVim(
|
|
290
|
+
RPCFrameVim(vimIndex: number, blendTime: number): Promise<RpcTypes.Segment | undefined>;
|
|
172
291
|
/**
|
|
173
|
-
* Frames specific
|
|
174
|
-
*
|
|
175
|
-
* @param
|
|
176
|
-
* @param
|
|
292
|
+
* Frames specific elements of a loaded vim.
|
|
293
|
+
* Automatically batches large arrays of elements.
|
|
294
|
+
* @param vimIndex - The index of the loaded vim
|
|
295
|
+
* @param vimElementIndices - Array of vim-based element indices to frame
|
|
177
296
|
* @param blendTime - Duration of the camera transition in seconds (non-negative)
|
|
178
297
|
* @returns Promise resolving to camera segment representing the final position
|
|
179
|
-
* @throws {Error} If the component handle is invalid or nodes array is empty
|
|
180
298
|
*/
|
|
181
|
-
RPCFrameElements(
|
|
299
|
+
RPCFrameElements(vimIndex: number, vimElementIndices: number[], blendTime: number): Promise<RpcTypes.Segment | undefined>;
|
|
182
300
|
/**
|
|
183
301
|
* Frames the camera to show a specific bounding box.
|
|
184
302
|
* @param box - The bounding box to frame
|
|
185
303
|
* @param blendTime - Duration of the camera transition in seconds (non-negative)
|
|
186
|
-
* @throws {Error} If the box is invalid (min values must be less than max values)
|
|
187
304
|
*/
|
|
188
305
|
RPCFrameAABB(box: RpcTypes.Box3, blendTime: number): Promise<RpcTypes.Segment | undefined>;
|
|
189
306
|
/*******************************************************************************
|
|
@@ -193,50 +310,43 @@ export declare class RpcSafeClient {
|
|
|
193
310
|
/**
|
|
194
311
|
* Sets the camera movement speed.
|
|
195
312
|
* @param speed - The desired movement speed (must be positive)
|
|
196
|
-
* @throws {Error} If speed is not positive
|
|
197
313
|
*/
|
|
198
314
|
RPCSetCameraSpeed(speed: number): void;
|
|
315
|
+
/**
|
|
316
|
+
* Sets the camera control mode.
|
|
317
|
+
* @param mode - The desired input mode (e.g., {@link InputMode.Orbit} or {@link InputMode.Free})
|
|
318
|
+
*/
|
|
199
319
|
RPCSetCameraMode(mode: InputMode): void;
|
|
200
320
|
/**
|
|
201
321
|
* Sets the viewer's aspect ratio.
|
|
202
|
-
* @param width - The width
|
|
203
|
-
* @param height - The height
|
|
204
|
-
* @throws {Error} If width or height are not positive integers
|
|
322
|
+
* @param width - The width of the desired aspect ratio
|
|
323
|
+
* @param height - The height of the desired aspect ratio
|
|
205
324
|
*/
|
|
206
325
|
RPCSetCameraAspectRatio(width: number, height: number): void;
|
|
207
326
|
/*******************************************************************************
|
|
208
327
|
* VIM FILE MANAGEMENT METHODS
|
|
209
|
-
* Methods for loading, unloading, and managing VIM files
|
|
328
|
+
* Methods for loading, unloading, and managing VIM files.
|
|
210
329
|
******************************************************************************/
|
|
211
330
|
/**
|
|
212
331
|
* Loads a VIM file from the local filesystem.
|
|
213
332
|
* @param source - The path to the VIM file (supports file:// protocol)
|
|
214
|
-
* @returns Promise resolving to the
|
|
215
|
-
* @throws {Error} If the filename is invalid or empty
|
|
333
|
+
* @returns Promise resolving to the index of the loaded vim
|
|
216
334
|
*/
|
|
217
335
|
RPCLoadVim(source: VimSource): Promise<number>;
|
|
218
336
|
/**
|
|
219
337
|
* Loads a VIM file from a remote URL.
|
|
220
|
-
* @param
|
|
221
|
-
* @returns Promise resolving to the
|
|
222
|
-
* @throws {Error} If the URL is invalid
|
|
338
|
+
* @param source - The URL or file path of the VIM file to load
|
|
339
|
+
* @returns Promise resolving to the index of the loaded vim
|
|
223
340
|
*/
|
|
224
341
|
RPCLoadVimURL(source: VimSource): Promise<number>;
|
|
225
342
|
/**
|
|
226
|
-
* Retrieves the current loading state and progress of a
|
|
227
|
-
* @param
|
|
343
|
+
* Retrieves the current loading state and progress of a vim.
|
|
344
|
+
* @param vimIndex - The index of the vim being loaded
|
|
228
345
|
* @returns Promise resolving to the current loading state and progress
|
|
229
|
-
* @throws {Error} If the component handle is invalid
|
|
230
|
-
*/
|
|
231
|
-
RPCGetVimLoadingState(componentHandle: number): Promise<VimLoadingState>;
|
|
232
|
-
/**
|
|
233
|
-
* Unloads a VIM component and frees associated resources.
|
|
234
|
-
* @param componentHandle - The handle of the component to unload
|
|
235
|
-
* @throws {Error} If the component handle is invalid
|
|
236
346
|
*/
|
|
237
|
-
|
|
347
|
+
RPCGetVimLoadingState(vimIndex: number): Promise<VimLoadingState>;
|
|
238
348
|
/**
|
|
239
|
-
* Clears the entire scene,
|
|
349
|
+
* Clears the entire scene, unloading all vims and resetting to initial state.
|
|
240
350
|
*/
|
|
241
351
|
RPCUnloadAll(): void;
|
|
242
352
|
/**
|
|
@@ -247,7 +357,7 @@ export declare class RpcSafeClient {
|
|
|
247
357
|
/**
|
|
248
358
|
* Performs hit testing at a specified screen position.
|
|
249
359
|
* @param pos - Normalized screen coordinates (0-1, 0-1)
|
|
250
|
-
* @returns Promise resolving to hit test result if
|
|
360
|
+
* @returns Promise resolving to hit test result if a valid hit was detected, undefined otherwise
|
|
251
361
|
*/
|
|
252
362
|
RPCPerformHitTest(pos: RpcTypes.Vector2): Promise<RpcTypes.HitCheckResult | undefined>;
|
|
253
363
|
/**
|
|
@@ -255,14 +365,12 @@ export declare class RpcSafeClient {
|
|
|
255
365
|
* @param position - The normalized screen coordinates (0-1, 0-1)
|
|
256
366
|
* @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
|
|
257
367
|
* @param down - True if button is pressed down, false if released
|
|
258
|
-
* @throws {Error} If mouseButton is not a valid positive integer
|
|
259
368
|
*/
|
|
260
369
|
RPCMouseButtonEvent(position: RpcTypes.Vector2, mouseButton: number, down: boolean): void;
|
|
261
370
|
/**
|
|
262
371
|
* Sends a mouse double-click event to the viewer.
|
|
263
372
|
* @param position - The normalized screen coordinates (0-1, 0-1)
|
|
264
373
|
* @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
|
|
265
|
-
* @throws {Error} If mouseButton is not a valid positive integer
|
|
266
374
|
*/
|
|
267
375
|
RPCMouseDoubleClickEvent(position: RpcTypes.Vector2, mouseButton: number): void;
|
|
268
376
|
/**
|
|
@@ -279,7 +387,6 @@ export declare class RpcSafeClient {
|
|
|
279
387
|
* Sends a mouse selection event to the viewer.
|
|
280
388
|
* @param position - The normalized screen coordinates (0-1, 0-1)
|
|
281
389
|
* @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
|
|
282
|
-
* @throws {Error} If mouseButton is not a valid positive integer
|
|
283
390
|
*/
|
|
284
391
|
RPCMouseSelectEvent(position: RpcTypes.Vector2, mouseButton: number): void;
|
|
285
392
|
/**
|
|
@@ -299,30 +406,25 @@ export declare class RpcSafeClient {
|
|
|
299
406
|
* @param smoothness - The smoothness value to apply (clamped between 0 and 1)
|
|
300
407
|
* @param colors - Array of colors for each material instance
|
|
301
408
|
* @returns Array of handles for the created material instances
|
|
302
|
-
* @throws {Error} If the material handle is invalid or smoothness is out of range
|
|
303
409
|
*/
|
|
304
410
|
RPCCreateMaterialInstances(materialHandle: MaterialHandle, smoothness: number, colors: RpcTypes.RGBA32[]): Promise<number[] | undefined>;
|
|
305
411
|
private createMaterialInstancesBatched;
|
|
306
412
|
/**
|
|
307
413
|
* Destroys multiple material instances, freeing associated resources.
|
|
308
|
-
* @param
|
|
309
|
-
* @throws {Error} If any handle in the array is invalid
|
|
414
|
+
* @param materialInstanceHandles - Array of handles for material instances to destroy
|
|
310
415
|
*/
|
|
311
|
-
RPCDestroyMaterialInstances(
|
|
416
|
+
RPCDestroyMaterialInstances(materialInstanceHandles: number[]): void;
|
|
312
417
|
/**
|
|
313
|
-
* Sets material overrides for specific
|
|
314
|
-
* Large arrays are automatically processed in batches
|
|
315
|
-
* @param
|
|
316
|
-
* @param
|
|
317
|
-
* @param materialInstanceHandles - Array of material instance handles to apply (must match
|
|
318
|
-
* @throws {Error} If arrays have different lengths or any handle is invalid
|
|
418
|
+
* Sets material overrides for specific elements in a loaded vim.
|
|
419
|
+
* Large arrays are automatically processed in batches.
|
|
420
|
+
* @param vimIndex - The index of the loaded vim
|
|
421
|
+
* @param vimElementIndices - Array of vim-based element indices to override
|
|
422
|
+
* @param materialInstanceHandles - Array of material instance handles to apply (must match element length)
|
|
319
423
|
*/
|
|
320
|
-
|
|
424
|
+
RPCSetMaterialOverridesForElements(vimIndex: number, vimElementIndices: number[], materialInstanceHandles: number[]): void;
|
|
321
425
|
private setMaterialOverridesBatched;
|
|
322
426
|
/**
|
|
323
|
-
* Clears all material overrides for the
|
|
324
|
-
* @param componentHandle - The unique identifier of the component
|
|
325
|
-
* @throws {Error} If the component handle is invalid or INVALID_HANDLE
|
|
427
|
+
* Clears all material overrides for the entire scene.
|
|
326
428
|
*/
|
|
327
429
|
RPCClearMaterialOverrides(): void;
|
|
328
430
|
/*******************************************************************************
|
|
@@ -27,7 +27,7 @@ export declare class SectionBox {
|
|
|
27
27
|
* Fits the given box, invalid dimensions will be reversed.
|
|
28
28
|
* @param box - The new bounding box.
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
setBox(box: THREE.Box3): void;
|
|
31
31
|
getBox(): THREE.Box3 | undefined;
|
|
32
32
|
dispose(): void;
|
|
33
33
|
}
|
|
@@ -3,7 +3,7 @@ import type { ILogger } from './logger';
|
|
|
3
3
|
import { ColorManager } from './colorManager';
|
|
4
4
|
import { Element3D } from './element3d';
|
|
5
5
|
import { LoadRequest } from './loadRequest';
|
|
6
|
-
import {
|
|
6
|
+
import { VisibilitySynchronizer } from './visibility';
|
|
7
7
|
import { Renderer } from './renderer';
|
|
8
8
|
import { RpcSafeClient, VimSource } from './rpcSafeClient';
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -16,7 +16,7 @@ export declare class Vim implements IVim<Element3D> {
|
|
|
16
16
|
private _colors;
|
|
17
17
|
private _renderer;
|
|
18
18
|
private _logger;
|
|
19
|
-
readonly visibility:
|
|
19
|
+
readonly visibility: VisibilitySynchronizer;
|
|
20
20
|
private _nodeColors;
|
|
21
21
|
private _updatedColors;
|
|
22
22
|
private _updateScheduled;
|
|
@@ -14,7 +14,7 @@ export declare enum VisibilityState {
|
|
|
14
14
|
* A class that wraps a StateTracker and is responsible for synchronizing its state updates with the remote RPCs.
|
|
15
15
|
* It batches updates to optimize performance and handles the communication with the remote system.
|
|
16
16
|
*/
|
|
17
|
-
export declare class
|
|
17
|
+
export declare class VisibilitySynchronizer {
|
|
18
18
|
private _tracker;
|
|
19
19
|
private _rpc;
|
|
20
20
|
private _getHandle;
|
|
@@ -64,7 +64,7 @@ export declare class StateSynchronizer {
|
|
|
64
64
|
* @param elementIndex - The element index to update
|
|
65
65
|
* @param state - The new state to apply
|
|
66
66
|
*/
|
|
67
|
-
|
|
67
|
+
setStateForElement(elementIndex: number, state: VisibilityState): void;
|
|
68
68
|
/**
|
|
69
69
|
* Sets the state of all elements to the specified value.
|
|
70
70
|
*
|
|
@@ -7,8 +7,8 @@ export declare class Validation {
|
|
|
7
7
|
static isPositiveInteger(value: number): boolean;
|
|
8
8
|
static isInRange01(value: number): boolean;
|
|
9
9
|
static areIntegers(values: number[]): boolean;
|
|
10
|
-
static
|
|
11
|
-
static
|
|
10
|
+
static isIndex(index: number): boolean;
|
|
11
|
+
static areIndices(indices: number[]): boolean;
|
|
12
12
|
static isMaterialHandle(handle: number): boolean;
|
|
13
13
|
static isValidVector2(value: THREE.Vector2): boolean;
|
|
14
14
|
static isRelativeVector2(value: THREE.Vector2): boolean;
|