vim-web 0.5.0-dev.2 → 0.5.0-dev.4

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.
@@ -107,10 +107,10 @@ export declare class Camera implements ICamera {
107
107
  /**
108
108
  * Frames specific nodes of a Vim model in the camera view
109
109
  * @param vim - The Vim model containing the nodes to frame
110
- * @param nodes - Array of node indices to frame, or 'all' to frame the entire model
110
+ * @param elements - Array of element indices to frame, or 'all' to frame the entire model
111
111
  * @param blendTime - Duration of the camera animation in seconds (defaults to 0.5)
112
112
  * @returns Promise that resolves when the framing animation is complete
113
113
  */
114
- frameVim(vim: Vim, nodes: number[] | 'all', blendTime?: number): Promise<Segment | undefined>;
114
+ frameVim(vim: Vim, elements: number[] | 'all', blendTime?: number): Promise<Segment | undefined>;
115
115
  frameObject(object: Element3D, blendTime?: number): Promise<Segment | undefined>;
116
116
  }
@@ -32,27 +32,28 @@ export declare class RpcClient {
32
32
  get url(): string;
33
33
  constructor(_socket: SocketClient);
34
34
  readonly API_VERSION = "6.0.0";
35
- RPCClearMaterialOverrides(componentHandle: number): void;
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(materialInstanceHandle: number[]): void;
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
- RPCFrameAll(blendTime: number): Promise<RpcTypes.Segment>;
43
- RPCFrameElements(componentHandle: number, elementIndices: number[], blendTime: number): Promise<RpcTypes.Segment>;
44
- RPCFrameVim(componentHandle: number, blendTime: number): Promise<RpcTypes.Segment>;
45
- RPCGetAABBForAll(): Promise<RpcTypes.Box3>;
46
- RPCGetAABBForElements(componentHandle: number, elementIndices: number[]): Promise<RpcTypes.Box3>;
47
- RPCGetAABBForVim(componentHandle: number): Promise<RpcTypes.Box3>;
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
- RPCGetElementCount(componentHandle: number): Promise<number>;
51
- RPCGetElementIds(componentHandle: number): Promise<bigint[]>;
50
+ RPCGetElementCountForScene(): Promise<number>;
51
+ RPCGetElementCountForVim(vimIndex: number): Promise<number>;
52
+ RPCGetElementIds(vimIndex: number): Promise<bigint[]>;
52
53
  RPCGetLastError(): Promise<string>;
53
- RPCGetRoomElements(componentHandle: number): Promise<number[]>;
54
+ RPCGetRoomElements(vimIndex: number): Promise<number[]>;
54
55
  RPCGetSectionBox(): Promise<RpcTypes.SectionBoxState>;
55
- RPCGetVimLoadingState(componentHandle: number): Promise<RpcTypes.VimStatus>;
56
+ RPCGetVimLoadingState(vimIndex: number): Promise<RpcTypes.VimStatus>;
56
57
  RPCKeyEvent(keyCode: number, down: boolean): void;
57
58
  RPCLoadVim(fileName: string): Promise<number>;
58
59
  RPCLoadVimURL(url: string, authToken: string): Promise<number>;
@@ -71,13 +72,13 @@ export declare class RpcClient {
71
72
  RPCSetCameraView(state: RpcTypes.Segment, blendTime: number): void;
72
73
  RPCSetGhostColor(ghostColor: RpcTypes.RGBA): void;
73
74
  RPCSetLighting(toneMappingWhitePoint: number, hdrScale: number, hdrBackgroundScale: number, hdrBackgroundSaturation: number, backgroundBlur: number, backgroundColor: RpcTypes.RGBA): void;
74
- RPCSetMaterialOverrides(componentHandle: number, elementIndices: number[], materialInstanceHandles: number[]): void;
75
+ RPCSetMaterialOverridesForElements(vimIndex: number, elementIndices: number[], materialInstanceHandles: number[]): void;
75
76
  RPCSetSectionBox(state: RpcTypes.SectionBoxState): void;
76
- RPCSetStateVim(componentHandle: number, state: number): void;
77
- RPCSetStateElements(componentHandle: number, elementIndices: number[], state: number): void;
78
- RPCSetStatesElements(componentHandle: number, elementIndices: number[], states: number[]): void;
77
+ RPCSetStateElements(vimIndex: number, elementIndices: number[], state: number): void;
78
+ RPCSetStateScene(state: number): void;
79
+ RPCSetStateVim(vimIndex: number, state: number): void;
80
+ RPCSetStatesElements(vimIndex: number, elementIndices: number[], states: number[]): void;
79
81
  RPCStartScene(toneMappingWhitePoint: number, hdrScale: number, hdrBackgroundScale: number, hdrBackgroundSaturation: number, backgroundBlur: number, backgroundColor: RpcTypes.RGBA): Promise<boolean>;
80
82
  RPCTriggerRenderDocCapture(): void;
81
83
  RPCUnloadAll(): void;
82
- RPCUnloadVim(componentHandle: number): void;
83
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
- backGroundBlur: number;
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 the raw RPC methods with input validation and batching support for large operations.
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,31 +131,59 @@ export declare class RpcSafeClient {
46
131
  * and scene-wide settings.
47
132
  ******************************************************************************/
48
133
  /**
49
- * Initializes and starts the scene with specified settings.
134
+ * Initializes and starts the scene with the given settings.
50
135
  * @param settings - Optional partial scene settings to override defaults
51
- * @remarks If no settings are provided, default values will be used
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
- * Sets the lighting settings for the scene.
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;
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>;
59
156
  /*******************************************************************************
60
- * NODE VISIBILITY METHODS
61
- * Methods for controlling node visibility, including show/hide, ghosting,
157
+ * ELEMENTS VISIBILITY METHODS
158
+ * Methods for controlling element visibility, including show/hide, ghosting,
62
159
  * and highlighting functionality.
63
160
  ******************************************************************************/
64
161
  /**
65
- * Highlights specified nodes in a component.
66
- * Large node arrays are automatically processed in batches.
67
- * @param componentHandle - The component containing the nodes
68
- * @param nodes - Array of node indices to highlight
69
- * @throws {Error} If the component handle is invalid or nodes array is invalid
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
70
178
  */
71
- RPCSetStateElements(componentHandle: number, elements: number[], state: VisibilityState): void;
72
- RPCSetStatesElements(componentHandle: number, elements: number[], states: VisibilityState[]): void;
73
- RPCSetStateVim(componentHandle: number, state: VisibilityState): void;
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;
74
187
  /*******************************************************************************
75
188
  * TEXT AND UI METHODS
76
189
  * Methods for creating and managing 3D text elements in the scene.
@@ -81,21 +194,31 @@ export declare class RpcSafeClient {
81
194
  * @param color - The color of the text
82
195
  * @param text - The content to display
83
196
  * @returns Promise resolving to the handle of the created text component
84
- * @throws {Error} If the text is empty
85
197
  */
86
198
  RPCCreateText(position: RpcTypes.Vector3, color: RpcTypes.RGBA32, text: string): Promise<number>;
87
199
  /**
88
200
  * Destroys a text component, removing it from the scene.
89
201
  * @param componentHandle - The handle of the text component to destroy
90
- * @throws {Error} If the component handle is invalid
91
202
  */
92
203
  RPCDestroyText(componentHandle: number): void;
93
204
  /*******************************************************************************
94
205
  * SECTION BOX METHODS
95
206
  * Methods for controlling section box visibility and position.
96
207
  ******************************************************************************/
208
+ /**
209
+ * Enables or disables the section box.
210
+ * @param enable - True to enable the section box, false to disable it
211
+ */
97
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
+ */
98
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
+ */
99
222
  RPCGetSectionBox(): Promise<RpcTypes.SectionBoxState | undefined>;
100
223
  /*******************************************************************************
101
224
  * CAMERA AND VIEW METHODS
@@ -130,58 +253,54 @@ export declare class RpcSafeClient {
130
253
  RPCSetCameraTarget(target: RpcTypes.Vector3, blendTime: number): void;
131
254
  /**
132
255
  * Retrieves the axis-aligned bounding box (AABB) that encompasses the entire scene.
133
- * This includes all loaded geometry across all VIM components.
256
+ * This includes all loaded geometry across all loaded vims.
134
257
  *
135
258
  * @returns Promise resolving to the global AABB of the scene, or undefined on failure
136
259
  */
137
- RPCGetAABBForAll(): Promise<RpcTypes.Box3 | undefined>;
260
+ RPCGetAABBForScene(): Promise<RpcTypes.Box3 | undefined>;
138
261
  /**
139
- * Retrieves the axis-aligned bounding box (AABB) for a specific VIM component.
140
- * This bounding box represents the spatial bounds of all geometry within the given component.
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.
141
264
  *
142
- * @param componentHandle - The handle of the VIM component to query
143
- * @returns Promise resolving to the component’s bounding box, or undefined on failure
265
+ * @param vimIndex - The index of the loaded vim to query
266
+ * @returns Promise resolving to the vim bounding box, or undefined on failure
144
267
  */
145
- RPCGetAABBForVim(componentHandle: number): Promise<RpcTypes.Box3 | undefined>;
268
+ RPCGetAABBForVim(vimIndex: number): Promise<RpcTypes.Box3 | undefined>;
146
269
  /**
147
- * Calculates the bounding box for specified nodes in a component.
148
- * Large node arrays are automatically processed in batches for better performance.
149
- * @param componentHandle - The component containing the nodes
150
- * @param elements - Array of node indices to calculate bounds for
151
- * @returns Promise resolving to the combined bounding box
152
- * @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
153
275
  */
154
- RPCGetAABBForElements(componentHandle: number, elements: number[]): Promise<RpcTypes.Box3 | undefined>;
276
+ RPCGetAABBForElements(vimIndex: number, vimElementIndices: number[]): Promise<RpcTypes.Box3 | undefined>;
155
277
  private RPCGetAABBForElementsBatched;
156
278
  /**
157
- * Frames the camera to show all components in the scene.
279
+ * Frames the camera to show all elements in the scene.
158
280
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
159
281
  * @returns Promise resolving to camera segment representing the final position
160
282
  */
161
- RPCFrameAll(blendTime: number): Promise<RpcTypes.Segment | undefined>;
283
+ RPCFrameScene(blendTime: number): Promise<RpcTypes.Segment | undefined>;
162
284
  /**
163
- * Frames a specific VIM component in the scene.
164
- * @param componentHandle - The handle of the VIM component to frame
285
+ * Frames a specific vim in the scene.
286
+ * @param vimIndex - The index of the loaded vim to frame
165
287
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
166
288
  * @returns Promise resolving to camera segment representing the final position
167
- * @throws {Error} If the component handle is invalid
168
289
  */
169
- RPCFrameVim(componentHandle: number, blendTime: number): Promise<RpcTypes.Segment | undefined>;
290
+ RPCFrameVim(vimIndex: number, blendTime: number): Promise<RpcTypes.Segment | undefined>;
170
291
  /**
171
- * Frames specific instances within a component. For large numbers of instances,
172
- * automatically switches to bounding box framing for better performance.
173
- * @param componentHandle - The component containing the instances
174
- * @param elements - Array of node indices to frame
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
175
296
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
176
297
  * @returns Promise resolving to camera segment representing the final position
177
- * @throws {Error} If the component handle is invalid or nodes array is empty
178
298
  */
179
- RPCFrameElements(componentHandle: number, elements: number[], blendTime: number): Promise<RpcTypes.Segment | undefined>;
299
+ RPCFrameElements(vimIndex: number, vimElementIndices: number[], blendTime: number): Promise<RpcTypes.Segment | undefined>;
180
300
  /**
181
301
  * Frames the camera to show a specific bounding box.
182
302
  * @param box - The bounding box to frame
183
303
  * @param blendTime - Duration of the camera transition in seconds (non-negative)
184
- * @throws {Error} If the box is invalid (min values must be less than max values)
185
304
  */
186
305
  RPCFrameAABB(box: RpcTypes.Box3, blendTime: number): Promise<RpcTypes.Segment | undefined>;
187
306
  /*******************************************************************************
@@ -191,50 +310,43 @@ export declare class RpcSafeClient {
191
310
  /**
192
311
  * Sets the camera movement speed.
193
312
  * @param speed - The desired movement speed (must be positive)
194
- * @throws {Error} If speed is not positive
195
313
  */
196
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
+ */
197
319
  RPCSetCameraMode(mode: InputMode): void;
198
320
  /**
199
321
  * Sets the viewer's aspect ratio.
200
- * @param width - The width component of the aspect ratio
201
- * @param height - The height component of the aspect ratio
202
- * @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
203
324
  */
204
325
  RPCSetCameraAspectRatio(width: number, height: number): void;
205
326
  /*******************************************************************************
206
327
  * VIM FILE MANAGEMENT METHODS
207
- * Methods for loading, unloading, and managing VIM files and components.
328
+ * Methods for loading, unloading, and managing VIM files.
208
329
  ******************************************************************************/
209
330
  /**
210
331
  * Loads a VIM file from the local filesystem.
211
332
  * @param source - The path to the VIM file (supports file:// protocol)
212
- * @returns Promise resolving to the handle of the loaded VIM component
213
- * @throws {Error} If the filename is invalid or empty
333
+ * @returns Promise resolving to the index of the loaded vim
214
334
  */
215
335
  RPCLoadVim(source: VimSource): Promise<number>;
216
336
  /**
217
337
  * Loads a VIM file from a remote URL.
218
- * @param url - The URL of the VIM file to load
219
- * @returns Promise resolving to the handle of the loaded VIM component
220
- * @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
221
340
  */
222
341
  RPCLoadVimURL(source: VimSource): Promise<number>;
223
342
  /**
224
- * Retrieves the current loading state and progress of a VIM component.
225
- * @param componentHandle - The handle of the VIM component
343
+ * Retrieves the current loading state and progress of a vim.
344
+ * @param vimIndex - The index of the vim being loaded
226
345
  * @returns Promise resolving to the current loading state and progress
227
- * @throws {Error} If the component handle is invalid
228
- */
229
- RPCGetVimLoadingState(componentHandle: number): Promise<VimLoadingState>;
230
- /**
231
- * Unloads a VIM component and frees associated resources.
232
- * @param componentHandle - The handle of the component to unload
233
- * @throws {Error} If the component handle is invalid
234
346
  */
235
- RPCUnloadVim(componentHandle: number): void;
347
+ RPCGetVimLoadingState(vimIndex: number): Promise<VimLoadingState>;
236
348
  /**
237
- * Clears the entire scene, removing all components and resetting to initial state.
349
+ * Clears the entire scene, unloading all vims and resetting to initial state.
238
350
  */
239
351
  RPCUnloadAll(): void;
240
352
  /**
@@ -245,7 +357,7 @@ export declare class RpcSafeClient {
245
357
  /**
246
358
  * Performs hit testing at a specified screen position.
247
359
  * @param pos - Normalized screen coordinates (0-1, 0-1)
248
- * @returns Promise resolving to hit test result if something was hit, undefined otherwise
360
+ * @returns Promise resolving to hit test result if a valid hit was detected, undefined otherwise
249
361
  */
250
362
  RPCPerformHitTest(pos: RpcTypes.Vector2): Promise<RpcTypes.HitCheckResult | undefined>;
251
363
  /**
@@ -253,14 +365,12 @@ export declare class RpcSafeClient {
253
365
  * @param position - The normalized screen coordinates (0-1, 0-1)
254
366
  * @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
255
367
  * @param down - True if button is pressed down, false if released
256
- * @throws {Error} If mouseButton is not a valid positive integer
257
368
  */
258
369
  RPCMouseButtonEvent(position: RpcTypes.Vector2, mouseButton: number, down: boolean): void;
259
370
  /**
260
371
  * Sends a mouse double-click event to the viewer.
261
372
  * @param position - The normalized screen coordinates (0-1, 0-1)
262
373
  * @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
263
- * @throws {Error} If mouseButton is not a valid positive integer
264
374
  */
265
375
  RPCMouseDoubleClickEvent(position: RpcTypes.Vector2, mouseButton: number): void;
266
376
  /**
@@ -277,7 +387,6 @@ export declare class RpcSafeClient {
277
387
  * Sends a mouse selection event to the viewer.
278
388
  * @param position - The normalized screen coordinates (0-1, 0-1)
279
389
  * @param mouseButton - The mouse button code (0=left, 1=middle, 2=right)
280
- * @throws {Error} If mouseButton is not a valid positive integer
281
390
  */
282
391
  RPCMouseSelectEvent(position: RpcTypes.Vector2, mouseButton: number): void;
283
392
  /**
@@ -297,32 +406,27 @@ export declare class RpcSafeClient {
297
406
  * @param smoothness - The smoothness value to apply (clamped between 0 and 1)
298
407
  * @param colors - Array of colors for each material instance
299
408
  * @returns Array of handles for the created material instances
300
- * @throws {Error} If the material handle is invalid or smoothness is out of range
301
409
  */
302
410
  RPCCreateMaterialInstances(materialHandle: MaterialHandle, smoothness: number, colors: RpcTypes.RGBA32[]): Promise<number[] | undefined>;
303
411
  private createMaterialInstancesBatched;
304
412
  /**
305
413
  * Destroys multiple material instances, freeing associated resources.
306
- * @param materialInstanceHandle - Array of handles for material instances to destroy
307
- * @throws {Error} If any handle in the array is invalid
414
+ * @param materialInstanceHandles - Array of handles for material instances to destroy
308
415
  */
309
- RPCDestroyMaterialInstances(materialInstanceHandle: number[]): void;
416
+ RPCDestroyMaterialInstances(materialInstanceHandles: number[]): void;
310
417
  /**
311
- * Sets material overrides for specific nodes in a component.
312
- * Large arrays are automatically processed in batches for better performance.
313
- * @param componentHandle - The component containing the nodes
314
- * @param nodes - Array of node indices to override
315
- * @param materialInstanceHandles - Array of material instance handles to apply (must match nodes length)
316
- * @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)
317
423
  */
318
- RPCSetMaterialOverrides(componentHandle: number, nodes: number[], materialInstanceHandles: number[]): void;
424
+ RPCSetMaterialOverridesForElements(vimIndex: number, vimElementIndices: number[], materialInstanceHandles: number[]): void;
319
425
  private setMaterialOverridesBatched;
320
426
  /**
321
- * Clears all material overrides for the specified component, restoring default materials.
322
- * @param componentHandle - The unique identifier of the component
323
- * @throws {Error} If the component handle is invalid or INVALID_HANDLE
427
+ * Clears all material overrides for the entire scene.
324
428
  */
325
- RPCClearMaterialOverrides(componentHandle: number): void;
429
+ RPCClearMaterialOverrides(): void;
326
430
  /*******************************************************************************
327
431
  * DEBUG AND UTILITY METHODS
328
432
  * Utility methods for debugging, error handling, and misc functionality.
@@ -50,9 +50,9 @@ export declare class RGBA32 {
50
50
  get a(): number;
51
51
  }
52
52
  export type HitCheckResult = {
53
- vimHandle: number;
54
- nodeIndex: number;
55
- elementIndex: number;
53
+ vimIndex: number;
54
+ vimElementIndex: number;
55
+ sceneElementIndex: number;
56
56
  worldPosition: THREE.Vector3;
57
57
  worldNormal: THREE.Vector3;
58
58
  };
@@ -126,6 +126,7 @@ export declare class Viewer {
126
126
  * Clears all loaded VIMs from the viewer.
127
127
  */
128
128
  clearVims(): void;
129
+ getElement3Ds(): Promise<number>;
129
130
  /**
130
131
  * Disposes all resources used by the viewer and disconnects from the server.
131
132
  */
@@ -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 { StateSynchronizer } from './visibility';
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,10 +16,11 @@ export declare class Vim implements IVim<Element3D> {
16
16
  private _colors;
17
17
  private _renderer;
18
18
  private _logger;
19
- readonly visibility: StateSynchronizer;
19
+ readonly visibility: VisibilitySynchronizer;
20
20
  private _nodeColors;
21
21
  private _updatedColors;
22
22
  private _updateScheduled;
23
+ private _elementCount;
23
24
  private _objects;
24
25
  constructor(rpc: RpcSafeClient, color: ColorManager, renderer: Renderer, source: VimSource, logger: ILogger);
25
26
  getElement(elementIndex: number): Element3D;
@@ -40,7 +41,7 @@ export declare class Vim implements IVim<Element3D> {
40
41
  setColor(nodes: number[], color: RGBA32 | undefined): Promise<void>;
41
42
  setColors(nodes: number[], color: (RGBA32 | undefined)[]): Promise<void>;
42
43
  private applyColor;
43
- clearColor(nodes: number[] | 'all'): void;
44
+ clearColor(elements: number[] | 'all'): void;
44
45
  reapplyColors(): void;
45
46
  private scheduleColorUpdate;
46
47
  private updateRemote;
@@ -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 StateSynchronizer {
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
- setElementState(elementIndex: number, state: VisibilityState): void;
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 isComponentHandle(handle: number): boolean;
11
- static areComponentHandles(handles: number[]): boolean;
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;